aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorSam Bishop <sam@bishop.dhs.org>2005-12-22 17:11:02 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-04 13:51:45 -0800
commitc8dd7709c534ab0d713aa698c99132b6c812b57c (patch)
tree30daa90dfdf17ef397efe4230f6dfb03060d669d /drivers/usb
parentcb5b3f6950b4fbad9d8d41756f49aba792804b5b (diff)
[PATCH] USB: fix usb-skeleton limit resource usage patch.
Prevents a compiler warning and uses down_interruptible() instead of down() in process context. Signed-off-by: Sam Bishop <sam@bishop.dhs.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/usb-skeleton.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
index b6652ef5683..5d02f16b7d0 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
int retval = 0;
struct urb *urb = NULL;
char *buf = NULL;
- size_t writesize = min(count, MAX_TRANSFER);
+ size_t writesize = min(count, (size_t)MAX_TRANSFER);
dev = (struct usb_skel *)file->private_data;
@@ -175,7 +175,10 @@ static ssize_t skel_write(struct file *file, const char *user_buffer, size_t cou
goto exit;
/* limit the number of URBs in flight to stop a user from using up all RAM */
- down (&dev->limit_sem);
+ if (down_interruptible(&dev->limit_sem)) {
+ retval = -ERESTARTSYS;
+ goto exit;
+ }
/* create a urb, and a buffer for it, and copy the data to the urb */
urb = usb_alloc_urb(0, GFP_KERNEL);