Re: [PATCH] block: Avoid accessing an already freed kobject in delete_partition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux