Commit 0c8d087c authored by Wei Yongjun's avatar Wei Yongjun Committed by David S. Miller

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: d52eb0d4 ('xen-netback: make sure skb linear area covers checksum field')
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: default avatarWei Liu <wei.liu2@citrix.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b1aac815
...@@ -1209,8 +1209,10 @@ static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb, ...@@ -1209,8 +1209,10 @@ static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb,
goto out; goto out;
if (!skb_partial_csum_set(skb, off, if (!skb_partial_csum_set(skb, off,
offsetof(struct tcphdr, check))) offsetof(struct tcphdr, check))) {
err = -EPROTO;
goto out; goto out;
}
if (recalculate_partial_csum) if (recalculate_partial_csum)
tcp_hdr(skb)->check = tcp_hdr(skb)->check =
...@@ -1227,8 +1229,10 @@ static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb, ...@@ -1227,8 +1229,10 @@ static int checksum_setup_ip(struct xenvif *vif, struct sk_buff *skb,
goto out; goto out;
if (!skb_partial_csum_set(skb, off, if (!skb_partial_csum_set(skb, off,
offsetof(struct udphdr, check))) offsetof(struct udphdr, check))) {
err = -EPROTO;
goto out; goto out;
}
if (recalculate_partial_csum) if (recalculate_partial_csum)
udp_hdr(skb)->check = udp_hdr(skb)->check =
...@@ -1350,8 +1354,10 @@ static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb, ...@@ -1350,8 +1354,10 @@ static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb,
goto out; goto out;
if (!skb_partial_csum_set(skb, off, if (!skb_partial_csum_set(skb, off,
offsetof(struct tcphdr, check))) offsetof(struct tcphdr, check))) {
err = -EPROTO;
goto out; goto out;
}
if (recalculate_partial_csum) if (recalculate_partial_csum)
tcp_hdr(skb)->check = tcp_hdr(skb)->check =
...@@ -1368,8 +1374,10 @@ static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb, ...@@ -1368,8 +1374,10 @@ static int checksum_setup_ipv6(struct xenvif *vif, struct sk_buff *skb,
goto out; goto out;
if (!skb_partial_csum_set(skb, off, if (!skb_partial_csum_set(skb, off,
offsetof(struct udphdr, check))) offsetof(struct udphdr, check))) {
err = -EPROTO;
goto out; goto out;
}
if (recalculate_partial_csum) if (recalculate_partial_csum)
udp_hdr(skb)->check = udp_hdr(skb)->check =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment