public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Haiyang Zhang <haiyangz@microsoft.com>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 3.18 17/20] hyperv: Fix the error processing in netvsc_send()
Date: Tue, 24 Feb 2015 18:10:32 -0800	[thread overview]
Message-ID: <20150225020854.808905101@linuxfoundation.org> (raw)
In-Reply-To: <20150225020854.096477776@linuxfoundation.org>

3.18-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Haiyang Zhang <haiyangz@microsoft.com>

[ Upstream commit d953ca4ddf71aa91a4596b2ff7ff1598f6ad4708 ]

The existing code frees the skb in EAGAIN case, in which the skb will be
retried from upper layer and used again.
Also, the existing code doesn't free send buffer slot in error case, because
there is no completion message for unsent packets.
This patch fixes these problems.

(Please also include this patch for stable trees. Thanks!)

Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/hyperv/netvsc.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -716,7 +716,7 @@ int netvsc_send(struct hv_device *device
 	u64 req_id;
 	unsigned int section_index = NETVSC_INVALID_INDEX;
 	u32 msg_size = 0;
-	struct sk_buff *skb;
+	struct sk_buff *skb = NULL;
 	u16 q_idx = packet->q_idx;
 
 
@@ -743,8 +743,6 @@ int netvsc_send(struct hv_device *device
 							   packet);
 			skb = (struct sk_buff *)
 			      (unsigned long)packet->send_completion_tid;
-			if (skb)
-				dev_kfree_skb_any(skb);
 			packet->page_buf_cnt = 0;
 		}
 	}
@@ -807,6 +805,13 @@ int netvsc_send(struct hv_device *device
 			   packet, ret);
 	}
 
+	if (ret != 0) {
+		if (section_index != NETVSC_INVALID_INDEX)
+			netvsc_free_send_slot(net_device, section_index);
+	} else if (skb) {
+		dev_kfree_skb_any(skb);
+	}
+
 	return ret;
 }
 



  parent reply	other threads:[~2015-02-25  2:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-25  2:10 [PATCH 3.18 00/20] 3.18.8-stable review Greg Kroah-Hartman
2015-02-25  2:10 ` [PATCH 3.18 01/20] ip: zero sockaddr returned on error queue Greg Kroah-Hartman
2015-02-25  2:10 ` [PATCH 3.18 02/20] net: rps: fix cpu unplug Greg Kroah-Hartman
2015-02-25  2:10 ` [PATCH 3.18 03/20] ipv6: stop sending PTB packets for MTU < 1280 Greg Kroah-Hartman
2015-02-25  2:10 ` [PATCH 3.18 04/20] netxen: fix netxen_nic_poll() logic Greg Kroah-Hartman
2015-02-25  2:10 ` [PATCH 3.18 05/20] net: sctp: fix slab corruption from use after free on INIT collisions Greg Kroah-Hartman
2015-02-25  2:10 ` [PATCH 3.18 06/20] ipv4: try to cache dst_entries which would cause a redirect Greg Kroah-Hartman
2015-02-25  2:10 ` [PATCH 3.18 07/20] udp_diag: Fix socket skipping within chain Greg Kroah-Hartman
2015-02-25  2:10 ` [PATCH 3.18 08/20] ping: Fix race in free in receive path Greg Kroah-Hartman
2015-02-25  2:10 ` [PATCH 3.18 09/20] ipv6: replacing a rt6_info needs to purge possible propagated rt6_infos too Greg Kroah-Hartman
2015-02-25  2:10 ` [PATCH 3.18 10/20] bnx2x: fix napi poll return value for repoll Greg Kroah-Hartman
2015-02-25  2:10 ` [PATCH 3.18 11/20] net: dont OOPS on socket aio Greg Kroah-Hartman
2015-02-25  2:10 ` [PATCH 3.18 12/20] bridge: dont send notification when skb->len == 0 in rtnl_bridge_notify Greg Kroah-Hartman
2015-02-25  2:10 ` [PATCH 3.18 13/20] tcp: ipv4: initialize unicast_sock sk_pacing_rate Greg Kroah-Hartman
2015-02-25  2:10 ` [PATCH 3.18 14/20] ipv4: tcp: get rid of ugly unicast_sock Greg Kroah-Hartman
2015-02-25  2:10 ` [PATCH 3.18 15/20] ppp: deflate: never return len larger than output buffer Greg Kroah-Hartman
2015-02-25  2:10 ` [PATCH 3.18 16/20] net: sctp: fix passing wrong parameter header to param_type2af in sctp_process_param Greg Kroah-Hartman
2015-02-25  2:10 ` Greg Kroah-Hartman [this message]
2015-02-25  2:10 ` [PATCH 3.18 18/20] net: sched: fix panic in rate estimators Greg Kroah-Hartman
2015-02-25  2:10 ` [PATCH 3.18 20/20] [media] media/rc: Send sync space information on the lirc device Greg Kroah-Hartman
2015-02-25 16:46 ` [PATCH 3.18 00/20] 3.18.8-stable review Guenter Roeck
2015-02-25 17:52   ` Greg Kroah-Hartman
2015-02-25 20:56 ` Shuah Khan
2015-02-25 21:07   ` Greg Kroah-Hartman

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=20150225020854.808905101@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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