From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: "Xia, Chenbo" <chenbo.xia@intel.com>,
Jiawei Zhu <17826875952@163.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: "liweifeng2@huawei.com" <liweifeng2@huawei.com>,
"zhujiawei12@huawei.com" <zhujiawei12@huawei.com>,
"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] net/virtio-user: fix error run close(0)
Date: Wed, 9 Dec 2020 12:33:57 +0100 [thread overview]
Message-ID: <df509f77-f7f8-fbb1-00d5-225bc750f335@redhat.com> (raw)
In-Reply-To: <MN2PR11MB40631660C79522248BB3FC3F9CCC0@MN2PR11MB4063.namprd11.prod.outlook.com>
On 12/9/20 12:31 PM, Xia, Chenbo wrote:
> Hi Jiawei,
>
> Thanks for catching this!
> Comments inline.
>
>> -----Original Message-----
>> From: Jiawei Zhu <17826875952@163.com>
>> Sent: Saturday, November 28, 2020 10:50 PM
>> To: dev@dpdk.org
>> Cc: liweifeng2@huawei.com; zhujiawei12@huawei.com; maxime.coquelin@redhat.com;
>> Xia, Chenbo <chenbo.xia@intel.com>
>> Subject: [PATCH] net/virtio-user: fix error run close(0)
>>
>> From: Jiawei Zhu <zhujiawei12@huawei.com>
>>
>> When i < VIRTIO_MAX_VIRTQUEUES and j == i,
>> dev->callfds[i] and dev->kickfds[i] are default 0.
>> So it will close(0), close the standard input (stdin).
>>
>> Fixes: e6e7ad8b3024 ("net/virtio-user: move eventfd open/close into
>> init/uninit")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Jiawei Zhu <zhujiawei12@huawei.com>
>> ---
>> drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c
>> b/drivers/net/virtio/virtio_user/virtio_user_dev.c
>> index 053f026..1bfd223 100644
>> --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c
>> +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c
>> @@ -284,7 +284,7 @@ int virtio_user_stop_device(struct virtio_user_dev *dev)
>> }
>>
>> if (i < VIRTIO_MAX_VIRTQUEUES) {
>> - for (j = 0; j <= i; ++j) {
>> + for (j = 0; j < i; ++j) {
>
> With the help of your patch, I notice another defect that if the code fails in kickfd
> creation, we will leave one callfd not closed. Since you are here, could you help solve
> this too? A potential solution could be doing 'dev->callfds[i] = callfd' just after callfd
> creation, keeping 'j <= i' and adding checks before close(). What do you think?
+1, I noticed the same discussing the patch with David.
> Btw, I noticed that you have sent multiple patches that have same content. If you want to
> send new version. Please --in-reply-to this patch as this is the one that shows in patchwork.
> (http://patchwork.dpdk.org/patch/84626/)
I personally don't care about the --in-reply-to, but I agree for the
versioning.
Thanks,
Maxime
> Thanks!
> Chenbo
>
>> close(dev->callfds[j]);
>> close(dev->kickfds[j]);
>> }
>> --
>> 1.8.3.1
>
next prev parent reply other threads:[~2020-12-09 11:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-28 14:50 Jiawei Zhu
2020-12-09 11:31 ` Xia, Chenbo
2020-12-09 11:33 ` Maxime Coquelin [this message]
[not found] ` <4a6e80c5.31.1764db4afc6.Coremail.17826875952@163.com>
2020-12-11 1:58 ` Xia, Chenbo
2020-12-11 21:35 ` 17826875952
-- strict thread matches above, loose matches on Subject: below --
2020-12-09 7:34 17826875952
2020-11-27 19:38 Jiawei Zhu
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=df509f77-f7f8-fbb1-00d5-225bc750f335@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=17826875952@163.com \
--cc=chenbo.xia@intel.com \
--cc=dev@dpdk.org \
--cc=liweifeng2@huawei.com \
--cc=stable@dpdk.org \
--cc=zhujiawei12@huawei.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).