lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <cdc952f8-2df7-a34b-8395-8fd076c10f8f@oracle.com>
Date:   Fri, 22 Feb 2019 20:40:29 +0800
From:   Dongli Zhang <dongli.zhang@...cle.com>
To:     Jan Kara <jack@...e.cz>
Cc:     linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        axboe@...nel.dk
Subject: Re: [PATCH v2 2/2] loop: set GENHD_FL_NO_PART_SCAN after
 blkdev_reread_part()



On 02/22/2019 07:47 PM, Jan Kara wrote:
> On Thu 21-02-19 23:33:43, Dongli Zhang wrote:
>> Commit 0da03cab87e6
>> ("loop: Fix deadlock when calling blkdev_reread_part()") moves
>> blkdev_reread_part() out of the loop_ctl_mutex. However,
>> GENHD_FL_NO_PART_SCAN is set before __blkdev_reread_part(). As a result,
>> __blkdev_reread_part() will fail the check of GENHD_FL_NO_PART_SCAN and
>> will not rescan the loop device to delete all partitions.
>>
>> Below are steps to reproduce the issue:
>>
>> step1 # dd if=/dev/zero of=tmp.raw bs=1M count=100
>> step2 # losetup -P /dev/loop0 tmp.raw
>> step3 # parted /dev/loop0 mklabel gpt
>> step4 # parted -a none -s /dev/loop0 mkpart primary 64s 1
>> step5 # losetup -d /dev/loop0
>>
>> Step5 will not be able to delete /dev/loop0p1 (introduced by step4) and
>> there is below kernel warning message:
>>
>> [  464.414043] __loop_clr_fd: partition scan of loop0 failed (rc=-22)
>>
>> This patch sets GENHD_FL_NO_PART_SCAN after blkdev_reread_part().
>>
>> Fixes: 0da03cab87e6 ("loop: Fix deadlock when calling blkdev_reread_part()")
>> Signed-off-by: Dongli Zhang <dongli.zhang@...cle.com>
>> ---
>> Changed since v1:
>>   * move the setting of lo->lo_state to Lo_unbound after partscan has finished as well
>>     (suggested by Jan Kara)
>>
>>  drivers/block/loop.c | 26 ++++++++++++++++++++++----
>>  1 file changed, 22 insertions(+), 4 deletions(-)
> 
> Thanks the patch looks good! Just one nit below:
> 
>> diff --git a/drivers/block/loop.c b/drivers/block/loop.c
>> index 7908673..a13f5dc 100644
>> --- a/drivers/block/loop.c
>> +++ b/drivers/block/loop.c
>> @@ -1034,6 +1034,16 @@ loop_init_xfer(struct loop_device *lo, struct loop_func_table *xfer,
>>  	return err;
>>  }
>>  
>> +static void loop_disable_partscan(struct loop_device *lo)
>> +{
> 
> I don't think there's any benefit in having this small function with a single
> caller and furthermore with the subtle sideeffect that it changes lo_state.
> So I'd just put the code inline in __loop_clr_fd(). With that you can add:
> 
> Reviewed-by: Jan Kara <jack@...e.cz>

Thank you very much!

I will send out v3 with the Reviewed-by and put the code inline in __loop_clr_fd().

Dongli Zhang

> 
> 								Honza
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ