Skip to contentSkip to conversation

net: 9p: fix refcount leak in p9_read_work() error handling

PATCH Applied Alexander Martyniuk 2 participants 2 messages Jun 18 – Jun 20

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: 9p: fix refcount leak in p9_read_work() error handling

From: Hangyu Hua <[email protected]>

commit 4ac7573e1f9333073fa8d303acc941c9b7ab7f61 upstream.

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

Fixes 728356dedeff ("9p: Add refcount to p9_req_t")
[Dominique: commit wording adjustments, p9_req_put argument fixes for rebase]

[Alexander: this branch doesn't contain 8b11ff098af4 ("9p: Add client parameter
to p9_req_put()"), therefore the parameter is removed from the added line]

---
Backport fix for CVE-2022-50114

 net/9p/trans_fd.c | 1 +
 1 file changed, 1 insertion(+)
net/9p/trans_fd.c +1 -0
index 40d458c438df..bd6a54e6f427 100644
@@ -346,6 +346,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;
Signature · 1 line
2.47.3
maintainer Applied
#1 lore raw
Quoted 1 line

[PATCH 5.10] net: 9p: fix refcount leak in p9_read_work() error handling

Queued for 5.10, thanks.

Signature · 2 lines
Thanks,
Sasha