[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <e93eb913-f3e4-081e-c4f7-92bcb99b83b6@ispras.ru>
Date: Fri, 28 Jul 2017 18:55:49 +0300
From: Anton Volkov <avolkov@...ras.ru>
To: axboe@...com
Cc: tom.leiming@...il.com, osandov@...com,
linux-kernel@...r.kernel.org, ldv-project@...uxtesting.org,
khoroshilov@...ras.ru
Subject: Possible race in loop.ko
Hello.
While searching for races in Linux kernel I've come across
drivers/block/loop.ko module. Here is the question that I came up with
while analyzing results. Lines are given using the info from Linux v4.12.
In loop_init function additional initialization happens after a
successful call to misc_register() (loop.c: line 1961). Consider the
following case:
Thread 1: Thread 2:
loop_init()
misc_register() loop_control_ioctl
part_shift = 0 -> loop_add
if (max_part > 0) { alloc_disk(1 << part_shift)
part_shift =
<greater than 0>
...
}
In this case alloc_disk() will be called with 1 as a parameter although
part_shift should have been greater than 0. Maybe it would be better to
move the call to a misc_register() function a bit further down (at least
so it could be after the part_shift initialization)?
Thank you for your time.
-- Anton Volkov
Linux Verification Center, ISPRAS
web: http://linuxtesting.org
e-mail: avolkov@...ras.ru
Powered by blists - more mailing lists