]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: 9p: fix refcount leak in p9_read_work() error handling
authorHangyu Hua <hbh25y@gmail.com>
Wed, 13 Jul 2022 00:55:11 +0000 (09:55 +0900)
committerDominique Martinet <asmadeus@codewreck.org>
Fri, 15 Jul 2022 11:22:21 +0000 (20:22 +0900)
p9_req_put need to be called when m->rreq->rc.sdata is NULL to avoid
temporary refcount leak.

Link: https://lkml.kernel.org/r/20220712104438.30800-1-hbh25y@gmail.com
Fixes: 10f61be1685d ("9p: Add refcount to p9_req_t")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
[Dominique: commit wording adjustments, p9_req_put argument fixes for rebase]
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
net/9p/trans_fd.c

index 007c3f45fe052c32fed305d18c923f87a2698a4a..e758978b44bee9a10963eb60cff042d7b129636d 100644 (file)
@@ -343,6 +343,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->client, m->rreq);
                        m->rreq = NULL;
                        err = -EIO;
                        goto error;