usb: misc: fix refcount leak in get_1284_register()
Subsystems (2)
PATCH 1/1 usb: misc: fix refcount leak in get_1284_register()
In get_1284_register(), submit_async_request() returns an "rq" object with a caller's reference. If the subsequent wait_for_completion_timeout() times out, the error path calls kill_all_async_requests_priv() to cancel pending URBs, but it fails to drop that caller's reference. All other paths (early exit on !val and the successful completion path) correctly call kref_put() to release the reference. This leak results in the memory allocated for the request never being freed.
Fix the timeout path by adding the missing kref_put() call before returning -EIO.
Fixes 0f36163d3abe ("[PATCH] usb: fix uss720 schedule with interrupts off")
Signed-off-by WenTao Liang <[email protected]>
--- drivers/usb/misc/uss720.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/misc/uss720.c +1 -0
@@ -223,6 +223,7 @@ static int get_1284_register(struct parport *pp, unsigned char reg, unsigned cha }printk (KERN_WARNING "get_1284_register timeout\n" );kill_all_async_requests_priv (priv); +kref_put (&rq->ref_count, destroy_async);return -EIO ; }
Signature · 1 line
2.50.1 (Apple Git-155)