3.18.134-stable review
Subsystems (3)
Greg Kroah-Hartman
maintainercover 3.18.134-stable review
This is the start of the stable review cycle for the 3.18.134 release. There are 31 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed Feb 6 10:35:28 UTC 2019. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v3.x/stable-review/patch-3.18.134-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-3.18.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.18.134-rc1
David Hildenbrand <[email protected]>
mm: migrate: don't rely on __PageMovable() of newpage after unlocking it
Shakeel Butt <[email protected]>
mm, oom: fix use-after-free in oom_kill_process
João Paulo Rechi Vita <[email protected]>
platform/x86: asus-nb-wmi: Drop mapping of 0x33 and 0x34 scan codes
João Paulo Rechi Vita <[email protected]>
platform/x86: asus-nb-wmi: Map 0x35 to KEY_SCREENLOCK
Andreas Gruenbacher <[email protected]>
gfs2: Revert "Fix loop in gfs2_rbm_find"
James Morse <[email protected]>
arm64: hyp-stub: Forbid kprobing of the hyp-stub
Waiman Long <[email protected]>
fs/dcache: Fix incorrect nr_dentry_unused accounting in shrink_dcache_sb()
Pavel Shilovsky <[email protected]>
CIFS: Do not count -ENODATA as failure for query directory
Jacob Wen <[email protected]>
l2tp: fix reading optional fields of L2TPv3
Lorenzo Bianconi <[email protected]>
l2tp: remove l2specific_len dependency in l2tp_core
Mathias Thore <[email protected]>
ucc_geth: Reset BQL queue when stopping device
Bernard Pidoux <[email protected]>
net/rose: fix NULL ax25_cb kernel panic
Cong Wang <[email protected]>
netrom: switch to sock timer API
Jacob Wen <[email protected]>
l2tp: copy 4 more bytes to linear part if necessary
David Ahern <[email protected]>
ipv6: Consider sk_bound_dev_if when binding a socket to an address
Pan Bian <[email protected]>
f2fs: read page index before freeing
Milian Wolff <[email protected]>
perf unwind: Take pgoff into account when reporting elf to libdwfl
Martin Vuille <[email protected]>
perf unwind: Unwind with libdw doesn't take symfs into account
Nicolas Pitre <[email protected]>
vt: invoke notifier on screen size change
Oliver Hartkopp <[email protected]>
can: bcm: check timer values before ktime conversion
Manfred Schlaegl <[email protected]>
can: dev: __can_get_echo_skb(): fix bogous check for non-existing skb by removing it
Daniel Drake <[email protected]>
x86/kaslr: Fix incorrect i8254 outb() parameters
Tom Panfil <[email protected]>
Input: xpad - add support for SteelSeries Stratus Duo
Pavel Shilovsky <[email protected]>
CIFS: Fix possible hang during async MTU reads and writes
Paul Fulghum <[email protected]>
tty/n_hdlc: fix __might_sleep warning
Greg Kroah-Hartman <[email protected]>
tty: Handle problem if line discipline does not have receive_buf
Michael Straube <[email protected]>
staging: rtl8188eu: Add device code for D-Link DWA-121 rev B1
Gerald Schaefer <[email protected]>
s390/smp: fix CPU hotplug deadlock with CPU rescan
Charles Yeh <[email protected]>
USB: serial: pl2303: add new PID to support PL2303TB
Max Schulze <[email protected]>
USB: serial: simple: add Motorola Tetra TPG2200 device id
Ross Lagerwall <[email protected]>
openvswitch: Avoid OOB read when parsing flow nlattrs
-------------
Diffstat:
Makefile | 4 +-- arch/arm64/kernel/hyp-stub.S | 2 ++ arch/s390/kernel/smp.c | 4 +++ arch/x86/boot/compressed/aslr.c | 4 +-- drivers/input/joystick/xpad.c | 3 ++ drivers/net/can/dev.c | 27 +++++++++--------- drivers/net/ethernet/freescale/ucc_geth.c | 2 ++ drivers/platform/x86/asus-nb-wmi.c | 3 +- drivers/s390/char/sclp_config.c | 2 ++ drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 + drivers/tty/n_hdlc.c | 1 + drivers/tty/tty_io.c | 3 +- drivers/tty/vt/vt.c | 1 + drivers/usb/serial/pl2303.c | 1 + drivers/usb/serial/pl2303.h | 2 ++ drivers/usb/serial/usb-serial-simple.c | 3 +- fs/cifs/smb2ops.c | 6 ++-- fs/cifs/smb2pdu.c | 4 +-- fs/dcache.c | 6 +--- fs/f2fs/node.c | 4 ++- fs/gfs2/rgrp.c | 2 +- mm/migrate.c | 7 +++-- mm/oom_kill.c | 8 ++++++ net/can/bcm.c | 27 ++++++++++++++++++ net/ipv6/af_inet6.c | 3 ++ net/l2tp/l2tp_core.c | 43 +++++++++++++++-------------- net/l2tp/l2tp_core.h | 31 +++++++++++++++++++++ net/l2tp/l2tp_ip.c | 3 ++ net/l2tp/l2tp_ip6.c | 3 ++ net/netrom/nr_timer.c | 20 +++++++------- net/openvswitch/flow_netlink.c | 2 +- net/rose/rose_route.c | 5 ++++ tools/perf/util/unwind-libdw.c | 4 +-- 33 files changed, 171 insertions(+), 70 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/31 openvswitch: Avoid OOB read when parsing flow nlattrs
3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ross Lagerwall <[email protected]>
[ Upstream commit 04a4af334b971814eedf4e4a413343ad3287d9a9 ]
For nested and variable attributes, the expected length of an attribute is not known and marked by a negative number. This results in an OOB read when the expected length is later used to check if the attribute is all zeros. Fix this by using the actual length of the attribute rather than the expected length.
--- net/openvswitch/flow_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/openvswitch/flow_netlink.c +1 -1
@@ -314,7 +314,7 @@ static int __parse_flow_nlattrs(const streturn -EINVAL ; } -if (!nz || !is_all_zero (nla_data (nla), expected_len)) { +if (!nz || !is_all_zero (nla_data (nla),nla_len (nla))) { attrs |=1 << type; a[type] = nla; }
Greg Kroah-Hartman
maintainerPATCH 2/31 USB: serial: simple: add Motorola Tetra TPG2200 device id
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Schulze <[email protected]>
commit b81c2c33eab79dfd3650293b2227ee5c6036585c upstream.
Add new Motorola Tetra device id for Motorola Solutions TETRA PEI device
T: Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 4 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=0cad ProdID=9016 Rev=24.16 S: Manufacturer=Motorola Solutions, Inc. S: Product=TETRA PEI interface C: #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=usb_serial_simple I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=usb_serial_simple
--- drivers/usb/serial/usb-serial-simple.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/serial/usb-serial-simple.c +2 -1
@@ -75,7 +75,8 @@ DEVICE(moto_modem, MOTO_IDS);/* Motorola Tetra driver */ #define MOTOROLA_TETRA_IDS () \ { USB_DEVICE(0x0cad, 0x9011) },/* Motorola Solutions TETRA PEI */ \ - { USB_DEVICE(0x0cad, 0x9012) } /* MTP6550 */ + { USB_DEVICE(0x0cad, 0x9012) }, /* MTP6550 */ \ + { USB_DEVICE(0x0cad, 0x9016) } /* TPG2200 */DEVICE (motorola_tetra,MOTOROLA_TETRA_IDS );/* Novatel Wireless GPS driver */
Greg Kroah-Hartman
maintainerPATCH 3/31 USB: serial: pl2303: add new PID to support PL2303TB
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Yeh <[email protected]>
commit 4dcf9ddc9ad5ab649abafa98c5a4d54b1a33dabb upstream.
Add new PID to support PL2303TB (TYPE_HX)
--- drivers/usb/serial/pl2303.c | 1 + drivers/usb/serial/pl2303.h | 2 ++ 2 files changed, 3 insertions(+)
drivers/usb/serial/pl2303.c +1 -0
@@ -47,6 +47,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) }, { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) }, { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ZTEK) }, + { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_TB) }, { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) },
drivers/usb/serial/pl2303.h +2 -0
@@ -13,6 +13,7 @@#define PL2303_VENDOR_ID 0x067b#define PL2303_PRODUCT_ID 0x2303 +#define PL2303_PRODUCT_ID_TB 0x2304#define PL2303_PRODUCT_ID_RSAQ2 0x04bb#define PL2303_PRODUCT_ID_DCU11 0x1234#define PL2303_PRODUCT_ID_PHAROS 0xaaa0
@@ -25,6 +26,7 @@#define PL2303_PRODUCT_ID_MOTOROLA 0x0307#define PL2303_PRODUCT_ID_ZTEK 0xe1f1 +#define ATEN_VENDOR_ID 0x0557#define ATEN_VENDOR_ID2 0x0547#define ATEN_PRODUCT_ID 0x2008
Greg Kroah-Hartman
maintainerPATCH 4/31 s390/smp: fix CPU hotplug deadlock with CPU rescan
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gerald Schaefer <[email protected]>
commit b7cb707c373094ce4008d4a6ac9b6b366ec52da5 upstream.
smp_rescan_cpus() is called without the device_hotplug_lock, which can lead to a dedlock when a new CPU is found and immediately set online by a udev rule.
This was observed on an older kernel version, where the cpu_hotplug_begin() loop was still present, and it resulted in hanging chcpu and systemd-udev processes. This specific deadlock will not show on current kernels. However, there may be other possible deadlocks, and since smp_rescan_cpus() can still trigger a CPU hotplug operation, the device_hotplug_lock should be held.
For reference, this was the deadlock with the old cpu_hotplug_begin() loop:
chcpu (rescan) systemd-udevd
echo 1 > /sys/../rescan
-> smp_rescan_cpus()
-> (*) get_online_cpus()
(increases refcount)
-> smp_add_present_cpu()
(new CPU found)
-> register_cpu()
-> device_add()
-> udev "add" event triggered -----------> udev rule sets CPU online
-> echo 1 > /sys/.../online
-> lock_device_hotplug_sysfs()
(this is missing in rescan path)
-> device_online()
-> (**) device_lock(new CPU dev)
-> cpu_up()
-> cpu_hotplug_begin()
(loops until refcount == 0)
-> deadlock with (*)
-> bus_probe_device()
-> device_attach()
-> device_lock(new CPU dev)
-> deadlock with (**)Fix this by taking the device_hotplug_lock in the CPU rescan path.
--- arch/s390/kernel/smp.c | 4 ++++ drivers/s390/char/sclp_config.c | 2 ++ 2 files changed, 6 insertions(+)
arch/s390/kernel/smp.c +4 -0
@@ -1014,7 +1014,11 @@ static ssize_t __ref rescan_store(struct {int rc; + rc =lock_device_hotplug_sysfs (); +if (rc) +return rc; rc =smp_rescan_cpus (); +unlock_device_hotplug ();return rc ? rc : count; } static DEVICE_ATTR(rescan, 0200, NULL, rescan_store);
drivers/s390/char/sclp_config.c +2 -0
@@ -43,7 +43,9 @@ static void sclp_cpu_capability_notify(sstatic void __ref sclp_cpu_change_notify (struct work_struct *work) { +lock_device_hotplug ();smp_rescan_cpus (); +unlock_device_hotplug (); }static void sclp_conf_receiver_fn (struct evbuf_header *evbuf)
Greg Kroah-Hartman
maintainerPATCH 5/31 staging: rtl8188eu: Add device code for D-Link DWA-121 rev B1
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Straube <[email protected]>
commit 5f74a8cbb38d10615ed46bc3e37d9a4c9af8045a upstream.
This device was added to the stand-alone driver on github. Add it to the staging driver as well.
--- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/rtl8188eu/os_dep/usb_intf.c +1 -0
@@ -48,6 +48,7 @@ static struct usb_device_id rtw_usb_id_t {USB_DEVICE(0x2001, 0x330F)}, /* DLink DWA-125 REV D1 */ {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ + {USB_DEVICE(0x2001, 0x331B)}, /* D-Link DWA-121 rev B1 */ {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */ {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */
Greg Kroah-Hartman
maintainerPATCH 6/31 tty: Handle problem if line discipline does not have receive_buf
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit 27cfb3a53be46a54ec5e0bd04e51995b74c90343 upstream.
Some tty line disciplines do not have a receive buf callback, so properly check for that before calling it. If they do not have this callback, just eat the character quietly, as we can't fail this call.
--- drivers/tty/tty_io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/tty_io.c +2 -1
@@ -2243,7 +2243,8 @@ static int tiocsti(struct tty_struct *ttreturn -EFAULT ;tty_audit_tiocsti (tty, ch); ld =tty_ldisc_ref_wait (tty); - ld->ops->receive_buf (tty, &ch, &mbz,1 ); +if (ld->ops->receive_buf) + ld->ops->receive_buf (tty, &ch, &mbz,1 );tty_ldisc_deref (ld);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 7/31 tty/n_hdlc: fix __might_sleep warning
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Fulghum <[email protected]>
commit fc01d8c61ce02c034e67378cd3e645734bc18c8c upstream.
Fix __might_sleep warning[1] in tty/n_hdlc.c read due to copy_to_user call while current is TASK_INTERRUPTIBLE. This is a false positive since the code path does not depend on current state remaining TASK_INTERRUPTIBLE. The loop breaks out and sets TASK_RUNNING after calling copy_to_user.
This patch supresses the warning by setting TASK_RUNNING before calling copy_to_user.
[1] https://syzkaller.appspot.com/bug?id=17d5de7f1fcab794cb8c40032f893f52de899324
--- drivers/tty/n_hdlc.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/n_hdlc.c +1 -0
@@ -598,6 +598,7 @@ static ssize_t n_hdlc_tty_read(struct tt/* too large for caller's buffer */ ret = -EOVERFLOW ; }else { +__set_current_state (TASK_RUNNING );if (copy_to_user (buf, rbuf->buf, rbuf->count)) ret = -EFAULT ;else
Greg Kroah-Hartman
maintainerPATCH 8/31 CIFS: Fix possible hang during async MTU reads and writes
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Shilovsky <[email protected]>
commit acc58d0bab55a50e02c25f00bd6a210ee121595f upstream.
When doing MTU i/o we need to leave some credits for possible reopen requests and other operations happening in parallel. Currently we leave 1 credit which is not enough even for reopen only: we need at least 2 credits if durable handle reconnect fails. Also there may be other operations at the same time including compounding ones which require 3 credits at a time each. Fix this by leaving 8 credits which is big enough to cover most scenarios.
Was able to reproduce this when server was configured to give out fewer credits than usual.
The proper fix would be to reconnect a file handle first and then obtain credits for an MTU request but this leads to bigger code changes and should happen in other patches.
--- fs/cifs/smb2ops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/cifs/smb2ops.c +3 -3
@@ -143,14 +143,14 @@ smb2_wait_mtu_credits(struct TCP_Server_ scredits = server->credits;/* can deadlock with reopen */ -if (scredits ==1 ) { +if (scredits <=8 ) { *num =SMB2_MAX_BUFFER_SIZE ; *credits =0 ;break ; } -/* leave one credit for a possible reopen */ - scredits--; +/* leave some credits for reopen and other ops */ + scredits -=8 ; *num = min_t(unsigned int, size, scredits *SMB2_MAX_BUFFER_SIZE );
Greg Kroah-Hartman
maintainerPATCH 9/31 Input: xpad - add support for SteelSeries Stratus Duo
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tom Panfil <[email protected]>
commit fe2bfd0d40c935763812973ce15f5764f1c12833 upstream.
Add support for the SteelSeries Stratus Duo, a wireless Xbox 360 controller. The Stratus Duo ships with a USB dongle to enable wireless connectivity, but it can also function as a wired controller by connecting it directly to a PC via USB, hence the need for two USD PIDs. 0x1430 is the dongle, and 0x1431 is the controller.
--- drivers/input/joystick/xpad.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/input/joystick/xpad.c +3 -0
@@ -255,6 +255,8 @@ static const struct xpad_device { { 0x0f30, 0x0202, "Joytech Advanced Controller", 0, XTYPE_XBOX }, { 0x0f30, 0x8888, "BigBen XBMiniPad Controller", 0, XTYPE_XBOX }, { 0x102c, 0xff0c, "Joytech Wireless Advanced Controller", 0, XTYPE_XBOX }, + { 0x1038, 0x1430, "SteelSeries Stratus Duo", 0, XTYPE_XBOX360 }, + { 0x1038, 0x1431, "SteelSeries Stratus Duo", 0, XTYPE_XBOX360 }, { 0x11c9, 0x55f0, "Nacon GC-100XF", 0, XTYPE_XBOX360 }, { 0x12ab, 0x0004, "Honey Bee Xbox360 dancepad", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, { 0x12ab, 0x0301, "PDP AFTERGLOW AX.1", 0, XTYPE_XBOX360 },
@@ -431,6 +433,7 @@ static const struct usb_device_id xpad_tXPAD_XBOXONE_VENDOR (0x0e6f ),/* 0x0e6f X-Box One controllers */ XPAD_XBOX360_VENDOR (0x0f0d ),/* Hori Controllers */ XPAD_XBOXONE_VENDOR (0x0f0d ),/* Hori Controllers */ +XPAD_XBOX360_VENDOR (0x1038 ),/* SteelSeries Controllers */ XPAD_XBOX360_VENDOR (0x11c9 ),/* Nacon GC100XF */ XPAD_XBOX360_VENDOR (0x12ab ),/* X-Box 360 dance pads */ XPAD_XBOX360_VENDOR(0x1430), /* RedOctane X-Box 360 controllers */
Greg Kroah-Hartman
maintainerPATCH 10/31 x86/kaslr: Fix incorrect i8254 outb() parameters
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Drake <[email protected]>
commit 7e6fc2f50a3197d0e82d1c0e86282976c9e6c8a4 upstream.
The outb() function takes parameters value and port, in that order. Fix the parameters used in the kalsr i8254 fallback code.
--- arch/x86/boot/compressed/aslr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/boot/compressed/aslr.c +2 -2
@@ -24,8 +24,8 @@ static inline u16 i8254(void)u16 status, timer; do { - outb(I8254_PORT_CONTROL, - I8254_CMD_READBACK | I8254_SELECT_COUNTER0); + outb(I8254_CMD_READBACK | I8254_SELECT_COUNTER0, + I8254_PORT_CONTROL); status = inb(I8254_PORT_COUNTER0); timer = inb(I8254_PORT_COUNTER0); timer |= inb(I8254_PORT_COUNTER0) << 8;
Greg Kroah-Hartman
maintainerPATCH 11/31 can: dev: __can_get_echo_skb(): fix bogous check for non-existing skb by removing it
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manfred Schlaegl <[email protected]>
commit 7b12c8189a3dc50638e7d53714c88007268d47ef upstream.
This patch revert commit 7da11ba5c506
("can: dev: __can_get_echo_skb(): print error message, if trying to echo non existing skb")
After introduction of this change we encountered following new error message on various i.MX plattforms (flexcan):
| flexcan 53fc8000.can can0: __can_get_echo_skb: BUG! Trying to echo non | existing skb: can_priv::echo_skb[0]
The introduction of the message was a mistake because priv->echo_skb[idx] = NULL is a perfectly valid in following case: If CAN_RAW_LOOPBACK is disabled (setsockopt) in applications, the pkt_type of the tx skb's given to can_put_echo_skb is set to PACKET_LOOPBACK. In this case can_put_echo_skb will not set priv->echo_skb[idx]. It is therefore kept NULL.
As additional argument for revert: The order of check and usage of idx was changed. idx is used to access an array element before checking it's boundaries.
--- drivers/net/can/dev.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-)
drivers/net/can/dev.c +13 -14
@@ -346,8 +346,6 @@ EXPORT_SYMBOL_GPL(can_put_echo_skb);struct sk_buff *__can_get_echo_skb (struct net_device *dev,unsigned int idx,u8 *len_ptr) {struct can_priv *priv =netdev_priv (dev); -struct sk_buff *skb = priv->echo_skb[idx]; -struct canfd_frame *cf;if (idx >= priv->echo_skb_max) { netdev_err(dev, "%s: BUG! Trying to access can_priv::echo_skb out of bounds (%u/max %u)\n",
@@ -355,20 +353,21 @@ struct sk_buff *__can_get_echo_skb(strucreturn NULL ; } -if (!skb) { -netdev_err (dev,"%s: BUG! Trying to echo non existing skb: can_priv::echo_skb[%u]\n" , - __func__, idx); -return NULL ; - } +if (priv->echo_skb[idx]) { +/* Using "struct canfd_frame::len" for the frame +* length is supported on both CAN and CANFD frames. +*/ +struct sk_buff *skb = priv->echo_skb[idx]; +struct canfd_frame *cf = (struct canfd_frame *)skb->data; +u8 len = cf->len; -/* Using "struct canfd_frame::len" for the frame -* length is supported on both CAN and CANFD frames. -*/ - cf = (struct canfd_frame *)skb->data; - *len_ptr = cf->len; - priv->echo_skb[idx] =NULL ; + *len_ptr = len; + priv->echo_skb[idx] =NULL ; + +return skb; + } -return skb; +return NULL ; }/*
Greg Kroah-Hartman
maintainerPATCH 12/31 can: bcm: check timer values before ktime conversion
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Hartkopp <[email protected]>
commit 93171ba6f1deffd82f381d36cb13177872d023f6 upstream.
Kyungtae Kim detected a potential integer overflow in bcm_[rx|tx]_setup() when the conversion into ktime multiplies the given value with NSEC_PER_USEC (1000).
Reference: https://marc.info/?l=linux-can&m=154732118819828&w=2
Add a check for the given tv_usec, so that the value stays below one second. Additionally limit the tv_sec value to a reasonable value for CAN related use-cases of 400 days and ensure all values to be positive.
--- net/can/bcm.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
net/can/bcm.c +27 -0
@@ -67,6 +67,9 @@*/ #define MAX_NFRAMES 256 +/* limit timers to 400 days for sending/timeouts */ +#define BCM_TIMER_SEC_MAX (400 * 24 * 60 * 60) +/* use of last_frames[index].can_dlc */ #define RX_RECV 0x40/* received data for this element */ #define RX_THR 0x80/* element not been sent due to throttle feature */
@@ -133,6 +136,22 @@ static inline struct bcm_sock *bcm_sk(coreturn (struct bcm_sock *)sk; } +/* check limitations for timeval provided by user */ +static bool bcm_is_invalid_tv (struct bcm_msg_head *msg_head) +{ +if ((msg_head->ival1.tv_sec <0 ) || + (msg_head->ival1.tv_sec >BCM_TIMER_SEC_MAX ) || + (msg_head->ival1.tv_usec <0 ) || + (msg_head->ival1.tv_usec >=USEC_PER_SEC ) || + (msg_head->ival2.tv_sec <0 ) || + (msg_head->ival2.tv_sec >BCM_TIMER_SEC_MAX ) || + (msg_head->ival2.tv_usec <0 ) || + (msg_head->ival2.tv_usec >=USEC_PER_SEC )) +return true; + +return false; +} +#define CFSIZ sizeof(struct can_frame)#define OPSIZ sizeof(struct bcm_op)#define MHSIZ sizeof(struct bcm_msg_head)
@@ -842,6 +861,10 @@ static int bcm_tx_setup(struct bcm_msg_hif (msg_head->nframes <1 || msg_head->nframes >MAX_NFRAMES )return -EINVAL ; +/* check timeval limitations */ +if ((msg_head->flags &SETTIMER ) &&bcm_is_invalid_tv (msg_head)) +return -EINVAL ; +/* check the given can_id */ op =bcm_find_op (&bo->tx_ops, msg_head->can_id, ifindex);
@@ -1009,6 +1032,10 @@ static int bcm_rx_setup(struct bcm_msg_h (!(msg_head->can_id & CAN_RTR_FLAG))))return -EINVAL ; +/* check timeval limitations */ +if ((msg_head->flags &SETTIMER ) &&bcm_is_invalid_tv (msg_head)) +return -EINVAL ; +/* check the given can_id */ op =bcm_find_op (&bo->rx_ops, msg_head->can_id, ifindex);if (op) {
Greg Kroah-Hartman
maintainerPATCH 13/31 vt: invoke notifier on screen size change
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Pitre <[email protected]>
commit 0c9b1965faddad7534b6974b5b36c4ad37998f8e upstream.
User space using poll() on /dev/vcs devices are not awaken when a screen size change occurs. Let's fix that.
--- drivers/tty/vt/vt.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/vt/vt.c +1 -0
@@ -949,6 +949,7 @@ static int vc_do_resize(struct tty_strucif (CON_IS_VISIBLE (vc))update_screen (vc);vt_event_post (VT_EVENT_RESIZE , vc->vc_num, vc->vc_num); +notify_update (vc);return err; }
Greg Kroah-Hartman
maintainerPATCH 14/31 perf unwind: Unwind with libdw doesnt take symfs into account
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 3d20c6246690219881786de10d2dda93f616d0ac ]
Path passed to libdw for unwinding doesn't include symfs path if specified, so unwinding fails because ELF file is not found.
Similar to unwinding with libunwind, pass symsrc_filename instead of long_name. If there is no symsrc_filename, fallback to long_name.
--- tools/perf/util/unwind-libdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/unwind-libdw.c +1 -1
@@ -47,7 +47,7 @@ static int __report_module(struct addr_lif (!mod) mod =dwfl_report_elf (ui->dwfl, dso->short_name, - dso->long_name,-1 , al->map->start, + (dso->symsrc_filename ? dso->symsrc_filename : dso->long_name),-1 , al->map->start, false);return mod &&dwfl_addrmodule (ui->dwfl, ip) == mod ?0 :-1 ;
Greg Kroah-Hartman
maintainerPATCH 15/31 perf unwind: Take pgoff into account when reporting elf to libdwfl
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 1fe627da30331024f453faef04d500079b901107 ]
libdwfl parses an ELF file itself and creates mappings for the individual sections. perf on the other hand sees raw mmap events which represent individual sections. When we encounter an address pointing into a mapping with pgoff != 0, we must take that into account and report the file at the non-offset base address.
This fixes unwinding with libdwfl in some cases. E.g. for a file like:
```
using namespace std;
mutex g_mutex;
double worker()
{
lock_guard<mutex> guard(g_mutex);
uniform_real_distribution<double> uniform(-1E5, 1E5);
default_random_engine engine;
double s = 0;
for (int i = 0; i < 1000; ++i) {
s += norm(complex<double>(uniform(engine), uniform(engine)));
}
cout << s << endl;
return s;
}
int main()
{
vector<std::future<double>> results;
for (int i = 0; i < 10000; ++i) {
results.push_back(async(launch::async, worker));
}
return 0;
}
```Compile it with g++ -g -O2 -lpthread cpp-locking.cpp -o cpp-locking, then record it with perf record --call-graph dwarf -e sched:sched_switch.
When you analyze it with perf script and libunwind, you should see:
```
cpp-locking 20038 [005] 54830.236589: sched:sched_switch: prev_comm=cpp-locking prev_pid=20038 prev_prio=120 prev_state=T ==> next_comm=swapper/5 next_pid=0 next_prio=120
ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb1670208 schedule+0x28 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb16737cc rwsem_down_read_failed+0xec (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb1665e04 call_rwsem_down_read_failed+0x14 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb1672a03 down_read+0x13 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb106bd85 __do_page_fault+0x445 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb18015f5 page_fault+0x45 (/lib/modules/4.14.78-1-lts/build/vmlinux)
7f38e4252591 new_heap+0x101 (/usr/lib/libc-2.28.so)
7f38e4252d0b arena_get2.part.4+0x2fb (/usr/lib/libc-2.28.so)
7f38e4255b1c tcache_init.part.6+0xec (/usr/lib/libc-2.28.so)
7f38e42569e5 __GI___libc_malloc+0x115 (inlined)
7f38e4241790 __GI__IO_file_doallocate+0x90 (inlined)
7f38e424fbbf __GI__IO_doallocbuf+0x4f (inlined)
7f38e424ee47 __GI__IO_file_overflow+0x197 (inlined)
7f38e424df36 _IO_new_file_xsputn+0x116 (inlined)
7f38e4242bfb __GI__IO_fwrite+0xdb (inlined)
7f38e463fa6d std::basic_streambuf<char, std::char_traits<char> >::sputn(char const*, long)+0x1cd (inlined)
7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> >::_M_put(char const*, long)+0x1cd (inlined)
7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> > std::__write<char>(std::ostreambuf_iterator<char, std::char_traits<char> >, char const*, int)+0x1cd (inlined)
7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_float<double>(std::ostreambuf_iterator<c>
7f38e464bd70 std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, double) const+0x90 (inl>
7f38e464bd70 std::ostream& std::ostream::_M_insert<double>(double)+0x90 (/usr/lib/libstdc++.so.6.0.25)
563b9cb502f7 std::ostream::operator<<(double)+0xb7 (inlined)
563b9cb502f7 worker()+0xb7 (/ssd/milian/projects/kdab/rnd/hotspot/build/tests/test-clients/cpp-locking/cpp-locking)
563b9cb506fb double std::__invoke_impl<double, double (*)()>(std::__invoke_other, double (*&&)())+0x2b (inlined)
563b9cb506fb std::__invoke_result<double (*)()>::type std::__invoke<double (*)()>(double (*&&)())+0x2b (inlined)
563b9cb506fb decltype (__invoke((_S_declval<0ul>)())) std::thread::_Invoker<std::tuple<double (*)()> >::_M_invoke<0ul>(std::_Index_tuple<0ul>)+0x2b (inlined)
563b9cb506fb std::thread::_Invoker<std::tuple<double (*)()> >::operator()()+0x2b (inlined)
563b9cb506fb std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<double>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<double (*)()> >, dou>
563b9cb506fb std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_>
563b9cb507e8 std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>::operator()() const+0x28 (inlined)
563b9cb507e8 std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)+0x28 (/ssd/milian/>
7f38e46d24fe __pthread_once_slow+0xbe (/usr/lib/libpthread-2.28.so)
563b9cb51149 __gthread_once+0xe9 (inlined)
563b9cb51149 void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>
563b9cb51149 std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool)+0xe9 (inlined)
563b9cb51149 std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_impl(std::thread::_Invoker<std::tuple<double (*)()> >&&)::{lambda()#1}::op>
563b9cb51149 void std::__invoke_impl<void, std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_impl(std::thread::_Invoker<std::tuple<double>
563b9cb51149 std::__invoke_result<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_impl(std::thread::_Invoker<std::tuple<double (*)()> >>
563b9cb51149 decltype (__invoke((_S_declval<0ul>)())) std::thread::_Invoker<std::tuple<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_>
563b9cb51149 std::thread::_Invoker<std::tuple<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_impl(std::thread::_Invoker<std::tuple<dou>
563b9cb51149 std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<double (*)()> >, double>::_Async_state_impl(std::thread>
7f38e45f0062 execute_native_thread_routine+0x12 (/usr/lib/libstdc++.so.6.0.25)
7f38e46caa9c start_thread+0xfc (/usr/lib/libpthread-2.28.so)
7f38e42ccb22 __GI___clone+0x42 (inlined)
```Before this patch, using libdwfl, you would see:
```
cpp-locking 20038 [005] 54830.236589: sched:sched_switch: prev_comm=cpp-locking prev_pid=20038 prev_prio=120 prev_state=T ==> next_comm=swapper/5 next_pid=0 next_prio=120
ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb1670208 schedule+0x28 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb16737cc rwsem_down_read_failed+0xec (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb1665e04 call_rwsem_down_read_failed+0x14 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb1672a03 down_read+0x13 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb106bd85 __do_page_fault+0x445 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb18015f5 page_fault+0x45 (/lib/modules/4.14.78-1-lts/build/vmlinux)
7f38e4252591 new_heap+0x101 (/usr/lib/libc-2.28.so)
a041161e77950c5c [unknown] ([unknown])
```With this patch applied, we get a bit further in unwinding:
```
cpp-locking 20038 [005] 54830.236589: sched:sched_switch: prev_comm=cpp-locking prev_pid=20038 prev_prio=120 prev_state=T ==> next_comm=swapper/5 next_pid=0 next_prio=120
ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb166fec5 __sched_text_start+0x545 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb1670208 schedule+0x28 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb16737cc rwsem_down_read_failed+0xec (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb1665e04 call_rwsem_down_read_failed+0x14 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb1672a03 down_read+0x13 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb106bd85 __do_page_fault+0x445 (/lib/modules/4.14.78-1-lts/build/vmlinux)
ffffffffb18015f5 page_fault+0x45 (/lib/modules/4.14.78-1-lts/build/vmlinux)
7f38e4252591 new_heap+0x101 (/usr/lib/libc-2.28.so)
7f38e4252d0b arena_get2.part.4+0x2fb (/usr/lib/libc-2.28.so)
7f38e4255b1c tcache_init.part.6+0xec (/usr/lib/libc-2.28.so)
7f38e42569e5 __GI___libc_malloc+0x115 (inlined)
7f38e4241790 __GI__IO_file_doallocate+0x90 (inlined)
7f38e424fbbf __GI__IO_doallocbuf+0x4f (inlined)
7f38e424ee47 __GI__IO_file_overflow+0x197 (inlined)
7f38e424df36 _IO_new_file_xsputn+0x116 (inlined)
7f38e4242bfb __GI__IO_fwrite+0xdb (inlined)
7f38e463fa6d std::basic_streambuf<char, std::char_traits<char> >::sputn(char const*, long)+0x1cd (inlined)
7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> >::_M_put(char const*, long)+0x1cd (inlined)
7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> > std::__write<char>(std::ostreambuf_iterator<char, std::char_traits<char> >, char const*, int)+0x1cd (inlined)
7f38e463fa6d std::ostreambuf_iterator<char, std::char_traits<char> > std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_float<double>(std::ostreambuf_iterator<c>
7f38e464bd70 std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::put(std::ostreambuf_iterator<char, std::char_traits<char> >, std::ios_base&, char, double) const+0x90 (inl>
7f38e464bd70 std::ostream& std::ostream::_M_insert<double>(double)+0x90 (/usr/lib/libstdc++.so.6.0.25)
563b9cb502f7 std::ostream::operator<<(double)+0xb7 (inlined)
563b9cb502f7 worker()+0xb7 (/ssd/milian/projects/kdab/rnd/hotspot/build/tests/test-clients/cpp-locking/cpp-locking)
6eab825c1ee3e4ff [unknown] ([unknown])
```Note that the backtrace is still stopping too early, when compared to the nice results obtained via libunwind. It's unclear so far what the reason for that is.
Committer note:
Further comment by Milian on the thread started on the Link: tag below:
---
The remaining issue is due to a bug in elfutils:
https://sourceware.org/ml/elfutils-devel/2018-q4/msg00089.html
With both patches applied, libunwind and elfutils produce the same output for the above scenario.
---
--- tools/perf/util/unwind-libdw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/unwind-libdw.c +2 -2
@@ -41,13 +41,13 @@ static int __report_module(struct addr_lDwarf_Addr s;dwfl_module_info (mod,NULL , &s,NULL ,NULL ,NULL ,NULL ,NULL ); -if (s != al->map->start) +if (s != al->map->start - al->map->pgoff) mod =0 ; }if (!mod) mod =dwfl_report_elf (ui->dwfl, dso->short_name, - (dso->symsrc_filename ? dso->symsrc_filename : dso->long_name),-1 , al->map->start, + (dso->symsrc_filename ? dso->symsrc_filename : dso->long_name),-1 , al->map->start - al->map->pgoff, false);return mod &&dwfl_addrmodule (ui->dwfl, ip) == mod ?0 :-1 ;
Greg Kroah-Hartman
maintainerPATCH 16/31 f2fs: read page index before freeing
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pan Bian <[email protected]>
commit 0ea295dd853e0879a9a30ab61f923c26be35b902 upstream.
The function truncate_node frees the page with f2fs_put_page. However, the page index is read after that. So, the patch reads the index before freeing the page.
--- fs/f2fs/node.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/f2fs/node.c +3 -1
@@ -565,6 +565,7 @@ static void truncate_node(struct dnode_o {struct f2fs_sb_info *sbi =F2FS_I_SB (dn->inode);struct node_info ni; +pgoff_t index;get_node_info (sbi, dn->nid, &ni);if (dn->inode->i_blocks ==0 ) {
@@ -588,10 +589,11 @@ invalidate:clear_node_page_dirty (dn->node_page);F2FS_SET_SB_DIRT (sbi); + index = dn->node_page->index;f2fs_put_page (dn->node_page,1 );invalidate_mapping_pages (NODE_MAPPING (sbi), - dn->node_page->index, dn->node_page->index); + index, index); dn->node_page =NULL ;trace_f2fs_truncate_node (dn->inode, dn->nid, ni.blk_addr);
Greg Kroah-Hartman
maintainerPATCH 17/31 ipv6: Consider sk_bound_dev_if when binding a socket to an address
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Ahern <[email protected]>
[ Upstream commit c5ee066333ebc322a24a00a743ed941a0c68617e ]
IPv6 does not consider if the socket is bound to a device when binding to an address. The result is that a socket can be bound to eth0 and then bound to the address of eth1. If the device is a VRF, the result is that a socket can only be bound to an address in the default VRF.
Resolve by considering the device if sk_bound_dev_if is set.
This problem exists from the beginning of git history.
--- net/ipv6/af_inet6.c | 3 +++ 1 file changed, 3 insertions(+)
net/ipv6/af_inet6.c +3 -0
@@ -333,6 +333,9 @@ int inet6_bind(struct socket *sock, stru err = -EINVAL ; goto out_unlock; } + } + +if (sk->sk_bound_dev_if) { dev =dev_get_by_index_rcu (net, sk->sk_bound_dev_if);if (!dev) { err = -ENODEV ;
Greg Kroah-Hartman
maintainerPATCH 18/31 l2tp: copy 4 more bytes to linear part if necessary
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Wen <[email protected]>
[ Upstream commit 91c524708de6207f59dd3512518d8a1c7b434ee3 ]
The size of L2TPv2 header with all optional fields is 14 bytes. l2tp_udp_recv_core only moves 10 bytes to the linear part of a skb. This may lead to l2tp_recv_common read data outside of a skb.
This patch make sure that there is at least 14 bytes in the linear part of a skb to meet the maximum need of l2tp_udp_recv_core and l2tp_recv_common. The minimum size of both PPP HDLC-like frame and Ethernet frame is larger than 14 bytes, so we are safe to do so.
Also remove L2TP_HDR_SIZE_NOSEQ, it is unused now.
--- net/l2tp/l2tp_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/l2tp/l2tp_core.c +2 -3
@@ -83,8 +83,7 @@#define L2TP_SLFLAG_S 0x40000000#define L2TP_SL_SEQ_MASK 0x00ffffff -#define L2TP_HDR_SIZE_SEQ 10 -#define L2TP_HDR_SIZE_NOSEQ 6 +#define L2TP_HDR_SIZE_MAX 14/* Default trace flags */ #define L2TP_DEFAULT_DEBUG_FLAGS 0
@@ -856,7 +855,7 @@ static int l2tp_udp_recv_core(struct l2t__skb_pull (skb,sizeof (struct udphdr ));/* Short packet? */ -if (!pskb_may_pull (skb,L2TP_HDR_SIZE_SEQ )) { +if (!pskb_may_pull (skb,L2TP_HDR_SIZE_MAX )) {l2tp_info (tunnel,L2TP_MSG_DATA ,"%s: recv short packet (len=%d)\n" , tunnel->name, skb->len);
Greg Kroah-Hartman
maintainerPATCH 19/31 netrom: switch to sock timer API
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit 63346650c1a94a92be61a57416ac88c0a47c4327 ]
sk_reset_timer() and sk_stop_timer() properly handle sock refcnt for timer function. Switching to them could fix a refcounting bug reported by syzbot.
--- net/netrom/nr_timer.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
net/netrom/nr_timer.c +10 -10
@@ -53,21 +53,21 @@ void nr_start_t1timer(struct sock *sk) {struct nr_sock *nr =nr_sk (sk); -mod_timer (&nr->t1timer, jiffies + nr->t1); +sk_reset_timer (sk, &nr->t1timer, jiffies + nr->t1); }void nr_start_t2timer (struct sock *sk) {struct nr_sock *nr =nr_sk (sk); -mod_timer (&nr->t2timer, jiffies + nr->t2); +sk_reset_timer (sk, &nr->t2timer, jiffies + nr->t2); }void nr_start_t4timer (struct sock *sk) {struct nr_sock *nr =nr_sk (sk); -mod_timer (&nr->t4timer, jiffies + nr->t4); +sk_reset_timer (sk, &nr->t4timer, jiffies + nr->t4); }void nr_start_idletimer (struct sock *sk)
@@ -75,37 +75,37 @@ void nr_start_idletimer(struct sock *sk)struct nr_sock *nr =nr_sk (sk);if (nr->idle >0 ) -mod_timer (&nr->idletimer, jiffies + nr->idle); +sk_reset_timer (sk, &nr->idletimer, jiffies + nr->idle); }void nr_start_heartbeat (struct sock *sk) { -mod_timer (&sk->sk_timer, jiffies +5 *HZ ); +sk_reset_timer (sk, &sk->sk_timer, jiffies +5 *HZ ); }void nr_stop_t1timer (struct sock *sk) { -del_timer (&nr_sk (sk)->t1timer); +sk_stop_timer (sk, &nr_sk (sk)->t1timer); }void nr_stop_t2timer (struct sock *sk) { -del_timer (&nr_sk (sk)->t2timer); +sk_stop_timer (sk, &nr_sk (sk)->t2timer); }void nr_stop_t4timer (struct sock *sk) { -del_timer (&nr_sk (sk)->t4timer); +sk_stop_timer (sk, &nr_sk (sk)->t4timer); }void nr_stop_idletimer (struct sock *sk) { -del_timer (&nr_sk (sk)->idletimer); +sk_stop_timer (sk, &nr_sk (sk)->idletimer); }void nr_stop_heartbeat (struct sock *sk) { -del_timer (&sk->sk_timer); +sk_stop_timer (sk, &sk->sk_timer); }int nr_t1timer_running (struct sock *sk)
Greg Kroah-Hartman
maintainerPATCH 20/31 net/rose: fix NULL ax25_cb kernel panic
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bernard Pidoux <[email protected]>
[ Upstream commit b0cf029234f9b18e10703ba5147f0389c382bccc ]
When an internally generated frame is handled by rose_xmit(), rose_route_frame() is called:
if (!rose_route_frame(skb, NULL)) {
dev_kfree_skb(skb);
stats->tx_errors++;
return NETDEV_TX_OK;
}We have the same code sequence in Net/Rom where an internally generated frame is handled by nr_xmit() calling nr_route_frame(skb, NULL). However, in this function NULL argument is tested while it is not in rose_route_frame().
Then kernel panic occurs later on when calling ax25cmp() with a NULL ax25_cb argument as reported many times and recently with syzbot.
We need to test if ax25 is NULL before using it.
Testing:
Built kernel with CONFIG_ROSE=y.
--- net/rose/rose_route.c | 5 +++++ 1 file changed, 5 insertions(+)
net/rose/rose_route.c +5 -0
@@ -849,6 +849,7 @@ void rose_link_device_down(struct net_de/* * Route a frame to an appropriate AX.25 connection. +* A NULL ax25_cb indicates an internally generated frame. */ int rose_route_frame (struct sk_buff *skb,ax25_cb *ax25) {
@@ -866,6 +867,10 @@ int rose_route_frame(struct sk_buff *skbif (skb->len <ROSE_MIN_LEN )return res; + +if (!ax25) +return rose_loopback_queue (skb,NULL ); + frametype = skb->data[2 ]; lci = ((skb->data[0 ] <<8 ) &0xF00 ) + ((skb->data[1 ] <<0 ) &0x0FF ); if (frametype == ROSE_CALL_REQUEST &&
Greg Kroah-Hartman
maintainerPATCH 21/31 ucc_geth: Reset BQL queue when stopping device
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Thore <[email protected]>
[ Upstream commit e15aa3b2b1388c399c1a2ce08550d2cc4f7e3e14 ]
After a timeout event caused by for example a broadcast storm, when the MAC and PHY are reset, the BQL TX queue needs to be reset as well. Otherwise, the device will exhibit severe performance issues even after the storm has ended.
--- drivers/net/ethernet/freescale/ucc_geth.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/freescale/ucc_geth.c +2 -0
@@ -1882,6 +1882,8 @@ static void ucc_geth_free_tx(struct ucc_u16 i, j;u8 __iomem *bd; +netdev_reset_queue (ugeth->ndev); + ug_info = ugeth->ug_info; uf_info = &ug_info->uf_info;
Greg Kroah-Hartman
maintainerPATCH 22/31 l2tp: remove l2specific_len dependency in l2tp_core
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
commit 62e7b6a57c7b9bf3c6fd99418eeec05b08a85c38 upstream.
Remove l2specific_len dependency while building l2tpv3 header or parsing the received frame since default L2-Specific Sublayer is always four bytes long and we don't need to rely on a user supplied value.
Moreover in l2tp netlink code there are no sanity checks to enforce the relation between l2specific_len and l2specific_type, so sending a malformed netlink message is possible to set l2specific_type to L2TP_L2SPECTYPE_DEFAULT (or even L2TP_L2SPECTYPE_NONE) and set l2specific_len to a value greater than 4 leaking memory on the wire and sending corrupted frames.
--- net/l2tp/l2tp_core.c | 34 ++++++++++++++++------------------ net/l2tp/l2tp_core.h | 11 +++++++++++ 2 files changed, 27 insertions(+), 18 deletions(-)
net/l2tp/l2tp_core.c +16 -18
@@ -700,11 +700,9 @@ void l2tp_recv_common(struct l2tp_sessio"%s: recv data ns=%u, session nr=%u\n" , session->name, ns, session->nr); } + ptr +=4 ; } -/* Advance past L2-specific header, if present */ - ptr += session->l2specific_len; -if (L2TP_SKB_CB (skb)->has_seq) {/* Received a packet with sequence numbers. If we're the LNS, * check if we sre sending sequence numbers and if not,
@@ -1026,21 +1024,20 @@ static int l2tp_build_l2tpv3_header(strumemcpy (bufp, &session->cookie[0 ], session->cookie_len); bufp += session->cookie_len; } -if (session->l2specific_len) { -if (session->l2specific_type ==L2TP_L2SPECTYPE_DEFAULT ) { -u32 l2h =0 ; -if (session->send_seq) { - l2h =0x40000000 | session->ns; - session->ns++; - session->ns &=0xffffff ; -l2tp_dbg (session,L2TP_MSG_SEQ , -"%s: updated ns to %u\n" , - session->name, session->ns); - } +if (session->l2specific_type ==L2TP_L2SPECTYPE_DEFAULT ) { +u32 l2h =0 ; - *((__be32 *) bufp) =htonl (l2h); +if (session->send_seq) { + l2h =0x40000000 | session->ns; + session->ns++; + session->ns &=0xffffff ; +l2tp_dbg (session,L2TP_MSG_SEQ , +"%s: updated ns to %u\n" , + session->name, session->ns); } - bufp += session->l2specific_len; + + *((__be32 *)bufp) =htonl (l2h); + bufp +=4 ; }if (session->offset) bufp += session->offset;
@@ -1722,7 +1719,7 @@ int l2tp_session_delete(struct l2tp_sessEXPORT_SYMBOL_GPL (l2tp_session_delete);/* We come here whenever a session's send_seq, cookie_len or -* l2specific_len parameters are set. +* l2specific_type parameters are set. */ void l2tp_session_set_header_len (struct l2tp_session *session,int version) {
@@ -1731,7 +1728,8 @@ void l2tp_session_set_header_len(structif (session->send_seq) session->hdr_len +=4 ; }else { - session->hdr_len =4 + session->cookie_len + session->l2specific_len + session->offset; + session->hdr_len =4 + session->cookie_len + session->offset; + session->hdr_len +=l2tp_get_l2specific_len (session);if (session->tunnel->encap ==L2TP_ENCAPTYPE_UDP ) session->hdr_len +=4 ; }
net/l2tp/l2tp_core.h +11 -0
@@ -312,6 +312,17 @@ do { \#define l2tp_session_dec_refcount (s) l2tp_session_dec_refcount_1(s)#endif +static inline int l2tp_get_l2specific_len (struct l2tp_session *session) +{ +switch (session->l2specific_type) { +case L2TP_L2SPECTYPE_DEFAULT : +return 4 ; +case L2TP_L2SPECTYPE_NONE : +default : +return 0 ; + } +} +#define l2tp_printk (ptr, type, func, fmt, ...) \ do { \ if (((ptr)->debug) & (type)) \
Greg Kroah-Hartman
maintainerPATCH 23/31 l2tp: fix reading optional fields of L2TPv3
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Wen <[email protected]>
[ Upstream commit 4522a70db7aa5e77526a4079628578599821b193 ]
Use pskb_may_pull() to make sure the optional fields are in skb linear parts, so we can safely read them later.
It's easy to reproduce the issue with a net driver that supports paged skb data. Just create a L2TPv3 over IP tunnel and then generates some network traffic.
Once reproduced, rx err in /sys/kernel/debug/l2tp/tunnels will increase.
Changes in v4:
1. s/l2tp_v3_pull_opt/l2tp_v3_ensure_opt_in_linear/
2. s/tunnel->version != L2TP_HDR_VER_2/tunnel->version == L2TP_HDR_VER_3/
3. Add 'Fixes' in commit messages.
Changes in v3:
1. To keep consistency, move the code out of l2tp_recv_common.
2. Use "net" instead of "net-next", since this is a bug fix.
Changes in v2:
1. Only fix L2TPv3 to make code simple.
To fix both L2TPv3 and L2TPv2, we'd better refactor l2tp_recv_common. It's complicated to do so.
2. Reloading pointers after pskb_may_pull
--- net/l2tp/l2tp_core.c | 4 ++++ net/l2tp/l2tp_core.h | 20 ++++++++++++++++++++ net/l2tp/l2tp_ip.c | 3 +++ net/l2tp/l2tp_ip6.c | 3 +++ 4 files changed, 30 insertions(+)
net/l2tp/l2tp_core.c +4 -0
@@ -926,6 +926,10 @@ static int l2tp_udp_recv_core(struct l2t goto error; } +if (tunnel->version ==L2TP_HDR_VER_3 && +l2tp_v3_ensure_opt_in_linear (session, skb, &ptr, &optr)) + goto error; +l2tp_recv_common (session, skb, ptr, optr, hdrflags, length, payload_hook);return 0 ;
net/l2tp/l2tp_core.h +20 -0
@@ -323,6 +323,26 @@ static inline int l2tp_get_l2specific_le } } +static inline int l2tp_v3_ensure_opt_in_linear (struct l2tp_session *session,struct sk_buff *skb, +unsigned char **ptr,unsigned char **optr) +{ +int opt_len = session->peer_cookie_len +l2tp_get_l2specific_len (session); + +if (opt_len >0 ) { +int off = *ptr - *optr; + +if (!pskb_may_pull (skb, off + opt_len)) +return -1 ; + +if (skb->data != *optr) { + *optr = skb->data; + *ptr = skb->data + off; + } + } + +return 0 ; +} +#define l2tp_printk (ptr, type, func, fmt, ...) \ do { \ if (((ptr)->debug) & (type)) \
net/l2tp/l2tp_ip.c +3 -0
@@ -163,6 +163,9 @@ static int l2tp_ip_recv(struct sk_buff *print_hex_dump_bytes ("" ,DUMP_PREFIX_OFFSET , ptr, length); } +if (l2tp_v3_ensure_opt_in_linear (session, skb, &ptr, &optr)) + goto discard; +l2tp_recv_common (session, skb, ptr, optr,0 , skb->len, tunnel->recv_payload_hook);return 0 ;
net/l2tp/l2tp_ip6.c +3 -0
@@ -174,6 +174,9 @@ static int l2tp_ip6_recv(struct sk_buffprint_hex_dump_bytes ("" ,DUMP_PREFIX_OFFSET , ptr, length); } +if (l2tp_v3_ensure_opt_in_linear (session, skb, &ptr, &optr)) + goto discard; +l2tp_recv_common (session, skb, ptr, optr,0 , skb->len, tunnel->recv_payload_hook);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 24/31 CIFS: Do not count -ENODATA as failure for query directory
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Shilovsky <[email protected]>
commit 8e6e72aeceaaed5aeeb1cb43d3085de7ceb14f79 upstream.
--- fs/cifs/smb2pdu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/cifs/smb2pdu.c +2 -2
@@ -2309,8 +2309,8 @@ SMB2_query_directory(const unsigned intif (rc == -ENODATA && rsp->hdr.Status ==STATUS_NO_MORE_FILES ) { srch_inf->endOfSearch = true; rc =0 ; - } -cifs_stats_fail_inc (tcon,SMB2_QUERY_DIRECTORY_HE ); + }else +cifs_stats_fail_inc (tcon,SMB2_QUERY_DIRECTORY_HE ); goto qdir_exit; }
Greg Kroah-Hartman
maintainerPATCH 25/31 fs/dcache: Fix incorrect nr_dentry_unused accounting in shrink_dcache_sb()
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Waiman Long <[email protected]>
commit 1dbd449c9943e3145148cc893c2461b72ba6fef0 upstream.
The nr_dentry_unused per-cpu counter tracks dentries in both the LRU lists and the shrink lists where the DCACHE_LRU_LIST bit is set.
The shrink_dcache_sb() function moves dentries from the LRU list to a shrink list and subtracts the dentry count from nr_dentry_unused. This is incorrect as the nr_dentry_unused count will also be decremented in shrink_dentry_list() via d_shrink_del().
To fix this double decrement, the decrement in the shrink_dcache_sb() function is taken out.
--- fs/dcache.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
fs/dcache.c +1 -5
@@ -1103,15 +1103,11 @@ static enum lru_status dentry_lru_isolat*/ void shrink_dcache_sb (struct super_block *sb) { -long freed; -do {LIST_HEAD (dispose); - freed =list_lru_walk (&sb->s_dentry_lru, +list_lru_walk (&sb->s_dentry_lru, dentry_lru_isolate_shrink, &dispose,1024 ); - -this_cpu_sub (nr_dentry_unused, freed);shrink_dentry_list (&dispose);cond_resched (); }while (list_lru_count (&sb->s_dentry_lru) >0 );
Greg Kroah-Hartman
maintainerPATCH 26/31 arm64: hyp-stub: Forbid kprobing of the hyp-stub
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Morse <[email protected]>
commit 8fac5cbdfe0f01254d9d265c6aa1a95f94f58595 upstream.
The hyp-stub is loaded by the kernel's early startup code at EL2 during boot, before KVM takes ownership later. The hyp-stub's text is part of the regular kernel text, meaning it can be kprobed.
A breakpoint in the hyp-stub causes the CPU to spin in el2_sync_invalid.
Add it to the __hyp_text.
--- arch/arm64/kernel/hyp-stub.S | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/kernel/hyp-stub.S +2 -0
@@ -26,6 +26,8 @@ #include <asm/virt.h> .text + .pushsection .hyp.text, "ax" + .align 11 ENTRY(__hyp_stub_vectors)
Greg Kroah-Hartman
maintainerPATCH 27/31 gfs2: Revert "Fix loop in gfs2_rbm_find"
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Gruenbacher <[email protected]>
commit e74c98ca2d6ae4376cc15fa2a22483430909d96b upstream.
This reverts commit 2d29f6b96d8f80322ed2dd895bca590491c38d34.
It turns out that the fix can lead to a ~20 percent performance regression in initial writes to the page cache according to iozone. Let's revert this for now to have more time for a proper fix.
--- fs/gfs2/rgrp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/rgrp.c +1 -1
@@ -1671,9 +1671,9 @@ static int gfs2_rbm_find(struct gfs2_rbm goto next_iter; }if (ret == -E2BIG ) { - n += rbm->bii - initial_bii; rbm->bii =0 ; rbm->offset =0 ; + n += (rbm->bii - initial_bii); goto res_covered_end_of_rgrp; }return ret;
Greg Kroah-Hartman
maintainerPATCH 28/31 platform/x86: asus-nb-wmi: Map 0x35 to KEY_SCREENLOCK
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit b3f2f3799a972d3863d0fdc2ab6287aef6ca631f ]
When the OS registers to handle events from the display off hotkey the EC will send a notification with 0x35 for every key press, independent of the backlight state.
The behavior of this key on Windows, with the ATKACPI driver from Asus installed, is turning off the backlight of all connected displays with a fading effect, and any cursor input or key press turning the backlight back on. The key press or cursor input that wakes up the display is also passed through to the application under the cursor or under focus.
The key that matches this behavior the closest is KEY_SCREENLOCK.
--- drivers/platform/x86/asus-nb-wmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/asus-nb-wmi.c +1 -0
@@ -314,6 +314,7 @@ static const struct key_entry asus_nb_wm { KE_KEY, 0x32, { KEY_MUTE } }, { KE_KEY, 0x33, { KEY_DISPLAYTOGGLE } }, /* LCD on */ { KE_KEY, 0x34, { KEY_DISPLAY_OFF } }, /* LCD off */ + { KE_KEY, 0x35, { KEY_SCREENLOCK } }, { KE_KEY, 0x40, { KEY_PREVIOUSSONG } }, { KE_KEY, 0x41, { KEY_NEXTSONG } }, { KE_KEY, 0x43, { KEY_STOPCD } }, /* Stop/Eject */
Greg Kroah-Hartman
maintainerPATCH 29/31 platform/x86: asus-nb-wmi: Drop mapping of 0x33 and 0x34 scan codes
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
[ Upstream commit 71b12beaf12f21a53bfe100795d0797f1035b570 ]
According to Asus firmware engineers, the meaning of these codes is only to notify the OS that the screen brightness has been turned on/off by the EC. This does not match the meaning of KEY_DISPLAYTOGGLE / KEY_DISPLAY_OFF, where userspace is expected to change the display brightness.
--- drivers/platform/x86/asus-nb-wmi.c | 2 -- 1 file changed, 2 deletions(-)
drivers/platform/x86/asus-nb-wmi.c +0 -2
@@ -312,8 +312,6 @@ static const struct key_entry asus_nb_wm { KE_KEY, 0x30, { KEY_VOLUMEUP } }, { KE_KEY, 0x31, { KEY_VOLUMEDOWN } }, { KE_KEY, 0x32, { KEY_MUTE } }, - { KE_KEY, 0x33, { KEY_DISPLAYTOGGLE } }, /* LCD on */ - { KE_KEY, 0x34, { KEY_DISPLAY_OFF } }, /* LCD off */ { KE_KEY, 0x35, { KEY_SCREENLOCK } }, { KE_KEY, 0x40, { KEY_PREVIOUSSONG } }, { KE_KEY, 0x41, { KEY_NEXTSONG } },
Greg Kroah-Hartman
maintainerPATCH 30/31 mm, oom: fix use-after-free in oom_kill_process
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shakeel Butt <[email protected]>
commit cefc7ef3c87d02fc9307835868ff721ea12cc597 upstream.
Syzbot instance running on upstream kernel found a use-after-free bug in oom_kill_process. On further inspection it seems like the process selected to be oom-killed has exited even before reaching read_lock(&tasklist_lock) in oom_kill_process(). More specifically the tsk->usage is 1 which is due to get_task_struct() in oom_evaluate_task() and the put_task_struct within for_each_thread() frees the tsk and for_each_thread() tries to access the tsk. The easiest fix is to do get/put across the for_each_thread() on the selected task.
Now the next question is should we continue with the oom-kill as the previously selected task has exited? However before adding more complexity and heuristics, let's answer why we even look at the children of oom-kill selected task? The select_bad_process() has already selected the worst process in the system/memcg. Due to race, the selected process might not be the worst at the kill time but does that matter? The userspace can use the oom_score_adj interface to prefer children to be killed before the parent. I looked at the history but it seems like this is there before git history.
--- mm/oom_kill.c | 8 ++++++++ 1 file changed, 8 insertions(+)
mm/oom_kill.c +8 -0
@@ -464,6 +464,13 @@ void oom_kill_process(struct task_struct* still freeing memory. */ read_lock (&tasklist_lock); + +/* +* The task 'p' might have already exited before reaching here. The +* put_task_struct() will free task_struct 'p' while the loop still try +* to access the field of 'p', so, get an extra reference. +*/ +get_task_struct (p);for_each_thread (p, t) {list_for_each_entry (child, &t->children, sibling) {unsigned int child_points;
@@ -483,6 +490,7 @@ void oom_kill_process(struct task_struct } } } +put_task_struct (p);read_unlock (&tasklist_lock); p =find_lock_task_mm (victim);
Greg Kroah-Hartman
maintainerPATCH 31/31 mm: migrate: dont rely on __PageMovable() of newpage after unlocking it
In reply to Greg Kroah-Hartman3.18-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit e0a352fabce61f730341d119fbedf71ffdb8663f upstream.
We had a race in the old balloon compaction code before b1123ea6d3b3 ("mm: balloon: use general non-lru movable page feature") refactored it that became visible after backporting 195a8c43e93d ("virtio-balloon:
deflate via a page list") without the refactoring.
The bug existed from commit d6d86c0a7f8d ("mm/balloon_compaction:
redesign ballooned pages management") till b1123ea6d3b3 ("mm: balloon:
use general non-lru movable page feature"). d6d86c0a7f8d ("mm/balloon_compaction: redesign ballooned pages management") was backported to 3.12, so the broken kernels are stable kernels [3.12 - 4.7].
There was a subtle race between dropping the page lock of the newpage in __unmap_and_move() and checking for __is_movable_balloon_page(newpage).
Just after dropping this page lock, virtio-balloon could go ahead and deflate the newpage, effectively dequeueing it and clearing PageBalloon, in turn making __is_movable_balloon_page(newpage) fail.
This resulted in dropping the reference of the newpage via putback_lru_page(newpage) instead of put_page(newpage), leading to page->lru getting modified and a !LRU page ending up in the LRU lists. With 195a8c43e93d ("virtio-balloon: deflate via a page list") backported, one would suddenly get corrupted lists in release_pages_balloon():
- WARNING: CPU: 13 PID: 6586 at lib/list_debug.c:59 __list_del_entry+0xa1/0xd0
- list_del corruption. prev->next should be ffffe253961090a0, but was dead000000000100
Nowadays this race is no longer possible, but it is hidden behind very ugly handling of __ClearPageMovable() and __PageMovable().
__ClearPageMovable() will not make __PageMovable() fail, only PageMovable(). So the new check (__PageMovable(newpage)) will still hold even after newpage was dequeued by virtio-balloon.
If anybody would ever change that special handling, the BUG would be introduced again. So instead, make it explicit and use the information of the original isolated page before migration.
This patch can be backported fairly easy to stable kernels (in contrast to the refactoring).
--- mm/migrate.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
mm/migrate.c +5 -2
@@ -943,6 +943,7 @@ static int unmap_and_move(new_page_t getint rc =0 ;int *result =NULL ;struct page *newpage =get_new_page (page, private, &result); +bool is_lru = !isolated_balloon_page (page);if (!newpage)return -ENOMEM ;
@@ -975,12 +976,14 @@ out:/* * If migration was not successful and there's a freeing callback, use * it. Otherwise, putback_lru_page() will drop the reference grabbed -* during isolation. +* during isolation. Use the old state of the isolated source page to +* determine if we migrated a LRU page. newpage was already unlocked +* and possibly modified by its owner - don't rely on the page state. */ if (rc !=MIGRATEPAGE_SUCCESS && put_new_page) {ClearPageSwapBacked (newpage);put_new_page (newpage, private); - }else if (unlikely (__is_movable_balloon_page (newpage))) { + }else if (rc ==MIGRATEPAGE_SUCCESS &&unlikely (!is_lru)) {/* drop our reference, page already in the balloon */ put_page (newpage); }else
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.18.134 release. There are 31 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed Feb 6 10:35:28 UTC 2019. Anything received after that time might be too late.
Build results:
total: 155 pass: 153 fail: 2
Failed builds:
arm64:defconfig
arm64:allmodconfig
Qemu test results:
total: 222 pass: 222 fail: 0
Error log:
Error log:arch/arm64/kernel/head.o: In function `el2_setup':
(.head.text+0x130): relocation truncated to fit: R_AARCH64_ADR_PREL_LO21 against symbol `__hyp_stub_vectors' defined in .hyp.text section in arch/arm64/kernel/built-in.o
Looks like this is due to commit 8640f2308921 ("arm64: hyp-stub: Forbid kprobing of the hyp-stub").
Guenter
Greg Kroah-Hartman
maintainerQuoted 20 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.18.134 release. There are 31 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed Feb 6 10:35:28 UTC 2019. Anything received after that time might be too late.
Build results:
total: 155 pass: 153 fail: 2Failed builds:
arm64:defconfig
arm64:allmodconfig
Qemu test results:total: 222 pass: 222 fail: 0Error log:
Quoted 7 lines
Error log:
arch/arm64/kernel/head.o: In function `el2_setup':
(.head.text+0x130): relocation truncated to fit:R_AARCH64_ADR_PREL_LO21against symbol `__hyp_stub_vectors' defined in .hyp.text section inarch/arm64/kernel/built-in.oLooks like this is due to commit
8640f2308921("arm64: hyp-stub: Forbid kprobing of the hyp-stub").
Ah, thanks, let me go fix this up...
Ok, pushed out a -rc2 with that patch dropped.
greg k-h
Quoted 26 lines · Greg Kroah-Hartman
Quoted 25 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.18.134 release. There are 31 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed Feb 6 10:35:28 UTC 2019. Anything received after that time might be too late.
Build results:
total: 155 pass: 153 fail: 2Failed builds:
arm64:defconfig
arm64:allmodconfig
Qemu test results:total: 222 pass: 222 fail: 0Error log:
Error log:
arch/arm64/kernel/head.o: In function `el2_setup':
(.head.text+0x130): relocation truncated to fit:R_AARCH64_ADR_PREL_LO21against symbol `__hyp_stub_vectors' defined in .hyp.text section inarch/arm64/kernel/built-in.o
Quoted 9 lines
Quoted 2 lines
Looks like this is due to commit
8640f2308921("arm64: hyp-stub: Forbid kprobing of the hyp-stub").Ah, thanks, let me go fix this up...
Ok, pushed out a -rc2 with that patch dropped.
greg k-h
Now fixed:
Build results:
total: 155 pass: 155 fail: 0 Qemu test results: total: 226 pass: 226 fail: 0
Guenter
Greg Kroah-Hartman
maintainerQuoted 34 lines · Guenter Roeck
Quoted 33 lines · Greg Kroah-Hartman
Quoted 20 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.18.134 release. There are 31 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed Feb 6 10:35:28 UTC 2019. Anything received after that time might be too late.
Build results:
total: 155 pass: 153 fail: 2Failed builds:
arm64:defconfig
arm64:allmodconfig
Qemu test results:total: 222 pass: 222 fail: 0Error log:
Quoted 7 lines
Error log:
arch/arm64/kernel/head.o: In function `el2_setup':
(.head.text+0x130): relocation truncated to fit:R_AARCH64_ADR_PREL_LO21against symbol `__hyp_stub_vectors' defined in .hyp.text section inarch/arm64/kernel/built-in.oLooks like this is due to commit
8640f2308921("arm64: hyp-stub: Forbid kprobing of the hyp-stub").Ah, thanks, let me go fix this up...
Ok, pushed out a -rc2 with that patch dropped.
Quoted 8 lines
Quoted 2 lines
greg k-h
Now fixed:
Build results:
total: 155 pass: 155 fail: 0 Qemu test results: total: 226 pass: 226 fail: 0
Wonderful, thanks for testing all of these and letting me know.
greg k-h