[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [qemu-xen stable-4.10] nbd/server: fix nbd_negotiate_handle_info



commit b01b1609e659863e7cdabc9eaad1514b8393ca78
Author:     Vladimir Sementsov-Ogievskiy <vsementsov@xxxxxxxxxxxxx>
AuthorDate: Wed Nov 1 18:42:03 2017 +0300
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Wed Dec 6 11:49:26 2017 -0600

    nbd/server: fix nbd_negotiate_handle_info
    
    namelen should be here, length is unrelated, and always 0 at this
    point.  Broken in introduction in commit f37708f6, but mostly
    harmless (replying with '' as the name does not violate protocol,
    and does not confuse qemu as the nbd client since our implementation
    does not ask for the name; but might confuse some other client that
    does ask for the name especially if the default export is different
    than the export name being queried).
    
    Adding an assert makes it obvious that we are not skipping any bytes
    in the client's message, as well as making it obvious that we were
    using the wrong variable.
    
    Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@xxxxxxxxxxxxx>
    CC: qemu-stable@xxxxxxxxxx
    Message-Id: <20171101154204.27146-1-vsementsov@xxxxxxxxxxxxx>
    [eblake: improve commit message, squash in assert addition]
    Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
    
    (cherry picked from commit 46321d6b5f8c880932a6b3d07bd0ff6f892e665c)
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 nbd/server.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/nbd/server.c b/nbd/server.c
index 56aed3a..5042cc4 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -434,6 +434,7 @@ static int nbd_negotiate_handle_info(NBDClient *client, 
uint32_t length,
             break;
         }
     }
+    assert(length == 0);
 
     exp = nbd_export_find(name);
     if (!exp) {
@@ -444,7 +445,7 @@ static int nbd_negotiate_handle_info(NBDClient *client, 
uint32_t length,
 
     /* Don't bother sending NBD_INFO_NAME unless client requested it */
     if (sendname) {
-        rc = nbd_negotiate_send_info(client, opt, NBD_INFO_NAME, length, name,
+        rc = nbd_negotiate_send_info(client, opt, NBD_INFO_NAME, namelen, name,
                                      errp);
         if (rc < 0) {
             return rc;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.10

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.