Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752260AbdHIVo1 convert rfc822-to-8bit (ORCPT ); Wed, 9 Aug 2017 17:44:27 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:52048 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752095AbdHIVo0 (ORCPT ); Wed, 9 Aug 2017 17:44:26 -0400 X-IronPort-AV: E=Sophos;i="5.41,349,1498546800"; d="scan'208";a="3715547" From: To: , CC: , , , , Subject: RE: [PATCH net] net: dsa: ksz: fix skb freeing Thread-Topic: [PATCH net] net: dsa: ksz: fix skb freeing Thread-Index: AQHTEVEtWf0jnITVuk2lvb2mXm55+6J8jesQ Date: Wed, 9 Aug 2017 21:43:39 +0000 Message-ID: <9235D6609DB808459E95D78E17F2E43D40AF7B16@CHN-SV-EXMX02.mchp-main.com> References: <20170809204609.8114-1-vivien.didelot@savoirfairelinux.com> In-Reply-To: <20170809204609.8114-1-vivien.didelot@savoirfairelinux.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.10.76.4] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 638 Lines: 12 > 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 Reviewed-by: Woojung Huh