From: Christoph Hellwig <hch@infradead.org>
To: Rajat Asthana <thisisrast7@gmail.com>
Cc: Christoph Hellwig <hch@infradead.org>,
Rajat Asthana <rajatasthana4@gmail.com>,
axboe@kernel.dk, damien.lemoal@wdc.com, jack@suse.cz,
rafael@kernel.org,
syzbot+7d6c5587ec9cff5be65c@syzkaller.appspotmail.com,
linux-kernel@vger.kernel.org, ming.lei@redhat.com,
linux-block@vger.kernel.org, hare@suse.de,
linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [PATCH] block: Avoid accessing an already freed kobject in delete_partition
Date: Tue, 6 Jul 2021 06:12:17 +0100 [thread overview]
Message-ID: <YOPmMZdMQgXAyEMO@infradead.org> (raw)
In-Reply-To: <0c623d71-6d99-2e0d-4d8b-63a1ff814dc1@gmail.com>
On Tue, Jul 06, 2021 at 06:31:11AM +0530, Rajat Asthana wrote:
>
>
> On 03/07/21 10:56 am, Christoph Hellwig wrote:
> > This should be fixed properly by:
> >
> > "block: check disk exist before trying to add partition"
>
> Hi Christoph, thanks a lot for suggesting this fix. I have been
> working on implementing this and have tried the following:
> - I checked if the the kobject of device structure embedded in
> gendisk structure is not NULL, to add the partition.
> This didn't work.
>
> - Then I checked the if kobject of the block_device struct (part0)
> embedded in the gendisk struct is not NULL, to add the partition.
> This also didn't work.
>
> - Then I checked the i_state of the bd_inode field of block_device
> struct embedded in the gendisk struct. I checked if the I_FREEING or
> I_WILL_FREE fields are not set. The reason behind doing this was
> to confirm that we only create partition on the disks which are not
> being freed.
>
> Am I going in the right direction? Can you point me to the correct
> direction if I am not?
No. There should be no need to check anything, but the code needs
to ensure that the block device is alive. I think the above mentioned
patch (now in Jens' tree) does that, so please try it.
next prev parent reply other threads:[~2021-07-06 5:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-02 23:12 [PATCH] block: Avoid accessing an already freed kobject in delete_partition Rajat Asthana
2021-07-03 5:26 ` Christoph Hellwig
2021-07-06 1:01 ` Rajat Asthana
2021-07-06 5:12 ` Christoph Hellwig [this message]
2021-07-06 6:28 ` Rajat Asthana
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=YOPmMZdMQgXAyEMO@infradead.org \
--to=hch@infradead.org \
--cc=axboe@kernel.dk \
--cc=damien.lemoal@wdc.com \
--cc=hare@suse.de \
--cc=jack@suse.cz \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=rafael@kernel.org \
--cc=rajatasthana4@gmail.com \
--cc=syzbot+7d6c5587ec9cff5be65c@syzkaller.appspotmail.com \
--cc=thisisrast7@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;
as well as URLs for NNTP newsgroup(s).