All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: 9p: fix possible refcount leak in p9_read_work()
@ 2022-07-12 10:44 Hangyu Hua
  2022-07-15 22:25 ` asmadeus
  0 siblings, 1 reply; 2+ messages in thread
From: Hangyu Hua @ 2022-07-12 10:44 UTC (permalink / raw)
  To: ericvh, lucho, asmadeus, linux_oss, davem, edumazet, kuba,
	pabeni, tomasbortoli
  Cc: v9fs-developer, netdev, linux-kernel, Hangyu Hua

p9_req_put need to be called when m->rreq->rc.sdata is NULL to avoid
possible refcount leak.

Fixes: 728356dedeff ("9p: Add refcount to p9_req_t")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
---

Add p9_req_put in the "No recv fcall for tag..." error path according to Dominique's suggestion.

 net/9p/trans_fd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 507974ce880c..090337f446d7 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -345,6 +345,7 @@ static void p9_read_work(struct work_struct *work)
 			p9_debug(P9_DEBUG_ERROR,
 				 "No recv fcall for tag %d (req %p), disconnecting!\n",
 				 m->rc.tag, m->rreq);
+			p9_req_put(m->rreq);
 			m->rreq = NULL;
 			err = -EIO;
 			goto error;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: 9p: fix possible refcount leak in p9_read_work()
  2022-07-12 10:44 [PATCH] net: 9p: fix possible refcount leak in p9_read_work() Hangyu Hua
@ 2022-07-15 22:25 ` asmadeus
  0 siblings, 0 replies; 2+ messages in thread
From: asmadeus @ 2022-07-15 22:25 UTC (permalink / raw)
  To: Hangyu Hua
  Cc: ericvh, lucho, linux_oss, davem, edumazet, kuba, pabeni,
	tomasbortoli, v9fs-developer, netdev, linux-kernel

Hangyu Hua wrote on Tue, Jul 12, 2022 at 06:44:38PM +0800:
> p9_req_put need to be called when m->rreq->rc.sdata is NULL to avoid
> possible refcount leak.
> 
> Fixes: 728356dedeff ("9p: Add refcount to p9_req_t")
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>

I realize I didn't reply to this -- I've reworded the commit message a
bit and queued it for 5.20:
https://github.com/martinetd/linux/commit/4ac7573e1f9333073fa8d303acc941c9b7ab7f61

I'll have a look at the RDMA path you pointed at once I can find time to
make this adapter work, and will credit you for it as well

--
Dominique

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-15 22:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-12 10:44 [PATCH] net: 9p: fix possible refcount leak in p9_read_work() Hangyu Hua
2022-07-15 22:25 ` asmadeus

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.