All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jaeyeong Lee" <lee@jaeyeong.cc>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH] RDMA/rtrs: Register client event handler after capability check
Date: Wed, 04 Nov 2026 08:53:16 +0000	[thread overview]
Message-ID: <sashiko-outbox-196893@kernel.org> (raw)
In-Reply-To: <179378222423.73361.3247716499619173751@jaeyeong.cc>

> rtrs_clt_ib_dev_init() registers dev->event_handler before checking
> IB_DEVICE_MEM_MGT_EXTENSIONS. If the device does not provide that
> capability, init returns -ENOTSUPP and rtrs_ib_dev_find_or_add() frees
> dev through out_free_pd without calling the deinit callback. The embedded
> event handler therefore remains on the IB device's list after its storage
> has been freed.
> 
> A later IB event walks the dangling list entry and accesses freed memory.
> The issue was found by static analysis. A focused out-of-tree test module
> on an x86_64 QEMU/KASAN kernel temporarily cleared only
> IB_DEVICE_MEM_MGT_EXTENSIONS on a SIW device, exercised the real
> rtrs_clt_ib_dev_init() callback through rtrs_ib_dev_find_or_add(), restored
> the capabilities, and dispatched IB_EVENT_DEVICE_FATAL. KASAN reported
> an 8-byte slab-use-after-free read in ib_dispatch_event_clients(), with
> both the allocation and free originating in rtrs_ib_dev_find_or_add().
> 
> Move the capability check before event handler registration. The check is
> a prerequisite for successful client initialization. Registration cannot
> fail and init returns success immediately afterwards, so every installed
> handler is now owned by a successfully initialized device and is removed
> by the existing deinit callback.
> 
> Fixes: 667db86bcbe8 ("RDMA/rtrs: Register ib event handler")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jaeyeong Lee <lee@jaeyeong.cc>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/179378222423.73361.3247716499619173751@jaeyeong.cc?part=1


  reply	other threads:[~2026-11-04  8:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04  8:50 [PATCH] RDMA/rtrs: Register client event handler after capability check Jaeyeong Lee
2026-11-04  8:53 ` sashiko-bot [this message]
2026-11-04 14:45 ` Leon Romanovsky

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-196893@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=lee@jaeyeong.cc \
    --cc=linux-rdma@vger.kernel.org \
    --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.