kernel/efirt: Fix a kfree(NULL) panic when deleting a UEFI variable. master
authorSascha Wildner <saw@online.de>
Tue, 2 Jun 2020 18:24:30 +0000 (20:24 +0200)
committerSascha Wildner <saw@online.de>
Tue, 2 Jun 2020 18:24:30 +0000 (20:24 +0200)
There is no data in this case. Rest of function is ok, just a forgotten
datasize check.

sys/dev/misc/efirt/efidev.c

index 549094f..494218b 100644 (file)
@@ -180,7 +180,8 @@ vg_out:
                error = efi_var_set(name, &ev->vendor, ev->attrib, ev->datasize,
                    data);
 vs_out:
-               kfree(data, M_TEMP);
+               if (ev->datasize > 0)
+                       kfree(data, M_TEMP);
                kfree(name, M_TEMP);
                break;
        }