Thread (18 messages) flat view 18 messages, 5 authors, 2021-03-27

Re: [syzbot] KASAN: use-after-free Read in disk_part_iter_next (2)

From: Dmitry Vyukov <dvyukov@google.com>
Date: 2021-03-22 07:50:46
Also in: lkml

On Mon, Mar 22, 2021 at 8:18 AM Christoph Hellwig [off-list ref] wrote:
I've been running the reproducer on a KASAN enable VM for about
15 minutes now, but haven't been able to reproduce it.

Is there a way to inject this proposed fix into the syzbot queue?
Hi Christoph,

Yes, since this bug has a reproducer, syzbot can test patches. See:

http://bit.do/syzbot#testing-patches

It would be, for example:

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
master

quoted hunk ↗ jump to hunk
diff --git a/block/partitions/core.c b/block/partitions/core.c
index 1a7558917c47d6..f5d5872b89d57e 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -288,15 +288,12 @@ struct device_type part_type = {
 void delete_partition(struct block_device *part)
 {
        xa_erase(&part->bd_disk->part_tbl, part->bd_partno);
-       kobject_put(part->bd_holder_dir);
-       device_del(&part->bd_device);
-
-       /*
-        * Remove the block device from the inode hash, so that it cannot be
-        * looked up any more even when openers still hold references.
-        */
        remove_inode_hash(part->bd_inode);

+       synchronize_rcu();
+
+       kobject_put(part->bd_holder_dir);
+       device_del(&part->bd_device);
        put_device(&part->bd_device);
 }

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help