Commit bb9c8f52 authored by Krishna Kurapati's avatar Krishna Kurapati
Browse files

FROMGIT: usb: gadget: f_fs: change ep->ep safe in ffs_epfile_io()



In ffs_epfile_io(), when read/write data in blocking mode, it will wait
the completion in interruptible mode, if task receive a signal, it will
terminate the wait, at same time, if function unbind occurs,
ffs_func_unbind() will kfree all eps, ffs_epfile_io() still try to
dequeue request by dereferencing ep which may become invalid.

Fix it by add ep spinlock and will not dereference ep if it is not valid.

Cc: <stable@vger.kernel.org> # 5.15
Reported-by: default avatarMichael Wu <michael@allwinnertech.com>
Tested-by: default avatarMichael Wu <michael@allwinnertech.com>
Reviewed-by: default avatarJohn Keeping <john@metanate.com>
Signed-off-by: default avatarLinyu Yuan <quic_linyyuan@quicinc.com>
Link: https://lore.kernel.org/r/1654863478-26228-3-git-send-email-quic_linyyuan@quicinc.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 0698f020
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/

 usb-next)

Bug: 237482099
Change-Id: I796c819a855241186058359a13c57c802e35ccbb
Signed-off-by: default avatarKrishna Kurapati <quic_kriskura@quicinc.com>
parent 7d2bd28e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment