Skip to content
Commit 4a3a485b authored by Tahsin Erdogan's avatar Tahsin Erdogan Committed by Jens Axboe
Browse files

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: default avatarJohn Sperbeck <jsperbeck@google.com>
Signed-off-by: default avatarTahsin Erdogan <tahsin@google.com>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 0067d4b0
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment