diff mbox

[v2] xen-netback: fix some error return code

Message ID CAPgLHd9Q7A--LQnsMKt-Tt-FwrA3FC1Un3kwLRH5pc4Z3N2K7A@mail.gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Wei Yongjun Dec. 17, 2013, 2:42 a.m. UTC
'err' is overwrited to 0 after maybe_pull_tail() call, so the error
code was not set if skb_partial_csum_set() call failed. Fix to return
error -EPROTO from those error handling case instead of 0.

Fixes: d52eb0d46f36 ('xen-netback: make sure skb linear area covers checksum field')
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
v1 -> v2: rebased and fixed the description
---
 drivers/net/xen-netback/netback.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)



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

Comments

Wei Liu Dec. 17, 2013, 9:49 a.m. UTC | #1
On Tue, Dec 17, 2013 at 10:42:09AM +0800, Wei Yongjun wrote:
> 'err' is overwrited to 0 after maybe_pull_tail() call, so the error
> code was not set if skb_partial_csum_set() call failed. Fix to return
> error -EPROTO from those error handling case instead of 0.
> 
> Fixes: d52eb0d46f36 ('xen-netback: make sure skb linear area covers checksum field')
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Acked-by: Wei Liu <wei.liu2@citrix.com>

This makes sense. This patch applies to 'net' tree. You should specify
'net' or 'net-next' tree in subject line for your future patch. You can
find relevant infomation in netdev-FAQ.txt in kernel documentation
directory.

Thanks
Wei.
--
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
David Miller Dec. 19, 2013, 7:59 p.m. UTC | #2
From: Wei Yongjun <weiyj.lk@gmail.com>
Date: Tue, 17 Dec 2013 10:42:09 +0800

> 'err' is overwrited to 0 after maybe_pull_tail() call, so the error
> code was not set if skb_partial_csum_set() call failed. Fix to return
> error -EPROTO from those error handling case instead of 0.
> 
> Fixes: d52eb0d46f36 ('xen-netback: make sure skb linear area covers checksum field')
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
> v1 -> v2: rebased and fixed the description

Applied and queued up for -stable.
--
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
diff mbox

Patch

diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index e884ee1..5d28e64 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -1206,8 +1206,10 @@  static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb,
 			goto out;
 
 		if (!skb_partial_csum_set(skb, off,
-					  offsetof(struct tcphdr, check)))
+					  offsetof(struct tcphdr, check))) {
+			err = -EPROTO;
 			goto out;
+		}
 
 		if (recalculate_partial_csum)
 			tcp_hdr(skb)->check =
@@ -1224,8 +1226,10 @@  static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb,
 			goto out;
 
 		if (!skb_partial_csum_set(skb, off,
-					  offsetof(struct udphdr, check)))
+					  offsetof(struct udphdr, check))) {
+			err = -EPROTO;
 			goto out;
+		}
 
 		if (recalculate_partial_csum)
 			udp_hdr(skb)->check =
@@ -1347,8 +1351,10 @@  static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb,
 			goto out;
 
 		if (!skb_partial_csum_set(skb, off,
-					  offsetof(struct tcphdr, check)))
+					  offsetof(struct tcphdr, check))) {
+			err = -EPROTO;
 			goto out;
+		}
 
 		if (recalculate_partial_csum)
 			tcp_hdr(skb)->check =
@@ -1365,8 +1371,10 @@  static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb,
 			goto out;
 
 		if (!skb_partial_csum_set(skb, off,
-					  offsetof(struct udphdr, check)))
+					  offsetof(struct udphdr, check))) {
+			err = -EPROTO;
 			goto out;
+		}
 
 		if (recalculate_partial_csum)
 			udp_hdr(skb)->check =