Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752105AbdFTTlc (ORCPT ); Tue, 20 Jun 2017 15:41:32 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:42654 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751175AbdFTTla (ORCPT ); Tue, 20 Jun 2017 15:41:30 -0400 Date: Tue, 20 Jun 2017 15:41:23 -0400 (EDT) Message-Id: <20170620.154123.561428545995150660.davem@davemloft.net> To: niklas.cassel@axis.com Cc: peppe.cavallaro@st.com, alexandre.torgue@st.com, niklass@axis.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] net: stmmac: free an skb first when there are no longer any descriptors using it From: David Miller In-Reply-To: <20170620123241.5677-1-niklas.cassel@axis.com> References: <20170620123241.5677-1-niklas.cassel@axis.com> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Tue, 20 Jun 2017 11:59:41 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 666 Lines: 15 From: Niklas Cassel Date: Tue, 20 Jun 2017 14:32:41 +0200 > When having the skb pointer in the first descriptor, stmmac_tx_clean > can get called at a moment where the IP has only cleared the own bit > of the first descriptor, thus freeing the skb, even though there can > be several descriptors whose buffers point into the same skb. > > By simply moving the skb pointer from the first descriptor to the last > descriptor, a skb will get freed only when the IP has cleared the > own bit of all the descriptors that are using that skb. > > Signed-off-by: Niklas Cassel Applied and queued up for -stable, thanks.