linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Ross Lagerwall <ross.lagerwall@citrix.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 4.20 003/117] net: Fix usage of pskb_trim_rcsum
Date: Tue, 29 Jan 2019 12:34:14 +0100	[thread overview]
Message-ID: <20190129113207.672800744@linuxfoundation.org> (raw)
In-Reply-To: <20190129113207.477505932@linuxfoundation.org>

4.20-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ross Lagerwall <ross.lagerwall@citrix.com>

[ Upstream commit 6c57f0458022298e4da1729c67bd33ce41c14e7a ]

In certain cases, pskb_trim_rcsum() may change skb pointers.
Reinitialize header pointers afterwards to avoid potential
use-after-frees. Add a note in the documentation of
pskb_trim_rcsum(). Found by KASAN.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ppp/pppoe.c                  |    1 +
 include/linux/skbuff.h                   |    1 +
 net/bridge/br_netfilter_ipv6.c           |    1 +
 net/bridge/netfilter/nft_reject_bridge.c |    1 +
 net/ipv4/ip_input.c                      |    1 +
 5 files changed, 5 insertions(+)

--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -445,6 +445,7 @@ static int pppoe_rcv(struct sk_buff *skb
 	if (pskb_trim_rcsum(skb, len))
 		goto drop;
 
+	ph = pppoe_hdr(skb);
 	pn = pppoe_pernet(dev_net(dev));
 
 	/* Note that get_item does a sock_hold(), so sk_pppox(po)
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -3204,6 +3204,7 @@ int pskb_trim_rcsum_slow(struct sk_buff
  *
  *	This is exactly the same as pskb_trim except that it ensures the
  *	checksum of received packets are still valid after the operation.
+ *	It can change skb pointers.
  */
 
 static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
--- a/net/bridge/br_netfilter_ipv6.c
+++ b/net/bridge/br_netfilter_ipv6.c
@@ -131,6 +131,7 @@ int br_validate_ipv6(struct net *net, st
 					IPSTATS_MIB_INDISCARDS);
 			goto drop;
 		}
+		hdr = ipv6_hdr(skb);
 	}
 	if (hdr->nexthdr == NEXTHDR_HOP && br_nf_check_hbh_len(skb))
 		goto drop;
--- a/net/bridge/netfilter/nft_reject_bridge.c
+++ b/net/bridge/netfilter/nft_reject_bridge.c
@@ -229,6 +229,7 @@ static bool reject6_br_csum_ok(struct sk
 	    pskb_trim_rcsum(skb, ntohs(ip6h->payload_len) + sizeof(*ip6h)))
 		return false;
 
+	ip6h = ipv6_hdr(skb);
 	thoff = ipv6_skip_exthdr(skb, ((u8*)(ip6h+1) - skb->data), &proto, &fo);
 	if (thoff < 0 || thoff >= skb->len || (fo & htons(~0x7)) != 0)
 		return false;
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -489,6 +489,7 @@ static struct sk_buff *ip_rcv_core(struc
 		goto drop;
 	}
 
+	iph = ip_hdr(skb);
 	skb->transport_header = skb->network_header + iph->ihl*4;
 
 	/* Remove any debris in the socket control block */



  parent reply	other threads:[~2019-01-29 11:37 UTC|newest]

Thread overview: 124+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-29 11:34 [PATCH 4.20 000/117] 4.20.6-stable review Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 001/117] amd-xgbe: Fix mdio access for non-zero ports and clause 45 PHYs Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 002/117] net: bridge: Fix ethernet header pointer before check skb forwardable Greg Kroah-Hartman
2019-01-29 11:34 ` Greg Kroah-Hartman [this message]
2019-01-29 11:34 ` [PATCH 4.20 004/117] net: phy: marvell: Errata for mv88e6390 internal PHYs Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 005/117] net: phy: mdio_bus: add missing device_del() in mdiobus_register() error handling Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 006/117] net: phy: phy driver features are mandatory Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 007/117] net/sched: act_tunnel_key: fix memory leak in case of action replace Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 008/117] net_sched: refetch skb protocol for each filter Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 009/117] openvswitch: Avoid OOB read when parsing flow nlattrs Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 010/117] vhost: log dirty page correctly Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 011/117] mlxsw: pci: Increase PCI SW reset timeout Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 012/117] net: ipv4: Fix memory leak in network namespace dismantle Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 013/117] mlxsw: spectrum_fid: Update dummy FID index Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 014/117] mlxsw: pci: Ring CQs doorbell before RDQs Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 015/117] net/sched: cls_flower: allocate mask dynamically in fl_change() Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 016/117] udp: with udp_segment release on error path Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 017/117] ip6_gre: fix tunnel list corruption for x-netns Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 018/117] erspan: build the header with the right proto according to erspan_ver Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 019/117] net: phy: marvell: Fix deadlock from wrong locking Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 020/117] ip6_gre: update version related info when changing link Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 021/117] tcp: allow MSG_ZEROCOPY transmission also in CLOSE_WAIT state Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 022/117] ARM: fix the cockup in the previous patch Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 023/117] SUNRPC: Address Kerberos performance/behavior regression Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 024/117] mei: me: mark LBG devices as having dma support Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 025/117] mei: me: add denverton innovation engine device IDs Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 026/117] USB: leds: fix regression in usbport led trigger Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 027/117] USB: EHCI: ehci-mv: add MODULE_DEVICE_TABLE Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 028/117] USB: serial: ftdi_sio: fix GPIO not working in autosuspend Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 029/117] USB: serial: simple: add Motorola Tetra TPG2200 device id Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 030/117] USB: serial: pl2303: add new PID to support PL2303TB Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 031/117] ceph: clear inode pointer when snap realm gets dropped by its inode Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 032/117] ASoC: atom: fix a missing check of snd_pcm_lib_malloc_pages Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 033/117] ASoC: rt5514-spi: Fix potential NULL pointer dereference Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 034/117] ASoC: tlv320aic32x4: Kernel OOPS while entering DAPM standby mode Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 035/117] clk: zynqmp: Fix memory allocation in zynqmp_clk_setup Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 036/117] clk: socfpga: stratix10: fix rate calculation for pll clocks Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 037/117] clk: socfpga: stratix10: fix naming convention for the fixed-clocks Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 038/117] inotify: Fix fd refcount leak in inotify_add_watch() Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 039/117] ALSA: hda/realtek - Fix typo for ALC225 model Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 040/117] ALSA: hda - Add mute LED support for HP ProBook 470 G5 Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 041/117] ARCv2: lib: memeset: fix doing prefetchw outside of buffer Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 042/117] ARC: adjust memblock_reserve of kernel memory Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 043/117] ARC: perf: map generic branches to correct hardware condition Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 044/117] s390/vdso: correct vdso mapping for compat tasks Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 045/117] s390/mm: always force a load of the primary ASCE on context switch Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 046/117] s390/early: improve machine detection Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 047/117] s390/smp: fix CPU hotplug deadlock with CPU rescan Greg Kroah-Hartman
2019-01-29 11:34 ` [PATCH 4.20 048/117] s390/smp: Fix calling smp_call_ipl_cpu() from ipl CPU Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 049/117] misc: ibmvsm: Fix potential NULL pointer dereference Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 050/117] char/mwave: fix potential Spectre v1 vulnerability Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 051/117] mmc: sdhci-iproc: handle mmc_of_parse() errors during probe Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 052/117] mmc: dw_mmc-bluefield: : Fix the license information Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 053/117] mmc: meson-gx: Free irq in release() callback Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 054/117] staging: rtl8188eu: Add device code for D-Link DWA-121 rev B1 Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 055/117] tty: Handle problem if line discipline does not have receive_buf Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 056/117] uart: Fix crash in uart_write and uart_put_char Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 057/117] tty/n_hdlc: fix __might_sleep warning Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 058/117] hv_balloon: avoid touching uninitialized struct page during tail onlining Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 059/117] Drivers: hv: vmbus: Check for ring when getting debug info Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 060/117] vgacon: unconfuse vc_origin when using soft scrollback Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 061/117] CIFS: Fix possible hang during async MTU reads and writes Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 062/117] CIFS: Fix credits calculations for reads with errors Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 063/117] CIFS: Fix credit calculation for encrypted " Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 064/117] CIFS: Do not reconnect TCP session in add_credits() Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 065/117] smb3: add credits we receive from oplock/break PDUs Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 066/117] Input: xpad - add support for SteelSeries Stratus Duo Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 067/117] Input: input_event - provide override for sparc64 Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 068/117] Input: uinput - fix undefined behavior in uinput_validate_absinfo() Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 069/117] acpi/nfit: Block function zero DSMs Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 070/117] acpi/nfit: Fix command-supported detection Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 071/117] scsi: ufs: Use explicit access size in ufshcd_dump_regs Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 072/117] dm thin: fix passdown_double_checking_shared_status() Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 073/117] dm crypt: fix parsing of extended IV arguments Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 074/117] drm/amdgpu: Add APTX quirk for Lenovo laptop Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 075/117] EDAC, altera: Fix S10 persistent register offset Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 076/117] KVM: x86: Fix single-step debugging Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 077/117] KVM: x86: Fix PV IPIs for 32-bit KVM host Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 078/117] KVM: x86: WARN_ONCE if sending a PV IPI returns a fatal error Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 079/117] kvm: x86/vmx: Use kzalloc for cached_vmcs12 Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 080/117] x86/pkeys: Properly copy pkey state at fork() Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 081/117] x86/selftests/pkeys: Fork() to check for state being preserved Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 082/117] x86/kaslr: Fix incorrect i8254 outb() parameters Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 083/117] x86/entry/64/compat: Fix stack switching for XEN PV Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 084/117] posix-cpu-timers: Unbreak timer rearming Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 085/117] net: sun: cassini: Cleanup license conflict Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 086/117] irqchip/gic-v3-its: Align PCI Multi-MSI allocation on their size Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 087/117] can: dev: __can_get_echo_skb(): fix bogous check for non-existing skb by removing it Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 088/117] can: bcm: check timer values before ktime conversion Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 089/117] can: flexcan: fix NULL pointer exception during bringup Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 090/117] vt: make vt_console_print() compatible with the unicode screen buffer Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 091/117] vt: always call notifier with the console lock held Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 092/117] vt: invoke notifier on screen size change Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 093/117] drm/meson: Fix atomic mode switching regression Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 094/117] bpf: move {prev_,}insn_idx into verifier env Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 095/117] bpf: move tmp variable into ax register in interpreter Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 096/117] nvmet-rdma: Add unlikely for response allocated check Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 097/117] nvmet-rdma: fix null dereference under heavy load Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 098/117] bpf: enable access to ax register also from verifier rewrite Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 099/117] bpf: restrict map value pointer arithmetic for unprivileged Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 100/117] bpf: restrict stack " Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 101/117] bpf: restrict unknown scalars of mixed signed bounds " Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 102/117] bpf: fix check_map_access smin_value test when pointer contains offset Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 103/117] bpf: prevent out of bounds speculation on pointer arithmetic Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 104/117] bpf: fix sanitation of alu op with pointer / scalar type from different paths Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 105/117] bpf: fix inner map masking to prevent oob under speculation Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 106/117] Drivers: hv: vmbus: Remove the useless API vmbus_get_outgoing_channel() Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 107/117] vmbus: fix subchannel removal Greg Kroah-Hartman
2019-01-29 11:35 ` [PATCH 4.20 108/117] Revert "mm, memory_hotplug: initialize struct pages for the full memory section" Greg Kroah-Hartman
2019-01-29 11:36 ` [PATCH 4.20 109/117] usb: dwc3: gadget: Clear req->needs_extra_trb flag on cleanup Greg Kroah-Hartman
2019-01-29 11:36 ` [PATCH 4.20 110/117] mt76x0: do not overwrite other MT_BBP(AGC, 8) fields Greg Kroah-Hartman
2019-01-29 11:36 ` [PATCH 4.20 111/117] mt76x0: use band parameter for LC calibration Greg Kroah-Hartman
2019-01-29 11:36 ` [PATCH 4.20 112/117] mt76x02: run calibration after scanning Greg Kroah-Hartman
2019-01-29 11:36 ` [PATCH 4.20 113/117] mt76x02: assure we update gain after scan Greg Kroah-Hartman
2019-01-29 11:36 ` [PATCH 4.20 114/117] mt76x0: do not perform MCU calibration for MT7630 Greg Kroah-Hartman
2019-01-29 11:36 ` [PATCH 4.20 115/117] mt76x0: antenna select corrections Greg Kroah-Hartman
2019-01-29 11:36 ` [PATCH 4.20 116/117] mt76x0: phy: unify calibration between mt76x0u and mt76x0e Greg Kroah-Hartman
2019-01-29 11:36 ` [PATCH 4.20 117/117] ide: fix a typo in the settings proc file name Greg Kroah-Hartman
2019-01-30  2:07 ` [PATCH 4.20 000/117] 4.20.6-stable review shuah
2019-01-30  6:49   ` Greg Kroah-Hartman
2019-01-30 13:34 ` Naresh Kamboju
2019-01-31  7:52   ` Greg Kroah-Hartman
2019-01-30 22:14 ` Guenter Roeck
2019-01-31  7:18   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190129113207.672800744@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ross.lagerwall@citrix.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).