From: Christoph Hellwig <hch@infradead.org>
To: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Cc: linux-scsi@vger.kernel.org,
"Martin K . Petersen" <martin.petersen@oracle.com>,
Dongliang Mu <mudongliangabcd@gmail.com>
Subject: Re: [PATCH v3 1/2] scsi: sd: Fix potential NULL pointer dereference
Date: Wed, 1 Jun 2022 08:26:08 -0700 [thread overview]
Message-ID: <YpeFEMWC48tPISK1@infradead.org> (raw)
In-Reply-To: <20220601062544.905141-2-damien.lemoal@opensource.wdc.com>
On Wed, Jun 01, 2022 at 03:25:43PM +0900, Damien Le Moal wrote:
> If sd_probe() sees an early error before sdkp->device is initialized,
> sd_zbc_release_disk() is called. This causes a NULL pointer dereference
> when sd_is_zoned() is called inside that function. Avoid this by
> removing the call to sd_zbc_release_disk() in sd_probe() error path.
>
> This chnage is safe and does not result in zone information memory
> leakage because the zone information for a zoned disk is allocated only
> when sd_revalidate_disk() is called, at which point sdkp->disk_dev is
> fully set, resulting in sd_disk_release() being called when needed to
> cleanup a disk zone information using sd_zbc_release_disk().
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
next prev parent reply other threads:[~2022-06-01 15:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-01 6:25 [PATCH v3 0/2] sd_zbc fixes Damien Le Moal
2022-06-01 6:25 ` [PATCH v3 1/2] scsi: sd: Fix potential NULL pointer dereference Damien Le Moal
2022-06-01 15:26 ` Christoph Hellwig [this message]
2022-06-01 6:25 ` [PATCH v3 2/2] scsi: sd_zbc: prevent zone information memory leak Damien Le Moal
2022-06-01 15:26 ` Christoph Hellwig
2022-06-02 2:37 ` [PATCH v3 0/2] sd_zbc fixes Martin K. Petersen
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=YpeFEMWC48tPISK1@infradead.org \
--to=hch@infradead.org \
--cc=damien.lemoal@opensource.wdc.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mudongliangabcd@gmail.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