diff options
author | Wei Yongjun <weiyj.lk@gmail.com> | 2013-12-16 21:42:09 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-19 14:58:47 -0500 |
commit | 0c8d087c04cdcef501064552149289866e53aa6c (patch) | |
tree | 2e3db99af1b6eace9d853e2f3c4209acfc3e64a7 /drivers/net/xen-netback/netback.c | |
parent | b1aac815c0891fe4a55a6b0b715910142227700f (diff) |
xen-netback: fix some error return code
'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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/xen-netback/netback.c')
-rw-r--r-- | drivers/net/xen-netback/netback.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 27bbe58dcbe7..7b4fd93be76d 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
@@ -1209,8 +1209,10 @@ static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb, | |||
1209 | goto out; | 1209 | goto out; |
1210 | 1210 | ||
1211 | if (!skb_partial_csum_set(skb, off, | 1211 | if (!skb_partial_csum_set(skb, off, |
1212 | offsetof(struct tcphdr, check))) | 1212 | offsetof(struct tcphdr, check))) { |
1213 | err = -EPROTO; | ||
1213 | goto out; | 1214 | goto out; |
1215 | } | ||
1214 | 1216 | ||
1215 | if (recalculate_partial_csum) | 1217 | if (recalculate_partial_csum) |
1216 | tcp_hdr(skb)->check = | 1218 | tcp_hdr(skb)->check = |
@@ -1227,8 +1229,10 @@ static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb, | |||
1227 | goto out; | 1229 | goto out; |
1228 | 1230 | ||
1229 | if (!skb_partial_csum_set(skb, off, | 1231 | if (!skb_partial_csum_set(skb, off, |
1230 | offsetof(struct udphdr, check))) | 1232 | offsetof(struct udphdr, check))) { |
1233 | err = -EPROTO; | ||
1231 | goto out; | 1234 | goto out; |
1235 | } | ||
1232 | 1236 | ||
1233 | if (recalculate_partial_csum) | 1237 | if (recalculate_partial_csum) |
1234 | udp_hdr(skb)->check = | 1238 | udp_hdr(skb)->check = |
@@ -1350,8 +1354,10 @@ static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb, | |||
1350 | goto out; | 1354 | goto out; |
1351 | 1355 | ||
1352 | if (!skb_partial_csum_set(skb, off, | 1356 | if (!skb_partial_csum_set(skb, off, |
1353 | offsetof(struct tcphdr, check))) | 1357 | offsetof(struct tcphdr, check))) { |
1358 | err = -EPROTO; | ||
1354 | goto out; | 1359 | goto out; |
1360 | } | ||
1355 | 1361 | ||
1356 | if (recalculate_partial_csum) | 1362 | if (recalculate_partial_csum) |
1357 | tcp_hdr(skb)->check = | 1363 | tcp_hdr(skb)->check = |
@@ -1368,8 +1374,10 @@ static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb, | |||
1368 | goto out; | 1374 | goto out; |
1369 | 1375 | ||
1370 | if (!skb_partial_csum_set(skb, off, | 1376 | if (!skb_partial_csum_set(skb, off, |
1371 | offsetof(struct udphdr, check))) | 1377 | offsetof(struct udphdr, check))) { |
1378 | err = -EPROTO; | ||
1372 | goto out; | 1379 | goto out; |
1380 | } | ||
1373 | 1381 | ||
1374 | if (recalculate_partial_csum) | 1382 | if (recalculate_partial_csum) |
1375 | udp_hdr(skb)->check = | 1383 | udp_hdr(skb)->check = |