From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) by dpdk.org (Postfix) with ESMTP id F420B8DAA for ; Fri, 16 Oct 2015 11:09:31 +0200 (CEST) Received: by wicgb1 with SMTP id gb1so589884wic.1 for ; Fri, 16 Oct 2015 02:09:31 -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=W1Bh66rqsVci+d2n2FoxRUdicXRn+MIcD9///yVHScYbnUyzf450pX6Gg/GuHWfVVl /9MShThEoxasgXegmNnm+2VZVE+6Ee7x4nK5dAHgSbhsPIIN353WYhRmvcR0mETKJV+h aPLRFxHpnBrBTGrtjw8C4TFUBZQJSpMG2BbpR3aWg/CZnUUV+detjBZudr9VDft8PoHi IBbfv0GgaO15PZ/cr7KNlyQwdTqtxNfVFC1xwy7SxO9daUPPU9JrhfYuvqGm4dhTkulc gtre7LHXmDawxyC99GmQq+N7oetZR6RDpSfgn0890KIy7bmTP+kgnwLzlividnAC+JrC 0P0Q== X-Gm-Message-State: ALoCoQmUe8fVzgacwlqsxC8RLBwFLYD5eiwkuKyj6NWxTg23tu/KdHEoV5YjaHt0VBJ55UcgH5B5 X-Received: by 10.194.63.81 with SMTP id e17mr16863292wjs.147.1444986571166; Fri, 16 Oct 2015 02:09:31 -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 ft2sm2409818wic.24.2015.10.16.02.09.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Oct 2015 02:09:30 -0700 (PDT) From: Jerome Jutteau To: dev@dpdk.org Date: Fri, 16 Oct 2015 11:08:49 +0200 Message-Id: <1444986530-20893-3-git-send-email-jerome.jutteau@outscale.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1444986530-20893-1-git-send-email-jerome.jutteau@outscale.com> References: <1444986530-20893-1-git-send-email-jerome.jutteau@outscale.com> Cc: changchun.ouyang@intel.com Subject: [dpdk-dev] [PATCH 2/3] 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: Fri, 16 Oct 2015 09:09:32 -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