Commit b08a6259 authored by Gavin Li's avatar Gavin Li Committed by Greg Kroah-Hartman

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: default avatarGavin Li <git@thegavinli.com>
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20190814212924.10381-1-gavinli@thegavinli.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a599e486
...@@ -1664,7 +1664,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb ...@@ -1664,7 +1664,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb
if (as->usbm) if (as->usbm)
num_sgs = 0; 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); num_sgs * sizeof(struct scatterlist);
ret = usbfs_increase_memory_usage(u); ret = usbfs_increase_memory_usage(u);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment