From: Christoph Hellwig <hch@infradead.org>
To: Ayush Jain <ayush.jain3@amd.com>
Cc: sfr@canb.auug.org.au,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Next Mailing List <linux-next@vger.kernel.org>,
Wyes Karny <wyes.karny@amd.com>,
hch@infradead.org, Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org
Subject: Re: Kernel null pointer dereference on stopping raid device
Date: Wed, 14 Jun 2023 00:22:38 -0700 [thread overview]
Message-ID: <ZIlqvsZ6nMv2OT2u@infradead.org> (raw)
In-Reply-To: <3c4911c4-d3d7-a93e-5f14-e97384ae4f21@amd.com>
Hi Ayush,
can you try this patch?
diff --git a/drivers/md/md.c b/drivers/md/md.c
index ca0de7ddd9434d..828c4e6b9c5013 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2460,7 +2460,7 @@ static void export_rdev(struct md_rdev *rdev, struct mddev *mddev)
if (test_bit(AutoDetected, &rdev->flags))
md_autodetect_dev(rdev->bdev->bd_dev);
#endif
- blkdev_put(rdev->bdev, mddev->major_version == -2 ? &claim_rdev : rdev);
+ blkdev_put(rdev->bdev, &claim_rdev);
rdev->bdev = NULL;
kobject_put(&rdev->kobj);
}
@@ -3644,7 +3644,7 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe
goto out_clear_rdev;
rdev->bdev = blkdev_get_by_dev(newdev, BLK_OPEN_READ | BLK_OPEN_WRITE,
- super_format == -2 ? &claim_rdev : rdev, NULL);
+ &claim_rdev, NULL);
if (IS_ERR(rdev->bdev)) {
pr_warn("md: could not open device unknown-block(%u,%u).\n",
MAJOR(newdev), MINOR(newdev));
@@ -3681,7 +3681,7 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe
return rdev;
out_blkdev_put:
- blkdev_put(rdev->bdev, super_format == -2 ? &claim_rdev : rdev);
+ blkdev_put(rdev->bdev, &claim_rdev);
out_clear_rdev:
md_rdev_clear(rdev);
out_free_rdev:
next prev parent reply other threads:[~2023-06-14 7:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-13 20:12 Kernel null pointer dereference on stopping raid device Jain, Ayush
2023-06-14 7:10 ` Ayush Jain
2023-06-14 7:22 ` Christoph Hellwig [this message]
[not found] ` <IA1PR12MB61375A452083D65B5FB815DBBA5AA@IA1PR12MB6137.namprd12.prod.outlook.com>
2023-06-14 14:01 ` Christoph Hellwig
2023-06-15 5:44 ` Ayush Jain
2023-06-15 6:03 ` Christoph Hellwig
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=ZIlqvsZ6nMv2OT2u@infradead.org \
--to=hch@infradead.org \
--cc=axboe@kernel.dk \
--cc=ayush.jain3@amd.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=sfr@canb.auug.org.au \
--cc=wyes.karny@amd.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.