From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Davide Caratti <dcaratti@redhat.com>
Cc: netfilter-devel@vger.kernel.org, Florian Westphal <fw@strlen.de>,
Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Subject: Re: [PATCH nf] netfilter: conntrack: fix false CRC32c mismatch using paged skb
Date: Fri, 19 May 2017 10:41:03 +0200 [thread overview]
Message-ID: <20170519084103.GA2512@salvia> (raw)
In-Reply-To: <f156034b4975584477c319a0946eb7adfc8d1e36.1495119678.git.dcaratti@redhat.com>
Hi Davide,
On Thu, May 18, 2017 at 06:01:43PM +0200, Davide Caratti wrote:
> sctp_compute_cksum() implementation assumes that at least the SCTP header
> is in the linear part of skb: modify conntrack error callback to avoid
> false CRC32c mismatch, if the transport header is partially/entirely paged.
I guess you considered this, but I would like to know the reason for
this approach. Why not fix this from sctp_compute_cksum()? I mean, I
can see other spots in the kernel tree that may be affected by this?
Or is it that you're only observing this from a path that is specific
of conntrack?
> Signed-off-by: Davide Caratti <dcaratti@redhat.com>
> ---
> net/netfilter/nf_conntrack_proto_sctp.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c
> index 13875d5..1c5b14a 100644
> --- a/net/netfilter/nf_conntrack_proto_sctp.c
> +++ b/net/netfilter/nf_conntrack_proto_sctp.c
> @@ -512,16 +512,19 @@ static int sctp_error(struct net *net, struct nf_conn *tpl, struct sk_buff *skb,
> u8 pf, unsigned int hooknum)
> {
> const struct sctphdr *sh;
> - struct sctphdr _sctph;
> const char *logmsg;
>
> - sh = skb_header_pointer(skb, dataoff, sizeof(_sctph), &_sctph);
> - if (!sh) {
> + if (skb->len < dataoff + sizeof(struct sctphdr)) {
> logmsg = "nf_ct_sctp: short packet ";
> goto out_invalid;
> }
> if (net->ct.sysctl_checksum && hooknum == NF_INET_PRE_ROUTING &&
> skb->ip_summed == CHECKSUM_NONE) {
> + if (!skb_make_writable(skb, dataoff + sizeof(struct sctphdr))) {
> + logmsg = "nf_ct_sctp: failed to read header ";
> + goto out_invalid;
> + }
> + sh = (const struct sctphdr *)(skb->data + dataoff);
> if (sh->checksum != sctp_compute_cksum(skb, dataoff)) {
> logmsg = "nf_ct_sctp: bad CRC ";
> goto out_invalid;
> --
> 2.7.4
>
next prev parent reply other threads:[~2017-05-19 8:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-18 16:01 [PATCH nf] netfilter: conntrack: fix false CRC32c mismatch using paged skb Davide Caratti
2017-05-19 8:41 ` Pablo Neira Ayuso [this message]
2017-05-19 11:39 ` Davide Caratti
2017-05-23 13:51 ` Davide Caratti
2017-05-23 19:35 ` Pablo Neira Ayuso
2017-05-23 21:29 ` Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170519084103.GA2512@salvia \
--to=pablo@netfilter.org \
--cc=dcaratti@redhat.com \
--cc=fw@strlen.de \
--cc=marcelo.leitner@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.