misc: ocxl: fix possible refcount leak in afu_ioctl()
Subsystems (2)
PATCH 1/1 misc: ocxl: fix possible refcount leak in afu_ioctl()
eventfd_ctx_put need to be called to put the refcount that gotten by eventfd_ctx_fdget when ocxl_irq_set_handler fails.
Fixes 060146614643 ("ocxl: move event_fd handling to frontend")
Signed-off-by Hangyu Hua <[email protected]>
--- drivers/misc/ocxl/file.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/misc/ocxl/file.c +2 -0
@@ -257,6 +257,8 @@ static long afu_ioctl(struct file *file, unsigned int cmd,if (IS_ERR (ev_ctx))return PTR_ERR (ev_ctx); rc =ocxl_irq_set_handler (ctx, irq_id, irq_handler, irq_free, ev_ctx); +if (rc) +eventfd_ctx_put (ev_ctx);break ;case OCXL_IOCTL_GET_METADATA :
Signature · 1 line
2.25.1
Quoted 6 lines · Hangyu Hua
eventfd_ctx_putneed to be called to put the refcount that gotten byeventfd_ctx_fdgetwhenocxl_irq_set_handlerfails.Fixes 060146614643 ("ocxl: move event_fd handling to frontend")Signed-off-by Hangyu Hua <[email protected]>---
Thanks for fixing it! LGTM
Acked-by Frederic Barrat <[email protected]>
Fred
Quoted 16 lines
drivers/misc/ocxl/file.c | 2 ++ 1 file changed, 2 insertions(+)drivers/misc/ocxl/file.c +2
-0@@ -257,6 +257,8 @@ static long afu_ioctl(struct file *file, unsigned int cmd,if (IS_ERR (ev_ctx))return PTR_ERR (ev_ctx); rc =ocxl_irq_set_handler (ctx, irq_id, irq_handler, irq_free, ev_ctx); +if (rc) +eventfd_ctx_put (ev_ctx);break ;case OCXL_IOCTL_GET_METADATA :