mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 05:39:54 -04:00
usb: gadget: f_fs: set req->num_sgs as 0 for non-sg transfer
commit d2450c6937018d40d4111fe830fa48d4ddceb8d0 upstream.
The UDC core uses req->num_sgs to judge if scatter buffer list is used.
Eg: usb_gadget_map_request_by_dev. For f_fs sync io mode, the request
is re-used for each request, so if the 1st request->length > PAGE_SIZE,
and the 2nd request->length is <= PAGE_SIZE, the f_fs uses the 1st
req->num_sgs for the 2nd request, it causes the UDC core get the wrong
req->num_sgs value (The 2nd request doesn't use sg). For f_fs async
io mode, it is not harm to initialize req->num_sgs as 0 either, in case,
the UDC driver doesn't zeroed request structure.
Cc: Jun Li <jun.li@nxp.com>
Cc: stable <stable@vger.kernel.org>
Fixes: 772a7a724f ("usb: gadget: f_fs: Allow scatter-gather buffers")
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Change-Id: I5df62ff47afb05d0ed02a396d4c67de23160e6c4
Git-commit: d2450c6937018d40d4111fe830fa48d4ddceb8d0
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Jack Pham <jackp@codeaurora.org>
This commit is contained in:
parent
87279d8c5f
commit
88259d89b8
1 changed files with 2 additions and 0 deletions
|
|
@ -1147,6 +1147,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
|
|||
req->num_sgs = io_data->sgt.nents;
|
||||
} else {
|
||||
req->buf = data;
|
||||
req->num_sgs = 0;
|
||||
}
|
||||
req->length = data_len;
|
||||
|
||||
|
|
@ -1195,6 +1196,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
|
|||
req->num_sgs = io_data->sgt.nents;
|
||||
} else {
|
||||
req->buf = data;
|
||||
req->num_sgs = 0;
|
||||
}
|
||||
req->length = data_len;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue