OSDN Git Service

usb: gadget: f_fs: Fix use-after-free
authorLars-Peter Clausen <lars@metafoo.de>
Thu, 14 Apr 2016 15:01:17 +0000 (17:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 May 2016 21:48:41 +0000 (14:48 -0700)
commite4c7ab76586146820b394e0176f286f5a2e70cb3
tree494683005513eb5ebc8fdf1600381d8d15bd6ddc
parent95b9219e05dafdb76b0707e815e5314cc0cf91af
usb: gadget: f_fs: Fix use-after-free

commit 38740a5b87d53ceb89eb2c970150f6e94e00373a upstream.

When using asynchronous read or write operations on the USB endpoints the
issuer of the IO request is notified by calling the ki_complete() callback
of the submitted kiocb when the URB has been completed.

Calling this ki_complete() callback will free kiocb. Make sure that the
structure is no longer accessed beyond that point, otherwise undefined
behaviour might occur.

Fixes: 2e4c7553cd6f ("usb: gadget: f_fs: add aio support")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_fs.c