From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B4CE4A04F0; Mon, 13 Jan 2020 08:40:45 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4018A1D58D; Mon, 13 Jan 2020 08:40:45 +0100 (CET) Received: from huawei.com (szxga04-in.huawei.com [45.249.212.190]) by dpdk.org (Postfix) with ESMTP id 3E76A1D558; Mon, 13 Jan 2020 08:40:44 +0100 (CET) Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id C50AE352E8D4F819F2C8; Mon, 13 Jan 2020 15:40:42 +0800 (CST) Received: from localhost (10.133.209.164) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.439.0; Mon, 13 Jan 2020 15:40:35 +0800 From: Yunjian Wang To: , , , CC: , Yunjian Wang , Date: Mon, 13 Jan 2020 15:40:31 +0800 Message-ID: <1578901231-16920-1-git-send-email-wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.133.209.164] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v3] 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 --- v3: * Fix return value check incorrectly in v2 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..52f3ee529 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; -- 2.19.1