All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "T S Rameshkumar" <rameshsv06@gmail.com>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next] mptcp: add MPTCP_MIB_RCVINVALIDOPT counter for invalid options
Date: Tue, 13 Oct 2026 09:35:36 +0000	[thread overview]
Message-ID: <sashiko-outbox-169354@kernel.org> (raw)
In-Reply-To: <20261013085604.115478-1-rameshkumar.t@phytecembedded.in>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] mptcp: missed MIB increment for backlog packets due to mptcp_skb_net()
--

commit 69466d93fa353450c6162f23ad6457846e513a9d
Author: T S Rameshkumar <rameshsv06@gmail.com>

mptcp: add MPTCP_MIB_RCVINVALIDOPT counter for invalid options

This commit introduces the MPTCP_MIB_RCVINVALIDOPT counter to track invalid
MPTCP options encountered during parsing. To perform the increment, it attempts
to resolve the net pointer from the socket buffer in mptcp_skb_net() by
checking skb->sk, skb->dev, and skb_dst.

Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/628

> diff --git a/net/mptcp/options.c b/net/mptcp/options.c
> index adbf8e0773dbb..a1af2acfa791b 100644
> --- a/net/mptcp/options.c
> +++ b/net/mptcp/options.c

[ ... ]

> @@ -419,13 +422,28 @@ static void mptcp_parse_option(const struct sk_buff *skb,
>  		break;
>  
>  	default:
> +bad_opt:
> +		if (net)
> +			MPTCP_INC_STATS(net, MPTCP_MIB_RCVINVALIDOPT);
>  		break;
>  	}
>  }
>  
> +static inline struct net *mptcp_skb_net(const struct sk_buff *skb)
> +{
> +	if (skb->sk)
> +		return sock_net(skb->sk);
> +	if (skb->dev)
> +		return dev_net_rcu(skb->dev);
> +	if (skb_dst(skb) && skb_dst_dev_rcu(skb))
> +		return skb_dst_dev_net_rcu(skb);
> +	return NULL;
> +}

[Severity: Medium]
For TCP packets processed from the socket backlog queue, is it possible for
mptcp_skb_net() to always return NULL?

When a packet is processed from the backlog (e.g. via tcp_v4_do_rcv()),
skb->dev is cleared unconditionally, skb_dst is dropped, and skb->sk is not
yet set for incoming packets.

Because all three pointers are NULL, the function will return NULL. This will
cause the MIB increment at the bad_opt label to be silently skipped for any
malformed options present in backlog packets.

Since the callers of mptcp_get_options() generally have access to the relevant
socket, could they pass the known net or sk directly instead of deriving it
from the skb?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261013085604.115478-1-rameshkumar.t@phytecembedded.in?part=1

  parent reply	other threads:[~2026-10-13  9:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13  8:56 [PATCH mptcp-next] mptcp: add MPTCP_MIB_RCVINVALIDOPT counter for invalid options T S Rameshkumar
2026-10-13  9:07 ` Matthieu Baerts
2026-10-13  9:35 ` sashiko-bot [this message]
2026-10-13  9:57 ` MPTCP CI

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=sashiko-outbox-169354@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=rameshsv06@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.