android_kernel_sony_sdm845/include
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jann Horn 943ebf4d8c splice: don't merge into linked buffers
commit a0ce2f0aa6ad97c3d4927bf2ca54bcebdf062d55 upstream.

Before this patch, it was possible for two pipes to affect each other after
data had been transferred between them with tee():

============
$ cat tee_test.c

int main(void) {
  int pipe_a[2];
  if (pipe(pipe_a)) err(1, "pipe");
  int pipe_b[2];
  if (pipe(pipe_b)) err(1, "pipe");
  if (write(pipe_a[1], "abcd", 4) != 4) err(1, "write");
  if (tee(pipe_a[0], pipe_b[1], 2, 0) != 2) err(1, "tee");
  if (write(pipe_b[1], "xx", 2) != 2) err(1, "write");

  char buf[5];
  if (read(pipe_a[0], buf, 4) != 4) err(1, "read");
  buf[4] = 0;
  printf("got back: '%s'\n", buf);
}
$ gcc -o tee_test tee_test.c
$ ./tee_test
got back: 'abxx'
$
============

As suggested by Al Viro, fix it by creating a separate type for
non-mergeable pipe buffers, then changing the types of buffers in
splice_pipe_to_pipe() and link_pipe().

Cc: <stable@vger.kernel.org>
Fixes: 7c77f0b3f9 ("splice: implement pipe to pipe splicing")
Fixes: 70524490ee ("[PATCH] splice: add support for sys_tee()")
Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-23 13:19:47 +01:00
..
acpi ACPICA: Reference Counts: increase max to 0x4000 for large servers 2019-03-19 13:14:07 +01:00
asm-generic locking/qspinlock: Pull in asm/byteorder.h to ensure correct endianness 2019-01-26 09:38:36 +01:00
clocksource
crypto crypto: vmac - separate tfm and request context 2018-08-17 20:59:29 +02:00
drm drm: disable uncached DMA optimization for ARM and arm64 2019-03-13 14:05:01 -07:00
dt-bindings dt-bindings: clock: mediatek: add binding for fixed-factor clock axisel_d4 2018-04-24 09:34:14 +02:00
keys KEYS: user: Align the payload buffer 2019-02-27 10:07:00 +01:00
kvm arm/arm64: KVM: Add PSCI version selection API 2018-05-09 09:50:19 +02:00
linux splice: don't merge into linked buffers 2019-03-23 13:19:47 +01:00
math-emu
media media: v4l: event: Prevent freeing event subscriptions while accessed 2018-10-03 17:01:55 -07:00
memory
misc
net phonet: fix building with clang 2019-03-23 13:19:44 +01:00
pcmcia
ras
rdma IB/core: Make testing MR flags for writability a static inline function 2018-08-15 18:14:43 +02:00
rxrpc
scsi scsi: sg: disable SET_FORCE_LOW_DMA 2018-01-23 19:57:04 +01:00
soc memory: tegra: Apply interrupts mask per SoC 2018-08-03 07:55:24 +02:00
sound ALSA: compress: Fix stop handling on compressed capture streams 2019-02-12 19:45:00 +01:00
target target: Avoid early CMD_T_PRE_EXECUTE failures during ABORT_TASK 2018-01-17 09:38:54 +01:00
trace ext4: force inode writes when nfsd calls commit_metadata() 2019-01-09 16:16:44 +01:00
uapi uapi/if_ether.h: move __UAPI_DEF_ETHHDR libc define 2019-02-20 10:18:35 +01:00
video udlfb: set optimal write delay 2018-09-09 20:01:25 +02:00
xen swiotlb-xen: implement xen_swiotlb_dma_mmap callback 2017-10-05 09:44:05 +02:00
Kbuild