Skip to content

Commit

Permalink
xen-netback: fix some error return code
Browse files Browse the repository at this point in the history
'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: d52eb0d ('xen-netback: make sure skb linear area covers checksum field')
Signed-off-by: Wei Yongjun <[email protected]>
Acked-by: Wei Liu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
weiyj authored and davem330 committed Dec 19, 2013
1 parent b1aac81 commit 0c8d087
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions drivers/net/xen-netback/netback.c
Original file line number Diff line number Diff line change
Expand Up @@ -1209,8 +1209,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 =
Expand All @@ -1227,8 +1229,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 =
Expand Down Expand Up @@ -1350,8 +1354,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 =
Expand All @@ -1368,8 +1374,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 =
Expand Down

0 comments on commit 0c8d087

Please sign in to comment.