diff options
| author | Mark Brown <broonie@kernel.org> | 2026-08-28 13:34:53 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-08-28 13:34:53 +0100 |
| commit | 3ab5a84fe12f0df60b983ace94124cd89c0914dd (patch) | |
| tree | 5f3f6ac46ee799da19217c89b20cb2958b9a5dcb /drivers/misc/fastrpc.c | |
| parent | c7398d8634178c26a5139226444b44d4cd7407dc (diff) | |
| parent | 20839d02c0cf7437bc508d4c5430538d9dc4f428 (diff) | |
| download | linux-next-pending-fixes.tar.gz linux-next-pending-fixes.zip | |
Merge branch 'for-linux-next-fixes' of https://gitlab.freedesktop.org/drm/misc/kernel.gitpending-fixes
# Conflicts:
# drivers/accel/ethosu/ethosu_drv.c
# drivers/gpu/drm/nouveau/nvkm/engine/disp/head.h
# drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/disp.c
Diffstat (limited to 'drivers/misc/fastrpc.c')
| -rw-r--r-- | drivers/misc/fastrpc.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 90fd669636ec..d4fac2caca86 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1822,24 +1822,20 @@ static int fastrpc_dmabuf_alloc(struct fastrpc_user *fl, char __user *argp) return err; } - bp.fd = dma_buf_fd(buf->dmabuf, O_ACCMODE); + bp.fd = get_unused_fd_flags(O_ACCMODE); if (bp.fd < 0) { dma_buf_put(buf->dmabuf); - return -EINVAL; + return bp.fd; } if (copy_to_user(argp, &bp, sizeof(bp))) { - /* - * The usercopy failed, but we can't do much about it, as - * dma_buf_fd() already called fd_install() and made the - * file descriptor accessible for the current process. It - * might already be closed and dmabuf no longer valid when - * we reach this point. Therefore "leak" the fd and rely on - * the process exit path to do any required cleanup. - */ + put_unused_fd(bp.fd); + dma_buf_put(buf->dmabuf); return -EFAULT; } + dma_buf_fd_install(buf->dmabuf, bp.fd); + return 0; } |
