]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 23 Feb 2017 03:54:45 +0000 (03:54 +0000)
commit0fbed614ccd7ab27d77bc129a9d8539181d7d275
treefab45651f6c7f8168bf380a4606e205261b94beb
parentfe525a280e8b5f04c7666fe22d1a4ef592f7b953
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>
[bwh: Backported to 3.16:
 - Adjust filename
 - We only use kiocb::private, not kiocb::ki_flags]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/usb/gadget/f_fs.c