Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc797285 authored by Hangyu Hua's avatar Hangyu Hua Committed by Greg Kroah-Hartman
Browse files

misc: ocxl: fix possible refcount leak in afu_ioctl()



[ Upstream commit c3b69ba5114c860d730870c03ab4ee45276e5e35 ]

eventfd_ctx_put need to be called to put the refcount that gotten by
eventfd_ctx_fdget when ocxl_irq_set_handler fails.

Fixes: 06014661 ("ocxl: move event_fd handling to frontend")
Acked-by: default avatarFrederic Barrat <fbarrat@linux.ibm.com>
Signed-off-by: default avatarHangyu Hua <hbh25y@gmail.com>
Link: https://lore.kernel.org/r/20220824082600.36159-1-hbh25y@gmail.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 7ed37be3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -259,6 +259,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: