diff options
author | Mathias Krause <minipli@grsecurity.net> | 2022-01-27 16:02:18 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-02-03 18:45:39 +0300 |
commit | 46963e2e0629cb31c96b1d47ddd89dc3d8990b34 (patch) | |
tree | 75790bb0da32d9c87696b9983f05d244ac85adca /drivers/net | |
parent | 26291c54e111ff6ba87a164d85d4a4e134b7315c (diff) | |
download | linux-46963e2e0629cb31c96b1d47ddd89dc3d8990b34.tar.xz |
misc: fastrpc: avoid double fput() on failed usercopy
If the copy back to userland fails for the FASTRPC_IOCTL_ALLOC_DMA_BUFF
ioctl(), we shouldn't assume that 'buf->dmabuf' is still valid. In fact,
dma_buf_fd() called fd_install() before, i.e. "consumed" one reference,
leaving us with none.
Calling dma_buf_put() will therefore put a reference we no longer own,
leading to a valid file descritor table entry for an already released
'file' object which is a straight use-after-free.
Simply avoid calling dma_buf_put() and rely on the process exit code to
do the necessary cleanup, if needed, i.e. if the file descriptor is
still valid.
Fixes: 6cffd79504ce ("misc: fastrpc: Add support for dmabuf exporter")
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Mathias Krause <minipli@grsecurity.net>
Link: https://lore.kernel.org/r/20220127130218.809261-1-minipli@grsecurity.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net')
0 files changed, 0 insertions, 0 deletions