]> www.infradead.org Git - users/jedix/linux-maple.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)
committerDhaval Giani <dhaval.giani@oracle.com>
Fri, 20 Jan 2017 22:21:49 +0000 (17:21 -0500)
commite4a0b40e0937a4c08a2626561aa64636dddb41a9
treea3c318cc10f3d3f9f6b080da43805e9e0edd607a
parent9a4c5c49fae05fc7388b13ae7a48e0318e602214
usb: gadget: f_fs: Fix use-after-free

Orabug: 25227130

[ Upstream commit 38740a5b87d53ceb89eb2c970150f6e94e00373a ]

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")
Cc: <stable@vger.kernel.org> # v3.15+
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
(cherry picked from commit 0763ce11708553fc7b2124f184ce2e4bb0cb186d)

Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
drivers/usb/gadget/function/f_fs.c