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 8AA02A0544 for ; Fri, 18 Nov 2022 07:38:37 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 680334067B; Fri, 18 Nov 2022 07:38:37 +0100 (CET) Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by mails.dpdk.org (Postfix) with ESMTP id 8060B4021F for ; Fri, 18 Nov 2022 07:38:36 +0100 (CET) Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 208DE3F158 for ; Fri, 18 Nov 2022 06:38:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1668753516; bh=0l2oCIrb5xMRTuJ1xWkxi4fAzTf5k8gFBYzEUVw0wR4=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=MtHhCRAyShfITAiaIrCL7FVT0zfz2kq0v9ugHq4+olSf6B+jcwAIG8M4SPcr/UNSQ aMSJp//4VlAH9ZfQz7j4jzgcPeWAW8bzrusOQ6RV9xaa00ciilIuqn8QnrUHtmn+yr mM5Yp3s50roJtNiP8uBetce6RzFK1nStP2mJ3oCZpleA9oZ7e6+vQuzX0PHiBsEONK HdlE68uKGl948EFBWUAspKpGeksby0xPEv/DcB2TtTZofcF4OfeUQVNvWc8yaY088K 4TH/4P6Mv4dvoXn98+mIttFEBFZL56wWArO+nguEkm8boOf64Fl/5AeGEfSGbstkxM NBYukITaZzrYw== Received: by mail-ot1-f70.google.com with SMTP id l31-20020a9d1b22000000b0066c48e9249fso1729520otl.5 for ; Thu, 17 Nov 2022 22:38:36 -0800 (PST) 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=0l2oCIrb5xMRTuJ1xWkxi4fAzTf5k8gFBYzEUVw0wR4=; b=hEtZGPAyLGqC6nz/2yXNLtK4hP+vpIZVATaT4KbXciYjDqWxMIVXAis+kBmLvRwHG4 ouBG99e4ZzjRDxlWC7Y13Fw325yhSMPno+iirQKxirnZva6P55joTDw14ZruONMcfxa3 BXXd3Ol2Vg5G0JtDq6d1D8P7KCe70C13qL4jK5o9scBkuBcw28E0TEkJuzXw6IzqSuNO prN/TFy1GGXlRwcaxnikD56TCfjLPb8x+idjdjHiZFZLxgZ/8ZcxIJIVSw4VfJGbjbJI TcemOadocFHMMyUMPbUTvHpvnc4g4m7fTYmkTH1Se3fxemPwButn6Qj60OSgyXIEtTAu gfUQ== X-Gm-Message-State: ANoB5pknn70KHxQo/2GBdGppFXOJ/+UsWbNpLsnrRhDfOUTDLm0OZFGS RYBAI7FNFX6Qrr07MuEX0zk0EayT7+PmdkCHEb2kohY9zlH7FicWk2Hd3Ek0mY/tHRRgjGl4WRu sb763SbTx3F3Z0oH2y0Znk8P7RSRhKsK2YTxLOfzO X-Received: by 2002:a05:6870:ec8a:b0:137:39b0:183a with SMTP id eo10-20020a056870ec8a00b0013739b0183amr3105130oab.127.1668753514854; Thu, 17 Nov 2022 22:38:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf646FVH9U9Deh+shjQbqIOeG3wEHVzWzratfcIclXy8lTLHM7ln4WeezNscFPynOzma9w81/Ga9mUcOP6Rc2tc= X-Received: by 2002:a05:6870:ec8a:b0:137:39b0:183a with SMTP id eo10-20020a056870ec8a00b0013739b0183amr3105121oab.127.1668753514606; Thu, 17 Nov 2022 22:38:34 -0800 (PST) MIME-Version: 1.0 References: <20221117154751.1273083-1-michaelba@nvidia.com> In-Reply-To: <20221117154751.1273083-1-michaelba@nvidia.com> From: Christian Ehrhardt Date: Fri, 18 Nov 2022 07:38:08 +0100 Message-ID: Subject: Re: [PATCH 19.11] net/mlx5: fix invalid memory access in port closing To: Michael Baum Cc: stable@dpdk.org, Matan Azrad , Viacheslav Ovsiienko Content-Type: text/plain; charset="UTF-8" X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Thu, Nov 17, 2022 at 4:48 PM Michael Baum wrote: > > The shared IB device (sh) has per port data updated in port creation. > In port closing this port data is updated even when the SH still exist. > > However, this updating is happened after SH has been released and for > last port it actually accesses to freed memory. > > This patch updates the port data before SH releasing. > > Fixes: 08c0b56cb304 ("net/mlx5: fix port event cleaning order") > Cc: michaelba@nvidia.com Applied, thanks for the ping in regard to this follow on fix, I'd have missed it since it has no 19.11 in the subject. > Signed-off-by: Michael Baum > Acked-by: Matan Azrad > --- > drivers/net/mlx5/mlx5.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c > index ece8c5e3e1..efeeb8443b 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -1405,6 +1405,12 @@ mlx5_dev_close(struct rte_eth_dev *dev) > close(priv->nl_socket_rdma); > if (priv->vmwa_context) > mlx5_vlan_vmwa_exit(priv->vmwa_context); > + priv->sh->port[priv->ibv_port - 1].nl_ih_port_id = RTE_MAX_ETHPORTS; > + /* > + * The interrupt handler port id must be reset before priv is reset > + * since 'mlx5_dev_interrupt_nl_cb' uses priv. > + */ > + rte_io_wmb(); > /* > * Free the shared context in last turn, because the cleanup > * routines above may use some shared fields, like > @@ -1458,12 +1464,6 @@ mlx5_dev_close(struct rte_eth_dev *dev) > if (!c) > claim_zero(rte_eth_switch_domain_free(priv->domain_id)); > } > - priv->sh->port[priv->ibv_port - 1].nl_ih_port_id = RTE_MAX_ETHPORTS; > - /* > - * The interrupt handler port id must be reset before priv is reset > - * since 'mlx5_dev_interrupt_nl_cb' uses priv. > - */ > - rte_io_wmb(); > memset(priv, 0, sizeof(*priv)); > priv->domain_id = RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID; > /* > -- > 2.25.1 > -- Christian Ehrhardt Senior Staff Engineer, Ubuntu Server Canonical Ltd