From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Qing Ming <a0yami@mailbox.org>
Cc: Harald Welte <laforge@gnumonks.org>,
horms@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
osmocom-net-gprs@lists.osmocom.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v3] gtp: serialize PDP context updates
Date: Tue, 11 Aug 2026 11:20:53 +0200 [thread overview]
Message-ID: <anrpdUa_ngVKH6NR@chamomile> (raw)
In-Reply-To: <20260811022012.5416-1-a0yami@mailbox.org>
On Tue, Aug 11, 2026 at 10:20:12AM +0800, Qing Ming wrote:
> PDP contexts can be deleted through GTP_CMD_DELPDP or while the GTP
> network device is being unregistered. The latter is serialized by RTNL,
> but the generic-netlink delete path only holds RCU.
>
> Running both paths concurrently can therefore make both paths delete the
> same PDP context. The issue was found through static analysis and
> reproduced on a KASAN-enabled kernel by a two-thread program
> racing GTP_CMD_DELPDP against RTM_DELLINK:
>
> Oops: general protection fault, probably for non-canonical address
> KASAN: maybe wild-memory-access in range
> [0xdead000000000120-0xdead000000000127]
> RIP: gtp_genl_del_pdp+0x1c1/0x420 [gtp]
> RBP: dead000000000122
>
> The second deletion dereferenced the poisoned hlist pprev pointer.
>
> Serialize PDP context updates with a mutex shared by gtp_pdp_add(),
> gtp_genl_del_pdp(), and gtp_dellink().
>
> Fixes: 459aa660eb1d ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)")
> Assisted-by: Codex:gpt-5
> Signed-off-by: Qing Ming <a0yami@mailbox.org>
> ---
> v3:
> - Rebase onto net/main.
>
> v2: https://lore.kernel.org/netdev/20260808124322.5800-1-a0yami@mailbox.org/
> - Use a dedicated mutex instead of RTNL.
> - Protect PDP add, delete, and link teardown with the same mutex.
>
> drivers/net/gtp.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
> index 9a12cc53da00..8ee516debeed 100644
> --- a/drivers/net/gtp.c
> +++ b/drivers/net/gtp.c
[...]
> @@ -2134,6 +2140,8 @@ static int gtp_genl_del_pdp(struct sk_buff *skb, struct genl_info *info)
> if (!info->attrs[GTPA_VERSION])
> return -EINVAL;
>
> + mutex_lock(>p_pdp_lock);
> +
> rcu_read_lock();
This rcu_read_lock() can go away after adding this new mutex.
> pctx = gtp_find_pdp(sock_net(skb->sk), info->attrs);
> @@ -2154,6 +2162,7 @@ static int gtp_genl_del_pdp(struct sk_buff *skb, struct genl_info *info)
>
> out_unlock:
> rcu_read_unlock();
This can go away too, for gtp_genl_del_pdp(), the mutex replaces this
incorrect rcu read size lock.
Thanks.
> + mutex_unlock(>p_pdp_lock);
> return err;
> }
>
> --
> 2.53.0
>
prev parent reply other threads:[~2026-08-11 9:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 2:20 [PATCH net v3] gtp: serialize PDP context updates Qing Ming
2026-08-11 2:43 ` Kuniyuki Iwashima
2026-08-11 9:20 ` Pablo Neira Ayuso [this message]
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=anrpdUa_ngVKH6NR@chamomile \
--to=pablo@netfilter.org \
--cc=a0yami@mailbox.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=laforge@gnumonks.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=osmocom-net-gprs@lists.osmocom.org \
--cc=pabeni@redhat.com \
/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.