syzbot is reporting double kfree() bug in disk_release_events() [1], for commit 9be68dd7ac0e13be ("md: add error handling support for add_disk()") is calling blk_cleanup_disk() which will call disk_release_events() from regular kobject_release() path when device_add_disk() from add_disk() failed. Since kobject_release() will be always called regardless of whether device_add_disk() from add_disk() succeeds, we should leave disk_release_events() to regular kobject_release() path. Link: https://syzkaller.appspot.com/bug?extid=28a66a9fbc621c939000 [1] Reported-by: syzbot <syzbot+28a66a9fbc621c939000@xxxxxxxxxxxxxxxxxxxxxxxxx> Tested-by: syzbot <syzbot+28a66a9fbc621c939000@xxxxxxxxxxxxxxxxxxxxxxxxx> Fixes: 83cbce9574462c6b ("block: add error handling for device_add_disk / add_disk") Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> --- block/genhd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/genhd.c b/block/genhd.c index 30362aeacac4..47bb34ab967b 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -540,7 +540,7 @@ int __must_check device_add_disk(struct device *parent, struct gendisk *disk, out_device_del: device_del(ddev); out_disk_release_events: - disk_release_events(disk); + /* disk_release() will call disk_release_events(). */ out_free_ext_minor: if (disk->major == BLOCK_EXT_MAJOR) blk_free_ext_minor(disk->first_minor); -- 2.32.0