mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cheng Xu <chengyou@linux.alibaba.com>
To: Fan Wu <fanwu01@zju.edu.cn>
Cc: kaishen@linux.alibaba.com, jgg@ziepe.ca, leon@kernel.org,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] RDMA/erdma: fix use-after-free in CEQ tasklet teardown
Date: Wed, 22 Jul 2026 10:02:30 +0800	[thread overview]
Message-ID: <68b9b418-b672-ee31-1c66-9806b8a2eb60@linux.alibaba.com> (raw)
In-Reply-To: <20260721133745.3197015-1-fanwu01@zju.edu.cn>



On 7/21/26 9:37 PM, Fan Wu wrote:
> The CEQ interrupt handler schedules a tasklet that accesses the CEQ
> buffers. During teardown, erdma_free_ceq_irq() removes the interrupt
> handler and waits for any in-flight handler invocation, but does not
> wait for a tasklet that was already scheduled by that handler.
> 
> erdma_ceq_uninit_one() can then free the EQ qbuf and dbrec while the
> tasklet is still accessing them.
> 
> Call tasklet_kill() after free_irq(). This prevents new tasklet
> scheduling and waits for any already scheduled tasklet before the EQ
> buffers are freed.
> 
> This issue was found by an in-house static analysis tool.
> 
> Fixes: f2a0a630b953 ("RDMA/erdma: Add event queue implementation")
> Cc: stable@vger.kernel.org
> Assisted-by: Codex:gpt-5.6
> Signed-off-by: Fan Wu <fanwu01@zju.edu.cn>
> ---
>  drivers/infiniband/hw/erdma/erdma_eq.c | 1 +
>  1 file changed, 1 insertion(+)
> 

Hi, Fan Wu,

Thanks your work! But there is another patch fixes this issue already:

https://lore.kernel.org/linux-rdma/CAHYDg1QDaWPxD7pb-A1ZmqxaX6YACWTsinzEG4_EZDKbAX38kQ@mail.gmail.com/T/#t

Thanks,
Cheng Xu

> diff --git a/drivers/infiniband/hw/erdma/erdma_eq.c b/drivers/infiniband/hw/erdma/erdma_eq.c
> index 6486234a2360..78ebec6d48a3 100644
> --- a/drivers/infiniband/hw/erdma/erdma_eq.c
> +++ b/drivers/infiniband/hw/erdma/erdma_eq.c
> @@ -219,6 +219,7 @@ static void erdma_free_ceq_irq(struct erdma_dev *dev, u16 ceqn)
> 
>  	irq_set_affinity_hint(eqc->irq.msix_vector, NULL);
>  	free_irq(eqc->irq.msix_vector, eqc);
> +	tasklet_kill(&dev->ceqs[ceqn].tasklet);
>  }
> 
>  static int create_eq_cmd(struct erdma_dev *dev, u32 eqn, struct erdma_eq *eq)
> --
> 2.34.1

      reply	other threads:[~2026-07-22  2:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21 13:37 Fan Wu
2026-07-22  2:02 ` Cheng Xu [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=68b9b418-b672-ee31-1c66-9806b8a2eb60@linux.alibaba.com \
    --to=chengyou@linux.alibaba.com \
    --cc=fanwu01@zju.edu.cn \
    --cc=jgg@ziepe.ca \
    --cc=kaishen@linux.alibaba.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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®