On Tue, Mar 29, 2022 at 05:49:48PM +0200, Fabio M. De Francesco wrote: > In sd_probe(), if device_add_disk() fails it simply calls put_device() > and jumps to the "out" label but the device is never deleted from system. > This leads to a memory leak as reported by Syzbot.[1] > > Fix this bug by calling device_del() soon before put_device() when > device_add_disk() fails. > > [1] [syzbot] memory leak in blk_mq_init_tags > https://lore.kernel.org/lkml/000000000000c341cc05db38c1b0@xxxxxxxxxx/ > > Reported-by: syzbot+f08c77040fa163a75a46@xxxxxxxxxxxxxxxxxxxxxxxxx > Suggested-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> > Fixes: 2a7a891f4c40 ("scsi: sd: Add error handling support for add_disk()") > Signed-off-by: Fabio M. De Francesco <fmdefrancesco@xxxxxxxxx> Thanks! regards, dan carpenter