From: Petr Pavlu <petr.pavlu@suse.com>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: Luis Chamberlain <mcgrof@kernel.org>,
Sami Tolvanen <samitolvanen@google.com>,
Daniel Gomez <da.gomez@samsung.com>,
Shyam Saini <shyamsaini@linux.microsoft.com>,
linux-modules@vger.kernel.org,
syzbot+7fb8a372e1f6add936dd@syzkaller.appspotmail.com
Subject: Re: [PATCH] module: ensure that kobject_put() is safe for module type kobjects
Date: Wed, 7 May 2025 20:20:31 +0200 [thread overview]
Message-ID: <a5543fda-6dbf-461a-9bcb-5750a459e140@suse.com> (raw)
In-Reply-To: <20250507065044.86529-1-dmantipov@yandex.ru>
On 5/7/25 08:50, Dmitry Antipov wrote:
> In 'lookup_or_create_module_kobject()', an internal kobject is created
> using 'module_ktype'. So call to 'kobject_put()' on error handling
> path causes an attempt to use an uninitialized completion pointer in
> 'module_kobject_release()'. In this scenario, we just want to release
> kobject without an extra synchronization required for a regular module
> unloading process, so adding an extra check whether 'complete()' is
> actually required makes 'kobject_put()' safe.
>
> Reported-by: syzbot+7fb8a372e1f6add936dd@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=7fb8a372e1f6add936dd
> Fixes: 942e443127e9 ("module: Fix mod->mkobj.kobj potentially freed too early")
> Suggested-by: Petr Pavlu <petr.pavlu@suse.com>
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Added on modules-fixes.
I plan to send the fix to Linus on Friday. While the underlying problem
was already there, commit f95bbfe18512 ("drivers: base: handle
module_kobject creation"), merged in v6.15-rc5, made it more exposed and
I think it's better to have it fixed in this cycle. The patch itself is
also safe.
--
Thanks,
Petr
prev parent reply other threads:[~2025-05-07 18:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-06 11:17 [PATCH] kernel: fix error handling in lookup_or_create_module_kobject() Dmitry Antipov
2025-05-06 14:49 ` Petr Pavlu
2025-05-07 6:05 ` Dmitry Antipov
2025-05-07 6:50 ` [PATCH] module: ensure that kobject_put() is safe for module type kobjects Dmitry Antipov
2025-05-07 18:20 ` Petr Pavlu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a5543fda-6dbf-461a-9bcb-5750a459e140@suse.com \
--to=petr.pavlu@suse.com \
--cc=da.gomez@samsung.com \
--cc=dmantipov@yandex.ru \
--cc=linux-modules@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=samitolvanen@google.com \
--cc=shyamsaini@linux.microsoft.com \
--cc=syzbot+7fb8a372e1f6add936dd@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.