Re: [PATCH] writeback: fix memory leak in wb_queue_work()

From: Jens Axboe
Date: Mon Mar 13 2017 - 10:54:45 EST


On 03/10/2017 01:09 PM, Tahsin Erdogan wrote:
> When WB_registered flag is not set, wb_queue_work() skips queuing the
> work, but does not perform the necessary clean up. In particular, if
> work->auto_free is true, it should free the memory.
>
> The leak condition can be reprouced by following these steps:
>
> mount /dev/sdb /mnt/sdb
> /* In qemu console: device_del sdb */
> umount /dev/sdb
>
> Above will result in a wb_queue_work() call on an unregistered wb and
> thus leak memory.

Added for 4.11, thanks Tahsin.

--
Jens Axboe