]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
fuse: Don't access pipe->buffers without pipe_lock()
authorAndrey Ryabinin <aryabinin@virtuozzo.com>
Tue, 17 Jul 2018 16:00:33 +0000 (19:00 +0300)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 23 Apr 2019 15:51:47 +0000 (17:51 +0200)
commit3b3caf8ef9a669e82b59a9a4fec63cc2dd9391e8
tree07c2e4bce53c20f4bc053d91e9fb7ac6f4ade3c9
parentbea53fb3df56dc50b7323af1f855516b834153fe
fuse: Don't access pipe->buffers without pipe_lock()

BugLink: https://bugs.launchpad.net/bugs/1824553
fuse_dev_splice_write() reads pipe->buffers to determine the size of
'bufs' array before taking the pipe_lock(). This is not safe as
another thread might change the 'pipe->buffers' between the allocation
and taking the pipe_lock(). So we end up with too small 'bufs' array.

Move the bufs allocations inside pipe_lock()/pipe_unlock() to fix this.

Fixes: dd3bb14f44a6 ("fuse: support splice() writing to fuse device")
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: <stable@vger.kernel.org> # v2.6.35
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
(backported from commit a2477b0e67c52f4364a47c3ad70902bc2a61bd4c)
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
fs/fuse/dev.c