diff options
Diffstat (limited to 'drivers/usb/usb-skeleton.c')
-rw-r--r-- | drivers/usb/usb-skeleton.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c index b6652ef56830..5d02f16b7d0e 100644 --- a/drivers/usb/usb-skeleton.c +++ b/drivers/usb/usb-skeleton.c | |||
@@ -166,7 +166,7 @@ static ssize_t skel_write(struct file *file, const char *user_buffer, size_t cou | |||
166 | int retval = 0; | 166 | int retval = 0; |
167 | struct urb *urb = NULL; | 167 | struct urb *urb = NULL; |
168 | char *buf = NULL; | 168 | char *buf = NULL; |
169 | size_t writesize = min(count, MAX_TRANSFER); | 169 | size_t writesize = min(count, (size_t)MAX_TRANSFER); |
170 | 170 | ||
171 | dev = (struct usb_skel *)file->private_data; | 171 | dev = (struct usb_skel *)file->private_data; |
172 | 172 | ||
@@ -175,7 +175,10 @@ static ssize_t skel_write(struct file *file, const char *user_buffer, size_t cou | |||
175 | goto exit; | 175 | goto exit; |
176 | 176 | ||
177 | /* limit the number of URBs in flight to stop a user from using up all RAM */ | 177 | /* limit the number of URBs in flight to stop a user from using up all RAM */ |
178 | down (&dev->limit_sem); | 178 | if (down_interruptible(&dev->limit_sem)) { |
179 | retval = -ERESTARTSYS; | ||
180 | goto exit; | ||
181 | } | ||
179 | 182 | ||
180 | /* create a urb, and a buffer for it, and copy the data to the urb */ | 183 | /* create a urb, and a buffer for it, and copy the data to the urb */ |
181 | urb = usb_alloc_urb(0, GFP_KERNEL); | 184 | urb = usb_alloc_urb(0, GFP_KERNEL); |