Commit d0e5f8c0 authored by Pat LaVarre's avatar Pat LaVarre Committed by James Bottomley

[PATCH] SG_SET_RESERVED_SIZE negative oops

I propose the 2.6.0-test8 two-line patch below to teach
SG_SET_RESERVED_SIZE to reject a negative size, rather than oops-ing.
parent f7ad2011
...@@ -124,6 +124,8 @@ static int sg_set_reserved_size(request_queue_t *q, int *p) ...@@ -124,6 +124,8 @@ static int sg_set_reserved_size(request_queue_t *q, int *p)
if (err) if (err)
return err; return err;
if (size < 0)
return -EINVAL;
if (size > (q->max_sectors << 9)) if (size > (q->max_sectors << 9))
return -EINVAL; return -EINVAL;
......
...@@ -877,6 +877,8 @@ sg_ioctl(struct inode *inode, struct file *filp, ...@@ -877,6 +877,8 @@ sg_ioctl(struct inode *inode, struct file *filp,
result = get_user(val, (int *) arg); result = get_user(val, (int *) arg);
if (result) if (result)
return result; return result;
if (val < 0)
return -EINVAL;
if (val != sfp->reserve.bufflen) { if (val != sfp->reserve.bufflen) {
if (sg_res_in_use(sfp) || sfp->mmap_called) if (sg_res_in_use(sfp) || sfp->mmap_called)
return -EBUSY; return -EBUSY;
......
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