diff options
| author | Manu Gautam <mgautam@codeaurora.org> | 2016-01-28 11:09:27 -0800 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-22 11:10:02 -0700 |
| commit | f5ae88ff3622603a46e86fd2ed8728c87e26b4b6 (patch) | |
| tree | b4dea77cc3496a5c4779b3f5ba3ed3929c64b38f /include/linux/flex_array.h | |
| parent | e822c0fcf5aca104b4ccb3905b2bce21779f370b (diff) | |
USB: f_fs: Fix disconnect check during ongoing IO
F_FS function driver allocated ffs_eps and updates ffs_ep->ep
to corresponding usb_ep during func->bind and never clears it.
On bind it also saves ffs_ep context in epfile->ep.
During func->disable, it clears only ffs_ep context in epfile->ep
and on func->unbind it frees ffs_eps memory.
ffs_epfile_io routine currently relies on ffs_ep->ep (which is
never cleared and ffs_ep could be freed on unbind) to detect any
disconnect during active IO. This can result in various issues e.g.
use after free use of ffs_ep if unbind finished before epfile_io
could resume or "stop adbd" trying to dequeue a freed USB request
when epfile_io could execute only after F_FS got disabled as
'if (ep->ep)' check would be TRUE.
Fix this by checking stored ffs_ep context against latest epfile->ep
to figure out if endpoint got disabled or changed before acquiring
spin_lock.
Change-Id: I6bdcdf0dff0813ed7b2af8c24f544a22796b0369
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Diffstat (limited to 'include/linux/flex_array.h')
0 files changed, 0 insertions, 0 deletions
