Netdev List
 help / color / mirror / Atom feed
From: Alexandra Winter <wintera@linux.ibm.com>
To: Rahul Chandelkar <rc@rexion.ai>, netdev@vger.kernel.org
Cc: "D. Wythe" <alibuda@linux.alibaba.com>,
	Wenjia Zhang <wenjia@linux.ibm.com>
Subject: Re: [PATCH net] dibs: fix use-after-free in dmb lookup functions
Date: Fri, 29 May 2026 15:11:51 +0200	[thread overview]
Message-ID: <f664f9ca-30b5-404d-9b3c-268d8dbf2bcb@linux.ibm.com> (raw)
In-Reply-To: <4gRZFl1CWvz2x9j@mail.spacemail.com>



On 29.05.26 09:08, Rahul Chandelkar wrote:
> From 68f633e58deb6edffa435a3b2bdc4a12a5e36daf Mon Sep 17 00:00:00 2001
> From: Rahul Chandelkar <rc@rexion.ai>
> Date: Fri, 29 May 2026 12:32:34 +0530
> Subject: [PATCH net] dibs: fix use-after-free in dmb lookup functions
> 
> dibs_lo_attach_dmb(), dibs_lo_detach_dmb(), and dibs_lo_unregister_dmb()
> all release read_lock_bh before operating on the dmb_node pointer found
> during hash table lookup. A concurrent unregister on the same token can
> kfree() the node in this window, causing a use-after-free when the
> original caller subsequently performs refcount_inc_not_zero() or
> refcount_dec_and_test() on the freed object.

As discussed off-list, there is no such problem in the current kernel, as there
is no such caller.
I fully agree that this should be improved, but this should go to [net-next]
as an improvement without a Fixes tag. (This matters, because it removes
the burden of backporting, porting to Stable etc..)

> 
> Fix by performing the refcount operation while still holding read_lock_bh,
> so the node cannot be freed between lookup and use. Release the lock
> before any code path that may call __dibs_lo_unregister_dmb(), since that
> function acquires write_lock_bh internally via hash_del().
> 
> Fixes: cb990a45d7f6 ("dibs: Define dibs loopback")
> Signed-off-by: Rahul Chandelkar <rc@rexion.ai>
> ---


Thank you very much for this patch, please allow for some more days
for me to review and test it.



      reply	other threads:[~2026-05-29 13:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29  7:08 [PATCH net] dibs: fix use-after-free in dmb lookup functions Rahul Chandelkar
2026-05-29 13:11 ` Alexandra Winter [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=f664f9ca-30b5-404d-9b3c-268d8dbf2bcb@linux.ibm.com \
    --to=wintera@linux.ibm.com \
    --cc=alibuda@linux.alibaba.com \
    --cc=netdev@vger.kernel.org \
    --cc=rc@rexion.ai \
    --cc=wenjia@linux.ibm.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