ia64/xen-unstable

changeset 14224:4d447158e1dd

linux: xenbus dev write function resets packet data on *all* error conditions.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Fri Mar 02 16:29:48 2007 +0000 (2007-03-02)
parents 36b923615369
children 87087954247a
files linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c	Fri Mar 02 16:26:56 2007 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_dev.c	Fri Mar 02 16:29:48 2007 +0000
     1.3 @@ -175,11 +175,15 @@ static ssize_t xenbus_dev_write(struct f
     1.4  	struct watch_adapter *watch, *tmp_watch;
     1.5  	int err, rc = len;
     1.6  
     1.7 -	if ((len + u->len) > sizeof(u->u.buffer))
     1.8 -		return -EINVAL;
     1.9 +	if ((len + u->len) > sizeof(u->u.buffer)) {
    1.10 +		rc = -EINVAL;
    1.11 +		goto out;
    1.12 +	}
    1.13  
    1.14 -	if (copy_from_user(u->u.buffer + u->len, ubuf, len) != 0)
    1.15 -		return -EFAULT;
    1.16 +	if (copy_from_user(u->u.buffer + u->len, ubuf, len) != 0) {
    1.17 +		rc = -EFAULT;
    1.18 +		goto out;
    1.19 +	}
    1.20  
    1.21  	u->len += len;
    1.22  	if ((u->len < sizeof(u->u.msg)) ||