From patchwork Tue Dec 17 02:42:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 301982 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A62C42C00A8 for ; Tue, 17 Dec 2013 13:42:15 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751945Ab3LQCmM (ORCPT ); Mon, 16 Dec 2013 21:42:12 -0500 Received: from mail-bk0-f50.google.com ([209.85.214.50]:43940 "EHLO mail-bk0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751088Ab3LQCmK (ORCPT ); Mon, 16 Dec 2013 21:42:10 -0500 Received: by mail-bk0-f50.google.com with SMTP id e11so2578192bkh.23 for ; Mon, 16 Dec 2013 18:42:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=3LLPs3wzILs2ET2IioKaK6Z1ExzT8c8exSdwU108/Ns=; b=i/AvVe5zqdezokcvYsUgTcJr2Ev41EG9tK3sRIoUFS0expPF1WlVU+CeIn3Z5QMwL6 lL+e7SwuIKvsmJLD2TugqJHo4ELhCDEbuF6ayQZa9kEdGhSJAIS7o8Auawk7retPx8g4 KhLHzM4kNKR/3mMAHTaBUTWDUBs1CWk9yXlUe4dOVb1gWS0I0gGju3bRQDcs4y8XhBRn XwLxgGJVDb5dqH5h5DErY0jyEhObz6GcVLoUkmOEWBBK3iBrRgpG8BLZp4cyD+rKZ3EQ eR5cj79XF1RL+/1BJZLaUaoNJ19JGPJJiRXEgm2Wj0XLUIUL33wgyMC+9DA8O0Us9tHL /7qQ== MIME-Version: 1.0 X-Received: by 10.204.165.134 with SMTP id i6mr104533bky.78.1387248129301; Mon, 16 Dec 2013 18:42:09 -0800 (PST) Received: by 10.204.74.130 with HTTP; Mon, 16 Dec 2013 18:42:09 -0800 (PST) In-Reply-To: <1387203160.21086.1.camel@kazak.uk.xensource.com> References: <20131216131313.GE12582@zion.uk.xensource.com> <1387201238.10247.37.camel@kazak.uk.xensource.com> <1387203160.21086.1.camel@kazak.uk.xensource.com> Date: Tue, 17 Dec 2013 10:42:09 +0800 Message-ID: Subject: [PATCH v2] xen-netback: fix some error return code From: Wei Yongjun To: Ian.Campbell@citrix.com Cc: wei.liu2@citrix.com, yongjun_wei@trendmicro.com.cn, xen-devel@lists.xenproject.org, netdev@vger.kernel.org, davem@davemloft.net Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org '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 Acked-by: Wei Liu --- 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 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 =