mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
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.
Fixes: 932d656217 ("xen/gntdev: Add initial support for dma-buf UAPI")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Message-ID: <20260916170956.2086505-1-vulab@iscas.ac.cn>
This commit is contained in:
parent
fcc43d1d6b
commit
6f165abe2b
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user