From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqpdg-0002ge-Cv for qemu-devel@nongnu.org; Thu, 14 Apr 2016 18:21:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aqpdd-0006qz-48 for qemu-devel@nongnu.org; Thu, 14 Apr 2016 18:21:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aqpdc-0006qu-T8 for qemu-devel@nongnu.org; Thu, 14 Apr 2016 18:21:25 -0400 References: <1460077777-31004-1-git-send-email-eblake@redhat.com> <57100C37.5090807@redhat.com> <5710149D.5090803@redhat.com> From: Max Reitz Message-ID: <571017E1.1040303@redhat.com> Date: Fri, 15 Apr 2016 00:21:21 +0200 MIME-Version: 1.0 In-Reply-To: <5710149D.5090803@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dPkcKsbBrI7071n34sURXUj0WND8v5MgQ" Subject: Re: [Qemu-devel] [PATCH for-2.6] nbd: Don't fail handshake on NBD_OPT_LIST descriptions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu-devel@nongnu.org Cc: pbonzini@redhat.com, alex@alex.org.uk This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --dPkcKsbBrI7071n34sURXUj0WND8v5MgQ Content-Type: multipart/mixed; boundary="UEEL1JC86isjkMeGsqnjCs9sFc23si59q" From: Max Reitz To: Eric Blake , qemu-devel@nongnu.org Cc: pbonzini@redhat.com, alex@alex.org.uk Message-ID: <571017E1.1040303@redhat.com> Subject: Re: [Qemu-devel] [PATCH for-2.6] nbd: Don't fail handshake on NBD_OPT_LIST descriptions References: <1460077777-31004-1-git-send-email-eblake@redhat.com> <57100C37.5090807@redhat.com> <5710149D.5090803@redhat.com> In-Reply-To: <5710149D.5090803@redhat.com> --UEEL1JC86isjkMeGsqnjCs9sFc23si59q Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 15.04.2016 00:07, Eric Blake wrote: > On 04/14/2016 03:31 PM, Max Reitz wrote: >> On 08.04.2016 03:09, Eric Blake wrote: >>> The NBD Protocol states that NBD_REP_SERVER may set >>> 'length > sizeof(namelen) + namelen'; in which case the rest >>> of the packet is a UTF-8 description of the export. While we >>> don't know of any NBD servers that send this description yet, >>> we had better consume the data so we don't choke when we start >>> to talk to such a server. >>> >=20 >>> @@ -214,6 +219,20 @@ static int nbd_receive_list(QIOChannel *ioc, cha= r **name, Error **errp) >>> return -1; >>> } >>> (*name)[namelen] =3D '\0'; >>> + len -=3D namelen; >>> + if (len) { >>> + char *buf =3D g_malloc(len + 1); >>> + if (read_sync(ioc, buf, len) !=3D len) { >>> + error_setg(errp, "failed to read export description"= ); >>> + g_free(*name); >>> + g_free(buf); >>> + *name =3D NULL; >>> + return -1; >>> + } >>> + buf[len] =3D '\0'; >>> + TRACE("Ignoring export description: %s", buf); >> >> I find this funny, somehow. >> >> Perhaps it's because this may explicitly print something while >> explaining that it's being ignored. >=20 > The server.c code had a nice function for skipping unwanted bytes; I know; I added it. ;-) > and > in a 2.7 series, I borrowed that idea: >=20 > https://lists.gnu.org/archive/html/qemu-devel/2016-04/msg01597.html >=20 > but for the purpose of minimal churn in 2.6, I don't mind the > (temporary) oddity. Yeah, I didn't mean funny in the "why is that here" sense, but in the "I chuckled a little" sense. :-) >>> + g_free(buf); >>> + } >>> } else { >>> error_setg(errp, "Unexpected reply type %x expected %x", >>> type, NBD_REP_SERVER); >>> >> >> Thanks Eric, I applied this patch to my block branch (for 2.6). If thi= s >> was not your intention, please speak up. :-) >> >> https://github.com/XanClic/qemu/commits/block >=20 > You did the right thing. That phrasing makes me feel a little uncomfortable. It's a phrase I'd expect to hear after I have committed a deed of questionable morality, which was right only in the greater scheme of things and for the well-being of the many. So now I'm a bit worried. :-) (Just kidding, of course.) Max --UEEL1JC86isjkMeGsqnjCs9sFc23si59q-- --dPkcKsbBrI7071n34sURXUj0WND8v5MgQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXEBfhAAoJEDuxQgLoOKytRm8H/3NxKpye8c7HLCTtFL57+XEc PrfB2lSLi5qRr663AD5xNRkbaA2WjheiVFwuMLpr2VIGwnc653XGQdRI7NGv6DoS +ZPOCQ9nPGSXmu0vzZULL8PalwctG8rHfIckt8ZkOYYiNviRpTUm4Tfwn1ZYj+Gd Lom8erGZfp1Kv69AniO4R/8UZAEuDP9Sb3e7bjvHCMEFxKbPbcPakVTtDkJXHM3C 86bpr4FZ50ffJc0vdWWzPLFOeHITRYK/hq/n3euU31P/iVb9ovCk4RN3w30BPyTP trfQR6vWR/VYSqldJnzshtdCN0evOFoY5pB5Q4n+pJOd1SF9/RtNb91DZKkGIAs= =vd0k -----END PGP SIGNATURE----- --dPkcKsbBrI7071n34sURXUj0WND8v5MgQ--