Skip to contentSkip to conversation

kobject: free memory if netlink_kernel_create() fails

PATCH In review Dan Carpenter 4 participants 4 messages May 25, 2010 – May 26, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kobject: free memory if netlink_kernel_create() fails

There is a kfree(ue_sk) missing on the error path if netlink_kernel_create() fails.

lib/kobject_uevent.c +1 -0
index 59c1551..08e15f7 100644
@@ -378,6 +378,7 @@ static int uevent_net_init(struct net *net)
 	if (!ue_sk->sk) {
 		printk(KERN_ERR
 		       "kobject_uevent: unable to create netlink socket!\n");
+		kfree(ue_sk);
 		return -ENODEV;
 	}
 	mutex_lock(&uevent_sock_mutex);
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Dan Carpenter

There is a kfree(ue_sk) missing on the error path if netlink_kernel_create() fails.

Oops.

Quoted 12 lines
lib/kobject_uevent.c +1 -0
index 59c1551..08e15f7 100644
@@ -378,6 +378,7 @@ static int uevent_net_init(struct net *net)
 	if (!ue_sk->sk) {
 		printk(KERN_ERR
 		       "kobject_uevent: unable to create netlink socket!\n");
+		kfree(ue_sk);
 		return -ENODEV;
 	}
 	mutex_lock(&uevent_sock_mutex);
#3 lore raw
Quoted 5 lines · David Miller

From: [email protected] (Eric W. Biederman)
Date: Tue, 25 May 2010 03:25:37 -0700

Quoted 2 lines

Dan Carpenter <[email protected]> writes:

Quoted 7 lines
Quoted 5 lines
Quoted 4 lines

There is a kfree(ue_sk) missing on the error path if netlink_kernel_create() fails.

Greg, I assume you've got this one?

Yes, I'll queue it up in a day or so.

thanks,

greg k-h