From patchwork Tue Nov 17 22:24:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: stephen hemminger X-Patchwork-Id: 545790 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 54F0E1402A2 for ; Wed, 18 Nov 2015 09:24:36 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754223AbbKQWYc (ORCPT ); Tue, 17 Nov 2015 17:24:32 -0500 Received: from mx0a-000f0801.pphosted.com ([67.231.144.122]:60694 "EHLO mx0a-000f0801.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753093AbbKQWYb (ORCPT ); Tue, 17 Nov 2015 17:24:31 -0500 Received: from pps.filterd (m0000542.ppops.net [127.0.0.1]) by mx0a-000f0801.pphosted.com (8.15.0.59/8.15.0.59) with SMTP id tAHMKbMg008316; Tue, 17 Nov 2015 14:24:30 -0800 Received: from hq1wp-exmb11.corp.brocade.com ([144.49.131.13]) by mx0a-000f0801.pphosted.com with ESMTP id 1y86m192ae-1 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Tue, 17 Nov 2015 14:24:30 -0800 Received: from samsung9 (172.16.180.50) by Hq1wp-exmb11.corp.brocade.com (10.70.20.185) with Microsoft SMTP Server (TLS) id 15.0.1104.5; Tue, 17 Nov 2015 14:24:29 -0800 Date: Tue, 17 Nov 2015 14:24:27 -0800 From: Stephen Hemminger To: Jeff Kirsher CC: Subject: [PATCH] fm10k: fix memory leak Message-ID: <20151117142427.37a4cc36@samsung9> Organization: Brocade Communication Systems X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Originating-IP: [172.16.180.50] X-ClientProxiedBy: hq1wp-excas11.corp.brocade.com (10.70.36.102) To Hq1wp-exmb11.corp.brocade.com (10.70.20.185) X-Proofpoint-Spam-Reason: safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.15.21, 1.0.33, 0.0.0000 definitions=2015-11-17_14:2015-11-17, 2015-11-17, 1970-01-01 signatures=0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This was detected by Coverity. The function skb_cow_head leaves skb alone on failure, so caller needs to free. Signed-off-by: Stephen Hemminger --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c 2015-11-17 13:33:40.032694657 -0800 +++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c 2015-11-17 14:13:03.086942495 -0800 @@ -627,8 +627,10 @@ static netdev_tx_t fm10k_xmit_frame(stru /* verify the skb head is not shared */ err = skb_cow_head(skb, 0); - if (err) + if (err) { + dev_kfree_skb(skb); return NETDEV_TX_OK; + } /* locate vlan header */ vhdr = (struct vlan_hdr *)(skb->data + ETH_HLEN);