Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753785AbdHKU52 (ORCPT ); Fri, 11 Aug 2017 16:57:28 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:59476 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753413AbdHKU50 (ORCPT ); Fri, 11 Aug 2017 16:57:26 -0400 Date: Fri, 11 Aug 2017 13:57:25 -0700 (PDT) Message-Id: <20170811.135725.67224099020250004.davem@davemloft.net> To: vivien.didelot@savoirfairelinux.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com, f.fainelli@gmail.com, andrew@lunn.ch Subject: Re: [PATCH net] net: dsa: ksz: fix skb freeing From: David Miller In-Reply-To: <20170809204609.8114-1-vivien.didelot@savoirfairelinux.com> References: <20170809204609.8114-1-vivien.didelot@savoirfairelinux.com> X-Mailer: Mew version 6.7 on Emacs 25.2 / 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]); Fri, 11 Aug 2017 13:57:26 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 701 Lines: 16 From: Vivien Didelot Date: Wed, 9 Aug 2017 16:46:09 -0400 > The DSA layer frees the original skb when an xmit function returns NULL, > meaning an error occurred. But if the tagging code copied the original > skb, it is responsible of freeing the copy if an error occurs. > > The ksz tagging code currently has two issues: if skb_put_padto fails, > the skb copy is not freed, and the original skb will be freed twice. > > To fix that, move skb_put_padto inside both branches of the skb_tailroom > condition, before freeing the original skb, and free the copy on error. > > Signed-off-by: Vivien Didelot Applied, thanks.