From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by dpdk.org (Postfix) with ESMTP id 4CDD334F3 for ; Wed, 19 Sep 2018 17:15:07 +0200 (CEST) Received: by mail-wm1-f67.google.com with SMTP id s12-v6so6708705wmc.0 for ; Wed, 19 Sep 2018 08:15:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=nyX7kA1aWL+LqDyHBuG5+3RzQ2/ELMnzmF9g9egP2w0=; b=Ac8L67V2rEs+lKcFHfXx5mgLVcNmFI64Z3Ezl2oWo87N6ep+TJqLXZjyp1m/9KU9Va j4TskH90+vO39oxEc4mxsUH1qEyPOCfpvluyb1vzwZFFuSJuQuu8v5s72/KuAxwO/Ii6 nvyl19iOyEyiiDFK2YFrj73hPh7Q8nAMlNmPFUMRI8OzJ1V3El5nZti4yasw+EpjZ0E9 ZCiQbanRUqkB5fCPqHyonRnfg705lAq3jdrrungUo/+9sIlTiOjD411M1fiMgxSp5rDo rHOJKaQJFLyxHn0FBtcbivQTV+ocgLCAu8LmOwIOptmvMf8hgowGEGg2t8PweohTM6WN I3Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=nyX7kA1aWL+LqDyHBuG5+3RzQ2/ELMnzmF9g9egP2w0=; b=Df58QbcuxHuFZBwOOA+vfLZ06XTKZtYaeptXQvyE/OFIU/0eSnXptTJXg/KvsiTuUo UqESFuXF9USmLXbENGqnuRy5I1H2Ws7hcqH+Ylw2Iz/WRtRlpph7JPqq+TgPRt0cnmCl BqNcLrWaWsiYMd93sWpuT1MOMm44CZqtCwgsUuszolUJbPmWCTD6/dObhh0noaPoWnL7 s4yS/zzTjQwpmm8pigHWJCrGwWsTJ4FQRibelB8rJNjo70TDx5PKrFHzBqFiflav4lnc 8w5VC37+cevJ1rRo+rDMNjD1s/p0XGFPuxbi3BPq5oWhqGsobjn8MznJoVSwXjkI3I51 gNoQ== X-Gm-Message-State: APzg51CxtHElDgsr9N058cr54YIG/yB0tM1fb1N5oGODxzbBzHbZQtWt XuETwTBseNQdAG1QKJlMG54Z3A== X-Google-Smtp-Source: ANB0VdZRHRDYCBitd0/ROgE3JTcqEVD6UD20HFcT1C2UaHhASIscBbX++xg6WcHnGrGSkC9sax5q1Q== X-Received: by 2002:a1c:e3d5:: with SMTP id a204-v6mr13955415wmh.20.1537370106865; Wed, 19 Sep 2018 08:15:06 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id b74-v6sm8444622wma.8.2018.09.19.08.15.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Sep 2018 08:15:06 -0700 (PDT) Date: Wed, 19 Sep 2018 17:14:49 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Andrew Rybchenko Cc: dev@dpdk.org, Igor Romanov , stable@dpdk.org Message-ID: <20180919151449.s2em4hgf7hti5jfg@bidouze.vm.6wind.com> References: <1535732192-3058-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1535732192-3058-1-git-send-email-arybchenko@solarflare.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH] net/failsafe: fix crash on slave queue release X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Sep 2018 15:15:07 -0000 On Fri, Aug 31, 2018 at 05:16:32PM +0100, Andrew Rybchenko wrote: > From: Igor Romanov > > Releasing a queue that is already released by slave may cause a > segmentation fault. For example, after a successfull device > configuration a queue is set up. Afterwards the device is reconfigured > with an invalid argument, forcing slaves to release the queues > (e.g. rte_eth_dev.data.tx_queues). Finally the failsafe's queues > are released. The queue release functions also try to release slaves' > queues using ETH(sdev)->data->tx_queues which is NULL at the time. > > Add checks for NULL slaves' Tx and Rx queues before releasing them. > > Fixes: a46f8d584eb8 ("net/failsafe: add fail-safe PMD") > Cc: stable@dpdk.org > > Signed-off-by: Igor Romanov > Signed-off-by: Andrew Rybchenko Acked-by: Gaetan Rivet > --- > drivers/net/failsafe/failsafe_ops.c | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c > index 24e91c931..94b9769e7 100644 > --- a/drivers/net/failsafe/failsafe_ops.c > +++ b/drivers/net/failsafe/failsafe_ops.c > @@ -309,9 +309,13 @@ fs_rx_queue_release(void *queue) > fs_lock(dev, 0); > if (rxq->event_fd > 0) > close(rxq->event_fd); > - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) > - SUBOPS(sdev, rx_queue_release) > - (ETH(sdev)->data->rx_queues[rxq->qid]); > + FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { > + if (ETH(sdev)->data->rx_queues != NULL && > + ETH(sdev)->data->rx_queues[rxq->qid] != NULL) { > + SUBOPS(sdev, rx_queue_release) > + (ETH(sdev)->data->rx_queues[rxq->qid]); > + } > + } > dev->data->rx_queues[rxq->qid] = NULL; > rte_free(rxq); > fs_unlock(dev, 0); > @@ -477,9 +481,13 @@ fs_tx_queue_release(void *queue) > txq = queue; > dev = txq->priv->dev; > fs_lock(dev, 0); > - FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) > - SUBOPS(sdev, tx_queue_release) > - (ETH(sdev)->data->tx_queues[txq->qid]); > + FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { > + if (ETH(sdev)->data->tx_queues != NULL && > + ETH(sdev)->data->tx_queues[txq->qid] != NULL) { > + SUBOPS(sdev, tx_queue_release) > + (ETH(sdev)->data->tx_queues[txq->qid]); > + } > + } > dev->data->tx_queues[txq->qid] = NULL; > rte_free(txq); > fs_unlock(dev, 0); > -- > 2.17.1 > -- Gaëtan Rivet 6WIND