summaryrefslogtreecommitdiffstats
path: root/drivers/clk/clk-qoriq.c
diff options
context:
space:
mode:
authorBen Wolsieffer <benwolsieffer@gmail.com>2018-11-04 00:32:20 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-11 20:47:39 +0100
commit5a96b2d38dc054c0bbcbcd585b116566cbd877fe (patch)
tree9e00fb3a1d66b11568e2820b30bd422941bec702 /drivers/clk/clk-qoriq.c
parentstaging: mt7621-pinctrl: fix uninitialized variable ngroups (diff)
downloadlinux-5a96b2d38dc054c0bbcbcd585b116566cbd877fe.tar.xz
linux-5a96b2d38dc054c0bbcbcd585b116566cbd877fe.zip
staging: vchiq_arm: fix compat VCHIQ_IOC_AWAIT_COMPLETION
The compatibility ioctl wrapper for VCHIQ_IOC_AWAIT_COMPLETION assumes that the native ioctl always uses a message buffer and decrements msgbufcount. Certain message types do not use a message buffer and in this case msgbufcount is not decremented, and completion->header for the message is NULL. Because the wrapper unconditionally decrements msgbufcount, the calling process may assume that a message buffer has been used even when it has not. This results in a memory leak in the userspace code that interfaces with this driver. When msgbufcount is decremented, the userspace code assumes that the buffer can be freed though the reference in completion->header, which cannot happen when the reference is NULL. This patch causes the wrapper to only decrement msgbufcount when the native ioctl decrements it. Note that we cannot simply copy the native ioctl's value of msgbufcount, because the wrapper only retrieves messages from the native ioctl one at a time, while userspace may request multiple messages. See https://github.com/raspberrypi/linux/pull/2703 for more discussion of this patch. Fixes: 5569a1260933 ("staging: vchiq_arm: Add compatibility wrappers for ioctls") Signed-off-by: Ben Wolsieffer <benwolsieffer@gmail.com> Acked-by: Stefan Wahren <stefan.wahren@i2se.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/clk/clk-qoriq.c')
0 files changed, 0 insertions, 0 deletions