[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPgLHd_yD=s0xKXop8T47hvxw2MZD9PHZ9tKKB+45Y5uOHNUVQ@mail.gmail.com>
Date: Mon, 16 Dec 2013 21:57:43 +0800
From: Wei Yongjun <weiyj.lk@...il.com>
To: Ian.Campbell@...rix.com
Cc: wei.liu2@...rix.com, yongjun_wei@...ndmicro.com.cn,
xen-devel@...ts.xenproject.org, netdev@...r.kernel.org
Subject: Re: [PATCH -next] xen-netback: fix some error return code
On 12/16/2013 09:40 PM, Ian Campbell wrote:
> On Mon, 2013-12-16 at 13:13 +0000, Wei Liu wrote:
>> On Mon, Dec 16, 2013 at 01:49:29PM +0800, Wei Yongjun wrote:
>>> From: Wei Yongjun <yongjun_wei@...ndmicro.com.cn>
>>>
>>> Fix to return -EPROTO error code instead of 0(overwrite by maybe_pull_tail())
>>> if skb_partial_csum_set() return false.
>>>
>>> Signed-off-by: Wei Yongjun <yongjun_wei@...ndmicro.com.cn>
>>> ---
>>> drivers/net/xen-netback/netback.c | 16 ++++++++++++----
>>> 1 file changed, 12 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
>>> index 800496b..b16daa7 100644
>>> --- a/drivers/net/xen-netback/netback.c
>>> +++ b/drivers/net/xen-netback/netback.c
>>> @@ -1108,8 +1108,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;
>> Why is this needed? It is set to -EPROTO before the 'switch'.
> Agreed.
As I said in the description, err is overwrited to 0 by the above
'err = maybe_pull_tail(...)' call in the same 'case XXX'.
Refer to the source code:
1104 err = maybe_pull_tail(skb,
1105 off + sizeof(struct tcphdr),
1106 MAX_IP_HDR_LEN);
1107 if (err < 0)
1108 goto out;
1109
1110 if (!skb_partial_csum_set(skb, off,
1111 offsetof(struct tcphdr, check)))
1112 goto out;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists