Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp4422199imc; Mon, 25 Feb 2019 04:48:12 -0800 (PST) X-Google-Smtp-Source: AHgI3IYjCXy28ILkyBgo8jUH2lQkN4VvI4Wr8ZQxCo05Ao2K3gocsdZ2XbZ2IqhE4p0f5uMRQEGO X-Received: by 2002:a17:902:6508:: with SMTP id b8mr20676887plk.17.1551098892198; Mon, 25 Feb 2019 04:48:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551098892; cv=none; d=google.com; s=arc-20160816; b=Q00YlwQLj5k6qv8mU8Aa0hXINAGIPpcdtp1i8a4zyeeIHNO+tGokBd3jbUZsIrGqWM eZrM5WQxJjumhgtam2zguqamCQJF2MQiyhK7RuPEiOzbfDpetrdVQsf+ixV3SexaKmpQ m7AU+QnPcoGG0w0m4Qw6DqGmk+nIsLSZK8cR8dVOrA5T51i6dUA5Q3fBNqA376dlIFLm pfE8yA/89bRbiZaiLMet0NlsY/sJxGBWTvyUJOXMl5tRRjKX0OknIkbOVuOoEV2t/bti ZiJ/UhfiZXhhAb/sgRwXbCB10QGsc36blnqMn9bCbda30TA1X6oWhIrM/PUzwVAOMvFk Mntw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=KC7hqVVaHXUnbQqUWzIhk5nftm3ow5Y+stCBnWoMr6E=; b=xgrEDBKDdToIkeJZhpQ0yemJL/bDsGT3qxqHEuzdmafGOU3jVGzw4kaIQVmO9iLO0u ozQoevIsqANZUN2Uy8BBWroMW9TLtA7P6fIyilO1H3h9glhgax26EyXpmC+cMSMQqynX +D5FwDVJtbCncV6ie1rzMTqA5S7sXL4bZChjazxIje7areY4fiTychuJru4t4l6JjjyJ k9tgDtJghUpogvEVC2wn7xn4QJc4HcEVr0SgA+APr6KngBIhvAFyyspoyxuStMU/p4C3 10SWBlY/+DPmEKXhceZof/bn+vSk0MbLriisBT7zBiFDAY3bvvGkRqPkNu+9n1rX3sxf ekFA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z88si10128235pfl.65.2019.02.25.04.47.56; Mon, 25 Feb 2019 04:48:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727017AbfBYMrK (ORCPT + 99 others); Mon, 25 Feb 2019 07:47:10 -0500 Received: from charlotte.tuxdriver.com ([70.61.120.58]:54936 "EHLO smtp.tuxdriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726819AbfBYMrJ (ORCPT ); Mon, 25 Feb 2019 07:47:09 -0500 Received: from cpe-2606-a000-111b-405a-9816-2c85-c514-8f7a.dyn6.twc.com ([2606:a000:111b:405a:9816:2c85:c514:8f7a] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1gyFee-00033M-Iz; Mon, 25 Feb 2019 07:47:05 -0500 Date: Mon, 25 Feb 2019 07:46:14 -0500 From: Neil Horman To: Xin Long Cc: linux-kernel@vger.kernel.org, network dev , linux-sctp@vger.kernel.org, davem@davemloft.net, Marcelo Ricardo Leitner Subject: Re: [PATCH net] sctp: get sctphdr by offset in sctp_compute_cksum Message-ID: <20190225124614.GB30699@hmswarspite.think-freely.org> References: <2aee76766861ac9e46b7acf123d5d6e8f2adf8e0.1551093937.git.lucien.xin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2aee76766861ac9e46b7acf123d5d6e8f2adf8e0.1551093937.git.lucien.xin@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Score: -2.9 (--) X-Spam-Status: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 25, 2019 at 07:25:37PM +0800, Xin Long wrote: > sctp_hdr(skb) only works when skb->transport_header is set properly. > > But in the path of nf_conntrack_in: sctp_packet() -> sctp_error() > > skb->transport_header is not guaranteed to be right value for sctp. > It will cause to fail to check the checksum for sctp packets. > > So fix it by using offset, which is always right in all places. > > Fixes: e6d8b64b34aa ("net: sctp: fix and consolidate SCTP checksumming code") > Reported-by: Li Shuang > Signed-off-by: Xin Long > --- > include/net/sctp/checksum.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h > index 32ee65a..1c6e6c0 100644 > --- a/include/net/sctp/checksum.h > +++ b/include/net/sctp/checksum.h > @@ -61,7 +61,7 @@ static inline __wsum sctp_csum_combine(__wsum csum, __wsum csum2, > static inline __le32 sctp_compute_cksum(const struct sk_buff *skb, > unsigned int offset) > { > - struct sctphdr *sh = sctp_hdr(skb); > + struct sctphdr *sh = (struct sctphdr *)(skb->data + offset); > const struct skb_checksum_ops ops = { > .update = sctp_csum_update, > .combine = sctp_csum_combine, > -- > 2.1.0 > > Shouldn't you use skb_set_transport_header and skb_transport_header here? Neil