qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Sassan Panahinejad <sassan@sassan.me.uk>
Cc: "Venkateswararao Jujjuri (JV)" <jvrao@linux.vnet.ibm.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Fix bug with virtio-9p fsync
Date: Tue, 26 Apr 2011 13:58:48 +0100	[thread overview]
Message-ID: <BANLkTim=FQDyH2nW81VtkXM3x_snTA=bag@mail.gmail.com> (raw)
In-Reply-To: <1303820065-25262-1-git-send-email-sassan@sassan.me.uk>

On Tue, Apr 26, 2011 at 1:14 PM, Sassan Panahinejad <sassan@sassan.me.uk> wrote:
> 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 therefore accesses the wrong element of the fs union.
> This error can result in guest applications failing (in my case it was dpkg).
> This patch fixes the issue, although there may be other, similar bugs in virtio-9p.
>
> Signed-off-by: Sassan Panahinejad <sassan@sassan.me.uk>
> ---
>  hw/virtio-9p.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c
> index 7e29535..cc4fdc8 100644
> --- a/hw/virtio-9p.c
> +++ b/hw/virtio-9p.c
> @@ -1875,7 +1875,11 @@ static void v9fs_fsync(V9fsState *s, V9fsPDU *pdu)
>         v9fs_post_do_fsync(s, pdu, err);
>         return;
>     }
> -    err = v9fs_do_fsync(s, fidp->fs.fd, datasync);
> +    if (fidp->fid_type == P9_FID_DIR) {
> +        err = v9fs_do_fsync(s, dirfd(fidp->fs.dir), datasync);
> +    } else {
> +        err = v9fs_do_fsync(s, fidp->fs.fd, datasync);
> +    }

What about P9_FID_XATTR, seems like we have the same issue there too?

wstat, lock, and getlock need closer auditing and perhaps fixing.

Stefan

  reply	other threads:[~2011-04-26 12:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-25 17:54 [Qemu-devel] [PATCH] Fix bug with virtio-9p fsync Sassan Panahinejad
2011-04-26  9:18 ` Stefan Hajnoczi
2011-04-26 12:14   ` Sassan Panahinejad
2011-04-26 12:58     ` Stefan Hajnoczi [this message]
2011-04-26 13:29       ` Sassan Panahinejad
2011-04-26 14:25         ` Venkateswararao Jujjuri
2011-04-26 16:51         ` Sassan Panahinejad
2011-04-26 21:12           ` Venkateswararao Jujjuri
2011-04-27 11:41             ` Sassan Panahinejad

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTim=FQDyH2nW81VtkXM3x_snTA=bag@mail.gmail.com' \
    --to=stefanha@gmail.com \
    --cc=jvrao@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sassan@sassan.me.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).