From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 62F13A0584; Wed, 19 Oct 2022 12:55:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4C30E410D1; Wed, 19 Oct 2022 12:55:04 +0200 (CEST) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mails.dpdk.org (Postfix) with ESMTP id EA2EB40E03 for ; Wed, 19 Oct 2022 12:55:02 +0200 (CEST) Received: by mail-wm1-f44.google.com with SMTP id 186-20020a1c02c3000000b003c6c154d528so2525133wmc.4 for ; Wed, 19 Oct 2022 03:55:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=nnYH1d+ibJ/+g49OjbeLGS80i8Z+00yZMzE0Bcgrjh0=; b=ch/uYqkonqblEZAgw4Wqtospa1+AOB82z/lcHNNzKyN4p/cG5xMeXCq3O90saCJ/hD GBnxHVjrAd68kVM5QvmIy2WwZ9epMwNmfnOVokDKIOKIVgZL6Q62r0KBHXjEf3a17OKZ fbYURk7r3wfkMyIVYSwXXozaLX7KUjfvfaSXwxms1B6Ye0H+bAypcJdl9TX3+EaOGNiX Z7WKe7irg8ILPnHcGTVEVIXGBaPX7GvenSsDO0WN4cTECLyrdUlk94WRjaz8nU8hgkK/ ThjBCqy+AV9DfZHyPPTPJFGEf+yLzQaVQKjoxlK3fVJm93a8zrskuCmTtIVtuUB6g3fA UbZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nnYH1d+ibJ/+g49OjbeLGS80i8Z+00yZMzE0Bcgrjh0=; b=D22txkhewy6H/KeDeGyCexS2txr5m7QoZL7IBPPhrGqZJm3ec7YORIbqNyoYGQi/cW ACaATolhls/BjN8+/spW/7Yy+f1jcDaExqPCt+qDjvj712TGoI5rUNyBcrBoaqhrBamd 5cSGBZG7XJZ/362N0mifiVZcyGePthsX2ou48xrZ5UK3aNdCfJwfKeHUiqP9ewP5o92Y xWao61rvBpVeNHDBwTPpu9yLXKKG+D+wVWDa4UbPaClD4OY5b4aN3cWOklRuwLoX5mck vb1vH0iY2Bsp7/ghDSy27VOmiGv4KBqGVmqo8ObUWd7gei4MZb2wdy75MBrmRvM/dp8i vstg== X-Gm-Message-State: ACrzQf0n9zXjywGLngmZsE+S/4DWXnEmS2de0PpDpaLcJOBeDVxedn/o FnFmV/rL8FCF1UWBNHHGB2w6Pg== X-Google-Smtp-Source: AMsMyM7/y7QfvO5qRjPXZvHuTX6sXaiG7Rk+v5Jz43zg+9j7uzKtrNSjWwfXHFjLtSo2yIviXkvUxg== X-Received: by 2002:a7b:c5c2:0:b0:3c4:fd96:fb68 with SMTP id n2-20020a7bc5c2000000b003c4fd96fb68mr5089424wmk.36.1666176902724; Wed, 19 Oct 2022 03:55:02 -0700 (PDT) Received: from localhost.localdomain ([213.146.143.36]) by smtp.gmail.com with ESMTPSA id z11-20020a05600c0a0b00b003c6bd91caa5sm18154096wmp.17.2022.10.19.03.55.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Oct 2022 03:55:02 -0700 (PDT) From: Zhangfei Gao To: Anatoly Burakov , Akhil Goyal , Fan Zhang Cc: dev@dpdk.org, acc@openeuler.org, Zhangfei Gao Subject: [PATCH] bus/vdev: vdev_cleanup checks dev->device.driver Date: Wed, 19 Oct 2022 18:48:47 +0800 Message-Id: <20221019104847.1699872-1-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The vdev_probe calls driver->probe, which may fail and dev->device.driver will still be NULL. In vdev_cleanup, drv = container_of(dev->device.driver) returns !NULL, then drv->remove will trigger Segmentation fault. Fix it by checking dev->device.driver first. Log: Thread 1 "dpdk-test" received signal SIGSEGV, Segmentation fault. 0x00000000012c484d in vdev_cleanup () Signed-off-by: Zhangfei Gao --- drivers/bus/vdev/vdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c index f5b43f1930..fbdaf68380 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -577,6 +577,9 @@ vdev_cleanup(void) const struct rte_vdev_driver *drv; int ret = 0; + if (dev->device.driver == NULL) + continue; + drv = container_of(dev->device.driver, const struct rte_vdev_driver, driver); if (drv == NULL || drv->remove == NULL) -- 2.36.1