From: Christoph Hellwig <hch@lst.de>
To: Changyul Lee <lcy8047@gmail.com>
Cc: Sagi Grimberg <sagi@grimberg.me>,
Chaitanya Kulkarni <kch@nvidia.com>,
Logan Gunthorpe <logang@deltatee.com>,
Stephen Bates <sbates@raithlin.com>,
Bjorn Helgaas <bhelgaas@google.com>,
linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nvmet: look up the P2P device under rcu_read_lock()
Date: Fri, 20 Nov 2026 18:43:00 +0100 [thread overview]
Message-ID: <20261120174300.GA1408@lst.de> (raw)
In-Reply-To: <20261116022558.560013-1-lcy8047@gmail.com>
> static struct pci_dev *nvmet_req_find_p2p_dev(struct nvmet_req *req)
> {
> + struct pci_dev *p2p_dev;
> +
> if (!IS_ENABLED(CONFIG_PCI_P2PDMA) ||
> !req->sq->ctrl || !req->sq->qid || !req->ns)
> return NULL;
> - return radix_tree_lookup(&req->sq->ctrl->p2p_ns_map, req->ns->nsid);
> +
> + rcu_read_lock();
> + p2p_dev = radix_tree_lookup(&req->sq->ctrl->p2p_ns_map, req->ns->nsid);
> + rcu_read_unlock();
> +
> + return p2p_dev;
Not sure what the RCU section is supposed to protect here. If we
don't get a reference the result can be stale as soon as we're outside
the critical section. So IFF this is a real bug, it isn't fixed as
easily.
prev parent reply other threads:[~2026-11-20 17:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 2:25 [PATCH] nvmet: look up the P2P device under rcu_read_lock() Changyul Lee
2026-11-20 17:43 ` Christoph Hellwig [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=20261120174300.GA1408@lst.de \
--to=hch@lst.de \
--cc=bhelgaas@google.com \
--cc=kch@nvidia.com \
--cc=lcy8047@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=logang@deltatee.com \
--cc=sagi@grimberg.me \
--cc=sbates@raithlin.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.