linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rajat Asthana <thisisrast7@gmail.com>
To: Christoph Hellwig <hch@infradead.org>,
	Rajat Asthana <rajatasthana4@gmail.com>
Cc: 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:31:11 +0530	[thread overview]
Message-ID: <0c623d71-6d99-2e0d-4d8b-63a1ff814dc1@gmail.com> (raw)
In-Reply-To: <YN/1DOeSA5ODf1AV@infradead.org>



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?

thanks
-- Rajat

  reply	other threads:[~2021-07-06  1:01 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 [this message]
2021-07-06  5:12     ` Christoph Hellwig
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=0c623d71-6d99-2e0d-4d8b-63a1ff814dc1@gmail.com \
    --to=thisisrast7@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@wdc.com \
    --cc=hare@suse.de \
    --cc=hch@infradead.org \
    --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 \
    /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).