diff options
author | Gavin Li <git@thegavinli.com> | 2019-08-14 14:29:24 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-08-21 09:57:36 -0700 |
commit | b08a6259a141baba98c57524ee4283fd91445bb8 (patch) | |
tree | 72fcc29c926f8e1ab5c95762cf558b54ee18cd70 | |
parent | a599e48662b4b505bef45d4831061f9d50703e17 (diff) | |
download | linux-b08a6259a141baba98c57524ee4283fd91445bb8.tar.bz2 |
usb: usbfs: only account once for mmap()'ed usb memory usage
Memory usage for USB memory allocated via mmap() is already accounted
for at mmap() time; no need to account for it again at submiturb time.
Signed-off-by: Gavin Li <git@thegavinli.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20190814212924.10381-1-gavinli@thegavinli.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/core/devio.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 24d4a801ca64..63f23f567680 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -1664,7 +1664,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb if (as->usbm) num_sgs = 0; - u += sizeof(struct async) + sizeof(struct urb) + uurb->buffer_length + + u += sizeof(struct async) + sizeof(struct urb) + + (as->usbm ? 0 : uurb->buffer_length) + num_sgs * sizeof(struct scatterlist); ret = usbfs_increase_memory_usage(u); if (ret) |