DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: Anatoly Burakov <anatoly.burakov@intel.com>,
	Akhil Goyal <gakhil@marvell.com>,
	 Fan Zhang <royzhang1980@gmail.com>,
	dev@dpdk.org, acc@openeuler.org
Subject: Re: [PATCH] bus/vdev: vdev_cleanup checks dev->device.driver
Date: Wed, 19 Oct 2022 13:39:33 +0200	[thread overview]
Message-ID: <CAJFAV8wsWEGdSaWquuM2KE1q6qX6QfVSA_twKR70iRAAZGiJPQ@mail.gmail.com> (raw)
In-Reply-To: <20221019104847.1699872-1-zhangfei.gao@linaro.org>

On Wed, Oct 19, 2022 at 12:55 PM Zhangfei Gao <zhangfei.gao@linaro.org> 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 <zhangfei.gao@linaro.org>
> ---
>  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


  reply	other threads:[~2022-10-19 11:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 10:48 Zhangfei Gao
2022-10-19 11:39 ` David Marchand [this message]
2022-10-19 13:27   ` Zhangfei Gao
2022-10-19 13:37   ` Zhangfei Gao
2022-10-19 13:56 ` [PATCH v2] " Zhangfei Gao
2022-10-19 14:08 ` [PATCH v2 resend] " Zhangfei Gao
2022-10-20 11:32   ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJFAV8wsWEGdSaWquuM2KE1q6qX6QfVSA_twKR70iRAAZGiJPQ@mail.gmail.com \
    --to=david.marchand@redhat.com \
    --cc=acc@openeuler.org \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=royzhang1980@gmail.com \
    --cc=zhangfei.gao@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).