From: Alexandr Sapozhnkiov <alsp705@gmail.com>
To: Alasdair Kergon <agk@redhat.com>,
Mike Snitzer <snitzer@redhat.com>,
dm-devel@redhat.com, linux-kernel@vger.kernel.org
Cc: Alexandr Sapozhnikov <alsp705@gmail.com>,
linux-media@vger.kernel.org, lvc-project@linuxtesting.org
Subject: [PATCH 5.10] md: fix NULL pointer dereference at reregister_snapshot()
Date: Mon, 22 Sep 2025 17:42:37 +0300 [thread overview]
Message-ID: <20250922144239.11-1-alsp705@gmail.com> (raw)
From: Alexandr Sapozhnikov <alsp705@gmail.com>
Return value of a function '__lookup_origin' is dereferenced
at dm-snap.c:596 without checking for NULL, but it is usually
checked for this function
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
Signed-off-by: Alexandr Sapozhnikov <alsp705@gmail.com>
---
drivers/md/dm-snap.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 4668b2cd98f4..105f6e768ad1 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -590,12 +590,15 @@ static int register_snapshot(struct dm_snapshot *snap)
*/
static void reregister_snapshot(struct dm_snapshot *s)
{
+ struct origin *o;
struct block_device *bdev = s->origin->bdev;
down_write(&_origins_lock);
+ o = __lookup_origin(s->origin->bdev);
list_del(&s->list);
- __insert_snapshot(__lookup_origin(bdev), s);
+ if (o)
+ __insert_snapshot(o, s);
up_write(&_origins_lock);
}
--
2.43.0
next reply other threads:[~2025-09-22 14:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-22 14:42 Alexandr Sapozhnkiov [this message]
2025-09-23 6:05 ` [PATCH 5.10] md: fix NULL pointer dereference at reregister_snapshot() kernel test robot
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=20250922144239.11-1-alsp705@gmail.com \
--to=alsp705@gmail.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=snitzer@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox