[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6d7d0b33-6c9e-4941-af5f-678137d2a00e@web.de>
Date: Tue, 19 Dec 2023 16:32:48 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: kernel-janitors@...r.kernel.org, Andrew Morton
<akpm@...ux-foundation.org>, Greg Kroah-Hartman
<gregkh@...uxfoundation.org>, "Rafael J. Wysocki" <rafael@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>, cocci@...ia.fr
Subject: [PATCH 1/3] kobject: Add a jump label in kobject_uevent_env()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Tue, 19 Dec 2023 14:16:35 +0100
Use another label so that a call of the function “kfree” can be avoided
after a failed call of the function “kobject_get_path”.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
lib/kobject_uevent.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index fb9a2f06dd1e..811e579ed89d 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -529,7 +529,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
devpath = kobject_get_path(kobj, GFP_KERNEL);
if (!devpath) {
retval = -ENOENT;
- goto exit;
+ goto free_env;
}
/* default keys */
@@ -623,6 +623,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
exit:
kfree(devpath);
+free_env:
kfree(env);
return retval;
}
--
2.43.0
Powered by blists - more mailing lists