[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220330043025.GD3293@kadam>
Date: Wed, 30 Mar 2022 07:30:25 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: "Fabio M. De Francesco" <fmdefrancesco@...il.com>
Cc: axboe@...nel.dk, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
linux-scsi@...r.kernel.org,
syzbot+f08c77040fa163a75a46@...kaller.appspotmail.com
Subject: Re: [PATCH] scsi: sd: call device_del() if device_add_disk() fails
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@google.com/
>
> Reported-by: syzbot+f08c77040fa163a75a46@...kaller.appspotmail.com
> Suggested-by: Dan Carpenter <dan.carpenter@...cle.com>
> Fixes: 2a7a891f4c40 ("scsi: sd: Add error handling support for add_disk()")
> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@...il.com>
Thanks!
regards,
dan carpenter
Powered by blists - more mailing lists