netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Tom Herbert <tom@herbertland.com>
Cc: David Miller <davem@davemloft.net>,
	Network Development <netdev@vger.kernel.org>,
	simon.horman@netronome.com, Tom Herbert <tom@quantonium.net>
Subject: Re: [PATCH v6 net-next 1/9] ipeh: Fix destopts and hopopts counters on drop
Date: Sun, 22 Dec 2019 11:20:57 -0500	[thread overview]
Message-ID: <CA+FuTSfSFtSZjstCCp4ZdwPMCiHXaskgTqQH0EJYzV4-08t2Eg@mail.gmail.com> (raw)
In-Reply-To: <1576885124-14576-2-git-send-email-tom@herbertland.com>

On Fri, Dec 20, 2019 at 6:39 PM Tom Herbert <tom@herbertland.com> wrote:
>
> From: Tom Herbert <tom@quantonium.net>
>
> For destopts, bump IPSTATS_MIB_INHDRERRORS when limit of length
> of extension header is exceeded.
>
> For hop-by-hop options, bump IPSTATS_MIB_INHDRERRORS in same
> situations as for when destopts are dropped.
>
> Signed-off-by: Tom Herbert <tom@herbertland.com>
> ---
>  net/ipv6/exthdrs.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
> index ab5add0..f605e4e 100644
> --- a/net/ipv6/exthdrs.c
> +++ b/net/ipv6/exthdrs.c
> @@ -288,9 +288,9 @@ static int ipv6_destopt_rcv(struct sk_buff *skb)
>         if (!pskb_may_pull(skb, skb_transport_offset(skb) + 8) ||
>             !pskb_may_pull(skb, (skb_transport_offset(skb) +
>                                  ((skb_transport_header(skb)[1] + 1) << 3)))) {
> +fail_and_free:
>                 __IP6_INC_STATS(dev_net(dst->dev), idev,
>                                 IPSTATS_MIB_INHDRERRORS);
> -fail_and_free:
>                 kfree_skb(skb);
>                 return -1;
>         }
> @@ -820,8 +820,10 @@ static const struct tlvtype_proc tlvprochopopt_lst[] = {
>
>  int ipv6_parse_hopopts(struct sk_buff *skb)
>  {
> +       struct inet6_dev *idev = __in6_dev_get(skb->dev);
>         struct inet6_skb_parm *opt = IP6CB(skb);
>         struct net *net = dev_net(skb->dev);
> +       struct dst_entry *dst = skb_dst(skb);
>         int extlen;
>
>         /*
> @@ -834,6 +836,8 @@ int ipv6_parse_hopopts(struct sk_buff *skb)
>             !pskb_may_pull(skb, (sizeof(struct ipv6hdr) +
>                                  ((skb_transport_header(skb)[1] + 1) << 3)))) {
>  fail_and_free:
> +               __IP6_INC_STATS(dev_net(dst->dev), idev,
> +                               IPSTATS_MIB_INHDRERRORS);

ip6_rcv_core, the only caller of ipv6_parse_hopopts, checks
skb_valid_dst(skb) before deref. Does this need the same?

  reply	other threads:[~2019-12-22 16:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20 23:38 [PATCH v6 net-next 0/9] ipv6: Extension header infrastructure Tom Herbert
2019-12-20 23:38 ` [PATCH v6 net-next 1/9] ipeh: Fix destopts and hopopts counters on drop Tom Herbert
2019-12-22 16:20   ` Willem de Bruijn [this message]
2019-12-23 16:53     ` Tom Herbert
2019-12-23 18:52       ` Willem de Bruijn
2019-12-23 20:02         ` Tom Herbert
2019-12-20 23:38 ` [PATCH v6 net-next 2/9] ipeh: Create exthdrs_options.c and ipeh.h Tom Herbert
2019-12-20 23:38 ` [PATCH v6 net-next 3/9] ipeh: Move generic EH functions to exthdrs_common.c Tom Herbert
2019-12-20 23:38 ` [PATCH v6 net-next 4/9] ipeh: Generic TLV parser Tom Herbert
2019-12-20 23:38 ` [PATCH v6 net-next 5/9] ipeh: Add callback to ipeh_parse_tlv to handle errors Tom Herbert
2019-12-20 23:38 ` [PATCH v6 net-next 6/9] ip6tlvs: Registration of TLV handlers and parameters Tom Herbert
2019-12-20 23:38 ` [PATCH v6 net-next 7/9] ip6tlvs: Add TX parameters Tom Herbert
2019-12-20 23:38 ` [PATCH v6 net-next 8/9] ip6tlvs: Add netlink interface Tom Herbert
2019-12-20 23:38 ` [PATCH v6 net-next 9/9] ip6tlvs: Validation of TX Destination and Hop-by-Hop options Tom Herbert

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=CA+FuTSfSFtSZjstCCp4ZdwPMCiHXaskgTqQH0EJYzV4-08t2Eg@mail.gmail.com \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=simon.horman@netronome.com \
    --cc=tom@herbertland.com \
    --cc=tom@quantonium.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).