linux/include
Eric Dumazet fa9b0c17c9 tcp: fix use after free in tcp_xmit_retransmit_queue()
[ Upstream commit bb1fceca22 ]

When tcp_sendmsg() allocates a fresh and empty skb, it puts it at the
tail of the write queue using tcp_add_write_queue_tail()

Then it attempts to copy user data into this fresh skb.

If the copy fails, we undo the work and remove the fresh skb.

Unfortunately, this undo lacks the change done to tp->highest_sack and
we can leave a dangling pointer (to a freed skb)

Later, tcp_xmit_retransmit_queue() can dereference this pointer and
access freed memory. For regular kernels where memory is not unmapped,
this might cause SACK bugs because tcp_highest_sack_seq() is buggy,
returning garbage instead of tp->snd_nxt, but with various debug
features like CONFIG_DEBUG_PAGEALLOC, this can crash the kernel.

This bug was found by Marco Grassi thanks to syzkaller.

Fixes: 6859d49475 ("[TCP]: Abstract tp->highest_sack accessing & point to next skb")
Reported-by: Marco Grassi <marco.gra@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Reviewed-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
History 2016-12-23 09:41:56 -05:00
..
acpi ACPICA: Tables: Fix an issue that FACS initialization is performed twice 2015-08-04 14:33:56 -04:00
asm-generic asm-generic: make get_user() clear the destination on errors 2016-10-05 22:40:20 -04:00
clocksource ARM: pxa: Add non device-tree timer link to clocksource 2014-07-23 12:02:39 +02:00
crypto crypto: af_alg - Allow af_af_alg_release_parent to be called on nokey path 2016-02-09 22:57:33 -05:00
drm drm/ttm: Make ttm_bo_mem_compat available 2016-08-07 21:44:43 -04:00
dt-bindings The fixes for the clock framework are all regressions in drivers, plus a 2014-11-25 17:52:56 -08:00
keys KEYS: Restore partial ID matching functionality for asymmetric keys 2014-10-06 15:21:05 +01:00
kvm arm/arm64: KVM: Keep elrsr/aisr in sync with software model 2015-05-11 07:07:37 -04:00
linux can: dev: fix deadlock reported after bus-off 2016-12-23 09:41:16 -05:00
math-emu math-emu: fix floating-point to integer overflow detection 2014-01-07 18:36:24 -06:00
media Merge branch 'patchwork' into v4l_for_linus 2014-10-09 14:00:54 -03:00
memory ddr: add LPDDR2 data from JESD209-2 2012-05-02 00:04:06 -07:00
misc cxl: Add new header for call backs and structs 2014-10-08 20:15:43 +11:00
net tcp: fix use after free in tcp_xmit_retransmit_queue() 2016-12-23 09:41:56 -05:00
pcmcia pcmcia/ds.h: introduce helper for pcmcia_driver module boilerplate 2013-03-15 12:26:03 -07:00
ras PCI/AER: Rename PCI_ERR_UNC_TRAIN to PCI_ERR_UNC_UND 2014-09-25 09:42:40 -06:00
rdma IB/security: Restrict use of the write() interface 2016-05-17 14:51:48 -04:00
rxrpc include/rxrpc/types.h: Remove unused header 2014-08-29 20:33:39 -07:00
scsi SCSI: add 1024 max sectors black list flag 2015-08-06 14:49:50 -04:00
soc/tegra ARM: tegra: Convert PMC to a driver 2014-07-17 14:58:43 +02:00
sound ALSA: pcm: More kerneldoc updates 2016-03-04 10:18:43 -05:00
target target: Fix remote-port TMR ABORT + se_cmd fabric stop 2016-03-05 22:13:44 -05:00
trace regmap: introduce regmap_name to fix syscon regmap trace events 2015-04-16 20:11:29 -04:00
uapi [media] v4l2-dv-timings.h: fix polarity for 4k formats 2016-05-17 14:31:59 -04:00
video fbdev changes for 3.18 2014-10-18 18:03:02 -07:00
xen x86/xen: Support kexec/kdump in HVM guests by doing a soft reset 2015-10-27 22:13:13 -04:00
Kbuild UAPI: remove empty Kbuild files 2013-04-30 17:04:09 -07:00