]> git.baikalelectronics.ru Git - kernel.git/commit
writeback: fix memory leak in wb_queue_work()
authorTahsin Erdogan <tahsin@google.com>
Fri, 10 Mar 2017 20:09:49 +0000 (12:09 -0800)
committerJens Axboe <axboe@fb.com>
Mon, 13 Mar 2017 14:27:34 +0000 (08:27 -0600)
commit3002df5616613ec66b8f72be1d62e6b92944bc1c
tree7e400cfc12120881e18efc4c6da3deefd6e50c3b
parent72283761afc88eb6f387a05d3ecefc308fde4f4a
writeback: fix memory leak in wb_queue_work()

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.

Reported-by: John Sperbeck <jsperbeck@google.com>
Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
fs/fs-writeback.c