FAILED: patch "[PATCH] xen/gntdev: Fix gntdev_dmabuf ref leak in dmabuf_exp_wait_released()" failed to apply to 6.18-stable tree
Subsystems (2)
Sasha Levin
maintainerThe patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 6f165abe2b40ede71c98956cd74cd17c18505e75
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 6f165abe2b40ede71c98956cd74cd17c18505e75 Mon Sep 17 00:00:00 2001
From: Wentao Liang <[email protected]>
Date: Wed, 16 Sep 2026 17:09:56 +0000
Subject: [PATCH] xen/gntdev: Fix gntdev_dmabuf ref leak in
dmabuf_exp_wait_released()
dmabuf_exp_wait_released() takes a reference on the exported gntdev_dmabuf with dmabuf_exp_wait_obj_get_dmabuf() and passes it to dmabuf_exp_wait_obj_new(), which drops that reference after adding the wait object to the wait list. When the wait object allocation fails, dmabuf_exp_wait_obj_new() returns ERR_PTR(-ENOMEM) early and the reference is never dropped, leaking a reference to the exported gntdev_dmabuf.
Drop the reference on the allocation failure path so the reference is consumed whether the wait object is created or not.
Message-ID: <[email protected]>
--- drivers/xen/gntdev-dmabuf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/xen/gntdev-dmabuf.c +3 -1
@@ -96,8 +96,10 @@ dmabuf_exp_wait_obj_new(struct gntdev_dmabuf_priv *priv,struct gntdev_dmabuf_wait_obj *obj; obj =kzalloc_obj (*obj); -if (!obj) +if (!obj) { +kref_put (&gntdev_dmabuf->u.exp.refcount, dmabuf_exp_release);return ERR_PTR (-ENOMEM ); + }init_completion (&obj->completion); obj->gntdev_dmabuf = gntdev_dmabuf;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 xen/gntdev: Fix gntdev_dmabuf ref leak in dmabuf_exp_wait_released()
From: Wentao Liang <[email protected]>
[ Upstream commit 6f165abe2b40ede71c98956cd74cd17c18505e75 ]
dmabuf_exp_wait_released() takes a reference on the exported gntdev_dmabuf with dmabuf_exp_wait_obj_get_dmabuf() and passes it to dmabuf_exp_wait_obj_new(), which drops that reference after adding the wait object to the wait list. When the wait object allocation fails, dmabuf_exp_wait_obj_new() returns ERR_PTR(-ENOMEM) early and the reference is never dropped, leaking a reference to the exported gntdev_dmabuf.
Drop the reference on the allocation failure path so the reference is consumed whether the wait object is created or not.
Message-ID: <[email protected]>
--- drivers/xen/gntdev-dmabuf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/xen/gntdev-dmabuf.c +3 -1
@@ -96,8 +96,10 @@ dmabuf_exp_wait_obj_new(struct gntdev_dmabuf_priv *priv,struct gntdev_dmabuf_wait_obj *obj; obj =kzalloc (sizeof (*obj),GFP_KERNEL ); -if (!obj) +if (!obj) { +kref_put (&gntdev_dmabuf->u.exp.refcount, dmabuf_exp_release);return ERR_PTR (-ENOMEM ); + }init_completion (&obj->completion); obj->gntdev_dmabuf = gntdev_dmabuf;
Signature · 1 line
2.53.0