From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f51.google.com (mail-lf0-f51.google.com [209.85.215.51]) by dpdk.org (Postfix) with ESMTP id 20F498E8F for ; Mon, 19 Oct 2015 11:45:18 +0200 (CEST) Received: by lffv3 with SMTP id v3so106160266lff.0 for ; Mon, 19 Oct 2015 02:45:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=r72ge3x6yPxAx1jJkMmqnVyUwPXhS4QYPwjs6kCAOJs=; b=WQkPM3MZ0le73u2pVQeCb1Y2c2InbZmvnAjJEJa6YrzuKB8qEyLSrlJrVvxDpLUz+N gzEQqvpWrUqPLwgXKpvk8Cd7cC9hSj6SnnJo/r7X+xEX+c+YgUE68/QgM+wT2X7YLxsB /g09mUbQP4edJEDxg1/pg/DSSlctbvO9TFeGUjTYbvhMBpJ48VVsry3g7rWwUn/RJ/IY Mqo2OxCr0qUf+s1D7Fcn7kPGh69UAkGxGH/RSoQ2qUbPTcfnY1vfXUV7vHJ5HlnySCzR DcYy8v887KlSUsQO4+toHBp6qtiY5Q8AwhkmVEKX1eM9Tqn2qKoF1dg4dKu4mjQ4gsr4 /WiA== X-Gm-Message-State: ALoCoQmZOO2LDRMxBd54zb5Zy/MfWDNideOt43FbSeiMBAIFazZg5u1Dn0tB7SjXAdLg1rB4b+fo X-Received: by 10.194.239.230 with SMTP id vv6mr30906481wjc.21.1445247917406; Mon, 19 Oct 2015 02:45:17 -0700 (PDT) Received: from localhost.localdomain (ows-185-21-195-233.eu-west-1.compute.outscale.com. [185.21.195.233]) by smtp.gmail.com with ESMTPSA id xt1sm39011197wjb.32.2015.10.19.02.45.16 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Oct 2015 02:45:16 -0700 (PDT) From: Jerome Jutteau To: dev@dpdk.org Date: Mon, 19 Oct 2015 11:44:27 +0200 Message-Id: <1445247869-713-3-git-send-email-jerome.jutteau@outscale.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1445247869-713-1-git-send-email-jerome.jutteau@outscale.com> References: <1445247869-713-1-git-send-email-jerome.jutteau@outscale.com> Subject: [dpdk-dev] [PATCH v2 2/4] vhost: check that a device exists during reset_owner X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Oct 2015 09:45:18 -0000 virtio-net search for it's device in reset_owner. The function don't check the return result of get_config_ll_entry which can be NULL. Signed-off-by: Jerome Jutteau --- lib/librte_vhost/virtio-net.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c index 955a29d..ec6a575 100644 --- a/lib/librte_vhost/virtio-net.c +++ b/lib/librte_vhost/virtio-net.c @@ -402,6 +402,8 @@ reset_owner(struct vhost_device_ctx ctx) uint64_t device_fh; ll_dev = get_config_ll_entry(ctx); + if (ll_dev == NULL) + return -1; device_fh = ll_dev->dev.device_fh; cleanup_device(&ll_dev->dev); -- jerome