usb: gadget: f_fs: change ep->status safe in ffs_epfile_io()
authorLinyu Yuan <quic_linyyuan@quicinc.com>
Fri, 10 Jun 2022 12:17:57 +0000 (20:17 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Jun 2022 12:22:03 +0000 (14:22 +0200)
commit20ac0adece7b18dd79467223b35e718223ccbf3d
treeb95e46c54a2439f30f6d4f71483b4a53fa9ec031
parent46da1e4a8b6329479433b2a4056941dfdd7f3efd
usb: gadget: f_fs: change ep->status safe in ffs_epfile_io()

commit fb1f16d74e263baa4ad11e31e28b68f144aa55ed upstream.

If a task read/write data in blocking mode, it will wait the completion
in ffs_epfile_io(), if function unbind occurs, ffs_func_unbind() will
kfree ffs ep, once the task wake up, it still dereference the ffs ep to
obtain the request status.

Fix it by moving the request status to io_data which is stack-safe.

Cc: <stable@vger.kernel.org> # 5.15
Reported-by: Michael Wu <michael@allwinnertech.com>
Tested-by: Michael Wu <michael@allwinnertech.com>
Reviewed-by: John Keeping <john@metanate.com>
Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com>
Link: https://lore.kernel.org/r/1654863478-26228-2-git-send-email-quic_linyyuan@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_fs.c