<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/block/loop.c, branch v5.14</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.14</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.14'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2021-07-23T16:18:25Z</updated>
<entry>
<title>loop: reintroduce global lock for safe loop_validate_file() traversal</title>
<updated>2021-07-23T16:18:25Z</updated>
<author>
<name>Tetsuo Handa</name>
<email>penguin-kernel@i-love.sakura.ne.jp</email>
</author>
<published>2021-07-06T14:40:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3ce6e1f662a910970880188ea7bfd00542bd3934'/>
<id>urn:sha1:3ce6e1f662a910970880188ea7bfd00542bd3934</id>
<content type='text'>
Commit 6cc8e7430801fa23 ("loop: scale loop device by introducing per
device lock") re-opened a race window for NULL pointer dereference at
loop_validate_file() where commit 310ca162d779efee ("block/loop: Use
global lock for ioctl() operation.") has closed.

Although we need to guarantee that other loop devices will not change
during traversal, we can't take remote "struct loop_device"-&gt;lo_mutex
inside loop_validate_file() in order to avoid AB-BA deadlock. Therefore,
introduce a global lock dedicated for loop_validate_file() which is
conditionally taken before local "struct loop_device"-&gt;lo_mutex is taken.

Signed-off-by: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Fixes: 6cc8e7430801fa23 ("loop: scale loop device by introducing per device lock")
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>loop: remove unused variable in loop_set_status()</title>
<updated>2021-07-02T15:28:42Z</updated>
<author>
<name>Tetsuo Handa</name>
<email>penguin-kernel@I-love.SAKURA.ne.jp</email>
</author>
<published>2021-07-02T15:27:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=585af8ede7035379b712cacca80e9c2c34853d4b'/>
<id>urn:sha1:585af8ede7035379b712cacca80e9c2c34853d4b</id>
<content type='text'>
Commit 0384264ea8a39bd9 ("block: pass a gendisk to bdev_disk_changed")
changed to pass lo-&gt;lo_disk instead of lo-&gt;lo_device.

Fixes: 0384264ea8a3 ("block: pass a gendisk to bdev_disk_changed")
Signed-off-by: Tetsuo Handa &lt;penguin-kernel@I-love.SAKURA.ne.jp&gt;
Link: https://lore.kernel.org/r/20210702152714.7978-1-penguin-kernel@I-love.SAKURA.ne.jp
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>loop: rewrite loop_exit using idr_for_each_entry</title>
<updated>2021-06-30T21:34:13Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2021-06-23T14:59:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8e60947d2f1ee675681a526da99fa587e63f78e3'/>
<id>urn:sha1:8e60947d2f1ee675681a526da99fa587e63f78e3</id>
<content type='text'>
Use idr_for_each_entry to simplify removing all devices.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Chaitanya Kulkarni &lt;chaitanya.kulkarni@wdc.com&gt;
Link: https://lore.kernel.org/r/20210623145908.92973-10-hch@lst.de
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>loop: split loop_lookup</title>
<updated>2021-06-30T21:34:13Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2021-06-23T14:59:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b9848081465d8734441408129bd44311c7b6d644'/>
<id>urn:sha1:b9848081465d8734441408129bd44311c7b6d644</id>
<content type='text'>
loop_lookup has two callers - one wants to do the a find by index and the
other wants any unbound loop device.  Open code the respective
functionality in each caller.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Link: https://lore.kernel.org/r/20210623145908.92973-9-hch@lst.de
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>loop: don't allow deleting an unspecified loop device</title>
<updated>2021-06-30T21:34:13Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2021-06-23T14:59:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e5d66a10324f2a0c31153fd6210d99a9d00ef047'/>
<id>urn:sha1:e5d66a10324f2a0c31153fd6210d99a9d00ef047</id>
<content type='text'>
Passing a negative index to loop_lookup while return any unbound device.
Doing that for a delete does not make much sense, so add check to
explicitly reject that case.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Link: https://lore.kernel.org/r/20210623145908.92973-8-hch@lst.de
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>loop: move loop_ctl_mutex locking into loop_add</title>
<updated>2021-06-30T21:34:13Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2021-06-23T14:59:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=18d1f200b3807c383d80cc00d6bbdee288e63b1f'/>
<id>urn:sha1:18d1f200b3807c383d80cc00d6bbdee288e63b1f</id>
<content type='text'>
Move acquiring and releasing loop_ctl_mutex from the callers into
loop_add.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Chaitanya Kulkarni &lt;chaitanya.kulkarni@wdc.com&gt;
Link: https://lore.kernel.org/r/20210623145908.92973-7-hch@lst.de
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>loop: split loop_control_ioctl</title>
<updated>2021-06-30T21:34:13Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2021-06-23T14:59:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f9d107644aa4943b383986a8aa36125379eeaa81'/>
<id>urn:sha1:f9d107644aa4943b383986a8aa36125379eeaa81</id>
<content type='text'>
Split loop_control_ioctl into a helper for each command.  This keeps the
code nicely separated for the upcoming locking changes.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Chaitanya Kulkarni &lt;chaitanya.kulkarni@wdc.com&gt;
Link: https://lore.kernel.org/r/20210623145908.92973-6-hch@lst.de
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>loop: don't call loop_lookup before adding a loop device</title>
<updated>2021-06-30T21:34:13Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2021-06-23T14:59:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4157fe0b3d16ceca4316674a90c681405cdd23bf'/>
<id>urn:sha1:4157fe0b3d16ceca4316674a90c681405cdd23bf</id>
<content type='text'>
loop_add returns the right error if the slot wasn't available.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Link: https://lore.kernel.org/r/20210623145908.92973-5-hch@lst.de
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>loop: remove the l argument to loop_add</title>
<updated>2021-06-30T21:34:13Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2021-06-23T14:59:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d6da83d072c187d6a69d5a49e2320f62920889d7'/>
<id>urn:sha1:d6da83d072c187d6a69d5a49e2320f62920889d7</id>
<content type='text'>
None of the callers cares about the allocated struct loop_device.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Chaitanya Kulkarni &lt;chaitanya.kulkarni@wdc.com&gt;
Link: https://lore.kernel.org/r/20210623145908.92973-4-hch@lst.de
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
<entry>
<title>loop: reduce loop_ctl_mutex coverage in loop_exit</title>
<updated>2021-06-30T21:34:13Z</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2021-06-23T14:59:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bd5c39edad535d9f6ccb99633930f9f7b768593c'/>
<id>urn:sha1:bd5c39edad535d9f6ccb99633930f9f7b768593c</id>
<content type='text'>
loop_ctl_mutex is only needed to iterate the IDR for removing the loop
devices, so reduce the coverage.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Chaitanya Kulkarni &lt;chaitanya.kulkarni@wdc.com&gt;
Link: https://lore.kernel.org/r/20210623145908.92973-3-hch@lst.de
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
</entry>
</feed>
