Skip to contentSkip to conversation

kmod: Release sub_info on cred allocation failure.

PATCH New David Howells 1 participant 1 message May 26, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kmod: Release sub_info on cred allocation failure.

From: Tetsuo Handa <[email protected]>

call_usermodehelper_setup() forgot to kfree(sub_info) when prepare_usermodehelper_creds() failed.

---

 kernel/kmod.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
kernel/kmod.c +3 -1
index b750675..7e95bed 100644
@@ -370,8 +370,10 @@ struct subprocess_info *call_usermodehelper_setup(char *path, char **argv,
 	sub_info->argv = argv;
 	sub_info->envp = envp;
 	sub_info->cred = prepare_usermodehelper_creds();
-	if (!sub_info->cred)
+	if (!sub_info->cred) {
+		kfree(sub_info);
 		return NULL;
+	}
 
   out:
 	return sub_info;