From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:48101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEePM-0005Zb-Pc for qemu-devel@nongnu.org; Tue, 26 Apr 2011 05:18:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QEePL-0007sm-FL for qemu-devel@nongnu.org; Tue, 26 Apr 2011 05:18:12 -0400 Received: from mail-gw0-f45.google.com ([74.125.83.45]:52539) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEePL-0007sc-AW for qemu-devel@nongnu.org; Tue, 26 Apr 2011 05:18:11 -0400 Received: by gwb19 with SMTP id 19so197151gwb.4 for ; Tue, 26 Apr 2011 02:18:11 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1303754045-19635-1-git-send-email-sassan@sassan.me.uk> References: <1303754045-19635-1-git-send-email-sassan@sassan.me.uk> Date: Tue, 26 Apr 2011 10:18:10 +0100 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] Fix bug with virtio-9p fsync List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sassan Panahinejad Cc: "Venkateswararao Jujjuri (JV)" , qemu-devel@nongnu.org On Mon, Apr 25, 2011 at 6:54 PM, Sassan Panahinejad w= rote: Thanks for finding and fixing this. Please see this wiki page on contributing patches to QEMU: http://wiki.qemu.org/Contribute/SubmitAPatch > v9fs_fsync and possibly others break when asked to operate on a directory= . > It does not check fid_type to see if it is operating on a directory and t= herefore accesses the wrong element of the fs union. > This error can result in guest applications failing (in my case it was dp= kg). > This patch fixes the issue, although there may be other, similar bugs in = virtio-9p. > --- > =A0hw/virtio-9p.c | =A0 =A05 ++++- > =A01 files changed, 4 insertions(+), 1 deletions(-) Missing Signed-off-by:. > diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c > index 7e29535..09fb5da 100644 > --- a/hw/virtio-9p.c > +++ b/hw/virtio-9p.c > @@ -1875,7 +1875,10 @@ static void v9fs_fsync(V9fsState *s, V9fsPDU *pdu) > =A0 =A0 =A0 =A0 v9fs_post_do_fsync(s, pdu, err); > =A0 =A0 =A0 =A0 return; > =A0 =A0 } > - =A0 =A0err =3D v9fs_do_fsync(s, fidp->fs.fd, datasync); > + =A0 =A0if (fidp->fid_type =3D=3D P9_FID_DIR) > + =A0 =A0 =A0 =A0err =3D v9fs_do_fsync(s, dirfd(fidp->fs.dir), datasync); > + =A0 =A0else > + =A0 =A0 =A0 =A0err =3D v9fs_do_fsync(s, fidp->fs.fd, datasync); Please follow QEMU coding style and always use {} with if ... else. Stefan