From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 8BFE7A0352;
	Mon, 16 Dec 2019 02:03:28 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 6DA7B1BF9E;
	Mon, 16 Dec 2019 02:03:27 +0100 (CET)
Received: from huawei.com (szxga07-in.huawei.com [45.249.212.35])
 by dpdk.org (Postfix) with ESMTP id 3AA0F1BF9E;
 Mon, 16 Dec 2019 02:03:25 +0100 (CET)
Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59])
 by Forcepoint Email with ESMTP id ADC7597769942558B461;
 Mon, 16 Dec 2019 09:03:23 +0800 (CST)
Received: from localhost (10.133.209.164) by DGGEMS412-HUB.china.huawei.com
 (10.3.19.212) with Microsoft SMTP Server id 14.3.439.0; Mon, 16 Dec 2019
 09:03:17 +0800
From: Yunjian Wang <wangyunjian@huawei.com>
To: <dev@dpdk.org>
CC: <maxime.coquelin@redhat.com>, <tiwei.bie@intel.com>,
 <zhihong.wang@intel.com>, <xudingke@huawei.com>, Yunjian Wang
 <wangyunjian@huawei.com>, <stable@dpdk.org>
Date: Mon, 16 Dec 2019 09:03:15 +0800
Message-ID: <1576458195-27980-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] 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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

The function vhost_kernel_tap_set_offload() could return errors,
the return value need to be checked.

Fixes: 1db4d2330bc8 ("net/virtio-user: check negotiated features before set")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/virtio/virtio_user/vhost_kernel_tap.c | 3 ++-
 1 file changed, 2 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 76bf754..f77d227 100644
--- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
+++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c
@@ -131,7 +131,8 @@
 		goto error;
 	}
 
-	vhost_kernel_tap_set_offload(tapfd, features);
+	if (vhost_kernel_tap_set_offload(tapfd, features) < 0)
+		goto error;
 
 	memset(&ifr, 0, sizeof(ifr));
 	ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER;
-- 
1.8.3.1