netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemming@brocade.com>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: <netdev@vger.kernel.org>
Subject: [PATCH] fm10k: fix memory leak
Date: Tue, 17 Nov 2015 14:24:27 -0800	[thread overview]
Message-ID: <20151117142427.37a4cc36@samsung9> (raw)

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 <stephen@networkplumber.org>

--- 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);

             reply	other threads:[~2015-11-17 22:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17 22:24 Stephen Hemminger [this message]
2015-11-18 20:06 ` [PATCH] fm10k: fix memory leak David Miller
2015-11-18 20:47   ` Jeff Kirsher
2015-11-18 21:53 ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151117142427.37a4cc36@samsung9 \
    --to=shemming@brocade.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).