summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorJunhao Xie <bigfoot@radxa.com>2025-10-17 16:39:06 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-10-29 14:09:01 +0100
commite17b13387827adce7acb19ac0f07f9bcafe0ff4c (patch)
tree8be8d339f5e83802fc5737086b6ff711de256830 /drivers/misc
parentfe408f5759cd67e4acb09409d79fb717cacbcef2 (diff)
downloadlinux-e17b13387827adce7acb19ac0f07f9bcafe0ff4c.tar.gz
linux-e17b13387827adce7acb19ac0f07f9bcafe0ff4c.tar.bz2
linux-e17b13387827adce7acb19ac0f07f9bcafe0ff4c.zip
misc: fastrpc: Fix dma_buf object leak in fastrpc_map_lookup
commit fff111bf45cbeeb659324316d68554e35d350092 upstream. In fastrpc_map_lookup, dma_buf_get is called to obtain a reference to the dma_buf for comparison purposes. However, this reference is never released when the function returns, leading to a dma_buf memory leak. Fix this by adding dma_buf_put before returning from the function, ensuring that the temporarily acquired reference is properly released regardless of whether a matching map is found. Fixes: 9031626ade38 ("misc: fastrpc: Fix fastrpc_map_lookup operation") Cc: stable@kernel.org Signed-off-by: Junhao Xie <bigfoot@radxa.com> Tested-by: Xilin Wu <sophon@radxa.com> Link: https://lore.kernel.org/stable/48B368FB4C7007A7%2B20251017083906.3259343-1-bigfoot%40radxa.com Link: https://patch.msgid.link/48B368FB4C7007A7+20251017083906.3259343-1-bigfoot@radxa.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/fastrpc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index 9d8e51351ff8..d6c55c338b06 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -384,6 +384,8 @@ static int fastrpc_map_lookup(struct fastrpc_user *fl, int fd,
}
spin_unlock(&fl->lock);
+ dma_buf_put(buf);
+
return ret;
}