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 7A7D2A0584; Wed, 19 Oct 2022 13:39:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 671EB410D1; Wed, 19 Oct 2022 13:39:52 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id B9D2440695 for ; Wed, 19 Oct 2022 13:39:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666179590; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aeEv6UZoR9c+qREJ7lYPNN8dyXYzSyqLJKCC2pgqUSs=; b=azN418MdP2N/AKO0L5CATLKTMufu6Nyil9LhyM193EyaIR8Mc7ZqowwuO3JYrWJpKHE6km N/OTn6s/Z3rqlH9xWeT357f5TAVQ5UC8o+C7Hb1V4ZaqG4eg6uf/m5r6OAr1vfag4p4saT OlyBzCDK1iXGxd3rE8LmsLdrPB0wAJE= Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-140-KtxpIWWzO6CSX9GNYUgejQ-1; Wed, 19 Oct 2022 07:39:45 -0400 X-MC-Unique: KtxpIWWzO6CSX9GNYUgejQ-1 Received: by mail-pl1-f199.google.com with SMTP id f18-20020a170902ce9200b0017f9ac4cfb5so11770444plg.22 for ; Wed, 19 Oct 2022 04:39:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aeEv6UZoR9c+qREJ7lYPNN8dyXYzSyqLJKCC2pgqUSs=; b=uqg6i/CjecFPJ3saEsLBwOmabuiNELp98Ka3+qtZMovfhfIrjKdvxX/7SPHlCJesIt AGj6TkLYNv6c/Yin/IGosa6PavWZsSGIEZ9ami+6f4i4/BCL9Uqym89shjtjUgomKmIz hqPm4Rccv6/e3kdndgS7pEE7kCR9Zy3i2qj6zL79wSDx31Opq8eM5XF6vuSRkpPZkrl2 lAFgzo6crRkCQr7yENk/CCuvJ3xUB9BJbN6Z+7xv3D7E3T7PaKcyOLK0X5WIAEPOPRD3 x4g7I8uvchA1ub/IgbZB4ny+z+2mDBwK6y5xWfXR0NAtVVuZEODscRLYaPn3mUSyX1XB Up9w== X-Gm-Message-State: ACrzQf1vQGFiBQ9f6eGip39mwLJo60Kxqn0PvBZRxJuu2cXel97SUDcP vPMJuDqJDml6Mv9AlO8qB0cQcBQWpBEZ3BYZt9NuhPRLGK+IDX/0r3UiibX1jxK3wrguW3Gg/Jb 71dHcFuAV0kpxqmuK9L8= X-Received: by 2002:a63:83c6:0:b0:46a:fe3e:8b1f with SMTP id h189-20020a6383c6000000b0046afe3e8b1fmr6802645pge.120.1666179584705; Wed, 19 Oct 2022 04:39:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6P775sdXiKbQBA4Ip3fJWUPTZVw78iG5e1mkrnCDUe6cjiCqnqBxDSyIq8fZ/EQSmkmvOi+76Cx3s3DAuNXXU= X-Received: by 2002:a63:83c6:0:b0:46a:fe3e:8b1f with SMTP id h189-20020a6383c6000000b0046afe3e8b1fmr6802627pge.120.1666179584425; Wed, 19 Oct 2022 04:39:44 -0700 (PDT) MIME-Version: 1.0 References: <20221019104847.1699872-1-zhangfei.gao@linaro.org> In-Reply-To: <20221019104847.1699872-1-zhangfei.gao@linaro.org> From: David Marchand Date: Wed, 19 Oct 2022 13:39:33 +0200 Message-ID: Subject: Re: [PATCH] bus/vdev: vdev_cleanup checks dev->device.driver To: Zhangfei Gao Cc: Anatoly Burakov , Akhil Goyal , Fan Zhang , dev@dpdk.org, acc@openeuler.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" 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 On Wed, Oct 19, 2022 at 12:55 PM Zhangfei Gao wrote: > > 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 () I suspect you hit this issue when running some crypto autotest. Can you confirm? The commit that introduced the issue should be mentionned, with a Fixes: tag, like: Fixes: 1cab1a40ea9b ("bus: cleanup devices on shutdown") > > 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) If dev->device.driver != NULL, then drv won't be NULL. -- David Marchand