diff mbox series

net: 9p: fix possible refcount leak in p9_read_work()

Message ID 20220712104438.30800-1-hbh25y@gmail.com (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series net: 9p: fix possible refcount leak in p9_read_work() | expand

Checks

Context Check Description
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 11 of 11 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Hangyu Hua July 12, 2022, 10:44 a.m. UTC
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(+)

Comments

Dominique Martinet July 15, 2022, 10:25 p.m. UTC | #1
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
diff mbox series

Patch

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;