* Re: [PATCH] loop: fix to a race condition due to the early registration of device
2017-08-07 12:37 ` [PATCH] loop: fix to a race condition due to the early registration of device Anton Volkov
@ 2017-08-07 12:54 ` Johannes Thumshirn
2017-08-07 13:09 ` Anton Volkov
2017-08-08 22:00 ` Omar Sandoval
2017-08-15 18:51 ` Jens Axboe
2 siblings, 1 reply; 7+ messages in thread
From: Johannes Thumshirn @ 2017-08-07 12:54 UTC (permalink / raw)
To: Anton Volkov
Cc: tom.leiming, axboe, osandov, linux-kernel, linux-block,
ldv-project, khoroshilov
On Mon, Aug 07, 2017 at 03:37:50PM +0300, Anton Volkov wrote:
> +err_out:
> return err;
Any reason you can't just use return err; at the respective callsites?
Thanks,
Johannes
--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg
GF: Felix Imend�rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N�rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] loop: fix to a race condition due to the early registration of device
2017-08-07 12:54 ` Johannes Thumshirn
@ 2017-08-07 13:09 ` Anton Volkov
2017-08-07 13:24 ` Johannes Thumshirn
0 siblings, 1 reply; 7+ messages in thread
From: Anton Volkov @ 2017-08-07 13:09 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: tom.leiming, axboe, osandov, linux-kernel, linux-block,
ldv-project, khoroshilov
This is more of a style-oriented suggestion. This kind of template is
commonly used in other modules.
Regards,
Anton
On 07.08.2017 15:54, Johannes Thumshirn wrote:
> On Mon, Aug 07, 2017 at 03:37:50PM +0300, Anton Volkov wrote:
>> +err_out:
>> return err;
>
> Any reason you can't just use return err; at the respective callsites?
>
> Thanks,
> Johannes
>
-- Anton Volkov
Linux Verification Center, ISPRAS
web: http://linuxtesting.org
e-mail: avolkov@ispras.ru
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] loop: fix to a race condition due to the early registration of device
2017-08-07 13:09 ` Anton Volkov
@ 2017-08-07 13:24 ` Johannes Thumshirn
0 siblings, 0 replies; 7+ messages in thread
From: Johannes Thumshirn @ 2017-08-07 13:24 UTC (permalink / raw)
To: Anton Volkov
Cc: tom.leiming, axboe, osandov, linux-kernel, linux-block,
ldv-project, khoroshilov
On Mon, Aug 07, 2017 at 04:09:12PM +0300, Anton Volkov wrote:
> This is more of a style-oriented suggestion. This kind of template is
> commonly used in other modules.
Yes but there is no point in using gotos here (i.e. cleanup to be done), you
an just return directly.
And yes it is a minor nit.
Anyways,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
--
Johannes Thumshirn Storage
jthumshirn@suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg
GF: Felix Imend�rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N�rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] loop: fix to a race condition due to the early registration of device
2017-08-07 12:37 ` [PATCH] loop: fix to a race condition due to the early registration of device Anton Volkov
2017-08-07 12:54 ` Johannes Thumshirn
@ 2017-08-08 22:00 ` Omar Sandoval
2017-08-10 15:46 ` Anton Volkov
2017-08-15 18:51 ` Jens Axboe
2 siblings, 1 reply; 7+ messages in thread
From: Omar Sandoval @ 2017-08-08 22:00 UTC (permalink / raw)
To: Anton Volkov
Cc: tom.leiming, axboe, osandov, linux-kernel, linux-block,
ldv-project, khoroshilov
On Mon, Aug 07, 2017 at 03:37:50PM +0300, Anton Volkov wrote:
> The early device registration made possible a race leading to allocations
> of disks with wrong minors.
>
> This patch moves the device registration further down the loop_init
> function to make the race infeasible.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Anton Volkov <avolkov@ispras.ru>
> Reviewed-by: Ming Lei <ming.lei@redhat.com>
Hi, Anton,
Were you able to reproduce this issue or was it purely theoretical? If
the former, it'd be nice if you could add a test case to blktests [1].
1: https://github.com/osandov/blktests
Thanks!
Omar
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] loop: fix to a race condition due to the early registration of device
2017-08-08 22:00 ` Omar Sandoval
@ 2017-08-10 15:46 ` Anton Volkov
0 siblings, 0 replies; 7+ messages in thread
From: Anton Volkov @ 2017-08-10 15:46 UTC (permalink / raw)
To: Omar Sandoval
Cc: tom.leiming, axboe, osandov, linux-kernel, linux-block,
ldv-project, khoroshilov
Hello, Omar.
It was a purely theoretical race that had been considered to be possible
in real-life.
Regards,
Anton
On 09.08.2017 01:00, Omar Sandoval wrote:
> On Mon, Aug 07, 2017 at 03:37:50PM +0300, Anton Volkov wrote:
>> The early device registration made possible a race leading to allocations
>> of disks with wrong minors.
>>
>> This patch moves the device registration further down the loop_init
>> function to make the race infeasible.
>>
>> Found by Linux Driver Verification project (linuxtesting.org).
>>
>> Signed-off-by: Anton Volkov <avolkov@ispras.ru>
>> Reviewed-by: Ming Lei <ming.lei@redhat.com>
>
> Hi, Anton,
>
> Were you able to reproduce this issue or was it purely theoretical? If
> the former, it'd be nice if you could add a test case to blktests [1].
>
> 1: https://github.com/osandov/blktests
>
> Thanks!
> Omar
>
-- Anton Volkov
Linux Verification Center, ISPRAS
web: http://linuxtesting.org
e-mail: avolkov@ispras.ru
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] loop: fix to a race condition due to the early registration of device
2017-08-07 12:37 ` [PATCH] loop: fix to a race condition due to the early registration of device Anton Volkov
2017-08-07 12:54 ` Johannes Thumshirn
2017-08-08 22:00 ` Omar Sandoval
@ 2017-08-15 18:51 ` Jens Axboe
2 siblings, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2017-08-15 18:51 UTC (permalink / raw)
To: Anton Volkov, tom.leiming
Cc: osandov, linux-kernel, linux-block, ldv-project, khoroshilov
On 08/07/2017 06:37 AM, Anton Volkov wrote:
> The early device registration made possible a race leading to allocations
> of disks with wrong minors.
>
> This patch moves the device registration further down the loop_init
> function to make the race infeasible.
>
> Found by Linux Driver Verification project (linuxtesting.org).
Added for 4.14, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 7+ messages in thread