From: "Xia, Chenbo" <chenbo.xia@intel.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
Eelco Chaudron <echaudro@redhat.com>,
"david.marchand@redhat.com" <david.marchand@redhat.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: RE: [PATCH v3 3/4] vhost: fix invalid call FD handling
Date: Wed, 31 May 2023 06:12:25 +0000 [thread overview]
Message-ID: <SN6PR11MB350473DF6D8279CBAB806D029C489@SN6PR11MB3504.namprd11.prod.outlook.com> (raw)
In-Reply-To: <a5e48065-e416-9efb-3d52-bac6e6c68819@redhat.com>
> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Tuesday, May 30, 2023 8:54 PM
> To: Eelco Chaudron <echaudro@redhat.com>; Xia, Chenbo
> <chenbo.xia@intel.com>; david.marchand@redhat.com
> Cc: dev@dpdk.org
> Subject: Re: [PATCH v3 3/4] vhost: fix invalid call FD handling
>
>
>
> On 5/17/23 11:09, Eelco Chaudron wrote:
> > This patch fixes cases where IRQ injection is tried while
> > the call FD is not valid, which should not happen.
> >
> > Fixes: b1cce26af1dc ("vhost: add notification for packed ring")
> > Fixes: e37ff954405a ("vhost: support virtqueue interrupt/notification
> suppression")
> >
> > Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> > Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
> > ---
> > lib/vhost/vhost.h | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h
> > index 37609c7c8d..23a4e2b1a7 100644
> > --- a/lib/vhost/vhost.h
> > +++ b/lib/vhost/vhost.h
> > @@ -903,9 +903,9 @@ vhost_vring_call_split(struct virtio_net *dev,
> struct vhost_virtqueue *vq)
> > "%s: used_event_idx=%d, old=%d, new=%d\n",
> > __func__, vhost_used_event(vq), old, new);
> >
> > - if ((vhost_need_event(vhost_used_event(vq), new, old) &&
> > - (vq->callfd >= 0)) ||
> > - unlikely(!signalled_used_valid)) {
> > + if ((vhost_need_event(vhost_used_event(vq), new, old) ||
> > + unlikely(!signalled_used_valid)) &&
> > + vq->callfd >= 0) {
> > eventfd_write(vq->callfd, (eventfd_t) 1);
> > if (dev->flags & VIRTIO_DEV_STATS_ENABLED)
> > __atomic_fetch_add(&vq->stats.guest_notifications,
> > @@ -974,7 +974,7 @@ vhost_vring_call_packed(struct virtio_net *dev,
> struct vhost_virtqueue *vq)
> > if (vhost_need_event(off, new, old))
> > kick = true;
> > kick:
> > - if (kick) {
> > + if (kick && vq->callfd >= 0) {
> > eventfd_write(vq->callfd, (eventfd_t)1);
> > if (dev->notify_ops->guest_notified)
> > dev->notify_ops->guest_notified(dev->vid);
> >
>
> Reporting Chenbo's R-by, from the VDUSE series RFC:
>
> Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Thanks Maxime! Btw: what's your plan of the same fix in VDUSE series, do you plan
to drop it in VDUSE series or?
Thanks,
Chenbo
next prev parent reply other threads:[~2023-05-31 6:12 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-17 9:08 [PATCH v3 0/4] vhost: add device op to offload the interrupt kick Eelco Chaudron
2023-05-17 9:08 ` [PATCH v3 1/4] vhost: change vhost_virtqueue access lock to a read/write one Eelco Chaudron
2023-05-17 17:33 ` Maxime Coquelin
2023-05-18 14:46 ` Eelco Chaudron
2023-05-31 6:37 ` Xia, Chenbo
2023-05-31 9:27 ` Maxime Coquelin
2023-05-31 11:13 ` Eelco Chaudron
2023-06-01 1:45 ` Xia, Chenbo
2023-05-17 9:08 ` [PATCH v3 2/4] vhost: make the guest_notifications statistic counter atomic Eelco Chaudron
2023-05-30 12:52 ` Maxime Coquelin
2023-05-31 7:03 ` Xia, Chenbo
2023-05-17 9:09 ` [PATCH v3 3/4] vhost: fix invalid call FD handling Eelco Chaudron
2023-05-30 12:54 ` Maxime Coquelin
2023-05-31 6:12 ` Xia, Chenbo [this message]
2023-05-31 9:30 ` Maxime Coquelin
2023-05-17 9:09 ` [PATCH v3 4/4] vhost: add device op to offload the interrupt kick Eelco Chaudron
2023-05-30 13:02 ` Maxime Coquelin
2023-05-30 13:16 ` Thomas Monjalon
2023-05-30 15:16 ` Maxime Coquelin
2023-05-31 6:19 ` Xia, Chenbo
2023-05-31 9:29 ` Maxime Coquelin
2023-05-31 11:21 ` Eelco Chaudron
2023-06-01 2:18 ` Xia, Chenbo
2023-06-01 8:15 ` Eelco Chaudron
2023-06-01 8:29 ` Maxime Coquelin
2023-06-01 8:49 ` Eelco Chaudron
2023-06-01 8:53 ` Maxime Coquelin
2023-05-31 11:49 ` David Marchand
2023-05-31 12:01 ` David Marchand
2023-05-31 12:48 ` Maxime Coquelin
2023-05-31 13:13 ` Eelco Chaudron
2023-05-31 14:12 ` David Marchand
2023-05-31 14:18 ` Maxime Coquelin
2023-06-01 20:00 ` [PATCH v3 0/4] " Maxime Coquelin
2023-06-02 6:20 ` Eelco Chaudron
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=SN6PR11MB350473DF6D8279CBAB806D029C489@SN6PR11MB3504.namprd11.prod.outlook.com \
--to=chenbo.xia@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=echaudro@redhat.com \
--cc=maxime.coquelin@redhat.com \
/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).