block: fix error unwinding in device_add_disk
mainline inclusion from mainline-v5.17-rc1 commit 99d8690a category: bugfix bugzilla: 188733 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=99d8690aae4b2f0d1d90075de355ac087f820a66 ---------------------------------------- One device_add is called disk->ev will be freed by disk_release, so we should free it twice. Fix this by allocating disk->ev after device_add so that the extra local unwinding can be removed entirely. Based on an earlier patch from Tetsuo Handa. Reported-by:syzbot <syzbot+28a66a9fbc621c939000@syzkaller.appspotmail.com> Tested-by:
syzbot <syzbot+28a66a9fbc621c939000@syzkaller.appspotmail.com> Fixes: 83cbce95 ("block: add error handling for device_add_disk / add_disk") Signed-off-by:
Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20211221161851.788424-1-hch@lst.de Signed-off-by:
Jens Axboe <axboe@kernel.dk> conflict: block/genhd.c Signed-off-by:
Zhong Jinghua <zhongjinghua@huawei.com> Signed-off-by:
Li Nan <linan122@huawei.com>
Loading
Please sign in to comment