[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7ea59d03-701c-4555-a8e8-5d7272b9381c@web.de>
Date: Mon, 12 Aug 2024 12:18:17 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Jinjie Ruan <ruanjinjie@...wei.com>, linux-modules@...r.kernel.org,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Luis Chamberlain <mcgrof@...nel.org>, "Rafael J. Wysocki" <rafael@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] driver core: Fix a null-ptr-deref in module_add_driver()
> Inject fault while probing of-fpga-region, if kasprintf() fails in
> module_add_driver(), the second sysfs_remove_link() in exit path will cause
> null-ptr-deref as below because kernfs_name_hash() will call strlen() with
> NULL driver_name.
…
How do you think about to use the term “null pointer dereference”
for the commit message (and summary phrase)?
…
> +++ b/drivers/base/module.c
> @@ -66,27 +66,31 @@ int module_add_driver(struct module *mod, const struct device_driver *drv)
…
> sysfs_remove_link(mk->drivers_dir, driver_name);
> +
> +out_free_driver_name:
> kfree(driver_name);
>
> +out_remove_kobj:
> + sysfs_remove_link(&drv->p->kobj, "module");
…
I suggest to omit two blank lines here.
Regards,
Markus
Powered by blists - more mailing lists