From patchwork Thu Jan 9 12:18:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunjian Wang X-Patchwork-Id: 64365 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C4E71A046B; Thu, 9 Jan 2020 13:18:57 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A8F471DD26; Thu, 9 Jan 2020 13:18:57 +0100 (CET) Received: from huawei.com (szxga06-in.huawei.com [45.249.212.32]) by dpdk.org (Postfix) with ESMTP id 381F71DD17; Thu, 9 Jan 2020 13:18:56 +0100 (CET) Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 06085181D3B8EEB3E678; Thu, 9 Jan 2020 20:18:53 +0800 (CST) Received: from localhost (10.133.209.164) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.439.0; Thu, 9 Jan 2020 20:18:42 +0800 From: Yunjian Wang To: , , , CC: , Yunjian Wang , Date: Thu, 9 Jan 2020 20:18:24 +0800 Message-ID: <1578572304-2296-1-git-send-email-wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.133.209.164] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v2] net/virtio-user: fix return value of tap offload sets not checked X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The function vhost_kernel_tap_set_offload() could return errors, the return value need to be checked. And there is no need to fail when error is -ENOTSUP. Fixes: 1db4d2330bc8 ("net/virtio-user: check negotiated features before set") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang --- v2: * No need to fail when error is -ENOTSUP. --- drivers/net/virtio/virtio_user/vhost_kernel_tap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c index 76bf75423..2a0c2106d 100644 --- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c +++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c @@ -66,6 +66,7 @@ vhost_kernel_open_tap(char **p_ifname, int hdr_size, int req_mq, int sndbuf = INT_MAX; struct ifreq ifr; int tapfd; + int ret; /* TODO: * 1. verify we can get/set vnet_hdr_len, tap_probe_vnet_hdr_len @@ -131,7 +132,9 @@ vhost_kernel_open_tap(char **p_ifname, int hdr_size, int req_mq, goto error; } - vhost_kernel_tap_set_offload(tapfd, features); + ret = vhost_kernel_tap_set_offload(tapfd, features); + if (ret < 0 && ret != ENOTSUP) + goto error; memset(&ifr, 0, sizeof(ifr)); ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER;