提交 c8dd7709 编写于 作者: S Sam Bishop 提交者: Greg Kroah-Hartman

[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: NSam Bishop <sam@bishop.dhs.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 cb5b3f69
无相关合并请求
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部