3.12.60-stable review
Subsystems (6)
cover 3.12.60-stable review
This is the start of the stable review cycle for the 3.12.60 release. There are 76 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 Mon May 23 11:07:53 CEST 2016. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
http://kernel.org/pub/linux/kernel/people/jirislaby/stable-review/patch-3.12.60-rc1.xz
and the diffstat can be found below.
thanks,
js
===============
Adrian Hunter (1):
mmc: sdhci: Allow for irq being shared
Al Viro (1):
get_rock_ridge_filename(): handle malformed NM entries
Andi Kleen (1):
asmlinkage, pnp: Make variables used from assembler code visible
Andrey Gelman (1):
Input: ads7846 - correct the value got from SPI
Anton Blanchard (1):
powerpc: scan_features() updates incorrect bits for REAL_LE
Antonio Alecrim Jr (1):
X.509: remove possible code fragility: enumeration values not handled
Arnd Bergmann (3):
ASoC: s3c24xx: use const snd_soc_component_driver pointer
paride: make 'verbose' parameter an 'int' again
lpfc: fix misleading indentation
Behan Webster (1):
x86: LLVMLinux: Fix "incomplete type const struct x86cpu_device_id"
Ben Hutchings (2):
misc/bmp085: Enable building as a module
atl2: Disable unimplemented scatter/gather feature
Borislav Petkov (1):
perf stat: Document --detailed option
Chris Friesen (1):
route: do not cache fib route info on local routes with oif
Dan Streetman (1):
nbd: ratelimit error msgs after socket close
Daniel Vetter (1):
drm/i915: Bail out of pipe config compute loop on LPT
David Howells (2):
ASN.1: Fix non-match detection failure on data overrun
KEYS: Fix ASN.1 indefinite length object parsing
David S. Miller (1):
decnet: Do not build routes to devices without decnet private data.
Dmitry Ivanov (1):
nl80211: check netlink protocol in socket release notification
Eric Dumazet (1):
net/mlx4_en: fix spurious timestamping callbacks
Ewan D. Milne (1):
scsi: Avoid crashing if device uses DIX but adapter does not support
it
Fabio Estevam (1):
bus: imx-weim: Take the 'status' property value into account
Geert Uytterhoeven (2):
rtc: vr41xx: Wire up alarm_irq_enable
serial: sh-sci: Remove cpufreq notifier to fix crash/deadlock
Herbert Xu (2):
crypto: gcm - Fix rfc4543 decryption crash
crypto: hash - Fix page length clamping in hash walk
Ian Campbell (1):
VSOCK: do not disconnect socket when peer has shutdown SEND only
Jasem Mutlaq (1):
USB: serial: cp210x: add Straizona Focusers device ids
Jiri Slaby (1):
Revert "xfs: add capability check to free eofblocks ioctl"
John Keeping (1):
drm/qxl: fix cursor position with non-zero hotspot
John Stultz (1):
cpuset: Fix potential deadlock w/ set_mems_allowed
Kangjie Lu (3):
net: fix infoleak in llc
net: fix infoleak in rtnetlink
net: fix a kernel infoleak in x25 module
Keerthy (1):
pinctrl: single: Fix pcs_parse_bits_in_pinctrl_entry to use __ffs than
ffs
Kirill Tkhai (1):
sched: Remove lockdep check in sched_move_task()
Konstantin Khlebnikov (2):
mm/balloon_compaction: redesign ballooned pages management mm/balloon_compaction: fix deflation when compaction is disabled
Krzysztof Kozlowski (1):
iio: ak8975: Fix NULL pointer exception on early interrupt
Laszlo Ersek (1):
efi: Fix out-of-bounds read in variable_matches()
Linus Lüssing (1):
batman-adv: Fix broadcast/ogm queue limit on a removed interface
Linus Walleij (1):
clk: versatile: sp810: support reentrance
Lokesh Vutla (1):
ARM: OMAP2+: hwmod: Fix updating of sysconfig register
Lu Baolu (1):
usb: xhci: fix wild pointers in xhci_mem_cleanup
Lucas Stach (1):
drm/radeon: fix PLL sharing on DCE6.1 (v2)
Marco Angaroni (1):
ipvs: correct initial offset of Call-ID header search in SIP
persistence engine
Marek Szyprowski (1):
Input: max8997-haptic - fix NULL pointer dereference
Mathias Krause (2):
proc: prevent accessing /proc/<PID>/environ until it's ready
packet: fix heap info leak in PACKET_DIAG_MCLIST sock_diag interface
Matt Fleming (1):
MAINTAINERS: Remove asterisk from EFI directory names
Michael Hennerich (1):
drivers/misc/ad525x_dpot: AD5274 fix RDAC read back errors
Mike Manning (1):
USB: serial: cp210x: add ID for Link ECU
Neil Horman (1):
netem: Segment GSO packets on enqueue
NeilBrown (1):
sunrpc/cache: drop reference when sunrpc_cache_pipe_upcall() detects a
race
Nikolay Aleksandrov (1):
net: bridge: fix old ioctl unlocked net device walk
Pali Rohár (1):
ARM: OMAP3: Add cpuidle parameters table for omap3430
Paolo Abeni (2):
net/route: enforce hoplimit max value
ipv4/fib: don't warn when primary address is missing if in_dev is dead
Paolo Bonzini (1):
compiler-gcc: disable -ftracer for __noclone functions
Prarit Bhargava (1):
ACPICA: Dispatcher: Update thread ID for recursive method calls
Robert Dobrowolski (1):
usb: hcd: out of bounds access in for_each_companion
Roman Pen (1):
workqueue: fix ghost PENDING flag while doing MQ IO
Rui Salvaterra (1):
lib: lz4: fixed zram with lz4 on big endian machines
Sascha Hauer (1):
ARM: SoCFPGA: Fix secondary CPU startup in thumb2 kernel
Sugar Zhang (1):
ASoC: rt5640: Correct the digital interface data select
Sushaanth Srirangapathi (1):
fbdev: da8xx-fb: fix videomodes of lcd panels
Sven Eckelmann (2):
batman-adv: Check skb size before using encapsulated ETH+VLAN header
batman-adv: Reduce refcnt of removed router when updating route
Takashi Iwai (1):
Input: i8042 - lower log level for "no controller" message
Tony Lindgren (1):
ARM: OMAP3: Fix booting with thumb2 kernel
Tony Luck (1):
EDAC: i7core, sb_edac: Don't return NOTIFY_BAD from mce_decoder
callback
Vasily Kulikov (1):
include/linux/poison.h: fix LIST_POISON{1,2} offset
Vitaly Kuznetsov (1):
Drivers: hv: vmbus: prevent cpu offlining on newer hypervisors
Vladis Dronov (1):
Input: gtco - fix crash on detecting device without endpoints
Wang YanQing (1):
x86/sysfb_efi: Fix valid BAR address range check
MAINTAINERS | 4 +- arch/arm/mach-omap2/cpuidle34xx.c | 69 ++++++++++++++++++++- arch/arm/mach-omap2/omap_hwmod.c | 8 +-- arch/arm/mach-omap2/sleep34xx.S | 22 +------ arch/arm/mach-socfpga/headsmp.S | 1 + arch/powerpc/include/uapi/asm/cputable.h | 1 + arch/powerpc/kernel/prom.c | 2 +- arch/x86/kernel/sysfb_efi.c | 14 ++++- crypto/ahash.c | 3 +- crypto/gcm.c | 3 + drivers/acpi/acpica/dsmethod.c | 3 + drivers/block/nbd.c | 4 +- drivers/block/paride/pd.c | 4 +- drivers/block/paride/pt.c | 4 +- drivers/bus/imx-weim.c | 2 +- drivers/clk/versatile/clk-sp810.c | 4 +- drivers/edac/i7core_edac.c | 2 +- drivers/edac/sb_edac.c | 2 +- drivers/firmware/efi/vars.c | 37 ++++++++---- drivers/gpu/drm/i915/intel_crt.c | 8 ++- drivers/gpu/drm/qxl/qxl_display.c | 13 ++-- drivers/gpu/drm/qxl/qxl_drv.h | 2 + drivers/gpu/drm/radeon/atombios_crtc.c | 10 +++ drivers/hv/vmbus_drv.c | 36 +++++++++++ drivers/iio/magnetometer/ak8975.c | 4 +- drivers/input/misc/max8997_haptic.c | 6 +- drivers/input/serio/i8042.c | 2 +- drivers/input/tablet/gtco.c | 10 ++- drivers/input/touchscreen/ads7846.c | 8 ++- drivers/misc/Kconfig | 2 +- drivers/misc/ad525x_dpot.c | 2 +- drivers/mmc/host/sdhci.c | 4 +- drivers/net/ethernet/atheros/atlx/atl2.c | 2 +- drivers/net/ethernet/mellanox/mlx4/en_tx.c | 6 +- drivers/pinctrl/pinctrl-single.c | 6 +- drivers/pnp/pnpbios/bioscalls.c | 9 +-- drivers/rtc/rtc-vr41xx.c | 13 ++-- drivers/scsi/lpfc/lpfc_init.c | 5 +- drivers/scsi/scsi_lib.c | 12 +++- drivers/tty/serial/sh-sci.c | 39 ------------ drivers/usb/core/hcd-pci.c | 9 +++ drivers/usb/host/xhci-mem.c | 6 ++ drivers/usb/serial/cp210x.c | 4 ++ drivers/video/da8xx-fb.c | 7 +-- drivers/virtio/virtio_balloon.c | 15 +++-- fs/isofs/rock.c | 13 +++- fs/proc/base.c | 3 +- fs/xfs/xfs_ioctl.c | 6 -- include/linux/balloon_compaction.h | 97 ++++++++---------------------- include/linux/compiler-gcc.h | 2 +- include/linux/cpuset.h | 4 ++ include/linux/migrate.h | 11 +--- include/linux/mm.h | 19 ++++++ include/linux/mod_devicetable.h | 8 +++ include/linux/poison.h | 4 +- kernel/sched/core.c | 8 ++- kernel/workqueue.c | 29 +++++++++ lib/asn1_decoder.c | 21 ++++--- lib/lz4/lz4defs.h | 21 ++++--- mm/balloon_compaction.c | 28 ++++----- mm/compaction.c | 2 +- mm/migrate.c | 20 ++---- net/batman-adv/routing.c | 9 +++ net/batman-adv/send.c | 6 ++ net/batman-adv/soft-interface.c | 8 ++- net/bridge/br_ioctl.c | 5 +- net/core/rtnetlink.c | 18 +++--- net/decnet/dn_route.c | 9 ++- net/ipv4/fib_frontend.c | 6 +- net/ipv4/fib_semantics.c | 2 + net/ipv4/route.c | 12 ++++ net/ipv6/route.c | 6 +- net/llc/af_llc.c | 1 + net/netfilter/ipvs/ip_vs_pe_sip.c | 2 +- net/packet/af_packet.c | 1 + net/sched/sch_netem.c | 61 ++++++++++++++++++- net/sunrpc/cache.c | 6 +- net/vmw_vsock/af_vsock.c | 21 +------ net/wireless/nl80211.c | 2 +- net/x25/x25_facilities.c | 1 + scripts/asn1_compiler.c | 2 + sound/soc/codecs/rt5640.c | 2 +- sound/soc/codecs/rt5640.h | 36 +++++------ sound/soc/samsung/s3c-i2s-v2.c | 2 +- sound/soc/samsung/s3c-i2s-v2.h | 2 +- tools/perf/Documentation/perf-stat.txt | 8 +++ 86 files changed, 603 insertions(+), 350 deletions(-)
Signature · 1 line
2.8.2
PATCH 1/76 crypto: gcm - Fix rfc4543 decryption crash
From: Herbert Xu <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
This bug has already bee fixed upstream since 4.2. However, it was fixed during the AEAD conversion so no fix was backported to the older kernels.
When we do an RFC 4543 decryption, we will end up writing the ICV beyond the end of the dst buffer. This should lead to a crash but for some reason it was never noticed.
This patch fixes it by only writing back the ICV for encryption.
--- crypto/gcm.c | 3 +++ 1 file changed, 3 insertions(+)
crypto/gcm.c +3 -0
@@ -1173,6 +1173,9 @@ static struct aead_request *crypto_rfc4543_crypt(struct aead_request *req,aead_request_set_tfm (subreq, ctx->child);aead_request_set_callback (subreq, req->base.flags, crypto_rfc4543_done, req); +if (!enc) +aead_request_set_callback (subreq, req->base.flags, + req->base.complete, req->base.data);aead_request_set_crypt (subreq, cipher, cipher, enc ?0 : authsize, iv);aead_request_set_assoc (subreq, assoc, assoclen);
Signature · 1 line
2.8.2
PATCH 2/76 ARM: OMAP2+: hwmod: Fix updating of sysconfig register
From: Lokesh Vutla <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 3ca4a238106dedc285193ee47f494a6584b6fd2f upstream.
Commit 127500ccb766f ("ARM: OMAP2+: Only write the sysconfig on idle when necessary") talks about verification of sysconfig cache value before updating it, only during idle path. But the patch is adding the verification in the enable path. So, adding the check in a proper place as per the commit description.
Not keeping this check during enable path as there is a chance of losing context and it is safe to do on idle as the context of the register will never be lost while the device is active.
[[email protected]: appears to have been caused by my own mismerge of the
originally posted patch]
--- arch/arm/mach-omap2/omap_hwmod.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/omap_hwmod.c +4 -4
@@ -1435,9 +1435,7 @@ static void _enable_sysc(struct omap_hwmod *oh) (sf & SYSC_HAS_CLOCKACTIVITY))_set_clockactivity (oh, oh->class->sysc->clockact, &v); -/* If the cached value is the same as the new value, skip the write */ -if (oh->_sysc_cache != v) -_write_sysconfig (v, oh); +_write_sysconfig (v, oh);/* * Set the autoidle bit only after setting the smartidle bit
@@ -1500,7 +1498,9 @@ static void _idle_sysc(struct omap_hwmod *oh)_set_master_standbymode (oh, idlemode, &v); } -_write_sysconfig (v, oh); +/* If the cached value is the same as the new value, skip the write */ +if (oh->_sysc_cache != v) +_write_sysconfig (v, oh); }/**
Signature · 1 line
2.8.2
PATCH 3/76 usb: xhci: fix wild pointers in xhci_mem_cleanup
In reply to Jiri SlabyFrom: Lu Baolu <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 71504062a7c34838c3fccd92c447f399d3cb5797 upstream.
This patch fixes some wild pointers produced by xhci_mem_cleanup. These wild pointers will cause system crash if xhci_mem_cleanup() is called twice.
--- drivers/usb/host/xhci-mem.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/host/xhci-mem.c +6 -0
@@ -1785,6 +1785,12 @@ no_bw:kfree (xhci->rh_bw);kfree (xhci->ext_caps); + xhci->usb2_ports =NULL ; + xhci->usb3_ports =NULL ; + xhci->port_array =NULL ; + xhci->rh_bw =NULL ; + xhci->ext_caps =NULL ; + xhci->page_size =0 ; xhci->page_shift =0 ; xhci->bus_state[0 ].bus_suspended =0 ;
Signature · 1 line
2.8.2
PATCH 4/76 usb: hcd: out of bounds access in for_each_companion
In reply to Jiri SlabyFrom: Robert Dobrowolski <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit e86103a75705c7c530768f4ffaba74cf382910f2 upstream.
On BXT platform Host Controller and Device Controller figure as same PCI device but with different device function. HCD should not pass data to Device Controller but only to Host Controllers. Checking if companion device is Host Controller, otherwise skip.
--- drivers/usb/core/hcd-pci.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/usb/core/hcd-pci.c +9 -0
@@ -74,6 +74,15 @@ static void for_each_companion(struct pci_dev *pdev, struct usb_hcd *hcd,if (companion->bus != pdev->bus ||PCI_SLOT (companion->devfn) != slot)continue ; + +/* +* Companion device should be either UHCI,OHCI or EHCI host +* controller, otherwise skip. +*/ +if (companion->class !=CL_UHCI && companion->class !=CL_OHCI && + companion->class !=CL_EHCI ) +continue ; + companion_hcd =pci_get_drvdata (companion);if (!companion_hcd || !companion_hcd->self.root_hub)continue ;
Signature · 1 line
2.8.2
PATCH 5/76 lib: lz4: fixed zram with lz4 on big endian machines
In reply to Jiri SlabyFrom: Rui Salvaterra <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 3e26a691fe3fe1e02a76e5bab0c143ace4b137b4 upstream.
Based on Sergey's test patch [1], this fixes zram with lz4 compression on big endian cpus.
Note that the 64-bit preprocessor test is not a cleanup, it's part of the fix, since those identifiers are bogus (for example, __ppc64__ isn't defined anywhere else in the kernel, which means we'd fall into the 32-bit definitions on ppc64).
Tested on ppc64 with no regression on x86_64.
[1] http://marc.info/?l=linux-kernel&m=145994470805853&w=4
--- lib/lz4/lz4defs.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
lib/lz4/lz4defs.h +12 -9
@@ -11,8 +11,7 @@/* * Detects 64 bits mode */ -#if (defined(__x86_64__) || defined(__x86_64) || defined(__amd64__) \ - || defined(__ppc64__) || defined(__LP64__)) +#if defined(CONFIG_64BIT )#define LZ4_ARCH64 1#else #define LZ4_ARCH64 0
@@ -35,6 +34,10 @@ typedef struct _U64_S { u64 v; } U64_S;#define PUT4 (s, d) (A32(d) = A32(s))#define PUT8 (s, d) (A64(d) = A64(s)) + +#define LZ4_READ_LITTLEENDIAN_16 (d, s, p) \ + (d = s - A16(p)) +#define LZ4_WRITE_LITTLEENDIAN_16 (p, v) \ do { \ A16(p) = v; \
@@ -51,10 +54,13 @@ typedef struct _U64_S { u64 v; } U64_S;#define PUT8 (s, d) \ put_unaligned(get_unaligned((const u64 *) s), (u64 *) d) -#define LZ4_WRITE_LITTLEENDIAN_16 (p, v) \ - do { \ - put_unaligned(v, (u16 *)(p)); \ - p += 2; \ +#define LZ4_READ_LITTLEENDIAN_16 (d, s, p) \ + (d = s - get_unaligned_le16(p)) + +#define LZ4_WRITE_LITTLEENDIAN_16 (p, v) \ + do { \ + put_unaligned_le16(v, (u16 *)(p)); \ + p += 2; \ } while (0)#endif
@@ -140,9 +146,6 @@ typedef struct _U64_S { u64 v; } U64_S;#endif -#define LZ4_READ_LITTLEENDIAN_16 (d, s, p) \ - (d = s - get_unaligned_le16(p)) -#define LZ4_WILDCOPY (s, d, e) \ do { \ LZ4_COPYPACKET(s, d); \
Signature · 1 line
2.8.2
PATCH 6/76 drm/qxl: fix cursor position with non-zero hotspot
In reply to Jiri SlabyFrom: John Keeping <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit d59a1f71ff1aeda4b4630df92d3ad4e3b1dfc885 upstream.
The SPICE protocol considers the position of a cursor to be the location of its active pixel on the display, so the cursor is drawn with its top-left corner at "(x - hot_spot_x, y - hot_spot_y)" but the DRM cursor position gives the location where the top-left corner should be drawn, with the hotspot being a hint for drivers that need it.
This fixes the location of the window resize cursors when using Fluxbox with the QXL DRM driver and both the QXL and modesetting X drivers.
--- drivers/gpu/drm/qxl/qxl_display.c | 13 +++++++++---- drivers/gpu/drm/qxl/qxl_drv.h | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-)
drivers/gpu/drm/qxl/qxl_display.c +9 -4
@@ -287,10 +287,15 @@ static int qxl_crtc_cursor_set2(struct drm_crtc *crtc,qxl_bo_kunmap (user_bo); + qcrtc->cur_x += qcrtc->hot_spot_x - hot_x; + qcrtc->cur_y += qcrtc->hot_spot_y - hot_y; + qcrtc->hot_spot_x = hot_x; + qcrtc->hot_spot_y = hot_y; + cmd = (struct qxl_cursor_cmd *)qxl_release_map (qdev, release); cmd->type =QXL_CURSOR_SET ; - cmd->u.set.position.x = qcrtc->cur_x; - cmd->u.set.position.y = qcrtc->cur_y; + cmd->u.set.position.x = qcrtc->cur_x + qcrtc->hot_spot_x; + cmd->u.set.position.y = qcrtc->cur_y + qcrtc->hot_spot_y; cmd->u.set.shape =qxl_bo_physical_address (qdev, cursor_bo,0 );
@@ -353,8 +358,8 @@ static int qxl_crtc_cursor_move(struct drm_crtc *crtc, cmd = (struct qxl_cursor_cmd *)qxl_release_map (qdev, release); cmd->type =QXL_CURSOR_MOVE ; - cmd->u.position.x = qcrtc->cur_x; - cmd->u.position.y = qcrtc->cur_y; + cmd->u.position.x = qcrtc->cur_x + qcrtc->hot_spot_x; + cmd->u.position.y = qcrtc->cur_y + qcrtc->hot_spot_y;qxl_release_unmap (qdev, release, &cmd->release_info);qxl_push_cursor_ring_release (qdev, release,QXL_CMD_CURSOR , false);
drivers/gpu/drm/qxl/qxl_drv.h +2 -0
@@ -139,6 +139,8 @@ struct qxl_crtc {int index;int cur_x;int cur_y; +int hot_spot_x; +int hot_spot_y; };struct qxl_output {
Signature · 1 line
2.8.2
PATCH 7/76 nl80211: check netlink protocol in socket release notification
In reply to Jiri SlabyFrom: Dmitry Ivanov <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 8f815cdde3e550e10c2736990d791f60c2ce43eb upstream.
A non-privileged user can create a netlink socket with the same port_id as used by an existing open nl80211 netlink socket (e.g. as used by a hostapd process) with a different protocol number.
Closing this socket will then lead to the notification going to nl80211's socket release notification handler, and possibly cause an action such as removing a virtual interface.
Fix this issue by checking that the netlink protocol is NETLINK_GENERIC. Since generic netlink has no notifier chain of its own, we can't fix the problem more generically.
--- net/wireless/nl80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/wireless/nl80211.c +1 -1
@@ -11156,7 +11156,7 @@ static int nl80211_netlink_notify(struct notifier_block * nb,struct wireless_dev *wdev;struct cfg80211_beacon_registration *reg, *tmp; -if (state !=NETLINK_URELEASE ) +if (state !=NETLINK_URELEASE || notify->protocol !=NETLINK_GENERIC )return NOTIFY_DONE ;rcu_read_lock ();
Signature · 1 line
2.8.2
PATCH 8/76 Input: gtco - fix crash on detecting device without endpoints
In reply to Jiri SlabyFrom: Vladis Dronov <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 162f98dea487206d9ab79fc12ed64700667a894d upstream.
The gtco driver expects at least one valid endpoint. If given malicious descriptors that specify 0 for the number of endpoints, it will crash in the probe function. Ensure there is at least one endpoint on the interface before using it.
Also let's fix a minor coding style issue.
The full correct report of this issue can be found in the public Red Hat Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=1283385
--- drivers/input/tablet/gtco.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/input/tablet/gtco.c +9 -1
@@ -869,6 +869,14 @@ static int gtco_probe(struct usb_interface *usbinterface, goto err_free_buf; } +/* Sanity check that a device has an endpoint */ +if (usbinterface->altsetting[0 ].desc.bNumEndpoints <1 ) { +dev_err (&usbinterface->dev, +"Invalid number of endpoints\n" ); + error = -EINVAL ; + goto err_free_urb; + } +/* * The endpoint is always altsetting 0, we know this since we know * this device only has one interrupt endpoint
@@ -890,7 +898,7 @@ static int gtco_probe(struct usb_interface *usbinterface,* HID report descriptor */ if (usb_get_extra_descriptor (usbinterface->cur_altsetting, -HID_DEVICE_TYPE , &hid_desc) !=0 ){ +HID_DEVICE_TYPE , &hid_desc) !=0 ) {dev_err (&usbinterface->dev,"Can't retrieve exta USB descriptor to get hid report descriptor length\n" ); error = -EIO ;
Signature · 1 line
2.8.2
PATCH 9/76 pinctrl: single: Fix pcs_parse_bits_in_pinctrl_entry to use __ffs than ffs
In reply to Jiri SlabyFrom: Keerthy <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 56b367c0cd67d4c3006738e7dc9dda9273fd2bfe upstream.
pcs_parse_bits_in_pinctrl_entry uses ffs which gives bit indices ranging from 1 to MAX. This leads to a corner case where we try to request the pin number = MAX and fails.
bit_pos value is being calculted using ffs. pin_num_from_lsb uses bit_pos value. pins array is populated with:
pin + pin_num_from_lsb.
The above is 1 more than usual bit indices as bit_pos uses ffs to compute first set bit. Hence the last of the pins array is populated with the MAX value and not MAX - 1 which causes error when we call pin_request.
mask_pos is rightly calculated as ((pcs->fmask) << (bit_pos - 1)) Consequently val_pos and submask are correct.
Hence use __ffs which gives (ffs(x) - 1) as the first bit set.
--- drivers/pinctrl/pinctrl-single.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-single.c +3 -3
@@ -1263,9 +1263,9 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,/* Parse pins in each row from LSB */ while (mask) { - bit_pos =ffs (mask); + bit_pos =__ffs (mask); pin_num_from_lsb = bit_pos / pcs->bits_per_pin; - mask_pos = ((pcs->fmask) << (bit_pos -1 )); + mask_pos = ((pcs->fmask) << bit_pos); val_pos = val & mask_pos; submask = mask & mask_pos; mask &= ~mask_pos;
@@ -1549,7 +1549,7 @@ static int pcs_probe(struct platform_device *pdev) ret =of_property_read_u32 (np,"pinctrl-single,function-mask" , &pcs->fmask);if (!ret) { - pcs->fshift =ffs (pcs->fmask) -1 ; + pcs->fshift =__ffs (pcs->fmask); pcs->fmax = pcs->fmask >> pcs->fshift; }else {/* If mask property doesn't exist, function mux is invalid. */
Signature · 1 line
2.8.2
PATCH 10/76 EDAC: i7core, sb_edac: Don't return NOTIFY_BAD from mce_decoder callback
In reply to Jiri SlabyFrom: Tony Luck <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit c4fc1956fa31003bfbe4f597e359d751568e2954 upstream.
Both of these drivers can return NOTIFY_BAD, but this terminates processing other callbacks that were registered later on the chain. Since the driver did nothing to log the error it seems wrong to prevent other interested parties from seeing it. E.g. neither of them had even bothered to check the type of the error to see if it was a memory error before the return NOTIFY_BAD.
--- drivers/edac/i7core_edac.c | 2 +- drivers/edac/sb_edac.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/edac/i7core_edac.c +1 -1
@@ -1878,7 +1878,7 @@ static int i7core_mce_check_error(struct notifier_block *nb, unsigned long val, i7_dev =get_i7core_dev (mce->socketid);if (!i7_dev) -return NOTIFY_BAD ; +return NOTIFY_DONE ; mci = i7_dev->mci; pvt = mci->pvt_info;
drivers/edac/sb_edac.c +1 -1
@@ -1538,7 +1538,7 @@ static int sbridge_mce_check_error(struct notifier_block *nb, unsigned long val, mci =get_mci_for_node_id (mce->socketid);if (!mci) -return NOTIFY_BAD ; +return NOTIFY_DONE ; pvt = mci->pvt_info;/*
Signature · 1 line
2.8.2
PATCH 11/76 ASoC: s3c24xx: use const snd_soc_component_driver pointer
In reply to Jiri SlabyFrom: Arnd Bergmann <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit ba4bc32eaa39ba7687f0958ae90eec94da613b46 upstream.
An older patch to convert the API in the s3c i2s driver ended up passing a const pointer into a function that takes a non-const pointer, so we now get a warning:
sound/soc/samsung/s3c2412-i2s.c: In function 's3c2412_iis_dev_probe':sound/soc/samsung/s3c2412-i2s.c:172:9: error: passing argument 3 of 's3c_i2sv2_register_component' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
However, the s3c_i2sv2_register_component() function again passes the pointer into another function taking a const, so we just need to change its prototype.
--- sound/soc/samsung/s3c-i2s-v2.c | 2 +- sound/soc/samsung/s3c-i2s-v2.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/soc/samsung/s3c-i2s-v2.c +1 -1
@@ -730,7 +730,7 @@ static int s3c2412_i2s_resume(struct snd_soc_dai *dai)#endif int s3c_i2sv2_register_component (struct device *dev,int id, -struct snd_soc_component_driver *cmp_drv, +const struct snd_soc_component_driver *cmp_drv,struct snd_soc_dai_driver *dai_drv) {struct snd_soc_dai_ops *ops = drv->ops;
sound/soc/samsung/s3c-i2s-v2.h +1 -1
@@ -101,7 +101,7 @@ extern int s3c_i2sv2_probe(struct snd_soc_dai *dai,* soc core. */ extern int s3c_i2sv2_register_component (struct device *dev,int id, -struct snd_soc_component_driver *cmp_drv, +const struct snd_soc_component_driver *cmp_drv,struct snd_soc_dai_driver *dai_drv);#endif /* __SND_SOC_S3C24XX_S3C_I2SV2_I2S_H */
Signature · 1 line
2.8.2
PATCH 12/76 ASoC: rt5640: Correct the digital interface data select
In reply to Jiri SlabyFrom: Sugar Zhang <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 653aa4645244042826f105aab1be3d01b3d493ca upstream.
this patch corrects the interface adc/dac control register definition according to datasheet.
--- sound/soc/codecs/rt5640.c | 2 +- sound/soc/codecs/rt5640.h | 36 ++++++++++++++++++------------------ 2 files changed, 19 insertions(+), 19 deletions(-)
sound/soc/codecs/rt5640.c +1 -1
@@ -358,7 +358,7 @@ static unsigned int bst_tlv[] = {/* Interface data select */ static const char *const rt5640_data_select[] = { -"Normal" ,"left copy to right" ,"right copy to left" ,"Swap" }; +"Normal" ,"Swap" ,"left copy to right" ,"right copy to left" }; static const SOC_ENUM_SINGLE_DECL(rt5640_if1_dac_enum, RT5640_DIG_INF_DATA, RT5640_IF1_DAC_SEL_SFT, rt5640_data_select);
sound/soc/codecs/rt5640.h +18 -18
@@ -435,39 +435,39 @@#define RT5640_IF1_DAC_SEL_MASK (0x3 << 14)#define RT5640_IF1_DAC_SEL_SFT 14#define RT5640_IF1_DAC_SEL_NOR (0x0 << 14) -#define RT5640_IF1_DAC_SEL_L2R (0x1 << 14) -#define RT5640_IF1_DAC_SEL_R2L (0x2 << 14) -#define RT5640_IF1_DAC_SEL_SWAP (0x3 << 14) +#define RT5640_IF1_DAC_SEL_SWAP (0x1 << 14) +#define RT5640_IF1_DAC_SEL_L2R (0x2 << 14) +#define RT5640_IF1_DAC_SEL_R2L (0x3 << 14)#define RT5640_IF1_ADC_SEL_MASK (0x3 << 12)#define RT5640_IF1_ADC_SEL_SFT 12#define RT5640_IF1_ADC_SEL_NOR (0x0 << 12) -#define RT5640_IF1_ADC_SEL_L2R (0x1 << 12) -#define RT5640_IF1_ADC_SEL_R2L (0x2 << 12) -#define RT5640_IF1_ADC_SEL_SWAP (0x3 << 12) +#define RT5640_IF1_ADC_SEL_SWAP (0x1 << 12) +#define RT5640_IF1_ADC_SEL_L2R (0x2 << 12) +#define RT5640_IF1_ADC_SEL_R2L (0x3 << 12)#define RT5640_IF2_DAC_SEL_MASK (0x3 << 10)#define RT5640_IF2_DAC_SEL_SFT 10#define RT5640_IF2_DAC_SEL_NOR (0x0 << 10) -#define RT5640_IF2_DAC_SEL_L2R (0x1 << 10) -#define RT5640_IF2_DAC_SEL_R2L (0x2 << 10) -#define RT5640_IF2_DAC_SEL_SWAP (0x3 << 10) +#define RT5640_IF2_DAC_SEL_SWAP (0x1 << 10) +#define RT5640_IF2_DAC_SEL_L2R (0x2 << 10) +#define RT5640_IF2_DAC_SEL_R2L (0x3 << 10)#define RT5640_IF2_ADC_SEL_MASK (0x3 << 8)#define RT5640_IF2_ADC_SEL_SFT 8#define RT5640_IF2_ADC_SEL_NOR (0x0 << 8) -#define RT5640_IF2_ADC_SEL_L2R (0x1 << 8) -#define RT5640_IF2_ADC_SEL_R2L (0x2 << 8) -#define RT5640_IF2_ADC_SEL_SWAP (0x3 << 8) +#define RT5640_IF2_ADC_SEL_SWAP (0x1 << 8) +#define RT5640_IF2_ADC_SEL_L2R (0x2 << 8) +#define RT5640_IF2_ADC_SEL_R2L (0x3 << 8)#define RT5640_IF3_DAC_SEL_MASK (0x3 << 6)#define RT5640_IF3_DAC_SEL_SFT 6#define RT5640_IF3_DAC_SEL_NOR (0x0 << 6) -#define RT5640_IF3_DAC_SEL_L2R (0x1 << 6) -#define RT5640_IF3_DAC_SEL_R2L (0x2 << 6) -#define RT5640_IF3_DAC_SEL_SWAP (0x3 << 6) +#define RT5640_IF3_DAC_SEL_SWAP (0x1 << 6) +#define RT5640_IF3_DAC_SEL_L2R (0x2 << 6) +#define RT5640_IF3_DAC_SEL_R2L (0x3 << 6)#define RT5640_IF3_ADC_SEL_MASK (0x3 << 4)#define RT5640_IF3_ADC_SEL_SFT 4#define RT5640_IF3_ADC_SEL_NOR (0x0 << 4) -#define RT5640_IF3_ADC_SEL_L2R (0x1 << 4) -#define RT5640_IF3_ADC_SEL_R2L (0x2 << 4) -#define RT5640_IF3_ADC_SEL_SWAP (0x3 << 4) +#define RT5640_IF3_ADC_SEL_SWAP (0x1 << 4) +#define RT5640_IF3_ADC_SEL_L2R (0x2 << 4) +#define RT5640_IF3_ADC_SEL_R2L (0x3 << 4)/* REC Left Mixer Control 1 (0x3b) */ #define RT5640_G_HP_L_RM_L_MASK (0x7 << 13)
Signature · 1 line
2.8.2
PATCH 13/76 efi: Fix out-of-bounds read in variable_matches()
In reply to Jiri SlabyFrom: Laszlo Ersek <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 630ba0cc7a6dbafbdee43795617c872b35cde1b4 upstream.
The variable_matches() function can currently read "var_name[len]", for example when:
- var_name[0] == 'a',
- len == 1
- match_name points to the NUL-terminated string "ab".
This function is supposed to accept "var_name" inputs that are not NUL-terminated (hence the "len" parameter"). Document the function, and access "var_name[*match]" only if "*match" is smaller than "len".
--- drivers/firmware/efi/vars.c | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-)
drivers/firmware/efi/vars.c +26 -11
@@ -202,29 +202,44 @@ static const struct variable_validate variable_validate[] = { { NULL_GUID, "", NULL }, }; +/* +* Check if @var_name matches the pattern given in @match_name. +* +* @var_name: an array of @len non-NUL characters. +* @match_name: a NUL-terminated pattern string, optionally ending in "*". A +* final "*" character matches any trailing characters @var_name, +* including the case when there are none left in @var_name. +* @match: on output, the number of non-wildcard characters in @match_name +* that @var_name matches, regardless of the return value. +* @return: whether @var_name fully matches @match_name. +*/ static bool variable_matches (const char *var_name,size_t len,const char *match_name,int *match) {for (*match =0 ; ; (*match)++) {char c = match_name[*match]; -char u = var_name[*match]; -/* Wildcard in the matching name means we've matched */ -if (c =='*' ) +switch (c) { +case '*' : +/* Wildcard in @match_name means we've matched. */ return true; -/* Case sensitive match */ -if (!c && *match == len) -return true; +case '\0' : +/* @match_name has ended. Has @var_name too? */ +return (*match == len); -if (c != u) +default : +/* +* We've reached a non-wildcard char in @match_name. +* Continue only if there's an identical character in +* @var_name. +*/ +if (*match < len && c == var_name[*match]) +continue ;return false; - -if (!c) -return true; + } } -return true; }bool
Signature · 1 line
2.8.2
PATCH 14/76 workqueue: fix ghost PENDING flag while doing MQ IO
In reply to Jiri SlabyFrom: Roman Pen <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 346c09f80459a3ad97df1816d6d606169a51001a upstream.
The bug in a workqueue leads to a stalled IO request in MQ ctx->rq_list with the following backtrace:
[ 601.347452] INFO: task kworker/u129:5:1636 blocked for more than 120 seconds. [ 601.347574] Tainted: G O 4.4.5-1-storage+ #6 [ 601.347651] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 601.348142] kworker/u129:5 D ffff880803077988 0 1636 2 0x00000000 [ 601.348519] Workqueue: ibnbd_server_fileio_wq ibnbd_dev_file_submit_io_worker [ibnbd_server] [ 601.348999] ffff880803077988 ffff88080466b900 ffff8808033f9c80 ffff880803078000 [ 601.349662] ffff880807c95000 7fffffffffffffff ffffffff815b0920 ffff880803077ad0 [ 601.350333] ffff8808030779a0 ffffffff815b01d5 0000000000000000 ffff880803077a38 [ 601.350965] Call Trace: [ 601.351203] [<ffffffff815b0920>] ? bit_wait+0x60/0x60 [ 601.351444] [<ffffffff815b01d5>] schedule+0x35/0x80 [ 601.351709] [<ffffffff815b2dd2>] schedule_timeout+0x192/0x230 [ 601.351958] [<ffffffff812d43f7>] ? blk_flush_plug_list+0xc7/0x220 [ 601.352208] [<ffffffff810bd737>] ? ktime_get+0x37/0xa0 [ 601.352446] [<ffffffff815b0920>] ? bit_wait+0x60/0x60 [ 601.352688] [<ffffffff815af784>] io_schedule_timeout+0xa4/0x110 [ 601.352951] [<ffffffff815b3a4e>] ? _raw_spin_unlock_irqrestore+0xe/0x10 [ 601.353196] [<ffffffff815b093b>] bit_wait_io+0x1b/0x70 [ 601.353440] [<ffffffff815b056d>] __wait_on_bit+0x5d/0x90 [ 601.353689] [<ffffffff81127bd0>] wait_on_page_bit+0xc0/0xd0 [ 601.353958] [<ffffffff81096db0>] ? autoremove_wake_function+0x40/0x40 [ 601.354200] [<ffffffff81127cc4>] __filemap_fdatawait_range+0xe4/0x140 [ 601.354441] [<ffffffff81127d34>] filemap_fdatawait_range+0x14/0x30 [ 601.354688] [<ffffffff81129a9f>] filemap_write_and_wait_range+0x3f/0x70 [ 601.354932] [<ffffffff811ced3b>] blkdev_fsync+0x1b/0x50 [ 601.355193] [<ffffffff811c82d9>] vfs_fsync_range+0x49/0xa0 [ 601.355432] [<ffffffff811cf45a>] blkdev_write_iter+0xca/0x100 [ 601.355679] [<ffffffff81197b1a>] __vfs_write+0xaa/0xe0 [ 601.355925] [<ffffffff81198379>] vfs_write+0xa9/0x1a0 [ 601.356164] [<ffffffff811c59d8>] kernel_write+0x38/0x50
The underlying device is a null_blk, with default parameters:
queue_mode = MQ
submit_queues = 1
Verification that nullb0 has something inflight:
root@pserver8:~# cat /sys/block/nullb0/inflight
0 1
root@pserver8:~# find /sys/block/nullb0/mq/0/cpu* -name rq_list -print -exec cat {} \;
...
/sys/block/nullb0/mq/0/cpu2/rq_list
CTX pending:
ffff8838038e2400
...During debug it became clear that stalled request is always inserted in the rq_list from the following path:
save_stack_trace_tsk + 34
blk_mq_insert_requests + 231
blk_mq_flush_plug_list + 281
blk_flush_plug_list + 199
wait_on_page_bit + 192
__filemap_fdatawait_range + 228
filemap_fdatawait_range + 20
filemap_write_and_wait_range + 63
blkdev_fsync + 27
vfs_fsync_range + 73
blkdev_write_iter + 202
__vfs_write + 170
vfs_write + 169
kernel_write + 56
So blk_flush_plug_list() was called with from_schedule == true.
If from_schedule is true, that means that finally blk_mq_insert_requests() offloads execution of __blk_mq_run_hw_queue() and uses kblockd workqueue, i.e. it calls kblockd_schedule_delayed_work_on().
That means, that we race with another CPU, which is about to execute __blk_mq_run_hw_queue() work.
Further debugging shows the following traces from different CPUs:
CPU#0 CPU#1
---------------------------------- -------------------------------
reqeust A inserted
STORE hctx->ctx_map[0] bit marked
kblockd_schedule...() returns 1
<schedule to kblockd workqueue>
request B inserted STORE hctx->ctx_map[1] bit marked kblockd_schedule...() returns 0
*** WORK PENDING bit is cleared ***
flush_busy_ctxs() is executed, but
bit 1, set by CPU#1, is not observed
As a result request B pended forever.
This behaviour can be explained by speculative LOAD of hctx->ctx_map on CPU#0, which is reordered with clear of PENDING bit and executed _before_ actual STORE of bit 1 on CPU#1.
The proper fix is an explicit full barrier <mfence>, which guarantees that clear of PENDING bit is to be executed before all possible speculative LOADS or STORES inside actual work function.
--- kernel/workqueue.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
kernel/workqueue.c +29 -0
@@ -622,6 +622,35 @@ static void set_work_pool_and_clear_pending(struct work_struct *work,*/ smp_wmb ();set_work_data (work, (unsigned long )pool_id <<WORK_OFFQ_POOL_SHIFT ,0 ); +/* +* The following mb guarantees that previous clear of a PENDING bit +* will not be reordered with any speculative LOADS or STORES from +* work->current_func, which is executed afterwards. This possible +* reordering can lead to a missed execution on attempt to qeueue +* the same @work. E.g. consider this case: +* +* CPU#0 CPU#1 +* ---------------------------- -------------------------------- +* +* 1 STORE event_indicated +* 2 queue_work_on() { +* 3 test_and_set_bit(PENDING) +* 4 } set_..._and_clear_pending() { +* 5 set_work_data() # clear bit +* 6 smp_mb() +* 7 work->current_func() { +* 8 LOAD event_indicated +* } +* +* Without an explicit full barrier speculative LOAD on line 8 can +* be executed before CPU#0 does STORE on line 1. If that happens, +* CPU#0 observes the PENDING bit is still set and new execution of +* a @work is not queued in a hope, that CPU#1 will eventually +* finish the queued @work. Meanwhile CPU#1 does not see +* event_indicated is set, because speculative LOAD was executed +* before actual STORE. +*/ +smp_mb (); }static void clear_work_data (struct work_struct *work)
Signature · 1 line
2.8.2
PATCH 15/76 paride: make 'verbose' parameter an 'int' again
In reply to Jiri SlabyFrom: Arnd Bergmann <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit dec63a4dec2d6d01346fd5d96062e67c0636852b upstream.
gcc-6.0 found an ancient bug in the paride driver, which had a "module_param(verbose, bool, 0);" since before 2.6.12, but actually uses it to accept '0', '1' or '2' as arguments:
drivers/block/paride/pd.c: In function 'pd_init_dev_parms':
drivers/block/paride/pd.c:298:29: warning: comparison of constant '1' with boolean expression is always false [-Wbool-compare]
#define DBMSG(msg) ((verbose>1)?(msg):NULL)
In 2012, Rusty did a cleanup patch that also changed the type of the variable to 'bool', which introduced what is now a gcc warning.
This changes the type back to 'int' and adapts the module_param() line instead, so it should work as documented in case anyone ever cares about running the ancient driver with debugging.
Rusty Russell <[email protected]>
--- drivers/block/paride/pd.c | 4 ++-- drivers/block/paride/pt.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/block/paride/pd.c +2 -2
@@ -126,7 +126,7 @@*/ #include <linux/types.h> -static bool verbose =0 ; +static int verbose =0 ;static int major =PD_MAJOR ;static char *name =PD_NAME ;static int cluster =64 ;
@@ -161,7 +161,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_GEO, D_SBY, D_DLY, D_SLV};static DEFINE_MUTEX (pd_mutex);static DEFINE_SPINLOCK (pd_lock); -module_param (verbose, bool,0 ); +module_param (verbose, int,0 );module_param (major, int,0 );module_param (name, charp,0 );module_param (cluster, int,0 );
drivers/block/paride/pt.c +2 -2
@@ -117,7 +117,7 @@*/ -static bool verbose =0 ; +static int verbose =0 ;static int major =PT_MAJOR ;static char *name =PT_NAME ;static int disable =0 ;
@@ -152,7 +152,7 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3};#include <asm/uaccess.h> -module_param (verbose, bool,0 ); +module_param (verbose, int,0 );module_param (major, int,0 );module_param (name, charp,0 );module_param_array (drive0, int,NULL ,0 );
Signature · 1 line
2.8.2
PATCH 16/76 fbdev: da8xx-fb: fix videomodes of lcd panels
In reply to Jiri SlabyFrom: Sushaanth Srirangapathi <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 713fced8d10fa1c759c8fb6bf9aaa681bae68cad upstream.
Commit 028cd86b794f4a ("video: da8xx-fb: fix the polarities of the hsync/vsync pulse") fixes polarities of HSYNC/VSYNC pulse but forgot to update known_lcd_panels[] which had sync values according to old logic. This breaks LCD at least on DA850 EVM.
This patch fixes this issue and I have tested this for panel "Sharp_LK043T1DG01" using DA850 EVM board.
--- drivers/video/da8xx-fb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/video/da8xx-fb.c +3 -4
@@ -210,8 +210,7 @@ static struct fb_videomode known_lcd_panels[] = { .lower_margin = 2, .hsync_len = 0, .vsync_len = 0, - .sync =FB_SYNC_CLK_INVERT | - FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + .sync = FB_SYNC_CLK_INVERT, },/* Sharp LK043T1DG01 */ [1] = {
@@ -225,7 +224,7 @@ static struct fb_videomode known_lcd_panels[] = { .lower_margin = 2, .hsync_len = 41, .vsync_len = 10, - .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + .sync = 0, .flag = 0, }, [2] = {
@@ -240,7 +239,7 @@ static struct fb_videomode known_lcd_panels[] = { .lower_margin = 10, .hsync_len = 10, .vsync_len = 10, - .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT, + .sync = 0, .flag = 0, }, };
Signature · 1 line
2.8.2
PATCH 17/76 misc/bmp085: Enable building as a module
In reply to Jiri SlabyFrom: Ben Hutchings <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 50e6315dba721cbc24ccd6d7b299f1782f210a98 upstream.
Commit 985087dbcb02 'misc: add support for bmp18x chips to the bmp085 driver' changed the BMP085 config symbol to a boolean. I see no reason why the shared code cannot be built as a module, so change it back to tristate.
--- drivers/misc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/Kconfig +1 -1
@@ -451,7 +451,7 @@ config ARM_CHARLCD still useful. config BMP085 - bool + tristate depends on SYSFS config BMP085_I2C
Signature · 1 line
2.8.2
PATCH 18/76 rtc: vr41xx: Wire up alarm_irq_enable
In reply to Jiri SlabyFrom: Geert Uytterhoeven <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit a25f4a95ec3cded34c1250364eba704c5e4fdac4 upstream.
drivers/rtc/rtc-vr41xx.c:229: warning: ‘vr41xx_rtc_alarm_irq_enable’ defined but not used
Apparently the conversion to alarm_irq_enable forgot to wire up the callback.
--- drivers/rtc/rtc-vr41xx.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/rtc/rtc-vr41xx.c +7 -6
@@ -272,12 +272,13 @@ static irqreturn_t rtclong1_interrupt(int irq, void *dev_id) }static const struct rtc_class_ops vr41xx_rtc_ops = { - .release = vr41xx_rtc_release, - .ioctl = vr41xx_rtc_ioctl, - .read_time = vr41xx_rtc_read_time, - .set_time = vr41xx_rtc_set_time, - .read_alarm = vr41xx_rtc_read_alarm, - .set_alarm = vr41xx_rtc_set_alarm, + .release = vr41xx_rtc_release, + .ioctl = vr41xx_rtc_ioctl, + .read_time = vr41xx_rtc_read_time, + .set_time = vr41xx_rtc_set_time, + .read_alarm = vr41xx_rtc_read_alarm, + .set_alarm = vr41xx_rtc_set_alarm, + .alarm_irq_enable = vr41xx_rtc_alarm_irq_enable, };static int rtc_probe (struct platform_device *pdev)
Signature · 1 line
2.8.2
PATCH 19/76 drivers/misc/ad525x_dpot: AD5274 fix RDAC read back errors
In reply to Jiri SlabyFrom: Michael Hennerich <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit f3df53e4d70b5736368a8fe8aa1bb70c1cb1f577 upstream.
Fix RDAC read back errors caused by a typo. Value must shift by 2.
--- drivers/misc/ad525x_dpot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/ad525x_dpot.c +1 -1
@@ -216,7 +216,7 @@ static s32 dpot_read_i2c(struct dpot_data *dpot, u8 reg)*/ value =swab16 (value); -if (dpot->uid ==DPOT_UID (AD5271_ID )) +if (dpot->uid ==DPOT_UID (AD5274_ID )) value = value >>2 ;return value;default :
Signature · 1 line
2.8.2
PATCH 20/76 serial: sh-sci: Remove cpufreq notifier to fix crash/deadlock
In reply to Jiri SlabyFrom: Geert Uytterhoeven <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit ff1cab374ad98f4b9f408525ca9c08992b4ed784 upstream.
The BSP team noticed that there is spin/mutex lock issue on sh-sci when CPUFREQ is used. The issue is that the notifier function may call mutex_lock() while the spinlock is held, which can lead to a BUG(). This may happen if CPUFREQ is changed while another CPU calls clk_get_rate().
Taking the spinlock was added to the notifier function in commit e552de2413edad1a ("sh-sci: add platform device private data"), to protect the list of serial ports against modification during traversal. At that time the Common Clock Framework didn't exist yet, and clk_get_rate() just returned clk->rate without taking a mutex. Note that since commit d535a2305facf9b4 ("serial: sh-sci: Require a device per port mapping."), there's no longer a list of serial ports to traverse, and taking the spinlock became superfluous.
To fix the issue, just remove the cpufreq notifier:
1. The notifier doesn't work correctly: all it does is update stored clock rates; it does not update the divider in the hardware. The divider will only be updated when calling sci_set_termios(). I believe this was broken back in 2004, when the old drivers/char/sh-sci.c driver (where the notifier did update the divider) was replaced by drivers/serial/sh-sci.c (where the notifier just updated port->uartclk).
Cfr. full-history-linux commits 6f8deaef2e9675d9 ("[PATCH] sh: port sh-sci driver to the new API") and 3f73fe878dc9210a ("[PATCH] Remove old sh-sci driver").
2. On modern SoCs, the sh-sci parent clock rate is no longer related to the CPU clock rate anyway, so using a cpufreq notifier is futile.
--- drivers/tty/serial/sh-sci.c | 39 --------------------------------------- 1 file changed, 39 deletions(-)
drivers/tty/serial/sh-sci.c +0 -39
@@ -41,7 +41,6 @@#include <linux/console.h> #include <linux/platform_device.h> #include <linux/serial_sci.h> -#include <linux/notifier.h> #include <linux/pm_runtime.h> #include <linux/cpufreq.h> #include <linux/clk.h>
@@ -97,8 +96,6 @@ struct sci_port {struct timer_list rx_timer;unsigned int rx_timeout;#endif - -struct notifier_block freq_transition; };/* Function prototypes */
@@ -1008,30 +1005,6 @@ static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr)return ret; } -/* -* Here we define a transition notifier so that we can update all of our -* ports' baud rate when the peripheral clock changes. -*/ -static int sci_notifier (struct notifier_block *self, -unsigned long phase,void *p) -{ -struct sci_port *sci_port; -unsigned long flags; - - sci_port = container_of(self, struct sci_port, freq_transition); - -if ((phase ==CPUFREQ_POSTCHANGE ) || - (phase ==CPUFREQ_RESUMECHANGE )) { -struct uart_port *port = &sci_port->port; - -spin_lock_irqsave (&port->lock, flags); - port->uartclk =clk_get_rate (sci_port->iclk); -spin_unlock_irqrestore (&port->lock, flags); - } - -return NOTIFY_OK ; -} - static struct sci_irq_desc { const char *desc; irq_handler_t handler;
@@ -2427,9 +2400,6 @@ static int sci_remove(struct platform_device *dev) {struct sci_port *port =platform_get_drvdata (dev); -cpufreq_unregister_notifier (&port->freq_transition, -CPUFREQ_TRANSITION_NOTIFIER ); -uart_remove_one_port (&sci_uart_driver, &port->port);sci_cleanup_single (port);
@@ -2487,15 +2457,6 @@ static int sci_probe(struct platform_device *dev)if (ret)return ret; - sp->freq_transition.notifier_call = sci_notifier; - - ret =cpufreq_register_notifier (&sp->freq_transition, -CPUFREQ_TRANSITION_NOTIFIER ); -if (unlikely (ret <0 )) { -sci_cleanup_single (sp); -return ret; - } -#ifdef CONFIG_SH_STANDARD_BIOS sh_bios_gdb_detach ();#endif
Signature · 1 line
2.8.2
PATCH 21/76 include/linux/poison.h: fix LIST_POISON{1,2} offset
In reply to Jiri SlabyFrom: Vasily Kulikov <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 8a5e5e02fc83aaf67053ab53b359af08c6c49aaf upstream.
Poison pointer values should be small enough to find a room in non-mmap'able/hardly-mmap'able space. E.g. on x86 "poison pointer space" is located starting from 0x0. Given unprivileged users cannot mmap anything below mmap_min_addr, it should be safe to use poison pointers lower than mmap_min_addr.
The current poison pointer values of LIST_POISON{1,2} might be too big for mmap_min_addr values equal or less than 1 MB (common case, e.g. Ubuntu uses only 0x10000). There is little point to use such a big value given the "poison pointer space" below 1 MB is not yet exhausted. Changing it to a smaller value solves the problem for small mmap_min_addr setups.
The values are suggested by Solar Designer:
http://www.openwall.com/lists/oss-security/2015/05/02/6
--- include/linux/poison.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/poison.h +2 -2
@@ -19,8 +19,8 @@* under normal circumstances, used to verify that nobody uses * non-initialized list entries. */ -#define LIST_POISON1 ((void *) 0x00100100 + POISON_POINTER_DELTA) -#define LIST_POISON2 ((void *) 0x00200200 + POISON_POINTER_DELTA) +#define LIST_POISON1 ((void *) 0x100 + POISON_POINTER_DELTA) +#define LIST_POISON2 ((void *) 0x200 + POISON_POINTER_DELTA)/********** include/linux/timer.h **********/ /*
Signature · 1 line
2.8.2
PATCH 22/76 Drivers: hv: vmbus: prevent cpu offlining on newer hypervisors
In reply to Jiri SlabyFrom: Vitaly Kuznetsov <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit e513229b4c386e6c9f66298c13fde92f73e6e1ac upstream.
When an SMP Hyper-V guest is running on top of 2012R2 Server and secondary cpus are sent offline (with echo 0 > /sys/devices/system/cpu/cpu$cpu/online) the system freeze is observed. This happens due to the fact that on newer hypervisors (Win8, WS2012R2, ...) vmbus channel handlers are distributed across all cpus (see init_vp_index() function in drivers/hv/channel_mgmt.c) and on cpu offlining nobody reassigns them to CPU0. Prevent cpu offlining when vmbus is loaded until the issue is fixed host-side.
This patch also disables hibernation but it is OK as it is also broken (MCE error is hit on resume). Suspend still works.
Tested with WS2008R2 and WS2012R2.
--- drivers/hv/vmbus_drv.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/hv/vmbus_drv.c +36 -0
@@ -32,6 +32,7 @@#include <linux/acpi.h> #include <acpi/acpi_bus.h> #include <linux/completion.h> +#include <linux/cpu.h> #include <linux/hyperv.h> #include <linux/kernel_stat.h> #include <asm/hyperv.h>
@@ -517,6 +518,39 @@ static void vmbus_flow_handler(unsigned int irq, struct irq_desc *desc) desc->action->handler (irq, desc->action->dev_id); } +#ifdef CONFIG_HOTPLUG_CPU +static int hyperv_cpu_disable (void ) +{ +return -ENOSYS ; +} + +static void hv_cpu_hotplug_quirk (bool vmbus_loaded) +{ +static void *previous_cpu_disable; + +/* +* Offlining a CPU when running on newer hypervisors (WS2012R2, Win8, +* ...) is not supported at this moment as channel interrupts are +* distributed across all of them. +*/ + +if ((vmbus_proto_version ==VERSION_WS2008 ) || + (vmbus_proto_version ==VERSION_WIN7 )) +return ; + +if (vmbus_loaded) { + previous_cpu_disable = smp_ops.cpu_disable; + smp_ops.cpu_disable = hyperv_cpu_disable; +pr_notice ("CPU offlining is not supported by hypervisor\n" ); + }else if (previous_cpu_disable) + smp_ops.cpu_disable = previous_cpu_disable; +} +#else +static void hv_cpu_hotplug_quirk (bool vmbus_loaded) +{ +} +#endif +/* * vmbus_bus_init -Main vmbus driver initialization routine. *
@@ -575,6 +609,7 @@ static int vmbus_bus_init(int irq)if (ret) goto err_alloc; +hv_cpu_hotplug_quirk (true);vmbus_request_offers ();return 0 ;
@@ -812,6 +847,7 @@ static void __exit vmbus_exit(void)bus_unregister (&hv_bus);hv_cleanup ();acpi_bus_unregister_driver (&vmbus_acpi_driver); +hv_cpu_hotplug_quirk (false); }
Signature · 1 line
2.8.2
PATCH 23/76 perf stat: Document --detailed option
In reply to Jiri SlabyFrom: Borislav Petkov <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit f594bae08183fb6b57db55387794ece3e1edf6f6 upstream.
I'm surprised this remained undocumented since at least 2011. And it is actually a very useful switch, as Steve and I came to realize recently.
Add the text from
2cba3ffb9a9d ("perf stat: Add -d -d and -d -d -d options to show more CPU events")
which added the incrementing aspect to -d.
--- tools/perf/Documentation/perf-stat.txt | 8 ++++++++ 1 file changed, 8 insertions(+)
tools/perf/Documentation/perf-stat.txt +8 -0
@@ -50,6 +50,14 @@ OPTIONS --scale:: scale/normalize counter values +-d:: +--detailed:: + print more detailed statistics, can be specified up to 3 times + + -d: detailed events, L1 and LLC data cache + -d -d: more detailed events, dTLB and iTLB events + -d -d -d: very detailed events, adding prefetch events + -r:: --repeat=<n>:: repeat command and print average + stddev (max: 100). 0 means forever.
Signature · 1 line
2.8.2
PATCH 24/76 ARM: OMAP3: Add cpuidle parameters table for omap3430
In reply to Jiri SlabyFrom: Pali Rohár <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 98f42221501353067251fbf11e732707dbb68ce3 upstream.
Based on CPU type choose generic omap3 or omap3430 specific cpuidle parameters. Parameters for omap3430 were measured on Nokia N900 device and added by commit 5a1b1d3a9efa ("OMAP3: RX-51: Pass cpu idle parameters") which were later removed by commit 231900afba52 ("ARM: OMAP3: cpuidle - remove rx51 cpuidle parameters table") due to huge code complexity.
This patch brings cpuidle parameters for omap3430 devices again, but uses simple condition based on CPU type.
parameters table")
--- arch/arm/mach-omap2/cpuidle34xx.c | 69 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-)
arch/arm/mach-omap2/cpuidle34xx.c +68 -1
@@ -34,6 +34,7 @@#include "pm.h" #include "control.h" #include "common.h" +#include "soc.h" /* Mach specific information to be recorded in the C-state driver_data */ struct omap3_idle_statedata {
@@ -322,6 +323,69 @@ static struct cpuidle_driver omap3_idle_driver = { .safe_state_index = 0, }; +/* +* Numbers based on measurements made in October 2009 for PM optimized kernel +* with CPU freq enabled on device Nokia N900. Assumes OPP2 (main idle OPP, +* and worst case latencies). +*/ +static struct cpuidle_driver omap3430_idle_driver = { + .name ="omap3430_idle" , + .owner =THIS_MODULE , + .states = { + { + .enter = omap3_enter_idle_bm, + .exit_latency =110 +162 , + .target_residency =5 , + .name ="C1" , + .desc ="MPU ON + CORE ON" , + }, + { + .enter = omap3_enter_idle_bm, + .exit_latency =106 +180 , + .target_residency =309 , + .name ="C2" , + .desc ="MPU ON + CORE ON" , + }, + { + .enter = omap3_enter_idle_bm, + .exit_latency =107 +410 , + .target_residency =46057 , + .name ="C3" , + .desc ="MPU RET + CORE ON" , + }, + { + .enter = omap3_enter_idle_bm, + .exit_latency =121 +3374 , + .target_residency =46057 , + .name ="C4" , + .desc ="MPU OFF + CORE ON" , + }, + { + .enter = omap3_enter_idle_bm, + .exit_latency =855 +1146 , + .target_residency =46057 , + .name ="C5" , + .desc ="MPU RET + CORE RET" , + }, + { + .enter = omap3_enter_idle_bm, + .exit_latency =7580 +4134 , + .target_residency =484329 , + .name ="C6" , + .desc ="MPU OFF + CORE RET" , + }, + { + .enter = omap3_enter_idle_bm, + .exit_latency =7505 +15274 , + .target_residency =484329 , + .name ="C7" , + .desc ="MPU OFF + CORE OFF" , + }, + }, + .state_count =ARRAY_SIZE (omap3_idle_data), + .safe_state_index =0 , +}; +/* Public functions */ /**
@@ -340,5 +404,8 @@ int __init omap3_idle_init(void)if (!mpu_pd || !core_pd || !per_pd || !cam_pd)return -ENODEV ; -return cpuidle_register (&omap3_idle_driver,NULL ); +if (cpu_is_omap3430 ()) +return cpuidle_register (&omap3430_idle_driver,NULL ); +else +return cpuidle_register (&omap3_idle_driver,NULL ); }
Signature · 1 line
2.8.2
PATCH 25/76 bus: imx-weim: Take the 'status' property value into account
In reply to Jiri SlabyFrom: Fabio Estevam <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 33b96d2c9579213cf3f36d7b29841b1e464750c4 upstream.
Currently we have an incorrect behaviour when multiple devices are present under the weim node. For example:
&weim {
...
status = "okay";
sram@0,0 {
...
status = "okay";
};
mram@0,0 {
...
status = "disabled";
};
};In this case only the 'sram' device should be probed and not 'mram'.
However what happens currently is that the status variable is ignored, causing the 'sram' device to be disabled and 'mram' to be enabled.
Change the weim_parse_dt() function to use for_each_available_child_of_node()so that the devices marked with 'status = disabled' are not probed.
--- drivers/bus/imx-weim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/imx-weim.c +1 -1
@@ -92,7 +92,7 @@ static int __init weim_parse_dt(struct platform_device *pdev,struct device_node *child;int ret; -for_each_child_of_node (pdev->dev.of_node, child) { +for_each_available_child_of_node (pdev->dev.of_node, child) {if (!child->name)continue ;
Signature · 1 line
2.8.2
PATCH 26/76 sunrpc/cache: drop reference when sunrpc_cache_pipe_upcall() detects a race
In reply to Jiri SlabyFrom: NeilBrown <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit a6ab1e8126d205238defbb55d23661a3a5c6a0d8 upstream.
sunrpc_cache_pipe_upcall() can detect a race if CACHE_PENDING is no longer set. In this case it aborts the queuing of the upcall.
However it has already taken a new counted reference on "h" and doesn't "put" it, even though it frees the data structure holding the reference.
So let's delay the "cache_get" until we know we need it.
--- net/sunrpc/cache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/sunrpc/cache.c +3 -3
@@ -1189,14 +1189,14 @@ int sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h) } crq->q.reader =0 ; - crq->item =cache_get (h); crq->buf = buf; crq->len =0 ; crq->readers =0 ;spin_lock (&queue_lock); -if (test_bit (CACHE_PENDING , &h->flags)) +if (test_bit (CACHE_PENDING , &h->flags)) { + crq->item =cache_get (h);list_add_tail (&crq->q.list, &detail->queue); -else + }else /* Lost a race, no longer PENDING, so don't enqueue */ ret = -EAGAIN ;spin_unlock (&queue_lock);
Signature · 1 line
2.8.2
PATCH 27/76 Revert "xfs: add capability check to free eofblocks ioctl"
In reply to Jiri Slaby3.12-stable review patch. If anyone has any objections, please let me know.
===============
This reverts commit eaeeaec383f3228446715e660851f73423501eba, upstream commit 8c567a7fab6e086a0284eee2db82348521e7120c.
It was (mis)applied twice to stable-3.12.
--- fs/xfs/xfs_ioctl.c | 6 ------ 1 file changed, 6 deletions(-)
fs/xfs/xfs_ioctl.c +0 -6
@@ -1718,12 +1718,6 @@ xfs_file_ioctl(if (mp->m_flags &XFS_MOUNT_RDONLY )return -XFS_ERROR (EROFS ); -if (!capable (CAP_SYS_ADMIN )) -return -EPERM ; - -if (mp->m_flags &XFS_MOUNT_RDONLY ) -return -XFS_ERROR (EROFS ); -if (copy_from_user (&eofb, arg,sizeof (eofb)))return -XFS_ERROR (EFAULT );
Signature · 1 line
2.8.2
PATCH 28/76 mmc: sdhci: Allow for irq being shared
In reply to Jiri SlabyFrom: Adrian Hunter <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 655bca7616bf6076d30b14d1478bca6807d49c45 upstream.
If the SDHCI irq is shared with another device then the interrupt handler can get called while SDHCI is runtime suspended. That is harmless but the warning message is not useful so remove it. Also returning IRQ_NONE is more appropriate.
--- drivers/mmc/host/sdhci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mmc/host/sdhci.c +1 -3
@@ -2417,9 +2417,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id)if (host->runtime_suspended) {spin_unlock (&host->lock); -pr_warning ("%s: got irq while runtime suspended\n" , -mmc_hostname (host->mmc)); -return IRQ_HANDLED ; +return IRQ_NONE ; } intmask =sdhci_readl (host,SDHCI_INT_STATUS );
Signature · 1 line
2.8.2
PATCH 29/76 scsi: Avoid crashing if device uses DIX but adapter does not support it
In reply to Jiri SlabyFrom: "Ewan D. Milne" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 91724c20613484555ba7e7b3d8549dac1e24f7a8 upstream.
This can happen if a multipathed device uses DIX and another path is added via an adapter that does not support it. Multipath should not allow this path to be added, but we should not depend upon that to avoid crashing.
--- drivers/scsi/scsi_lib.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +11 -1
@@ -1096,7 +1096,17 @@ int scsi_init_io(struct scsi_cmnd *cmd, gfp_t gfp_mask)struct scsi_data_buffer *prot_sdb = cmd->prot_sdb;int ivecs, count; -BUG_ON (prot_sdb ==NULL ); +if (prot_sdb ==NULL ) { +/* +* This can happen if someone (e.g. multipath) +* queues a command to a device on an adapter +* that does not support DIX. +*/ +WARN_ON_ONCE (1 ); + error =BLKPREP_KILL ; + goto err_exit; + } + ivecs =blk_rq_count_integrity_sg (rq->q, rq->bio);if (scsi_alloc_sgtable (prot_sdb, ivecs, gfp_mask)) {
Signature · 1 line
2.8.2
PATCH 30/76 cpuset: Fix potential deadlock w/ set_mems_allowed
In reply to Jiri SlabyFrom: John Stultz <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit db751fe3ea6880ff5ac5abe60cb7b80deb5a4140 upstream.
After adding lockdep support to seqlock/seqcount structures, I started seeing the following warning:
[ 1.070907] ======================================================
[ 1.072015] [ INFO: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected ]
[ 1.073181] 3.11.0+ #67 Not tainted
[ 1.073801] ------------------------------------------------------
[ 1.074882] kworker/u4:2/708 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:
[ 1.076088] (&p->mems_allowed_seq){+.+...}, at: [<ffffffff81187d7f>] new_slab+0x5f/0x280
[ 1.077572]
[ 1.077572] and this task is already holding:
[ 1.078593] (&(&q->__queue_lock)->rlock){..-...}, at: [<ffffffff81339f03>] blk_execute_rq_nowait+0x53/0xf0
[ 1.080042] which would create a new lock dependency:
[ 1.080042] (&(&q->__queue_lock)->rlock){..-...} -> (&p->mems_allowed_seq){+.+...}
[ 1.080042]
[ 1.080042] but this new dependency connects a SOFTIRQ-irq-safe lock:
[ 1.080042] (&(&q->__queue_lock)->rlock){..-...}
[ 1.080042] ... which became SOFTIRQ-irq-safe at:
[ 1.080042] [<ffffffff810ec179>] __lock_acquire+0x5b9/0x1db0
[ 1.080042] [<ffffffff810edfe5>] lock_acquire+0x95/0x130
[ 1.080042] [<ffffffff818968a1>] _raw_spin_lock+0x41/0x80
[ 1.080042] [<ffffffff81560c9e>] scsi_device_unbusy+0x7e/0xd0
[ 1.080042] [<ffffffff8155a612>] scsi_finish_command+0x32/0xf0
[ 1.080042] [<ffffffff81560e91>] scsi_softirq_done+0xa1/0x130
[ 1.080042] [<ffffffff8133b0f3>] blk_done_softirq+0x73/0x90
[ 1.080042] [<ffffffff81095dc0>] __do_softirq+0x110/0x2f0
[ 1.080042] [<ffffffff81095fcd>] run_ksoftirqd+0x2d/0x60
[ 1.080042] [<ffffffff810bc506>] smpboot_thread_fn+0x156/0x1e0
[ 1.080042] [<ffffffff810b3916>] kthread+0xd6/0xe0
[ 1.080042] [<ffffffff818980ac>] ret_from_fork+0x7c/0xb0
[ 1.080042]
[ 1.080042] to a SOFTIRQ-irq-unsafe lock:
[ 1.080042] (&p->mems_allowed_seq){+.+...}
[ 1.080042] ... which became SOFTIRQ-irq-unsafe at:
[ 1.080042] ... [<ffffffff810ec1d3>] __lock_acquire+0x613/0x1db0
[ 1.080042] [<ffffffff810edfe5>] lock_acquire+0x95/0x130
[ 1.080042] [<ffffffff810b3df2>] kthreadd+0x82/0x180
[ 1.080042] [<ffffffff818980ac>] ret_from_fork+0x7c/0xb0
[ 1.080042]
[ 1.080042] other info that might help us debug this:
[ 1.080042]
[ 1.080042] Possible interrupt unsafe locking scenario:
[ 1.080042]
[ 1.080042] CPU0 CPU1
[ 1.080042] ---- ----
[ 1.080042] lock(&p->mems_allowed_seq);
[ 1.080042] local_irq_disable();
[ 1.080042] lock(&(&q->__queue_lock)->rlock);
[ 1.080042] lock(&p->mems_allowed_seq);
[ 1.080042] <Interrupt>
[ 1.080042] lock(&(&q->__queue_lock)->rlock);
[ 1.080042]
[ 1.080042] *** DEADLOCK ***The issue stems from the kthreadd() function calling set_mems_allowed with irqs enabled. While its possibly unlikely for the actual deadlock to trigger, a fix is fairly simple: disable irqs before taking the mems_allowed_seq lock.
--- include/linux/cpuset.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/cpuset.h +4 -0
@@ -132,10 +132,14 @@ static inline bool read_mems_allowed_retry(unsigned int seq)static inline void set_mems_allowed (nodemask_t nodemask) { +unsigned long flags; +task_lock (current); +local_irq_save (flags);write_seqcount_begin (¤t->mems_allowed_seq); current->mems_allowed = nodemask;write_seqcount_end (¤t->mems_allowed_seq); +local_irq_restore (flags);task_unlock (current); }
Signature · 1 line
2.8.2
PATCH 31/76 compiler-gcc: disable -ftracer for __noclone functions
In reply to Jiri SlabyFrom: Paolo Bonzini <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 95272c29378ee7dc15f43fa2758cb28a5913a06d upstream.
-ftracer can duplicate asm blocks causing compilation to fail in noclone functions. For example, KVM declares a global variable in an asm like
asm("2: ... \n
.pushsection data \n
.global vmx_return \n
vmx_return: .long 2b");
and -ftracer causes a double declaration.
--- include/linux/compiler-gcc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/compiler-gcc.h +1 -1
@@ -177,7 +177,7 @@#define unreachable () __builtin_unreachable()/* Mark a function definition as prohibited from being cloned. */ -#define __noclone __attribute__((__noclone__)) +#define __noclone __attribute__((__noclone__, __optimize__("no-tracer")))#endif /* GCC_VERSION >= 40500 */
Signature · 1 line
2.8.2
PATCH 32/76 x86: LLVMLinux: Fix "incomplete type const struct x86cpu_device_id"
In reply to Jiri SlabyFrom: Behan Webster <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit c4586256f0c440bc2bdb29d2cbb915f0ca785d26 upstream.
Similar to the fix in 40413dcb7b273bda681dca38e6ff0bbb3728ef11
MODULE_DEVICE_TABLE(x86cpu, ...) expects the struct to be called struct x86cpu_device_id, and not struct x86_cpu_id which is what is used in the rest of the kernel code. Although gcc seems to ignore this error, clang fails without this define to fix the name.
Code from drivers/thermal/x86_pkg_temp_thermal.c
static const struct x86_cpu_id __initconst pkg_temp_thermal_ids[] = { ... }; MODULE_DEVICE_TABLE(x86cpu, pkg_temp_thermal_ids);
Error from clang:drivers/thermal/x86_pkg_temp_thermal.c:577:1: error: variable has
incomplete type 'const struct x86cpu_device_id'MODULE_DEVICE_TABLE(x86cpu, pkg_temp_thermal_ids);
^include/linux/module.h:145:3: note: expanded from macro
'MODULE_DEVICE_TABLE'
MODULE_GENERIC_TABLE(type##_device, name)
^include/linux/module.h:87:32: note: expanded from macro
'MODULE_GENERIC_TABLE'
extern const struct gtype##_id __mod_##gtype##_table \
^<scratch space>:143:1: note: expanded from here __mod_x86cpu_device_table
^drivers/thermal/x86_pkg_temp_thermal.c:577:1: note: forward declaration of
'struct x86cpu_device_id'include/linux/module.h:145:3: note: expanded from macro
'MODULE_DEVICE_TABLE'
MODULE_GENERIC_TABLE(type##_device, name)
^include/linux/module.h:87:21: note: expanded from macro
'MODULE_GENERIC_TABLE'
extern const struct gtype##_id __mod_##gtype##_table \
^<scratch space>:141:1: note: expanded from herex86cpu_device_id
^
1 error generated.
--- include/linux/mod_devicetable.h | 8 ++++++++ 1 file changed, 8 insertions(+)
include/linux/mod_devicetable.h +8 -0
@@ -398,6 +398,7 @@ struct virtio_device_id {/* * For Hyper-V devices we use the device guid as the id. */ +#define vmbus_device_id hv_vmbus_device_idstruct hv_vmbus_device_id {__u8 guid[16 ];kernel_ulong_t driver_data;/* Data private to the driver */
@@ -548,6 +549,11 @@ struct amba_id {* See documentation of "x86_match_cpu" for details. */ +/* +* MODULE_DEVICE_TABLE expects this struct to be called x86cpu_device_id. +* Although gcc seems to ignore this error, clang fails without this define. +*/ +#define x86cpu_device_id x86_cpu_idstruct x86_cpu_id {__u16 vendor;__u16 family;
@@ -575,6 +581,7 @@ struct ipack_device_id {#define MEI_CL_MODULE_PREFIX "mei:"#define MEI_CL_NAME_SIZE 32 +#define mei_device_id mei_cl_device_idstruct mei_cl_device_id {char name[MEI_CL_NAME_SIZE ];kernel_ulong_t driver_info;
@@ -594,6 +601,7 @@ struct mei_cl_device_id {* Identifies a RapidIO device based on both the device/vendor IDs and * the assembly device/vendor IDs. */ +#define rapidio_device_id rio_device_idstruct rio_device_id {__u16 did, vid;__u16 asm_did, asm_vid;
Signature · 1 line
2.8.2
PATCH 33/76 ipvs: correct initial offset of Call-ID header search in SIP persistence engine
In reply to Jiri SlabyFrom: Marco Angaroni <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 7617a24f83b5d67f4dab1844956be1cebc44aec8 upstream.
The IPVS SIP persistence engine is not able to parse the SIP header "Call-ID" when such header is inserted in the first positions of the SIP message.
When IPVS is configured with "--pe sip" option, like for example:
ipvsadm -A -u 1.2.3.4:5060 -s rr --pe sip -p 120 -o
some particular messages (see below for details) do not create entries in the connection template table, which can be listed with:
ipvsadm -Lcn --persistent-conn
Problematic SIP messages are SIP responses having "Call-ID" header positioned just after message first line:
SIP/2.0 200 OK
[Call-ID header here]
[rest of the headers]
When "Call-ID" header is positioned down (after a few other headers) it is correctly recognized.
This is due to the data offset used in get_callid function call inside ip_vs_pe_sip.c file: since dptr already points to the start of the SIP message, the value of dataoff should be initially 0. Otherwise the header is searched starting from some bytes after the first character of the SIP message.
--- net/netfilter/ipvs/ip_vs_pe_sip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/ipvs/ip_vs_pe_sip.c +1 -1
@@ -88,7 +88,7 @@ ip_vs_sip_fill_param(struct ip_vs_conn_param *p, struct sk_buff *skb) dptr = skb->data + dataoff; datalen = skb->len - dataoff; -if (get_callid (dptr, dataoff, datalen, &matchoff, &matchlen)) +if (get_callid (dptr,0 , datalen, &matchoff, &matchlen))return -EINVAL ;/* N.B: pe_data is only set on success,
Signature · 1 line
2.8.2
PATCH 34/76 nbd: ratelimit error msgs after socket close
In reply to Jiri SlabyFrom: Dan Streetman <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit da6ccaaa79caca4f38b540b651238f87215217a2 upstream.
Make the "Attempted send on closed socket" error messages generated in nbd_request_handler() ratelimited.
When the nbd socket is shutdown, the nbd_request_handler() function emits an error message for every request remaining in its queue. If the queue is large, this will spam a large amount of messages to the log. There's no need for a separate error message for each request, so this patch ratelimits it.
In the specific case this was found, the system was virtual and the error messages were logged to the serial port, which overwhelmed it.
--- drivers/block/nbd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/nbd.c +2 -2
@@ -581,8 +581,8 @@ static void do_nbd_request(struct request_queue *q)BUG_ON (nbd->magic !=NBD_MAGIC );if (unlikely (!nbd->sock)) { -dev_err (disk_to_dev (nbd->disk), -"Attempted send on closed socket\n" ); +dev_err_ratelimited (disk_to_dev (nbd->disk), +"Attempted send on closed socket\n" ); req->errors++;nbd_end_request (req);spin_lock_irq (q->queue_lock);
Signature · 1 line
2.8.2
PATCH 35/76 clk: versatile: sp810: support reentrance
In reply to Jiri SlabyFrom: Linus Walleij <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit ec7957a6aa0aaf981fb8356dc47a2cdd01cde03c upstream.
Despite care take to allocate clocks state containers the SP810 driver actually just supports creating one instance:
all clocks registered for every instance will end up with the exact same name and __clk_init() will fail.
Rename the timclken<0> .. timclken<n> to sp810_<instance>_<n> so every clock on every instance gets a unique name.
This is necessary for the RealView PBA8 which has two SP810
blocks: the second block will not register its clocks unless every clock on every instance is unique and results in boot logs like this:
------------[ cut here ]------------
WARNING: CPU: 0 PID: 0 at ../drivers/clk/versatile/clk-sp810.c:137
clk_sp810_of_setup+0x110/0x154()
Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted
4.5.0-rc2-00030-g352718fc39f6-dirty #225
Hardware name: ARM RealView Machine (Device Tree Support)
[<c00167f8>] (unwind_backtrace) from [<c0013204>]
(show_stack+0x10/0x14)
[<c0013204>] (show_stack) from [<c01a049c>]
(dump_stack+0x84/0x9c)
[<c01a049c>] (dump_stack) from [<c0024990>]
(warn_slowpath_common+0x74/0xb0)
[<c0024990>] (warn_slowpath_common) from [<c0024a68>]
(warn_slowpath_null+0x1c/0x24)
[<c0024a68>] (warn_slowpath_null) from [<c051eb44>]
(clk_sp810_of_setup+0x110/0x154)
[<c051eb44>] (clk_sp810_of_setup) from [<c051e3a4>]
(of_clk_init+0x12c/0x1c8)
[<c051e3a4>] (of_clk_init) from [<c0504714>]
(time_init+0x20/0x2c)
[<c0504714>] (time_init) from [<c0501b18>]
(start_kernel+0x244/0x3c4)
[<c0501b18>] (start_kernel) from [<7000807c>] (0x7000807c)
---[ end trace cb88537fdc8fa200 ]------ drivers/clk/versatile/clk-sp810.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/versatile/clk-sp810.c +3 -1
@@ -141,6 +141,7 @@ void __init clk_sp810_of_setup(struct device_node *node)const char *parent_names[2 ];char name[12 ];struct clk_init_data init; +static int instance;int i;if (!sp810) {
@@ -172,7 +173,7 @@ void __init clk_sp810_of_setup(struct device_node *node) init.num_parents =ARRAY_SIZE (parent_names);for (i =0 ; i <ARRAY_SIZE (sp810->timerclken); i++) { -snprintf (name,ARRAY_SIZE (name),"timerclken%d" , i); +snprintf (name,sizeof (name),"sp810_%d_%d" , instance, i); sp810->timerclken[i].sp810 = sp810; sp810->timerclken[i].channel = i;
@@ -184,5 +185,6 @@ void __init clk_sp810_of_setup(struct device_node *node) }of_clk_add_provider (node, clk_sp810_timerclken_of_get, sp810); + instance++; }CLK_OF_DECLARE (sp810,"arm,sp810" , clk_sp810_of_setup);
Signature · 1 line
2.8.2
PATCH 36/76 lpfc: fix misleading indentation
In reply to Jiri SlabyFrom: Arnd Bergmann <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit aeb6641f8ebdd61939f462a8255b316f9bfab707 upstream.
gcc-6 complains about the indentation of the lpfc_destroy_vport_work_array() call in lpfc_online(), which clearly doesn't look right:
drivers/scsi/lpfc/lpfc_init.c: In function 'lpfc_online':drivers/scsi/lpfc/lpfc_init.c:2880:3: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation]
lpfc_destroy_vport_work_array(phba, vports);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~drivers/scsi/lpfc/lpfc_init.c:2863:2: note: ...this 'if' clause, but it is not
if (vports != NULL)
^~
Looking at the patch that introduced this code, it's clear that the behavior is correct and the indentation is wrong.
This fixes the indentation and adds curly braces around the previous if() block for clarity, as that is most likely what caused the code to be misindented in the first place.
--- drivers/scsi/lpfc/lpfc_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +3 -2
@@ -2697,7 +2697,7 @@ lpfc_online(struct lpfc_hba *phba) } vports =lpfc_create_vport_work_array (phba); -if (vports !=NULL ) +if (vports !=NULL ) {for (i =0 ; i <= phba->max_vports && vports[i] !=NULL ; i++) {struct Scsi_Host *shost; shost =lpfc_shost_from_vport (vports[i]);
@@ -2714,7 +2714,8 @@ lpfc_online(struct lpfc_hba *phba) }spin_unlock_irq (shost->host_lock); } -lpfc_destroy_vport_work_array (phba, vports); + } +lpfc_destroy_vport_work_array (phba, vports);lpfc_unblock_mgmt_io (phba);return 0 ;
Signature · 1 line
2.8.2
PATCH 37/76 ARM: SoCFPGA: Fix secondary CPU startup in thumb2 kernel
In reply to Jiri SlabyFrom: Sascha Hauer <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 5616f36713ea77f57ae908bf2fef641364403c9f upstream.
The secondary CPU starts up in ARM mode. When the kernel is compiled in thumb2 mode we have to explicitly compile the secondary startup trampoline in ARM mode, otherwise the CPU will go to Nirvana.
--- arch/arm/mach-socfpga/headsmp.S | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-socfpga/headsmp.S +1 -0
@@ -11,6 +11,7 @@ #include <linux/init.h> .arch armv7-a + .arm ENTRY(secondary_trampoline) movw r2, #:lower16:cpu1start_addr
Signature · 1 line
2.8.2
PATCH 38/76 proc: prevent accessing /proc/<PID>/environ until it's ready
In reply to Jiri SlabyFrom: Mathias Krause <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 8148a73c9901a8794a50f950083c00ccf97d43b3 upstream.
If /proc/<PID>/environ gets read before the envp[] array is fully set up in create_{aout,elf,elf_fdpic,flat}_tables(), we might end up trying to read more bytes than are actually written, as env_start will already be set but env_end will still be zero, making the range calculation underflow, allowing to read beyond the end of what has been written.
Fix this as it is done for /proc/<PID>/cmdline by testing env_end for zero. It is, apparently, intentionally set last in create_*_tables().
This bug was found by the PaX size_overflow plugin that detected the arithmetic underflow of 'this_len = env_end - (env_start + src)' when env_end is still zero.
The expected consequence is that userland trying to access /proc/<PID>/environ of a not yet fully set up process may get inconsistent data as we're in the middle of copying in the environment variables.
--- fs/proc/base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/proc/base.c +2 -1
@@ -844,7 +844,8 @@ static ssize_t environ_read(struct file *file, char __user *buf,int ret =0 ;struct mm_struct *mm = file->private_data; -if (!mm) +/* Ensure the process spawned far enough to have an environment. */ +if (!mm || !mm->env_end)return 0 ; page = (char *)__get_free_page (GFP_TEMPORARY );
Signature · 1 line
2.8.2
PATCH 39/76 batman-adv: Check skb size before using encapsulated ETH+VLAN header
In reply to Jiri SlabyFrom: Sven Eckelmann <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit c78296665c3d81f040117432ab9e1cb125521b0c upstream.
The encapsulated ethernet and VLAN header may be outside the received ethernet frame. Thus the skb buffer size has to be checked before it can be parsed to find out if it encapsulates another batman-adv packet.
--- net/batman-adv/soft-interface.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/batman-adv/soft-interface.c +6 -2
@@ -326,10 +326,16 @@ void batadv_interface_rx(struct net_device *soft_iface,skb_pull_rcsum (skb, hdr_size);skb_reset_mac_header (skb); +if (unlikely (!pskb_may_pull (skb,ETH_HLEN ))) + goto dropped; + ethhdr =eth_hdr (skb);switch (ntohs (ethhdr->h_proto)) {case ETH_P_8021Q : +if (!pskb_may_pull (skb,VLAN_ETH_HLEN )) + goto dropped; + vhdr = (struct vlan_ethhdr *)skb->data; vid =ntohs (vhdr->h_vlan_TCI) &VLAN_VID_MASK ; vid |=BATADV_VLAN_HAS_TAG ;
@@ -343,8 +349,6 @@ void batadv_interface_rx(struct net_device *soft_iface, }/* skb->dev & skb->pkt_type are set here */ -if (unlikely (!pskb_may_pull (skb,ETH_HLEN ))) - goto dropped; skb->protocol =eth_type_trans (skb, soft_iface);/* should not be necessary anymore as we use skb_pull_rcsum()
Signature · 1 line
2.8.2
PATCH 40/76 batman-adv: Fix broadcast/ogm queue limit on a removed interface
In reply to Jiri SlabyFrom: Linus Lüssing <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit c4fdb6cff2aa0ae740c5f19b6f745cbbe786d42f upstream.
When removing a single interface while a broadcast or ogm packet is still pending then we will free the forward packet without releasing the queue slots again.
This patch is supposed to fix this issue.
--- net/batman-adv/send.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/batman-adv/send.c +6 -0
@@ -364,6 +364,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,if (pending) {hlist_del (&forw_packet->list); +if (!forw_packet->own) +atomic_inc (&bat_priv->batman_queue_left); +batadv_forw_packet_free (forw_packet); } }
@@ -390,6 +393,9 @@ batadv_purge_outstanding_packets(struct batadv_priv *bat_priv,if (pending) {hlist_del (&forw_packet->list); +if (!forw_packet->own) +atomic_inc (&bat_priv->bcast_queue_left); +batadv_forw_packet_free (forw_packet); } }
Signature · 1 line
2.8.2
PATCH 41/76 batman-adv: Reduce refcnt of removed router when updating route
In reply to Jiri SlabyFrom: Sven Eckelmann <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit d1a65f1741bfd9c69f9e4e2ad447a89b6810427d upstream.
_batadv_update_route rcu_derefences orig_ifinfo->router outside of a spinlock protected region to print some information messages to the debug log. But this pointer is not checked again when the new pointer is assigned in the spinlock protected region. Thus is can happen that the value of orig_ifinfo->router changed in the meantime and thus the reference counter of the wrong router gets reduced after the spinlock protected region.
Just rcu_dereferencing the value of orig_ifinfo->router inside the spinlock protected region (which also set the new pointer) is enough to get the correct old router object.
--- net/batman-adv/routing.c | 9 +++++++++ 1 file changed, 9 insertions(+)
net/batman-adv/routing.c +9 -0
@@ -70,6 +70,15 @@ static void _batadv_update_route(struct batadv_priv *bat_priv, neigh_node =NULL ;spin_lock_bh (&orig_node->neigh_list_lock); +/* curr_router used earlier may not be the current orig_node->router +* anymore because it was dereferenced outside of the neigh_list_lock +* protected region. After the new best neighbor has replace the current +* best neighbor the reference counter needs to decrease. Consequently, +* the code needs to ensure the curr_router variable contains a pointer +* to the replaced best neighbor. +*/ + curr_router =rcu_dereference_protected (orig_node->router, true); +rcu_assign_pointer (orig_node->router, neigh_node);spin_unlock_bh (&orig_node->neigh_list_lock);
Signature · 1 line
2.8.2
PATCH 42/76 MAINTAINERS: Remove asterisk from EFI directory names
In reply to Jiri SlabyFrom: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit e8dfe6d8f6762d515fcd4f30577f7bfcf7659887 upstream.
Mark reported that having asterisks on the end of directory names confuses get_maintainer.pl when it encounters subdirectories, and that my name does not appear when run on drivers/firmware/efi/libstub.
--- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
MAINTAINERS +2 -2
@@ -3165,8 +3165,8 @@ F: Documentation/x86/efi-stub.txt F: arch/ia64/kernel/efi.c F: arch/x86/boot/compressed/eboot.[ch] F: arch/x86/include/asm/efi.h -F: arch/x86/platform/efi/* -F: drivers/firmware/efi/* +F: arch/x86/platform/efi/ +F: drivers/firmware/efi/ F: include/linux/efi*.h EFI VARIABLE FILESYSTEM
Signature · 1 line
2.8.2
PATCH 43/76 x86/sysfb_efi: Fix valid BAR address range check
In reply to Jiri SlabyFrom: Wang YanQing <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit c10fcb14c7afd6688c7b197a814358fecf244222 upstream.
The code for checking whether a BAR address range is valid will break out of the loop when a start address of 0x0 is encountered.
This behaviour is wrong since by breaking out of the loop we may miss the BAR that describes the EFI frame buffer in a later iteration.
Because of this bug I can't use video=efifb: boot parameter to get efifb on my new ThinkPad E550 for my old linux system hard disk with 3.10 kernel. In 3.10, efifb is the only choice due to DRM/I915 not supporting the GPU.
This patch also add a trivial optimization to break out after we find the frame buffer address range without testing later BARs.
--- arch/x86/kernel/sysfb_efi.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
arch/x86/kernel/sysfb_efi.c +12 -2
@@ -106,14 +106,24 @@ static int __init efifb_set_system(const struct dmi_system_id *id)continue ;for (i =0 ; i <DEVICE_COUNT_RESOURCE ; i++) {resource_size_t start, end; +unsigned long flags; + + flags =pci_resource_flags (dev, i); +if (!(flags &IORESOURCE_MEM )) +continue ; + +if (flags &IORESOURCE_UNSET ) +continue ; + +if (pci_resource_len (dev, i) ==0 ) +continue ; start =pci_resource_start (dev, i); -if (start ==0 ) -break ; end =pci_resource_end (dev, i);if (screen_info.lfb_base >= start && screen_info.lfb_base < end) { found_bar =1 ; +break ; } } }
Signature · 1 line
2.8.2
PATCH 44/76 ACPICA: Dispatcher: Update thread ID for recursive method calls
In reply to Jiri SlabyFrom: Prarit Bhargava <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 93d68841a23a5779cef6fb9aa0ef32e7c5bd00da upstream.
ACPICA commit 7a3bd2d962f221809f25ddb826c9e551b916eb25
Set the mutex owner thread ID.
Original patch from: Prarit Bhargava <[email protected]>
--- drivers/acpi/acpica/dsmethod.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/acpi/acpica/dsmethod.c +3 -0
@@ -267,6 +267,9 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, obj_desc->method.mutex->mutex. original_sync_level = obj_desc->method.mutex->mutex.sync_level; + + obj_desc->method.mutex->mutex.thread_id = +acpi_os_get_thread_id (); } }
Signature · 1 line
2.8.2
PATCH 45/76 USB: serial: cp210x: add ID for Link ECU
In reply to Jiri SlabyFrom: Mike Manning <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 1d377f4d690637a0121eac8701f84a0aa1e69a69 upstream.
The Link ECU is an aftermarket ECU computer for vehicles that provides full tuning abilities as well as datalogging and displaying capabilities via the USB to Serial adapter built into the device.
--- drivers/usb/serial/cp210x.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/cp210x.c +2 -0
@@ -140,6 +140,8 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x10C4, 0xF004) }, /* Elan Digital Systems USBcount50 */ { USB_DEVICE(0x10C5, 0xEA61) }, /* Silicon Labs MobiData GPRS USB Modem */ { USB_DEVICE(0x10CE, 0xEA6A) }, /* Silicon Labs MobiData GPRS USB Modem 100EU */ + { USB_DEVICE(0x12B8, 0xEC60) }, /* Link G4 ECU */ + { USB_DEVICE(0x12B8, 0xEC62) }, /* Link G4+ ECU */ { USB_DEVICE(0x13AD, 0x9999) }, /* Baltech card reader */ { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */ { USB_DEVICE(0x166A, 0x0201) }, /* Clipsal 5500PACA C-Bus Pascal Automation Controller */
Signature · 1 line
2.8.2
PATCH 46/76 USB: serial: cp210x: add Straizona Focusers device ids
In reply to Jiri SlabyFrom: Jasem Mutlaq <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 613ac23a46e10d4d4339febdd534fafadd68e059 upstream.
Adding VID:PID for Straizona Focusers to cp210x driver.
--- drivers/usb/serial/cp210x.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/cp210x.c +2 -0
@@ -108,6 +108,7 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x10C4, 0x826B) }, /* Cygnal Integrated Products, Inc., Fasttrax GPS demonstration module */ { USB_DEVICE(0x10C4, 0x8281) }, /* Nanotec Plug & Drive */ { USB_DEVICE(0x10C4, 0x8293) }, /* Telegesis ETRX2USB */ + { USB_DEVICE(0x10C4, 0x82F4) }, /* Starizona MicroTouch */ { USB_DEVICE(0x10C4, 0x82F9) }, /* Procyon AVS */ { USB_DEVICE(0x10C4, 0x8341) }, /* Siemens MC35PU GPRS Modem */ { USB_DEVICE(0x10C4, 0x8382) }, /* Cygnal Integrated Products, Inc. */
@@ -117,6 +118,7 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */ { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ { USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */ + { USB_DEVICE(0x10C4, 0x84B6) }, /* Starizona Hyperion */ { USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */ { USB_DEVICE(0x10C4, 0x85EB) }, /* AC-Services CIS-IBUS */ { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */
Signature · 1 line
2.8.2
PATCH 47/76 iio: ak8975: Fix NULL pointer exception on early interrupt
In reply to Jiri SlabyFrom: Krzysztof Kozlowski <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 07d2390e36ee5b3265e9cc8305f2a106c8721e16 upstream.
In certain probe conditions the interrupt came right after registering the handler causing a NULL pointer exception because of uninitialized waitqueue:
$ udevadm trigger i2c-gpio i2c-gpio-1: using pins 143 (SDA) and 144 (SCL) i2c-gpio i2c-gpio-3: using pins 53 (SDA) and 52 (SCL) Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = e8b38000 [00000000] *pgd=00000000 Internal error: Oops: 5 [#1] SMP ARM Modules linked in: snd_soc_i2s(+) i2c_gpio(+) snd_soc_idma snd_soc_s3c_dma snd_soc_core snd_pcm_dmaengine snd_pcm snd_timer snd soundcore ac97_bus spi_s3c64xx pwm_samsung dwc2 exynos_adc phy_exynos_usb2 exynosdrm exynos_rng rng_core rtc_s3c CPU: 0 PID: 717 Comm: data-provider-m Not tainted 4.6.0-rc1-next-20160401-00011-g1b8d87473b9e-dirty #101 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) (...) (__wake_up_common) from [<c0379624>] (__wake_up+0x38/0x4c) (__wake_up) from [<c0a41d30>] (ak8975_irq_handler+0x28/0x30) (ak8975_irq_handler) from [<c0386720>] (handle_irq_event_percpu+0x88/0x140) (handle_irq_event_percpu) from [<c038681c>] (handle_irq_event+0x44/0x68) (handle_irq_event) from [<c0389c40>] (handle_edge_irq+0xf0/0x19c) (handle_edge_irq) from [<c0385e04>] (generic_handle_irq+0x24/0x34) (generic_handle_irq) from [<c05ee360>] (exynos_eint_gpio_irq+0x50/0x68) (exynos_eint_gpio_irq) from [<c0386720>] (handle_irq_event_percpu+0x88/0x140) (handle_irq_event_percpu) from [<c038681c>] (handle_irq_event+0x44/0x68) (handle_irq_event) from [<c0389a70>] (handle_fasteoi_irq+0xb4/0x194) (handle_fasteoi_irq) from [<c0385e04>] (generic_handle_irq+0x24/0x34) (generic_handle_irq) from [<c03860b4>] (__handle_domain_irq+0x5c/0xb4) (__handle_domain_irq) from [<c0301774>] (gic_handle_irq+0x54/0x94) (gic_handle_irq) from [<c030c910>] (__irq_usr+0x50/0x80)
The bug was reproduced on exynos4412-trats2 (with a max77693 device also using i2c-gpio) after building max77693 as a module.
--- drivers/iio/magnetometer/ak8975.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/magnetometer/ak8975.c +2 -2
@@ -151,6 +151,8 @@ static int ak8975_setup_irq(struct ak8975_data *data)int rc;int irq; +init_waitqueue_head (&data->data_ready_queue); +clear_bit (0 , &data->flags);if (client->irq) irq = client->irq;else
@@ -166,8 +168,6 @@ static int ak8975_setup_irq(struct ak8975_data *data)return rc; } -init_waitqueue_head (&data->data_ready_queue); -clear_bit (0 , &data->flags); data->eoc_irq = irq;return rc;
Signature · 1 line
2.8.2
PATCH 48/76 Input: ads7846 - correct the value got from SPI
In reply to Jiri SlabyFrom: Andrey Gelman <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 879f2fea8a5a748bcbf98d2cdce9139c045505d3 upstream.
According to the touch controller spec, SPI return a 16 bit value, only 12 bits are valid, they are bit[14-3].
The value of MISO and MOSI can be configured when SPI is in idle mode. Currently this touch driver assumes the SPI bus sets the MOSI and MISO in low level when SPI bus is in idle mode. So the bit[15] of the value got from SPI bus is always 0. But when SPI bus congfigures the MOSI and MISO in high level during the SPI idle mode, the bit[15] of the value get from SPI is always 1. If bit[15] is not masked, we may get the wrong value.
Mask the invalid bit to make sure the correct value gets returned. Regardless of the SPI bus idle configuration.
--- drivers/input/touchscreen/ads7846.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/input/touchscreen/ads7846.c +6 -2
@@ -700,18 +700,22 @@ static int ads7846_no_filter(void *ads, int data_idx, int *val)static int ads7846_get_value (struct ads7846 *ts,struct spi_message *m) { +int value;struct spi_transfer *t = list_entry(m->transfers.prev, struct spi_transfer, transfer_list);if (ts->model ==7845 ) { -return be16_to_cpup ((__be16 *)&(((char *)t->rx_buf)[1 ])) >>3 ; + value =be16_to_cpup ((__be16 *)&(((char *)t->rx_buf)[1 ])); }else {/* * adjust: on-wire is a must-ignore bit, a BE12 value, then * padding; built from two 8 bit values written msb-first. */ -return be16_to_cpup ((__be16 *)t->rx_buf) >>3 ; + value =be16_to_cpup ((__be16 *)t->rx_buf); } + +/* enforce ADC output is 12 bits width */ +return (value >>3 ) &0xfff ; }static void ads7846_update_value (struct spi_message *m,int val)
Signature · 1 line
2.8.2
PATCH 49/76 powerpc: scan_features() updates incorrect bits for REAL_LE
In reply to Jiri SlabyFrom: Anton Blanchard <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 6997e57d693b07289694239e52a10d2f02c3a46f upstream.
The REAL_LE feature entry in the ibm_pa_feature struct is missing an MMU feature value, meaning all the remaining elements initialise the wrong values.
This means instead of checking for byte 5, bit 0, we check for byte 0, bit 0, and then we incorrectly set the CPU feature bit as well as MMU feature bit 1 and CPU user feature bits 0 and 2 (5).
Checking byte 0 bit 0 (IBM numbering), means we're looking at the "Memory Management Unit (MMU)" feature - ie. does the CPU have an MMU. In practice that bit is set on all platforms which have the property.
This means we set CPU_FTR_REAL_LE always. In practice that seems not to matter because all the modern cpus which have this property also implement REAL_LE, and we've never needed to disable it.
We're also incorrectly setting MMU feature bit 1, which is:
#define MMU_FTR_TYPE_8xx 0x00000002
Luckily the only place that looks for MMU_FTR_TYPE_8xx is in Book3E code, which can't run on the same cpus as scan_features(). So this also doesn't matter in practice.
Finally in the CPU user feature mask, we're setting bits 0 and 2. Bit 2 is not currently used, and bit 0 is:
#define PPC_FEATURE_PPC_LE 0x00000001
Which says the CPU supports the old style "PPC Little Endian" mode. Again this should be harmless in practice as no 64-bit CPUs implement that mode.
Fix the code by adding the missing initialisation of the MMU feature.
Also add a comment marking CPU user feature bit 2 (0x4) as reserved. It would be unsafe to start using it as old kernels incorrectly set it.
--- arch/powerpc/include/uapi/asm/cputable.h | 1 + arch/powerpc/kernel/prom.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/include/uapi/asm/cputable.h +1 -0
@@ -31,6 +31,7 @@#define PPC_FEATURE_PSERIES_PERFMON_COMPAT \ 0x00000040 +/* Reserved - do not use 0x00000004 */ #define PPC_FEATURE_TRUE_LE 0x00000002#define PPC_FEATURE_PPC_LE 0x00000001
arch/powerpc/kernel/prom.c +1 -1
@@ -159,7 +159,7 @@ static struct ibm_pa_feature { {CPU_FTR_NOEXECUTE, 0, 0, 0, 6, 0}, {CPU_FTR_NODSISRALIGN, 0, 0, 1, 1, 1}, {0, MMU_FTR_CI_LARGE_PAGE, 0, 1, 2, 0}, - {CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0}, + {CPU_FTR_REAL_LE, 0, PPC_FEATURE_TRUE_LE, 5, 0, 0}, }; static void __init scan_features(unsigned long node, unsigned char *ftrs,
Signature · 1 line
2.8.2
PATCH 50/76 Input: i8042 - lower log level for "no controller" message
In reply to Jiri SlabyFrom: Takashi Iwai <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit f5d75341fac6033f6afac900da110cc78e06d40d upstream.
Nowadays the machines without i8042 controller is popular, and no need to print "No controller found" message in the error log level, which annoys at booting in quiet mode. Let's lower it info level.
--- drivers/input/serio/i8042.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/serio/i8042.c +1 -1
@@ -871,7 +871,7 @@ static int __init i8042_check_aux(void)static int i8042_controller_check (void ) {if (i8042_flush ()) { -pr_err ("No controller found\n" ); +pr_info ("No controller found\n" );return -ENODEV ; }
Signature · 1 line
2.8.2
PATCH 51/76 mm/balloon_compaction: redesign ballooned pages management
In reply to Jiri SlabyFrom: Konstantin Khlebnikov <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit d6d86c0a7f8ddc5b38cf089222cb1d9540762dc2 upstream.
Sasha Levin reported KASAN splash inside isolate_migratepages_range(). Problem is in the function __is_movable_balloon_page() which tests AS_BALLOON_MAP in page->mapping->flags. This function has no protection against anonymous pages. As result it tried to check address space flags inside struct anon_vma.
Further investigation shows more problems in current implementation:
* Special branch in __unmap_and_move() never works:
balloon_page_movable() checks page flags and page_count. In __unmap_and_move() page is locked, reference counter is elevated, thus balloon_page_movable() always fails. As a result execution goes to the normal migration path. virtballoon_migratepage() returns MIGRATEPAGE_BALLOON_SUCCESS instead of MIGRATEPAGE_SUCCESS, move_to_new_page() thinks this is an error code and assigns newpage->mapping to NULL. Newly migrated page lose connectivity with balloon an all ability for further migration.
* lru_lock erroneously required in isolate_migratepages_range() for isolation ballooned page. This function releases lru_lock periodically, this makes migration mostly impossible for some pages.
* balloon_page_dequeue have a tight race with balloon_page_isolate:
balloon_page_isolate could be executed in parallel with dequeue between picking page from list and locking page_lock. Race is rare because they use trylock_page() for locking.
This patch fixes all of them.
Instead of fake mapping with special flag this patch uses special state of page->_mapcount: PAGE_BALLOON_MAPCOUNT_VALUE = -256. Buddy allocator uses PAGE_BUDDY_MAPCOUNT_VALUE = -128 for similar purpose. Storing mark directly in struct page makes everything safer and easier.
PagePrivate is used to mark pages present in page list (i.e. not isolated, like PageLRU for normal pages). It replaces special rules for reference counter and makes balloon migration similar to migration of normal pages. This flag is protected by page_lock together with link to the balloon device.
[js] backport to 3.12. MIGRATEPAGE_BALLOON_SUCCESS had to be removed
from one more place. VM_BUG_ON_PAGE does not exist in 3.12 yet, use plain VM_BUG_ON.
--- drivers/virtio/virtio_balloon.c | 15 +++--- include/linux/balloon_compaction.h | 97 ++++++++++---------------------------- include/linux/migrate.h | 11 +---- include/linux/mm.h | 19 ++++++++ mm/balloon_compaction.c | 26 +++++----- mm/compaction.c | 2 +- mm/migrate.c | 20 ++------ 7 files changed, 69 insertions(+), 121 deletions(-)
drivers/virtio/virtio_balloon.c +7 -8
@@ -164,8 +164,8 @@ static void release_pages_by_pfn(const u32 pfns[], unsigned int num)/* Find pfns pointing at start of each page, get pages and free them. */ for (i =0 ; i < num; i +=VIRTIO_BALLOON_PAGES_PER_PAGE ) {struct page *page =balloon_pfn_to_page (pfns[i]); -balloon_page_free (page);adjust_managed_page_count (page,1 ); +put_page (page);/* balloon reference */ } }
@@ -399,6 +399,8 @@ int virtballoon_migratepage(struct address_space *mapping,if (!mutex_trylock (&vb->balloon_lock))return -EAGAIN ; +get_page (newpage);/* balloon reference */ +/* balloon's page migration 1st step -- inflate "newpage" */ spin_lock_irqsave (&vb_dev_info->pages_lock, flags);balloon_page_insert (newpage, mapping, &vb_dev_info->pages);
@@ -408,12 +410,7 @@ int virtballoon_migratepage(struct address_space *mapping,set_page_pfns (vb->pfns, newpage);tell_host (vb, vb->inflate_vq); -/* -* balloon's page migration 2nd step -- deflate "page" -* -* It's safe to delete page->lru here because this page is at -* an isolated migration list, and this step is expected to happen here -*/ +/* balloon's page migration 2nd step -- deflate "page" */ balloon_page_delete (page); vb->num_pfns =VIRTIO_BALLOON_PAGES_PER_PAGE ;set_page_pfns (vb->pfns, page);
@@ -421,7 +418,9 @@ int virtballoon_migratepage(struct address_space *mapping,mutex_unlock (&vb->balloon_lock); -return MIGRATEPAGE_BALLOON_SUCCESS ; +put_page (page);/* balloon reference */ + +return MIGRATEPAGE_SUCCESS ; }/* define the balloon_mapping->a_ops callback to allow balloon page migration */
include/linux/balloon_compaction.h +24 -73
156 lines not on this page · raw message
include/linux/migrate.h +1 -10
@@ -13,18 +13,9 @@ typedef void free_page_t(struct page *page, unsigned long private);* Return values from addresss_space_operations.migratepage(): * - negative errno on page migration failure; * - zero on page migration success; -* -* The balloon page migration introduces this special case where a 'distinct' -* return code is used to flag a successful page migration to unmap_and_move(). -* This approach is necessary because page migration can race against balloon -* deflation procedure, and for such case we could introduce a nasty page leak -* if a successfully migrated balloon page gets released concurrently with -* migration's unmap_and_move() wrap-up steps. */ #define MIGRATEPAGE_SUCCESS 0 -#define MIGRATEPAGE_BALLOON_SUCCESS 1/* special ret code for balloon page -* sucessful migration case. -*/ +enum migrate_reason {MR_COMPACTION ,MR_MEMORY_FAILURE ,
include/linux/mm.h +19 -0
@@ -477,6 +477,25 @@ static inline void __ClearPageBuddy(struct page *page)atomic_set (&page->_mapcount,-1 ); } +#define PAGE_BALLOON_MAPCOUNT_VALUE (-256) + +static inline int PageBalloon (struct page *page) +{ +return atomic_read (&page->_mapcount) ==PAGE_BALLOON_MAPCOUNT_VALUE ; +} + +static inline void __SetPageBalloon (struct page *page) +{ +VM_BUG_ON (atomic_read (&page->_mapcount) !=-1 ); +atomic_set (&page->_mapcount,PAGE_BALLOON_MAPCOUNT_VALUE ); +} + +static inline void __ClearPageBalloon (struct page *page) +{ +VM_BUG_ON (!PageBalloon (page)); +atomic_set (&page->_mapcount,-1 ); +} +void put_page (struct page *page);void put_pages_list (struct list_head *pages);
mm/balloon_compaction.c +12 -14
@@ -93,17 +93,12 @@ struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info)* to be released by the balloon driver. */ if (trylock_page (page)) { +if (!PagePrivate (page)) { +/* raced with isolation */ +unlock_page (page); +continue ; + }spin_lock_irqsave (&b_dev_info->pages_lock, flags); -/* -* Raise the page refcount here to prevent any wrong -* attempt to isolate this page, in case of coliding -* with balloon_page_isolate() just after we release -* the page lock. -* -* balloon_page_free() will take care of dropping -* this extra refcount later. -*/ -get_page (page);balloon_page_delete (page);spin_unlock_irqrestore (&b_dev_info->pages_lock, flags);unlock_page (page);
@@ -187,7 +182,9 @@ static inline void __isolate_balloon_page(struct page *page) {struct balloon_dev_info *b_dev_info = page->mapping->private_data;unsigned long flags; +spin_lock_irqsave (&b_dev_info->pages_lock, flags); +ClearPagePrivate (page);list_del (&page->lru); b_dev_info->isolated_pages++;spin_unlock_irqrestore (&b_dev_info->pages_lock, flags);
@@ -197,7 +194,9 @@ static inline void __putback_balloon_page(struct page *page) {struct balloon_dev_info *b_dev_info = page->mapping->private_data;unsigned long flags; +spin_lock_irqsave (&b_dev_info->pages_lock, flags); +SetPagePrivate (page);list_add (&page->lru, &b_dev_info->pages); b_dev_info->isolated_pages--;spin_unlock_irqrestore (&b_dev_info->pages_lock, flags);
@@ -235,12 +234,11 @@ bool balloon_page_isolate(struct page *page)*/ if (likely (trylock_page (page))) {/* -* A ballooned page, by default, has just one refcount. +* A ballooned page, by default, has PagePrivate set. * Prevent concurrent compaction threads from isolating -* an already isolated balloon page by refcount check. +* an already isolated balloon page by clearing it. */ -if (__is_movable_balloon_page (page) && -page_count (page) ==2 ) { +if (balloon_page_movable (page)) {__isolate_balloon_page (page);unlock_page (page);return true;
mm/compaction.c +1 -1
@@ -595,7 +595,7 @@ isolate_migratepages_range(struct zone *zone, struct compact_control *cc,*/ if (!PageLRU (page)) {if (unlikely (balloon_page_movable (page))) { -if (locked &&balloon_page_isolate (page)) { +if (balloon_page_isolate (page)) {/* Successfully isolated */ goto isolate_success; }
mm/migrate.c +5 -15
@@ -856,7 +856,7 @@ static int __unmap_and_move(struct page *page, struct page *newpage, } } -if (unlikely (balloon_page_movable (page))) { +if (unlikely (isolated_balloon_page (page))) {/* * A ballooned page does not need any special attention from * physical to virtual reverse mapping procedures.
@@ -904,9 +904,7 @@ skip_unmap:put_anon_vma (anon_vma); uncharge: -mem_cgroup_end_migration (mem, page, newpage, - (rc ==MIGRATEPAGE_SUCCESS || - rc ==MIGRATEPAGE_BALLOON_SUCCESS )); +mem_cgroup_end_migration (mem, page, newpage, rc ==MIGRATEPAGE_SUCCESS );unlock_page (page); out:return rc;
@@ -938,17 +936,6 @@ static int unmap_and_move(new_page_t get_new_page, free_page_t put_new_page, rc =__unmap_and_move (page, newpage, force, mode); -if (unlikely (rc ==MIGRATEPAGE_BALLOON_SUCCESS )) { -/* -* A ballooned page has been migrated already. -* Now, it's the time to wrap-up counters, -* handle the page back to Buddy and return. -*/ -dec_zone_page_state (page,NR_ISOLATED_ANON + -page_is_file_cache (page)); -balloon_page_free (page); -return MIGRATEPAGE_SUCCESS ; - } out:if (rc != -EAGAIN ) {/*
@@ -971,6 +958,9 @@ out:if (rc !=MIGRATEPAGE_SUCCESS && put_new_page) {ClearPageSwapBacked (newpage);put_new_page (newpage, private); + }else if (unlikely (__is_movable_balloon_page (newpage))) { +/* drop our reference, page already in the balloon */ +put_page (newpage); }else putback_lru_page (newpage);
Signature · 1 line
2.8.2
PATCH 52/76 mm/balloon_compaction: fix deflation when compaction is disabled
In reply to Jiri SlabyFrom: Konstantin Khlebnikov <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 4d88e6f7d5ffc84e6094a47925870f4a130555c2 upstream.
If CONFIG_BALLOON_COMPACTION=n balloon_page_insert() does not link pages with balloon and doesn't set PagePrivate flag, as a result balloon_page_dequeue() cannot get any pages because it thinks that all of them are isolated. Without balloon compaction nobody can isolate ballooned pages. It's safe to remove this check.
--- mm/balloon_compaction.c | 2 ++ 1 file changed, 2 insertions(+)
mm/balloon_compaction.c +2 -0
@@ -93,11 +93,13 @@ struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info)* to be released by the balloon driver. */ if (trylock_page (page)) { +#ifdef CONFIG_BALLOON_COMPACTION if (!PagePrivate (page)) {/* raced with isolation */ unlock_page (page);continue ; } +#endif spin_lock_irqsave (&b_dev_info->pages_lock, flags);balloon_page_delete (page);spin_unlock_irqrestore (&b_dev_info->pages_lock, flags);
Signature · 1 line
2.8.2
PATCH 53/76 crypto: hash - Fix page length clamping in hash walk
In reply to Jiri SlabyFrom: Herbert Xu <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 13f4bb78cf6a312bbdec367ba3da044b09bf0e29 upstream.
The crypto hash walk code is broken when supplied with an offset greater than or equal to PAGE_SIZE. This patch fixes it by adjusting walk->pg and walk->offset when this happens.
--- crypto/ahash.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
crypto/ahash.c +2 -1
@@ -64,8 +64,9 @@ static int hash_walk_new_entry(struct crypto_hash_walk *walk)struct scatterlist *sg; sg = walk->sg; - walk->pg =sg_page (sg); walk->offset = sg->offset; + walk->pg =sg_page (walk->sg) + (walk->offset >>PAGE_SHIFT ); + walk->offset =offset_in_page (walk->offset); walk->entrylen = sg->length;if (walk->entrylen > walk->total)
Signature · 1 line
2.8.2
PATCH 54/76 get_rock_ridge_filename(): handle malformed NM entries
In reply to Jiri SlabyFrom: Al Viro <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 99d825822eade8d827a1817357cbf3f889a552d6 upstream.
Payloads of NM entries are not supposed to contain NUL. When we run into such, only the part prior to the first NUL goes into the concatenation (i.e. the directory entry name being encoded by a bunch of NM entries). We do stop when the amount collected so far + the claimed amount in the current NM entry exceed 254. So far, so good, but what we return as the total length is the sum of *claimed* sizes, not the actual amount collected. And that can grow pretty large - not unlimited, since you'd need to put CE entries in between to be able to get more than the maximum that could be contained in one isofs directory entry / continuation chunk and we are stop once we'd encountered 32 CEs, but you can get about 8Kb easily. And that's what will be passed to readdir callback as the name length. 8Kb __copy_to_user() from a buffer allocated by __get_free_page()
--- fs/isofs/rock.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
fs/isofs/rock.c +10 -3
@@ -203,6 +203,8 @@ int get_rock_ridge_filename(struct iso_directory_record *de,int retnamlen =0 ;int truncate =0 ;int ret =0 ; +char *p; +int len;if (!ISOFS_SB (inode->i_sb)->s_rock)return 0 ;
@@ -267,12 +269,17 @@ repeat: rr->u.NM.flags);break ; } -if ((strlen (retname) + rr->len -5 ) >=254 ) { + len = rr->len -5 ; +if (retnamlen + len >=254 ) { truncate =1 ;break ; } -strncat (retname, rr->u.NM.name, rr->len -5 ); - retnamlen += rr->len -5 ; + p =memchr (rr->u.NM.name,'\0' , len); +if (unlikely (p)) + len = p - rr->u.NM.name; +memcpy (retname + retnamlen, rr->u.NM.name, len); + retnamlen += len; + retname[retnamlen] ='\0' ;break ;case SIG ('R' ,'E' ):kfree (rs.buffer);
Signature · 1 line
2.8.2
PATCH 55/76 Input: max8997-haptic - fix NULL pointer dereference
In reply to Jiri SlabyFrom: Marek Szyprowski <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 6ae645d5fa385f3787bf1723639cd907fe5865e7 upstream.
NULL pointer derefence happens when booting with DTB because the platform data for haptic device is not set in supplied data from parent MFD device.
The MFD device creates only platform data (from Device Tree) for itself, not for haptic child.
Unable to handle kernel NULL pointer dereference at virtual address 0000009c pgd = c0004000 [0000009c] *pgd=00000000 Internal error: Oops: 5 [#1] PREEMPT SMP ARM (max8997_haptic_probe) from [<c03f9cec>] (platform_drv_probe+0x4c/0xb0) (platform_drv_probe) from [<c03f8440>] (driver_probe_device+0x214/0x2c0) (driver_probe_device) from [<c03f8598>] (__driver_attach+0xac/0xb0) (__driver_attach) from [<c03f67ac>] (bus_for_each_dev+0x68/0x9c) (bus_for_each_dev) from [<c03f7a38>] (bus_add_driver+0x1a0/0x218) (bus_add_driver) from [<c03f8db0>] (driver_register+0x78/0xf8) (driver_register) from [<c0101774>] (do_one_initcall+0x90/0x1d8) (do_one_initcall) from [<c0a00dbc>] (kernel_init_freeable+0x15c/0x1fc) (kernel_init_freeable) from [<c06bb5b4>] (kernel_init+0x8/0x114) (kernel_init) from [<c0107938>] (ret_from_fork+0x14/0x3c)
--- drivers/input/misc/max8997_haptic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/input/misc/max8997_haptic.c +4 -2
@@ -246,12 +246,14 @@ static int max8997_haptic_probe(struct platform_device *pdev)struct max8997_dev *iodev =dev_get_drvdata (pdev->dev.parent);const struct max8997_platform_data *pdata =dev_get_platdata (iodev->dev); -const struct max8997_haptic_platform_data *haptic_pdata = - pdata->haptic_pdata; +const struct max8997_haptic_platform_data *haptic_pdata =NULL ;struct max8997_haptic *chip;struct input_dev *input_dev;int error; +if (pdata) + haptic_pdata = pdata->haptic_pdata; +if (!haptic_pdata) {dev_err (&pdev->dev,"no haptic platform data\n" );return -EINVAL ;
Signature · 1 line
2.8.2
PATCH 56/76 asmlinkage, pnp: Make variables used from assembler code visible
In reply to Jiri SlabyFrom: Andi Kleen <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit a99aa42d0253f033cbb85096d3f2bd82201321e6 upstream.
Mark variables referenced from assembler files visible.
This fixes compile problems with LTO.
--- drivers/pnp/pnpbios/bioscalls.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/pnp/pnpbios/bioscalls.c +5 -4
@@ -21,7 +21,7 @@#include "pnpbios.h" -static struct { +__visible struct {u16 offset;u16 segment; } pnp_bios_callpoint;
@@ -41,6 +41,7 @@ asmlinkage void pnp_bios_callfunc(void); __asm__(".text \n" __ALIGN_STR"\n" +".globl pnp_bios_callfunc\n" "pnp_bios_callfunc:\n" " pushl %edx \n" " pushl %ecx \n"
@@ -66,9 +67,9 @@ static struct desc_struct bad_bios_desc = GDT_ENTRY_INIT(0x4092,* after PnP BIOS oopses. */ -u32 pnp_bios_fault_esp; -u32 pnp_bios_fault_eip; -u32 pnp_bios_is_utter_crap =0 ; +__visible u32 pnp_bios_fault_esp; +__visible u32 pnp_bios_fault_eip; +__visible u32 pnp_bios_is_utter_crap = 0;static spinlock_t pnp_bios_lock;
Signature · 1 line
2.8.2
PATCH 57/76 drm/radeon: fix PLL sharing on DCE6.1 (v2)
In reply to Jiri SlabyFrom: Lucas Stach <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit e3c00d87845ab375f90fa6e10a5e72a3a5778cd3 upstream.
On DCE6.1 PPLL2 is exclusively available to UNIPHYA, so it should not be taken into consideration when looking for an already enabled PLL to be shared with other outputs.
This fixes the broken VGA port (TRAVIS DP->VGA bridge) on my Richland based laptop, where the internal display is connected to UNIPHYA through a TRAVIS DP->LVDS bridge.
Bug:
https://bugs.freedesktop.org/show_bug.cgi?id=78987
v2: agd: add check in radeon_get_shared_nondp_ppll as well, drop
extra parameter.
--- drivers/gpu/drm/radeon/atombios_crtc.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/radeon/atombios_crtc.c +10 -0
@@ -1572,6 +1572,7 @@ static u32 radeon_get_pll_use_mask(struct drm_crtc *crtc)static int radeon_get_shared_dp_ppll (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev; +struct radeon_device *rdev = dev->dev_private;struct drm_crtc *test_crtc;struct radeon_crtc *test_radeon_crtc;
@@ -1581,6 +1582,10 @@ static int radeon_get_shared_dp_ppll(struct drm_crtc *crtc) test_radeon_crtc =to_radeon_crtc (test_crtc);if (test_radeon_crtc->encoder &&ENCODER_MODE_IS_DP (atombios_get_encoder_mode (test_radeon_crtc->encoder))) { +/* PPLL2 is exclusive to UNIPHYA on DCE61 */ +if (ASIC_IS_DCE61 (rdev) && !ASIC_IS_DCE8 (rdev) && + test_radeon_crtc->pll_id ==ATOM_PPLL2 ) +continue ;/* for DP use the same PLL for all */ if (test_radeon_crtc->pll_id !=ATOM_PPLL_INVALID )return test_radeon_crtc->pll_id;
@@ -1602,6 +1607,7 @@ static int radeon_get_shared_nondp_ppll(struct drm_crtc *crtc) {struct radeon_crtc *radeon_crtc =to_radeon_crtc (crtc);struct drm_device *dev = crtc->dev; +struct radeon_device *rdev = dev->dev_private;struct drm_crtc *test_crtc;struct radeon_crtc *test_radeon_crtc;u32 adjusted_clock, test_adjusted_clock;
@@ -1617,6 +1623,10 @@ static int radeon_get_shared_nondp_ppll(struct drm_crtc *crtc) test_radeon_crtc =to_radeon_crtc (test_crtc);if (test_radeon_crtc->encoder && !ENCODER_MODE_IS_DP (atombios_get_encoder_mode (test_radeon_crtc->encoder))) { +/* PPLL2 is exclusive to UNIPHYA on DCE61 */ +if (ASIC_IS_DCE61 (rdev) && !ASIC_IS_DCE8 (rdev) && + test_radeon_crtc->pll_id ==ATOM_PPLL2 ) +continue ;/* check if we are already driving this connector with another crtc */ if (test_radeon_crtc->connector == radeon_crtc->connector) {/* if we are, return that pll */
Signature · 1 line
2.8.2
PATCH 58/76 drm/i915: Bail out of pipe config compute loop on LPT
In reply to Jiri SlabyFrom: Daniel Vetter <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 2700818ac9f935d8590715eecd7e8cadbca552b6 upstream.
LPT is pch, so might run into the fdi bandwidth constraint (especially since it has only 2 lanes). But right now we just force pipe_bpp back to 24, resulting in a nice loop (which we bail out with a loud WARN_ON). Fix this.
Cc: Chris Wilson <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
References: https://bugs.freedesktop.org/show_bug.cgi?id=93477
--- drivers/gpu/drm/i915/intel_crt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_crt.c +7 -1
@@ -248,8 +248,14 @@ static bool intel_crt_compute_config(struct intel_encoder *encoder, pipe_config->has_pch_encoder = true;/* LPT FDI RX only supports 8bpc. */ -if (HAS_PCH_LPT (dev)) +if (HAS_PCH_LPT (dev)) { +if (pipe_config->bw_constrained && pipe_config->pipe_bpp <24 ) { +DRM_DEBUG_KMS ("LPT only supports 24bpp\n" ); +return false; + } + pipe_config->pipe_bpp =24 ; + }return true; }
Signature · 1 line
2.8.2
PATCH 59/76 ARM: OMAP3: Fix booting with thumb2 kernel
In reply to Jiri SlabyFrom: Tony Lindgren <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit d8a50941c91a68da202aaa96a3dacd471ea9c693 upstream.
We get a NULL pointer dereference on omap3 for thumb2 compiled kernels:
Internal error: Oops: 80000005 [#1] SMP THUMB2
...
[<c046497b>] (_raw_spin_unlock_irqrestore) from [<c0024375>] (omap3_enter_idle_bm+0xc5/0x178)
[<c0024375>] (omap3_enter_idle_bm) from [<c0374e63>] (cpuidle_enter_state+0x77/0x27c)
[<c0374e63>] (cpuidle_enter_state) from [<c00627f1>] (cpu_startup_entry+0x155/0x23c)
[<c00627f1>] (cpu_startup_entry) from [<c06b9a47>] (start_kernel+0x32f/0x338)
[<c06b9a47>] (start_kernel) from [<8000807f>] (0x8000807f)
The power management related assembly on omaps needs to interact with ARM mode bootrom code, so we need to keep most of the related assembly in ARM mode.
Turns out this error is because of missing ENDPROC for assembly code as suggested by Stephen Boyd <[email protected]>. Let's fix the problem by adding ENDPROC in two places to sleep34xx.S.
Let's also remove the now duplicate custom code for mode switching. This has been unnecessary since commit 6ebbf2ce437b ("ARM: convert all "mov.* pc, reg" to "bx reg" for ARMv6+").
And let's also remove the comments about local variables, they are now just confusing after the ENDPROC.
The reason why ENDPROC makes a difference is it sets .type and then the compiler knows what to do with the thumb bit as explained at:
https://wiki.ubuntu.com/ARM/Thumb2PortingHowto
--- arch/arm/mach-omap2/sleep34xx.S | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-)
arch/arm/mach-omap2/sleep34xx.S +2 -20
@@ -203,23 +203,8 @@ save_context_wfi: */ ldr r1, kernel_flush blx r1 - /* - * The kernel doesn't interwork: v7_flush_dcache_all in particluar will - * always return in Thumb state when CONFIG_THUMB2_KERNEL is enabled. - * This sequence switches back to ARM. Note that .align may insert a - * nop: bx pc needs to be word-aligned in order to work. - */ - THUMB( .thumb ) - THUMB( .align ) - THUMB( bx pc ) - THUMB( nop ) - .arm - b omap3_do_wfi - -/* - * Local variables - */ +ENDPROC(omap34xx_cpu_suspend) omap3_do_wfi_sram_addr: .word omap3_do_wfi_sram kernel_flush:
@@ -364,10 +349,7 @@ exit_nonoff_modes: * =================================== */ ldmfd sp!, {r4 - r11, pc} @ restore regs and return - -/* - * Local variables - */ +ENDPROC(omap3_do_wfi) sdrc_power: .word SDRC_POWER_V cm_idlest1_core:
Signature · 1 line
2.8.2
PATCH 60/76 net/route: enforce hoplimit max value
In reply to Jiri SlabyFrom: Paolo Abeni <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit 626abd59e51d4d8c6367e03aae252a8aa759ac78 ]
Currently, when creating or updating a route, no check is performed in both ipv4 and ipv6 code to the hoplimit value.
The caller can i.e. set hoplimit to 256, and when such route will
be used, packets will be sent with hoplimit/ttl equal to 0.
This commit adds checks for the RTAX_HOPLIMIT value, in both ipv4 ipv6 route code, substituting any value greater than 255 with 255.
This is consistent with what is currently done for ADVMSS and MTU in the ipv4 code.
[js] backport to 3.12: no ip6_convert_metrics yet, fix applied to
ip6_route_add directly.
--- net/ipv4/fib_semantics.c | 2 ++ net/ipv6/route.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-)
net/ipv4/fib_semantics.c +2 -0
@@ -860,6 +860,8 @@ struct fib_info *fib_create_info(struct fib_config *cfg) val =65535 -40 ;if (type ==RTAX_MTU && val >65535 -15 ) val =65535 -15 ; +if (type ==RTAX_HOPLIMIT && val >255 ) + val =255 ; fi->fib_metrics[type -1 ] = val; } }
net/ipv6/route.c +5 -1
@@ -1670,7 +1670,11 @@ install_route: goto out; } -dst_metric_set (&rt->dst, type,nla_get_u32 (nla)); +if (type ==RTAX_HOPLIMIT &&nla_get_u32 (nla) >255 ) +dst_metric_set (&rt->dst, type,255 ); +else +dst_metric_set (&rt->dst, type, +nla_get_u32 (nla)); } } }
Signature · 1 line
2.8.2
PATCH 61/76 decnet: Do not build routes to devices without decnet private data.
In reply to Jiri SlabyFrom: "David S. Miller" <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit a36a0d4008488fa545c74445d69eaf56377d5d4e ]
In particular, make sure we check for decnet private presence for loopback devices.
--- net/decnet/dn_route.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/decnet/dn_route.c +8 -1
@@ -1030,10 +1030,13 @@ source_ok:if (!fld.daddr) { fld.daddr = fld.saddr; - err = -EADDRNOTAVAIL ;if (dev_out)dev_put (dev_out); + err = -EINVAL ; dev_out = init_net.loopback_dev; +if (!dev_out->dn_ptr) + goto out; + err = -EADDRNOTAVAIL ;dev_hold (dev_out);if (!fld.daddr) { fld.daddr =
@@ -1106,6 +1109,8 @@ source_ok:if (dev_out ==NULL ) goto out; dn_db =rcu_dereference_raw (dev_out->dn_ptr); +if (!dn_db) + goto e_inval;/* Possible improvement - check all devices for local addr */ if (dn_dev_islocal (dev_out, fld.daddr)) {dev_put (dev_out);
@@ -1147,6 +1152,8 @@ select_source:dev_put (dev_out); dev_out = init_net.loopback_dev;dev_hold (dev_out); +if (!dev_out->dn_ptr) + goto e_inval; fld.flowidn_oif = dev_out->ifindex;if (res.fi)dn_fib_info_put (res.fi);
Signature · 1 line
2.8.2
PATCH 62/76 route: do not cache fib route info on local routes with oif
In reply to Jiri SlabyFrom: Chris Friesen <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit d6d5e999e5df67f8ec20b6be45e2229455ee3699 ]
For local routes that require a particular output interface we do not want to cache the result. Caching the result causes incorrect behaviour when there are multiple source addresses on the interface. The end result being that if the intended recipient is waiting on that interface for the packet he won't receive it because it will be delivered on the loopback interface and the IP_PKTINFO ipi_ifindex will be set to the loopback interface as well.
This can be tested by running a program such as "dhcp_release" which attempts to inject a packet on a particular interface so that it is received by another program on the same board. The receiving process should see an IP_PKTINFO ipi_ifndex value of the source interface (e.g., eth1) instead of the loopback interface (e.g., lo). The packet will still appear on the loopback interface in tcpdump but the important aspect is that the CMSG info is correct.
Sample dhcp_release command line:
dhcp_release eth1 192.168.204.222 02:11:33:22:44:66
Signed off-by: Chris Friesen <[email protected]>
--- net/ipv4/route.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
net/ipv4/route.c +12 -0
@@ -1968,6 +1968,18 @@ static struct rtable *__mkroute_output(const struct fib_result *res,*/ if (fi && res->prefixlen <4 ) fi =NULL ; + }else if ((type ==RTN_LOCAL ) && (orig_oif !=0 ) && + (orig_oif != dev_out->ifindex)) { +/* For local routes that require a particular output interface +* we do not want to cache the result. Caching the result +* causes incorrect behaviour when there are multiple source +* addresses on the interface, the end result being that if the +* intended recipient is waiting on that interface for the +* packet he won't receive it because it will be delivered on +* the loopback interface and the IP_PKTINFO ipi_ifindex will +* be set to the loopback interface as well. +*/ + fi =NULL ; } fnhe =NULL ;
Signature · 1 line
2.8.2
PATCH 63/76 packet: fix heap info leak in PACKET_DIAG_MCLIST sock_diag interface
In reply to Jiri SlabyFrom: Mathias Krause <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit 309cf37fe2a781279b7675d4bb7173198e532867 ]
Because we miss to wipe the remainder of i->addr[] in packet_mc_add(), pdiag_put_mclist() leaks uninitialized heap bytes via the PACKET_DIAG_MCLIST netlink attribute.
Fix this by explicitly memset(0)ing the remaining bytes in i->addr[].
--- net/packet/af_packet.c | 1 + 1 file changed, 1 insertion(+)
net/packet/af_packet.c +1 -0
@@ -2977,6 +2977,7 @@ static int packet_mc_add(struct sock *sk, struct packet_mreq_max *mreq) i->ifindex = mreq->mr_ifindex; i->alen = mreq->mr_alen;memcpy (i->addr, mreq->mr_address, i->alen); +memset (i->addr + i->alen,0 ,sizeof (i->addr) - i->alen); i->count =1 ; i->next = po->mclist; po->mclist = i;
Signature · 1 line
2.8.2
PATCH 64/76 atl2: Disable unimplemented scatter/gather feature
In reply to Jiri SlabyFrom: Ben Hutchings <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit f43bfaeddc79effbf3d0fcb53ca477cca66f3db8 ]
atl2 includes NETIF_F_SG in hw_features even though it has no support for non-linear skbs. This bug was originally harmless since the driver does not claim to implement checksum offload and that used to be a requirement for SG.
Now that SG and checksum offload are independent features, if you explicitly enable SG *and* use one of the rare protocols that can use SG without checkusm offload, this potentially leaks sensitive information (before you notice that it just isn't working). Therefore this obscure bug has been designated CVE-2016-2117.
--- drivers/net/ethernet/atheros/atlx/atl2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/atheros/atlx/atl2.c +1 -1
@@ -1413,7 +1413,7 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err = -EIO ; - netdev->hw_features =NETIF_F_SG |NETIF_F_HW_VLAN_CTAG_RX ; + netdev->hw_features =NETIF_F_HW_VLAN_CTAG_RX ; netdev->features |= (NETIF_F_HW_VLAN_CTAG_TX |NETIF_F_HW_VLAN_CTAG_RX );/* Init PHY as early as possible due to power saving issue */
Signature · 1 line
2.8.2
PATCH 65/76 ipv4/fib: don't warn when primary address is missing if in_dev is dead
In reply to Jiri SlabyFrom: Paolo Abeni <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit 391a20333b8393ef2e13014e6e59d192c5594471 ]
After commit fbd40ea0180a ("ipv4: Don't do expensive useless work during inetdev destroy.") when deleting an interface, fib_del_ifaddr() can be executed without any primary address present on the dead interface.
The above is safe, but triggers some "bug: prim == NULL" warnings.
This commit avoids warning if the in_dev is dead
--- net/ipv4/fib_frontend.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/ipv4/fib_frontend.c +5 -1
@@ -797,7 +797,11 @@ void fib_del_ifaddr(struct in_ifaddr *ifa, struct in_ifaddr *iprim)if (ifa->ifa_flags &IFA_F_SECONDARY ) { prim =inet_ifa_byprefix (in_dev, any, ifa->ifa_mask);if (prim ==NULL ) { -pr_warn ("%s: bug: prim == NULL\n" , __func__); +/* if the device has been deleted, we don't perform +* address promotion +*/ +if (!in_dev->dead) +pr_warn ("%s: bug: prim == NULL\n" , __func__);return ; }if (iprim && iprim != prim) {
Signature · 1 line
2.8.2
PATCH 66/76 net/mlx4_en: fix spurious timestamping callbacks
In reply to Jiri SlabyFrom: Eric Dumazet <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit fc96256c906362e845d848d0f6a6354450059e81 ]
When multiple skb are TX-completed in a row, we might incorrectly keep a timestamp of a prior skb and cause extra work.
--- drivers/net/ethernet/mellanox/mlx4/en_tx.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_tx.c +4 -2
@@ -343,7 +343,6 @@ static void mlx4_en_process_tx_cq(struct net_device *dev, struct mlx4_en_cq *cq)u32 packets =0 ;u32 bytes =0 ;int factor = priv->cqe_factor; -u64 timestamp =0 ;if (!priv->port_up)return ;
@@ -375,9 +374,12 @@ static void mlx4_en_process_tx_cq(struct net_device *dev, struct mlx4_en_cq *cq) new_index =be16_to_cpu (cqe->wqe_index) & size_mask; do { + u64 timestamp = 0; + txbbs_skipped += ring->last_nr_txbb; ring_index = (ring_index + ring->last_nr_txbb) & size_mask; - if (ring->tx_info[ring_index].ts_requested) + + if (unlikely(ring->tx_info[ring_index].ts_requested)) timestamp = mlx4_en_get_cqe_ts(cqe); /* free next descriptor */
Signature · 1 line
2.8.2
PATCH 67/76 netem: Segment GSO packets on enqueue
In reply to Jiri SlabyFrom: Neil Horman <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit 6071bd1aa13ed9e41824bafad845b7b7f4df5cfd ]
This was recently reported to me, and reproduced on the latest net kernel, when attempting to run netperf from a host that had a netem qdisc attached to the egress interface:
[ 788.073771] ---------------------[ cut here ]--------------------------- [ 788.096716] WARNING: at net/core/dev.c:2253 skb_warn_bad_offload+0xcd/0xda() [ 788.129521] bnx2: caps=(0x00000001801949b3, 0x0000000000000000) len=2962 data_len=0 gso_size=1448 gso_type=1 ip_summed=3 [ 788.182150] Modules linked in: sch_netem kvm_amd kvm crc32_pclmul ipmi_ssif
ghash_clmulni_intel sp5100_tco amd64_edac_mod aesni_intel lrw gf128mul glue_helper ablk_helper edac_mce_amd cryptd pcspkr sg edac_core hpilo ipmi_si i2c_piix4 k10temp fam15h_power hpwdt ipmi_msghandler shpchp acpi_power_meter pcc_cpufreq nfsd auth_rpcgss nfs_acl lockd grace sunrpc ip_tables xfs libcrc32c sd_mod crc_t10dif crct10dif_generic mgag200 syscopyarea sysfillrect sysimgblt i2c_algo_bit drm_kms_helper ahci ata_generic pata_acpi ttm libahci crct10dif_pclmul pata_atiixp tg3 libata crct10dif_common drm crc32c_intel ptp serio_raw bnx2 r8169 hpsa pps_core i2c_core mii dm_mirror dm_region_hash dm_log dm_mod
[ 788.465294] CPU: 16 PID: 0 Comm: swapper/16 Tainted: G W ------------ 3.10.0-327.el7.x86_64 #1 [ 788.511521] Hardware name: HP ProLiant DL385p Gen8, BIOS A28 12/17/2012 [ 788.542260] ffff880437c036b8 f7afc56532a53db9 ffff880437c03670 ffffffff816351f1 [ 788.576332] ffff880437c036a8 ffffffff8107b200 ffff880633e74200 ffff880231674000 [ 788.611943] 0000000000000001 0000000000000003 0000000000000000 ffff880437c03710 [ 788.647241] Call Trace: [ 788.658817] <IRQ> [<ffffffff816351f1>] dump_stack+0x19/0x1b [ 788.686193] [<ffffffff8107b200>] warn_slowpath_common+0x70/0xb0 [ 788.713803] [<ffffffff8107b29c>] warn_slowpath_fmt+0x5c/0x80 [ 788.741314] [<ffffffff812f92f3>] ? ___ratelimit+0x93/0x100 [ 788.767018] [<ffffffff81637f49>] skb_warn_bad_offload+0xcd/0xda [ 788.796117] [<ffffffff8152950c>] skb_checksum_help+0x17c/0x190 [ 788.823392] [<ffffffffa01463a1>] netem_enqueue+0x741/0x7c0 [sch_netem] [ 788.854487] [<ffffffff8152cb58>] dev_queue_xmit+0x2a8/0x570 [ 788.880870] [<ffffffff8156ae1d>] ip_finish_output+0x53d/0x7d0
...
The problem occurs because netem is not prepared to handle GSO packets (as it uses skb_checksum_help in its enqueue path, which cannot manipulate these frames).
The solution I think is to simply segment the skb in a simmilar fashion to the way we do in __dev_queue_xmit (via validate_xmit_skb), with some minor changes. When we decide to corrupt an skb, if the frame is GSO, we segment it, corrupt the first segment, and enqueue the remaining ones.
tested successfully by myself on the latest net kernel, to which this applies
[js] backport to 3.12: no qdisc_qstats_drop yet, update directly. Also use
qdisc_tree_decrease_qlen instead of qdisc_tree_reduce_backlog.
--- net/sched/sch_netem.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-)
net/sched/sch_netem.c +59 -2
@@ -394,6 +394,25 @@ static void tfifo_enqueue(struct sk_buff *nskb, struct Qdisc *sch) sch->q.qlen++; } +/* netem can't properly corrupt a megapacket (like we get from GSO), so instead +* when we statistically choose to corrupt one, we instead segment it, returning +* the first packet to be corrupted, and re-enqueue the remaining frames +*/ +static struct sk_buff *netem_segment (struct sk_buff *skb,struct Qdisc *sch) +{ +struct sk_buff *segs; +netdev_features_t features =netif_skb_features (skb); + + segs =skb_gso_segment (skb, features & ~NETIF_F_GSO_MASK ); + +if (IS_ERR_OR_NULL (segs)) { +qdisc_reshape_fail (skb, sch); +return NULL ; + } +consume_skb (skb); +return segs; +} +/* * Insert one skb into qdisc. * Note: parent depends on return value to account for queue length.
@@ -406,7 +425,11 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)/* We don't fill cb now as skb_unshare() may invalidate it */ struct netem_skb_cb *cb;struct sk_buff *skb2; +struct sk_buff *segs =NULL ; +unsigned int len =0 , last_len; +int nb =0 ;int count =1 ; +int rc =NET_XMIT_SUCCESS ;/* Random duplication */ if (q->duplicate && q->duplicate >=get_crandom (&q->dup_cor))
@@ -452,10 +475,23 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)* do it now in software before we mangle it. */ if (q->corrupt && q->corrupt >=get_crandom (&q->corrupt_cor)) { +if (skb_is_gso (skb)) { + segs =netem_segment (skb, sch); +if (!segs) +return NET_XMIT_DROP ; + }else { + segs = skb; + } + + skb = segs; + segs = segs->next; +if (!(skb =skb_unshare (skb,GFP_ATOMIC )) || (skb->ip_summed ==CHECKSUM_PARTIAL && -skb_checksum_help (skb))) -return qdisc_drop (skb, sch); +skb_checksum_help (skb))) { + rc =qdisc_drop (skb, sch); + goto finish_segs; + } skb->data[net_random () %skb_headlen (skb)] ^=1 <<(net_random () %8 ); }
@@ -514,6 +550,27 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) sch->qstats.requeues++; } +finish_segs: +if (segs) { +while (segs) { + skb2 = segs->next; + segs->next =NULL ; +qdisc_skb_cb (segs)->pkt_len = segs->len; + last_len = segs->len; + rc =qdisc_enqueue (segs, sch); +if (rc !=NET_XMIT_SUCCESS ) { +if (net_xmit_drop_count (rc)) + sch->qstats.drops++; + }else { + nb++; + len += last_len; + } + segs = skb2; + } + sch->q.qlen += nb; +if (nb >1 ) +qdisc_tree_decrease_qlen (sch,1 - nb); + }return NET_XMIT_SUCCESS ; }
Signature · 1 line
2.8.2
PATCH 68/76 net: fix infoleak in llc
In reply to Jiri SlabyFrom: Kangjie Lu <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit b8670c09f37bdf2847cc44f36511a53afc6161fd ]
The stack object “info” has a total size of 12 bytes. Its last byte is padding which is not initialized and leaked via “put_cmsg”.
--- net/llc/af_llc.c | 1 + 1 file changed, 1 insertion(+)
net/llc/af_llc.c +1 -0
@@ -626,6 +626,7 @@ static void llc_cmsg_rcv(struct msghdr *msg, struct sk_buff *skb)if (llc->cmsg_flags &LLC_CMSG_PKTINFO ) {struct llc_pktinfo info; +memset (&info,0 ,sizeof (info)); info.lpi_ifindex =llc_sk (skb->sk)->dev->ifindex;llc_pdu_decode_dsap (skb, &info.lpi_sap);llc_pdu_decode_da (skb, info.lpi_mac);
Signature · 1 line
2.8.2
PATCH 69/76 net: fix infoleak in rtnetlink
In reply to Jiri SlabyFrom: Kangjie Lu <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit 5f8e44741f9f216e33736ea4ec65ca9ac03036e6 ]
The stack object “map” has a total size of 32 bytes. Its last 4 bytes are padding generated by compiler. These padding bytes are not initialized and sent out via “nla_put”.
--- net/core/rtnetlink.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
net/core/rtnetlink.c +10 -8
@@ -950,14 +950,16 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, goto nla_put_failure;if (1 ) { -struct rtnl_link_ifmap map = { - .mem_start = dev->mem_start, - .mem_end = dev->mem_end, - .base_addr = dev->base_addr, - .irq = dev->irq, - .dma = dev->dma, - .port = dev->if_port, - }; +struct rtnl_link_ifmap map; + +memset (&map,0 ,sizeof (map)); + map.mem_start = dev->mem_start; + map.mem_end = dev->mem_end; + map.base_addr = dev->base_addr; + map.irq = dev->irq; + map.dma = dev->dma; + map.port = dev->if_port; +if (nla_put (skb,IFLA_MAP ,sizeof (map), &map)) goto nla_put_failure; }
Signature · 1 line
2.8.2
Re: [PATCH 3.12 69/76] net: fix infoleak in rtnetlink
Quoted 49 lines · Jiri Slaby
From: Kangjie Lu <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit
5f8e44741f9f216e33736ea4ec65ca9ac03036e6]The stack object “map” has a total size of 32 bytes. Its last 4 bytes are padding generated by compiler. These padding bytes are not initialized and sent out via “nla_put”.
Signed-off-by Kangjie Lu <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Jiri Slaby <[email protected]>--- net/core/rtnetlink.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)net/core/rtnetlink.c +10
-9@@ -950,14 +950,16 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev, goto nla_put_failure;if (1 ) { -struct rtnl_link_ifmap map = { - .mem_start = dev->mem_start, - .mem_end = dev->mem_end, - .base_addr = dev->base_addr, - .irq = dev->irq, - .dma = dev->dma, - .port = dev->if_port, - }; +struct rtnl_link_ifmap map; + +memset (&map,0 ,sizeof (map)); + map.mem_start = dev->mem_start; + map.mem_end = dev->mem_end; + map.base_addr = dev->base_addr; + map.irq = dev->irq; + map.dma = dev->dma; + map.port = dev->if_port; +if (nla_put (skb,IFLA_MAP ,sizeof (map), &map)) goto nla_put_failure; } --
Quoted 2 lines
2.8.2
Just out of curiosity, was this observed in practice? I could be wrong, but I was under the impression that using designated initializers would zero the rest of the struct, including padding. This seems to back that up:
http://stackoverflow.com/a/3374468/1697183
If this is indeed a real info leak, then I would assume we have much bigger problems around the kernel.
Vegard
A message that is not in the archive (sent off-list or not yet received): CABEk9YxT4eRBrEhkrCNHwM9yuFKRW4bBcrAfjgW0iyS0q3v65A@mail.gmail.com
Re: [PATCH 3.12 69/76] net: fix infoleak in rtnetlink
Quoted 64 lines · Kangjie Lu
Quoted 51 lines · Vegard Nossum
Quoted 49 lines · Jiri Slaby
From: Kangjie Lu <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit
5f8e44741f9f216e33736ea4ec65ca9ac03036e6]The stack object “map” has a total size of 32 bytes. Its last 4 bytes are padding generated by compiler. These padding bytes are not initialized and sent out via “nla_put”.
Signed-off-by Kangjie Lu <[email protected]>Signed-off-by David S. Miller <[email protected]>Signed-off-by Jiri Slaby <[email protected]>--- net/core/rtnetlink.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)net/core/rtnetlink.c +10
-8@@ -950,14 +950,16 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb,struct net_device *dev, goto nla_put_failure;if (1 ) { -struct rtnl_link_ifmap map = { - .mem_start = dev->mem_start, - .mem_end = dev->mem_end, - .base_addr = dev->base_addr, - .irq = dev->irq, - .dma = dev->dma, - .port = dev->if_port, - }; +struct rtnl_link_ifmap map; + +memset (&map,0 ,sizeof (map)); + map.mem_start = dev->mem_start; + map.mem_end = dev->mem_end; + map.base_addr = dev->base_addr; + map.irq = dev->irq; + map.dma = dev->dma; + map.port = dev->if_port; +if (nla_put (skb,IFLA_MAP ,sizeof (map), &map)) goto nla_put_failure;Quoted 8 lines
Quoted 4 lines
}--
2.8.2Just out of curiosity, was this observed in practice? I could be wrong, but I was under the impression that using designated initializers would zero the rest of the struct, including padding.
Quoted 8 lines
Yes or no. According to my experiences, it depends on how
it is initialized:
if there are no variables but all constants in the bracket,
a global initializer will be generated, which will zero the remaining bytes including padding; otherwise, no global initializer
will be used, hence the remaining bytes are not initialized.
In this case, dev is not a constant, so no global initializer will be used to initialize the padding bytes
I did some experiements with gcc and my observations are:
1. it doesn't depend on whether the initializer is constant or variable, but...
2. whether or not padding gets initialized depends on *which fields* you're initializing (I assume this has to do with what instructions it ends up using, as it might be faster to do a 32-bit mov on x86 instead of an 8-bit one if you're initializing an 8-bit field which is followed by 24 bits of padding, for example).
Quoted 9 lines
Quoted 6 lines
This seems to back that up:
http://stackoverflow.com/a/3374468/1697183
If this is indeed a real info leak, then I would assume we have much bigger problems around the kernel.
Could be. We've found many such bugs.
That is pretty sad. Anyway, thanks for fixing them.
Vegard
David Miller
maintainerRe: [PATCH 3.12 69/76] net: fix infoleak in rtnetlink
In reply to Vegard NossumFrom: Vegard Nossum <[email protected]>
Date: Fri, 20 May 2016 14:04:54 +0200
Quoted 3 lines
Just out of curiosity, was this observed in practice? I could be wrong, but I was under the impression that using designated initializers would zero the rest of the struct, including padding.
I compiled testcases and found that the compiler does not zero out padding when using designated initializers.
You can do the same.
For example, on sparc 32-bit, this code:
struct foo {
int a;
short b;
int c;
};extern void foo(struct foo *);
void bar(void)
{
struct foo f = { .a = 1, .b = 2, .c = 3 };
foo(&f);
}gives:
mov 1, %g1 st %g1, [%fp-12] mov 2, %g1 sth %g1, [%fp-8] mov 3, %g1 st %g1, [%fp-4]
It does not initialize the padding between 'b' and 'c'.
Re: [PATCH 3.12 69/76] net: fix infoleak in rtnetlink
Quoted 31 lines · David Miller
From: Vegard Nossum <[email protected]>
Date: Fri, 20 May 2016 14:04:54 +0200Quoted 3 lines
Just out of curiosity, was this observed in practice? I could be wrong, but I was under the impression that using designated initializers would zero the rest of the struct, including padding.
I compiled testcases and found that the compiler does not zero out padding when using designated initializers.
You can do the same.
For example, on sparc 32-bit, this code:
struct foo { int a; short b; int c; };extern void
foo(struct foo *);void bar(void)
{ struct foo f = { .a = 1, .b = 2, .c = 3 }; foo(&f); }gives:
Quoted 8 lines
mov 1, %g1 st %g1, [%fp-12] mov 2, %g1 sth %g1, [%fp-8] mov 3, %g1 st %g1, [%fp-4]It does not initialize the padding between 'b' and 'c'.
Interesting side note here is question 1 of the survey "What is C in practice?", here:
<https://www.cl.cam.ac.uk/~pes20/cerberus/notes50-survey-discussion.html>
It seems safe right now from my understanding but we need to be careful with future compiler optimizations, e.g. for memset, as Joseph Myers commented on the question for future possible optimizations.
This report is also going to be presented in the C2X standard meetings, hopefully they come up with something sensible for that.
Bye,
Hannes
PATCH 70/76 VSOCK: do not disconnect socket when peer has shutdown SEND only
In reply to Jiri SlabyFrom: Ian Campbell <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit dedc58e067d8c379a15a8a183c5db318201295bb ]
The peer may be expecting a reply having sent a request and then done a shutdown(SHUT_WR), so tearing down the whole socket at this point seems wrong and breaks for me with a client which does a SHUT_WR.
Looking at other socket family's stream_recvmsg callbacks doing a shutdown here does not seem to be the norm and removing it does not seem to have had any adverse effects that I can see.
I'm using Stefan's RFC virtio transport patches, I'm unsure of the impact on the vmci transport.
--- net/vmw_vsock/af_vsock.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-)
net/vmw_vsock/af_vsock.c +1 -20
@@ -1796,27 +1796,8 @@ vsock_stream_recvmsg(struct kiocb *kiocb,else if (sk->sk_shutdown &RCV_SHUTDOWN ) err =0 ; -if (copied >0 ) { -/* We only do these additional bookkeeping/notification steps -* if we actually copied something out of the queue pair -* instead of just peeking ahead. -*/ - -if (!(flags &MSG_PEEK )) { -/* If the other side has shutdown for sending and there -* is nothing more to read, then modify the socket -* state. -*/ -if (vsk->peer_shutdown &SEND_SHUTDOWN ) { -if (vsock_stream_has_data (vsk) <=0 ) { - sk->sk_state =SS_UNCONNECTED ; -sock_set_flag (sk,SOCK_DONE ); - sk->sk_state_change (sk); - } - } - } +if (copied >0 ) err = copied; - } out_wait:finish_wait (sk_sleep (sk), &wait);
Signature · 1 line
2.8.2
PATCH 71/76 net: bridge: fix old ioctl unlocked net device walk
In reply to Jiri SlabyFrom: Nikolay Aleksandrov <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit 31ca0458a61a502adb7ed192bf9716c6d05791a5 ]
get_bridge_ifindices() is used from the old "deviceless" bridge ioctl calls which aren't called with rtnl held. The comment above says that it is called with rtnl but that is not really the case.
Here's a sample output from a test ASSERT_RTNL() which I put in get_bridge_ifindices and executed "brctl show":
[ 957.422726] RTNL: assertion failed at net/bridge//br_ioctl.c (30) [ 957.422925] CPU: 0 PID: 1862 Comm: brctl Tainted: G W O 4.6.0-rc4+ #157 [ 957.423009] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.8.1-20150318_183358- 04/01/2014 [ 957.423009] 0000000000000000 ffff880058adfdf0 ffffffff8138dec5 0000000000000400 [ 957.423009] ffffffff81ce8380 ffff880058adfe58 ffffffffa05ead32 0000000000000001 [ 957.423009] 00007ffec1a444b0 0000000000000400 ffff880053c19130 0000000000008940 [ 957.423009] Call Trace: [ 957.423009] [<ffffffff8138dec5>] dump_stack+0x85/0xc0 [ 957.423009] [<ffffffffa05ead32>] br_ioctl_deviceless_stub+0x212/0x2e0 [bridge] [ 957.423009] [<ffffffff81515beb>] sock_ioctl+0x22b/0x290 [ 957.423009] [<ffffffff8126ba75>] do_vfs_ioctl+0x95/0x700 [ 957.423009] [<ffffffff8126c159>] SyS_ioctl+0x79/0x90 [ 957.423009] [<ffffffff8163a4c0>] entry_SYSCALL_64_fastpath+0x23/0xc1
Since it only reads bridge ifindices, we can use rcu to safely walk the net device list. Also remove the wrong rtnl comment above.
--- net/bridge/br_ioctl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/bridge/br_ioctl.c +3 -2
@@ -21,18 +21,19 @@#include <asm/uaccess.h> #include "br_private.h" -/* called with RTNL */ static int get_bridge_ifindices (struct net *net,int *indices,int num) {struct net_device *dev;int i =0 ; -for_each_netdev (net, dev) { +rcu_read_lock (); +for_each_netdev_rcu (net, dev) {if (i >= num)break ;if (dev->priv_flags &IFF_EBRIDGE ) indices[i++] = dev->ifindex; } +rcu_read_unlock ();return i; }
Signature · 1 line
2.8.2
PATCH 72/76 net: fix a kernel infoleak in x25 module
In reply to Jiri SlabyFrom: Kangjie Lu <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
[ Upstream commit 79e48650320e6fba48369fccf13fd045315b19b8 ]
Stack object "dte_facilities" is allocated in x25_rx_call_request(), which is supposed to be initialized in x25_negotiate_facilities. However, 5 fields (8 bytes in total) are not initialized. This object is then copied to userland via copy_to_user, thus infoleak occurs.
--- net/x25/x25_facilities.c | 1 + 1 file changed, 1 insertion(+)
net/x25/x25_facilities.c +1 -0
@@ -275,6 +275,7 @@ int x25_negotiate_facilities(struct sk_buff *skb, struct sock *sk,memset (&theirs,0 ,sizeof (theirs));memcpy (new, ours,sizeof (*new)); +memset (dte,0 ,sizeof (*dte)); len =x25_parse_facilities (skb, &theirs, dte, &x25->vc_facil_mask);if (len <0 )
Signature · 1 line
2.8.2
PATCH 73/76 ASN.1: Fix non-match detection failure on data overrun
In reply to Jiri SlabyFrom: David Howells <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 0d62e9dd6da45bbf0f33a8617afc5fe774c8f45f upstream.
If the ASN.1 decoder is asked to parse a sequence of objects, non-optional matches get skipped if there's no more data to be had rather than a data-overrun error being reported.
This is due to the code segment that decides whether to skip optional matches (ie. matches that could get ignored because an element is marked OPTIONAL in the grammar) due to a lack of data also skips non-optional elements if the data pointer has reached the end of the buffer.
This can be tested with the data decoder for the new RSA akcipher algorithm that takes three non-optional integers. Currently, it skips the last integer if there is insufficient data.
Without the fix, #defining DEBUG in asn1_decoder.c will show something like:
next_op: pc=0/13 dp=0/270 C=0 J=0
- match? 30 30 00
- TAG: 30 266 CONS
next_op: pc=2/13 dp=4/270 C=1 J=0
- match? 02 02 00
- TAG: 02 257
- LEAF: 257
next_op: pc=5/13 dp=265/270 C=1 J=0
- match? 02 02 00
- TAG: 02 3
- LEAF: 3
next_op: pc=8/13 dp=270/270 C=1 J=0
next_op: pc=11/13 dp=270/270 C=1 J=0
- end cons t=4 dp=270 l=270/270
The next_op line for pc=8/13 should be followed by a match line.
This is not exploitable for X.509 certificates by means of shortening the message and fixing up the ASN.1 CONS tags because:
(1) The relevant records being built up are cleared before use.
(2) If the message is shortened sufficiently to remove the public key, the ASN.1 parse of the RSA key will fail quickly due to a lack of data.
(3) Extracted signature data is either turned into MPIs (which cope with a 0 length) or is simpler integers specifying algoritms and suchlike (which can validly be 0); and
(4) The AKID and SKID extensions are optional and their removal is handled without risking passing a NULL to asymmetric_key_generate_id().
(5) If the certificate is truncated sufficiently to remove the subject, issuer or serialNumber then the ASN.1 decoder will fail with a 'Cons stack underflow' return.
This is not exploitable for PKCS#7 messages by means of removal of elements from such a message from the tail end of a sequence:
(1) Any shortened X.509 certs embedded in the PKCS#7 message are survivable as detailed above.
(2) The message digest content isn't used if it shows a NULL pointer, similarly, the authattrs aren't used if that shows a NULL pointer.
(3) A missing signature results in a NULL MPI - which the MPI routines deal with.
(4) If data is NULL, it is expected that the message has detached content and that is handled appropriately.
(5) If the serialNumber is excised, the unconditional action associated with it will pick up the containing SEQUENCE instead, so no NULL pointer will be seen here.
If both the issuer and the serialNumber are excised, the ASN.1 decode will fail with an 'Unexpected tag' return.
In either case, there's no way to get to asymmetric_key_generate_id() with a NULL pointer.
(6) Other fields are decoded to simple integers. Shortening the message to omit an algorithm ID field will cause checks on this to fail early in the verification process.
This can also be tested by snipping objects off of the end of the ASN.1 stream such that mandatory tags are removed - or even from the end of internal SEQUENCEs. If any mandatory tag is missing, the error EBADMSG *should* be produced. Without this patch ERANGE or ENOPKG might be produced or the parse may apparently succeed, perhaps with ENOKEY or EKEYREJECTED being produced later, depending on what gets snipped.
Just snipping off the final BIT_STRING or OCTET_STRING from either sample should be a start since both are mandatory and neither will cause an EBADMSG without the patches
--- lib/asn1_decoder.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
lib/asn1_decoder.c +2 -3
@@ -208,9 +208,8 @@ next_op:unsigned char tmp;/* Skip conditional matches if possible */ -if ((op &ASN1_OP_MATCH__COND && - flags &FLAG_MATCHED ) || - dp == datalen) { +if ((op &ASN1_OP_MATCH__COND && flags &FLAG_MATCHED ) || + (op &ASN1_OP_MATCH__SKIP && dp == datalen)) { pc += asn1_op_lengths[op]; goto next_op; }
Signature · 1 line
2.8.2
PATCH 74/76 KEYS: Fix ASN.1 indefinite length object parsing
In reply to Jiri SlabyFrom: David Howells <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 23c8a812dc3c621009e4f0e5342aa4e2ede1ceaa upstream.
This fixes CVE-2016-0758.
In the ASN.1 decoder, when the length field of an ASN.1 value is extracted, it isn't validated against the remaining amount of data before being added to the cursor. With a sufficiently large size indicated, the check:
datalen - dp < 2
may then fail due to integer overflow.
Fix this by checking the length indicated against the amount of remaining data in both places a definite length is determined.
Whilst we're at it, make the following changes:
(1) Check the maximum size of extended length does not exceed the capacity of the variable it's being stored in (len) rather than the type that variable is assumed to be (size_t).
(2) Compare the EOC tag to the symbolic constant ASN1_EOC rather than the integer 0.
(3) To reduce confusion, move the initialisation of len outside of:
for (len = 0; n > 0; n--) {
since it doesn't have anything to do with the loop counter n.--- lib/asn1_decoder.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
lib/asn1_decoder.c +9 -7
@@ -69,7 +69,7 @@ next_tag:/* Extract a tag from the data */ tag = data[dp++]; -if (tag ==0 ) { +if (tag ==ASN1_EOC ) {/* It appears to be an EOC. */ if (data[dp++] !=0 ) goto invalid_eoc;
@@ -91,10 +91,8 @@ next_tag:/* Extract the length */ len = data[dp++]; -if (len <=0x7f ) { - dp += len; - goto next_tag; - } +if (len <=0x7f ) + goto check_length;if (unlikely (len ==ASN1_INDEFINITE_LENGTH )) {/* Indefinite length */
@@ -105,14 +103,18 @@ next_tag: } n = len -0x80 ; -if (unlikely (n >sizeof (size_t ) -1 )) +if (unlikely (n >sizeof (len) -1 )) goto length_too_long;if (unlikely (n > datalen - dp)) goto data_overrun_error; -for (len =0 ; n >0 ; n--) { + len =0 ; +for (; n >0 ; n--) { len <<=8 ; len |= data[dp++]; } +check_length: +if (len > datalen - dp) + goto data_overrun_error; dp += len; goto next_tag;
Signature · 1 line
2.8.2
PATCH 75/76 sched: Remove lockdep check in sched_move_task()
In reply to Jiri SlabyFrom: Kirill Tkhai <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit f7b8a47da17c9ee4998f2ca2018fcc424e953c0e upstream.
sched_move_task() is the only interface to change sched_task_group:cpu_cgrp_subsys methods and autogroup_move_group() use it.
Everything is synchronized by task_rq_lock(), so cpu_cgroup_attach() is ordered with other users of sched_move_task(). This means we do no need RCU here: if we've dereferenced a tg here, the .attach method hasn't been called for it yet.
Thus, we should pass "true" to task_css_check() to silence lockdep warnings.
--- kernel/sched/core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/sched/core.c +6 -2
@@ -6865,8 +6865,12 @@ void sched_move_task(struct task_struct *tsk)if (unlikely (running)) tsk->sched_class->put_prev_task (rq, tsk); - tg =container_of (task_css_check (tsk, cpu_cgroup_subsys_id, -lockdep_is_held (&tsk->sighand->siglock)), +/* +* All callers are synchronized by task_rq_lock(); we do not use RCU +* which is pointless here. Thus, we pass "true" to task_css_check() +* to prevent lockdep warnings. +*/ + tg =container_of (task_css_check (tsk, cpu_cgroup_subsys_id, true), struct task_group, css); tg =autogroup_task_group (tsk, tg); tsk->sched_task_group = tg;
Signature · 1 line
2.8.2
PATCH 76/76 X.509: remove possible code fragility: enumeration values not handled
In reply to Jiri SlabyFrom: Antonio Alecrim Jr <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit eb8948a03704f3dbbfc7e83090e20e93c6c476d2 upstream.
--- scripts/asn1_compiler.c | 2 ++ 1 file changed, 2 insertions(+)
scripts/asn1_compiler.c +2 -0
@@ -1353,6 +1353,8 @@ static void render_out_of_line_list(FILE *out)render_opcode (out,"ASN1_OP_END_SET_OF%s,\n" , act);render_opcode (out,"_jump_target(%u),\n" , entry);break ; +default : +break ; }if (e->action) render_opcode(out, "_action(ACT_%s),\n",
Signature · 1 line
2.8.2
Quoted 8 lines · Jiri Slaby
This is the start of the stable review cycle for the 3.12.60 release. There are 76 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 Mon May 23 11:07:53 CEST 2016. Anything received after that time might be too late.
Build results:
total: 127 pass: 127 fail: 0 Qemu test results: total: 85 pass: 85 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
Quoted 10 lines · Guenter Roeck
Quoted 8 lines · Jiri Slaby
This is the start of the stable review cycle for the 3.12.60 release. There are 76 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 Mon May 23 11:07:53 CEST 2016. Anything received after that time might be too late.
Quoted 6 lines
Build results:
total: 127 pass: 127 fail: 0 Qemu test results: total: 85 pass: 85 fail: 0Details are available at http://kerneltests.org/builders.
Thanks!
Signature · 2 lines
js suse labs
Quoted 5 lines · Jiri Slaby
This is the start of the stable review cycle for the 3.12.60 release. There are 76 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.
Quoted 7 lines
Responses should be made by Mon May 23 11:07:53 CEST 2016. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
http://kernel.org/pub/linux/kernel/people/jirislaby/stable-review/patch-3.12.60-rc1.xzand the diffstat can be found below.
Sorry I tested this release and forgot to send results. Might be late now. Compiled and booted on my test system and no dmesg regressions.
thanks,
-- Shuah
Quoted 9 lines · Shuah Khan
Quoted 8 lines · Jiri Slaby
This is the start of the stable review cycle for the 3.12.60 release. There are 76 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 Mon May 23 11:07:53 CEST 2016. Anything received after that time might be too late.
Quoted 8 lines
Quoted 4 lines
The whole patch series can be found in one patch at:
http://kernel.org/pub/linux/kernel/people/jirislaby/stable-review/patch-3.12.60-rc1.xzand the diffstat can be found below.
Sorry I tested this release and forgot to send results. Might be late now. Compiled and booted on my test system and no dmesg regressions.
It's never late when the results are positive :). Thanks!
Signature · 2 lines
js suse labs