From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83A3841777 for ; Tue, 14 Nov 2023 21:59:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GATfj12r" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46FBCC433C9; Tue, 14 Nov 2023 21:59:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699999147; bh=flrhQtjisAB4oq7jwgHK6gDW/4qpObavqqwfwxnwVh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GATfj12rUSCV4pkWEoF9QYU9/6/D/dKU+amxqkdocsVOlIGPwEH5BlomomA09xEFf 5L12acMGqu3ipwt3Lzoznn2rRIUhPnDFwY5ZIqsh97shEijegNAcxtooaofiNubNhO S4GxuvilwrDeDS07w21LTjEzIUh8dwax/lZgwDnwnnrSkij4EJ1i6z/KFpkUM3AeT3 AVA4DJQBYMPbKpRFanijNLNawQIdddiiLSnIkXz08WgWvqcgcCuNQVz0UQWt2AWwSv MGP8J20nf9/1osrTRy7D5bc60E42bcIyfTPWbRcLmhdYbNY2zJN0Xi51TIjvIFiC/S +RfmKwjZ3/d0w== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet Cc: Saeed Mahameed , netdev@vger.kernel.org, Tariq Toukan , Rahul Rameshbabu Subject: [net V2 09/15] net/mlx5e: Avoid referencing skb after free-ing in drop path of mlx5e_sq_xmit_wqe Date: Tue, 14 Nov 2023 13:58:40 -0800 Message-ID: <20231114215846.5902-10-saeed@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231114215846.5902-1-saeed@kernel.org> References: <20231114215846.5902-1-saeed@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Rahul Rameshbabu When SQ is a port timestamping SQ for PTP, do not access tx flags of skb after free-ing the skb. Free the skb only after all references that depend on it have been handled in the dropped WQE path. Fixes: 3178308ad4ca ("net/mlx5e: Make tx_port_ts logic resilient to out-of-order CQEs") Signed-off-by: Rahul Rameshbabu Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c index d41435c22ce5..19f2c25b05a0 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c @@ -494,10 +494,10 @@ mlx5e_sq_xmit_wqe(struct mlx5e_txqsq *sq, struct sk_buff *skb, err_drop: stats->dropped++; - dev_kfree_skb_any(skb); if (unlikely(sq->ptpsq && (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP))) mlx5e_ptp_metadata_fifo_push(&sq->ptpsq->metadata_freelist, be32_to_cpu(eseg->flow_table_metadata)); + dev_kfree_skb_any(skb); mlx5e_tx_flush(sq); } -- 2.41.0