patch-2.4.15 linux/arch/ia64/kernel/efivars.c

Next file: linux/arch/ia64/kernel/entry.S
Previous file: linux/arch/ia64/kernel/efi_stub.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.14/linux/arch/ia64/kernel/efivars.c linux/arch/ia64/kernel/efivars.c
@@ -65,6 +65,7 @@
 
 MODULE_AUTHOR("Matt Domsch <Matt_Domsch@Dell.com>");
 MODULE_DESCRIPTION("/proc interface to EFI Variables");
+MODULE_LICENSE("GPL");
 
 #define EFIVARS_VERSION "0.03 2001-Apr-20"
 
@@ -276,21 +277,20 @@
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
 
-	spin_lock(&efivars_lock);
 	MOD_INC_USE_COUNT;
 
 	var_data = kmalloc(size, GFP_KERNEL);
 	if (!var_data) {
 		MOD_DEC_USE_COUNT;
-		spin_unlock(&efivars_lock);
 		return -ENOMEM;
 	}
 	if (copy_from_user(var_data, buffer, size)) {
 		MOD_DEC_USE_COUNT;
-		spin_unlock(&efivars_lock);
+                kfree(var_data);
 		return -EFAULT;
 	}
 
+	spin_lock(&efivars_lock);
 
 	/* Since the data ptr we've currently got is probably for
 	   a different variable find the right variable.

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)