]> git.baikalelectronics.ru Git - kernel.git/commit
block: ensure the bdi is freed after inode_detach_wb
authorChristoph Hellwig <hch@lst.de>
Mon, 16 Aug 2021 12:26:14 +0000 (14:26 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 16 Aug 2021 16:49:11 +0000 (10:49 -0600)
commit709fde07e880f379889ae8dbe2db1657b6a33ca2
tree61d680894772d993d79976efa1c593cfdb1c0dff
parentea4323f32a35fbd61ba23d3e5d6875ae0eccc0da
block: ensure the bdi is freed after inode_detach_wb

inode_detach_wb references the "main" bdi of the inode.  With the
recent change to move the bdi from the request_queue to the gendisk
this causes a guaranteed use after free when using certain cgroup
configurations.  The big itself is older through as any non-default
inode reference (e.g. an open file descriptor) could have injected
this use after free even before that.

Fixes: 0bfd3047cfb4 ("writeback: make backing_dev_info host cgroup-specific bdi_writebacks")
Reported-by: Qian Cai <quic_qiancai@quicinc.com>
Reported-by: syzbot <syzbot+1fb38bb7d3ce0fa3e1c4@syzkaller.appspotmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20210816122614.601358-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/genhd.c
fs/block_dev.c