mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Serhat Kumral <serhatkumral1@gmail.com>
To: yanjun.zhu@linux.dev
Cc: zyjzyj2000@gmail.com, jgg@ziepe.ca, leon@kernel.org,
	dsahern@kernel.org, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	syzbot+8c9eede336e3a843750e@syzkaller.appspotmail.com
Subject: Re: [PATCH v2] RDMA/rxe: rework per-net tunnel socket lifetime to fix refcount underflow
Date: Tue,  7 Jul 2026 18:54:21 +0300	[thread overview]
Message-ID: <20260707155421.18021-1-serhatkumral1@gmail.com> (raw)
In-Reply-To: <91a47c3a-d6c5-4998-99e2-fb615253853b@linux.dev>

Hi Yanjun,

> The current ordering introduces a subtle race that
> can leave an RXE link in an unrecoverable state.
>
> If the DELLINK path sets RXE_NET_SK_PUT first and
> then finds ndev == NULL, it returns without calling rxe_net_uninit().
>
> Finally, the per-netns UDP socket reference (nr_sk4/nr_sk6) is never
> decremented.

You are right, thanks for catching this. The once-only bit must not be
consumed by a path that can then fail to do the actual put.

In v3 the put no longer depends on ib_device_get_netdev() at all: the
struct net pointer is recorded in struct rxe_dev at creation time and
used for the put directly. That way the invocation that wins the
test_and_set_bit() can never fail to drop the references, even if the
queued unregister has already cleared the ib_device -> netdev
association. I chose this over reordering the bit test against the
netdev lookup because a reordered lookup still has a smaller window
where both racing paths see a NULL netdev.

I will send v3 shortly.

Thanks,
Serhat

      reply	other threads:[~2026-07-07 16:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06 18:33 Serhat Kumral
2026-07-07  1:15 ` Yanjun.Zhu
2026-07-07 15:54   ` Serhat Kumral [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=20260707155421.18021-1-serhatkumral1@gmail.com \
    --to=serhatkumral1@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=syzbot+8c9eede336e3a843750e@syzkaller.appspotmail.com \
    --cc=yanjun.zhu@linux.dev \
    --cc=zyjzyj2000@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®