linux-2.6.18/xenbus: fix overflow check in xenbus_dev_write()
PATCH 1/1 linux-2.6.18/xenbus: fix overflow check in xenbus_dev_write()
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Jan Beulich <[email protected]>
drivers/xen/xenbus/xenbus_dev.c +1 -1
@@ -239,7 +239,7 @@ static ssize_t xenbus_dev_write(struct fif (!is_xenstored_ready ())return -ENODEV ; -if ((len + u->len) >sizeof (u->u.buffer)) { +if (len >sizeof (u->u.buffer) - u->len) { rc = -EINVAL ; goto out; }
xenbus: fix overflow check in xenbus_dev_write()
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Jan Beulich <[email protected]>
drivers/xen/xenbus/xenbus_dev.c +1 -1
@@ -239,7 +239,7 @@ static ssize_t xenbus_dev_write(struct fif (!is_xenstored_ready ())return -ENODEV ; -if ((len + u->len) >sizeof (u->u.buffer)) { +if (len >sizeof (u->u.buffer) - u->len) { rc = -EINVAL ; goto out; }
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 2 lines · Jan Beulich
Reported-by Dan Carpenter <[email protected]>Signed-off-by Jan Beulich <[email protected]>
Acked-by Ian Campbell <[email protected]>
CC-ing Konrad since I think that modulo tweaking the path this ought to apply as is to upstream kernels.
Quoted 15 lines
drivers/xen/xenbus/xenbus_dev.c +1
-1@@ -239,7 +239,7 @@ static ssize_t xenbus_dev_write(struct fif (!is_xenstored_ready ())return -ENODEV ; -if ((len + u->len) >sizeof (u->u.buffer)) { +if (len >sizeof (u->u.buffer) - u->len) { rc = -EINVAL ; goto out; }
Quoted 16 lines · Ian Campbell
Quoted 2 lines · Jan Beulich
Reported-by Dan Carpenter <[email protected]>Signed-off-by Jan Beulich <[email protected]>Acked-by Ian Campbell <[email protected]>CC-ing Konrad since I think that modulo tweaking the path this ought to apply as is to upstream kernels.
Quoted 7 lines
drivers/xen/xenbus/xenbus_dev.c +0
-0@@ -239,7 +239,7 @@ static ssize_t xenbus_dev_write(struct fif (!is_xenstored_ready ())return -ENODEV ;
Quoted 8 lines
drivers/xen/xenbus/xenbus_dev.c static ssize_t xenbus_dev_write(struct f · line 245
Quoted 8 lines
drivers/xen/xenbus/xenbus_dev.c +1
-1-if ((len + u->len) >sizeof (u->u.buffer)) { +if (len >sizeof (u->u.buffer) - u->len) { rc = -EINVAL ; goto out; }
Like this:
drivers/xen/xenbus/xenbus_dev_frontend.c +1 -1
@@ -458,7 +458,7 @@ static ssize_t xenbus_file_write(struct file *filp, goto out;/* Can't write a xenbus message larger we can buffer */ -if ((len + u->len) >sizeof (u->u.buffer)) { +if (len >sizeof (u->u.buffer) - u->len) {/* On error, dump existing buffer */ u->len =0 ; rc = -EINVAL ;