Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'xen/xenbus' of git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen

* 'xen/xenbus' of git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen:
xenbus: Fix memory leak on release
xenbus: avoid zero returns from read()
xenbus: add missing wakeup in concurrent read/write
xenbus: allow any xenbus command over /proc/xen/xenbus
xenfs/xenbus: report partial reads/writes correctly

+13 -18
+13 -18
drivers/xen/xenfs/xenbus.c
··· 122 122 int ret; 123 123 124 124 mutex_lock(&u->reply_mutex); 125 + again: 125 126 while (list_empty(&u->read_buffers)) { 126 127 mutex_unlock(&u->reply_mutex); 127 128 if (filp->f_flags & O_NONBLOCK) ··· 145 144 i += sz - ret; 146 145 rb->cons += sz - ret; 147 146 148 - if (ret != sz) { 147 + if (ret != 0) { 149 148 if (i == 0) 150 149 i = -EFAULT; 151 150 goto out; ··· 161 160 struct read_buffer, list); 162 161 } 163 162 } 163 + if (i == 0) 164 + goto again; 164 165 165 166 out: 166 167 mutex_unlock(&u->reply_mutex); ··· 410 407 411 408 mutex_lock(&u->reply_mutex); 412 409 rc = queue_reply(&u->read_buffers, &reply, sizeof(reply)); 410 + wake_up(&u->read_waitq); 413 411 mutex_unlock(&u->reply_mutex); 414 412 } 415 413 ··· 459 455 460 456 ret = copy_from_user(u->u.buffer + u->len, ubuf, len); 461 457 462 - if (ret == len) { 458 + if (ret != 0) { 463 459 rc = -EFAULT; 464 460 goto out; 465 461 } ··· 492 488 msg_type = u->u.msg.type; 493 489 494 490 switch (msg_type) { 495 - case XS_TRANSACTION_START: 496 - case XS_TRANSACTION_END: 497 - case XS_DIRECTORY: 498 - case XS_READ: 499 - case XS_GET_PERMS: 500 - case XS_RELEASE: 501 - case XS_GET_DOMAIN_PATH: 502 - case XS_WRITE: 503 - case XS_MKDIR: 504 - case XS_RM: 505 - case XS_SET_PERMS: 506 - /* Send out a transaction */ 507 - ret = xenbus_write_transaction(msg_type, u); 508 - break; 509 - 510 491 case XS_WATCH: 511 492 case XS_UNWATCH: 512 493 /* (Un)Ask for some path to be watched for changes */ ··· 499 510 break; 500 511 501 512 default: 502 - ret = -EINVAL; 513 + /* Send out a transaction */ 514 + ret = xenbus_write_transaction(msg_type, u); 503 515 break; 504 516 } 505 517 if (ret != 0) ··· 545 555 struct xenbus_file_priv *u = filp->private_data; 546 556 struct xenbus_transaction_holder *trans, *tmp; 547 557 struct watch_adapter *watch, *tmp_watch; 558 + struct read_buffer *rb, *tmp_rb; 548 559 549 560 /* 550 561 * No need for locking here because there are no other users, ··· 564 573 free_watch_adapter(watch); 565 574 } 566 575 576 + list_for_each_entry_safe(rb, tmp_rb, &u->read_buffers, list) { 577 + list_del(&rb->list); 578 + kfree(rb); 579 + } 567 580 kfree(u); 568 581 569 582 return 0;