Skip to contentSkip to conversation

4.4.77-stable review

PATCH In review Greg Kroah-Hartman 8 participants 73 messages Jul 13, 2017 – Jul 18, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Greg Kroah-Hartman

author maintainer
#0 lore raw

cover 4.4.77-stable review

This is the start of the stable review cycle for the 4.4.77 release. There are 57 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 Sat Jul 15 15:39:40 UTC 2017. Anything received after that time might be too late.

The whole patch series can be found in one patch at:

	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.77-rc1.gz

or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <[email protected]>

    Linux 4.4.77-rc1

Maciej S. Szmigiero <[email protected]>
saa7134: fix warm Medion 7134 EEPROM read

Mikulas Patocka <[email protected]>
x86/mm/pat: Don't report PAT on CPUs that don't support it

Chao Yu <[email protected]>
ext4: check return value of kstrtoull correctly in reserved_clusters_store

Ian Abbott <[email protected]>
staging: comedi: fix clean-up of comedi_class in comedi_init()

Malcolm Priestley <[email protected]>
staging: vt6556: vnt_start Fix missing call to vnt_key_init_table.

Neal Cardwell <[email protected]>
tcp: fix tcp_mark_head_lost to check skb len before fragmenting

Jason Yan <[email protected]>
md: fix super_offset endianness in super_1_rdev_size_change

Jason Yan <[email protected]>
md: fix incorrect use of lexx_to_cpu in does_sb_need_changing

Arnaldo Carvalho de Melo <[email protected]>
perf tools: Use readdir() instead of deprecated readdir_r() again

Markus Trippelsdorf <[email protected]>
perf tests: Remove wrong semicolon in while loop in CQM test

Arnaldo Carvalho de Melo <[email protected]>
perf trace: Do not process PERF_RECORD_LOST twice

Arnaldo Carvalho de Melo <[email protected]>
perf dwarf: Guard !x86_64 definitions under #ifdef else clause

Markus Trippelsdorf <[email protected]>
perf pmu: Fix misleadingly indented assignment (whitespace)

Markus Trippelsdorf <[email protected]>
perf annotate browser: Fix behaviour of Shift-Tab with nothing focussed

Eric Engestrom <[email protected]>
perf tools: Remove duplicate const qualifier

Arnaldo Carvalho de Melo <[email protected]>
perf script: Use readdir() instead of deprecated readdir_r()

Arnaldo Carvalho de Melo <[email protected]>
perf thread_map: Use readdir() instead of deprecated readdir_r()

Arnaldo Carvalho de Melo <[email protected]>
perf tools: Use readdir() instead of deprecated readdir_r()

Arnaldo Carvalho de Melo <[email protected]>
perf bench numa: Avoid possible truncation when using snprintf()

Arnaldo Carvalho de Melo <[email protected]>

    perf tests: Avoid possible truncation with dirent->d_name + snprintf

Wang YanQing <[email protected]>
perf scripting perl: Fix compile error with some perl5 versions

Arnaldo Carvalho de Melo <[email protected]>

    perf thread_map: Correctly size buffer used with dirent->dt_name

Arnaldo Carvalho de Melo <[email protected]>
perf intel-pt: Use __fallthrough

Arnaldo Carvalho de Melo <[email protected]>
perf top: Use __fallthrough

Arnaldo Carvalho de Melo <[email protected]>
tools strfilter: Use __fallthrough

Arnaldo Carvalho de Melo <[email protected]>
tools string: Use __fallthrough in perf_atoll()

Arnaldo Carvalho de Melo <[email protected]>
tools include: Add a __fallthrough statement

Cong Wang <[email protected]>
mqueue: fix a use-after-free in sys_mq_notify()

Boris Pismenny <[email protected]>
RDMA/uverbs: Check port number supplied by user verbs cmds

Dan Carpenter <[email protected]>
KEYS: Fix an error code in request_master_key()

Bartosz Markowski <[email protected]>
ath10k: override CE5 config for QCA9377

Paolo Abeni <[email protected]>
x86/uaccess: Optimize copy_user_enhanced_fast_string() for short strings

Markus Trippelsdorf <[email protected]>
x86/tools: Fix gcc-7 warning in relocs.c

Andreas Gruenbacher <[email protected]>
gfs2: Fix glock rhashtable rcu bug

Bjørn Mork <[email protected]>
USB: serial: qcserial: new Sierra Wireless EM7305 device ID

Johan Hovold <[email protected]>
USB: serial: option: add two Longcheer device ids

Geert Uytterhoeven <[email protected]>
pinctrl: sh-pfc: Update info pointer after SoC-specific init

Uwe Kleine-König <[email protected]>
pinctrl: mxs: atomically switch mux and drive strength config

Chen-Yu Tsai <[email protected]>
pinctrl: sunxi: Fix SPDIF function name for A83T

Martin Blumenstingl <[email protected]>
pinctrl: meson: meson8b: fix the NAND DQS pins

Sergei Shtylyov <[email protected]>
pinctrl: sh-pfc: r8a7791: Add missing DVC_MUTE signal

Sergei Shtylyov <[email protected]>
pinctrl: sh-pfc: r8a7791: Fix SCIF2 pinmux data

Liping Zhang <[email protected]>
sysctl: report EINVAL if value is larger than UINT_MAX for proc_douintvec

Liping Zhang <[email protected]>
sysctl: don't print negative flag for proc_douintvec

Thomas Gleixner <[email protected]>
mac80211_hwsim: Replace bogus hrtimer clockid

Benjamin Herrenschmidt <[email protected]>
usb: Fix typo in the definition of Endpoint[out]Request

Michael Grzeschik <[email protected]>
usb: usbip: set buffer pointers to NULL after free

Devin Heitmueller <[email protected]>
Add USB quirk for HVR-950q to avoid intermittent device resets

Jeremie Rapin <[email protected]>

    USB: serial: cp210x: add ID for CEL EM3588 USB ZigBee stick

Felipe Balbi <[email protected]>
usb: dwc3: replace %p with %pK

Gerd Hoffmann <[email protected]>
drm/virtio: don't leak bo on drm_gem_object_init failure

Sabrina Dubroca <[email protected]>
tracing/kprobes: Allow to create probe with a module name starting with a digit

Vlastimil Babka <[email protected]>
mm: fix classzone_idx underflow in shrink_zones()

Rafał Miłecki <[email protected]>
bgmac: reset & enable Ethernet core before using it

Adrian Salido <[email protected]>
driver core: platform: fix race condition with driver_override

Christoph Hellwig <[email protected]>
fs: completely ignore unknown open flags

Christoph Hellwig <[email protected]>
fs: add a VALID_OPEN_FLAGS

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

Diffstat:

 Makefile                                           |  4 +-
 arch/x86/include/asm/pat.h                         |  1 +
 arch/x86/kernel/setup.c                            |  7 +++
 arch/x86/lib/copy_user_64.S                        |  7 ++-
 arch/x86/mm/pat.c                                  | 28 ++++-----
 arch/x86/tools/relocs.c                            |  3 +-
 drivers/base/platform.c                            | 11 +++-
 drivers/gpu/drm/virtio/virtgpu_object.c            |  4 +-
 drivers/infiniband/core/uverbs_cmd.c               |  8 +++
 drivers/md/md.c                                    |  4 +-
 drivers/media/pci/saa7134/saa7134-i2c.c            | 31 ++++++++++
 drivers/net/ethernet/broadcom/bgmac.c              |  5 ++
 drivers/net/wireless/ath/ath10k/pci.c              |  2 +-
 drivers/net/wireless/mac80211_hwsim.c              |  2 +-
 drivers/pinctrl/freescale/pinctrl-mxs.c            | 16 +++--
 drivers/pinctrl/meson/pinctrl-meson8b.c            |  4 +-
 drivers/pinctrl/sh-pfc/core.c                      |  3 +
 drivers/pinctrl/sh-pfc/pfc-r8a7791.c               |  9 +--
 drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c         |  2 +-
 drivers/staging/comedi/comedi_fops.c               |  1 +
 drivers/staging/vt6656/main_usb.c                  |  3 +
 drivers/usb/core/quirks.c                          |  4 ++
 drivers/usb/dwc3/dwc3-st.c                         |  2 +-
 drivers/usb/dwc3/gadget.c                          |  6 +-
 drivers/usb/serial/cp210x.c                        |  1 +
 drivers/usb/serial/option.c                        |  4 ++
 drivers/usb/serial/qcserial.c                      |  1 +
 drivers/usb/usbip/stub_main.c                      |  4 ++
 drivers/usb/usbip/stub_tx.c                        |  4 ++
 fs/ext4/sysfs.c                                    |  2 +-
 fs/fcntl.c                                         | 14 ++---
 fs/gfs2/glock.c                                    | 11 +++-
 fs/gfs2/incore.h                                   |  1 +
 fs/open.c                                          |  6 ++
 include/linux/fcntl.h                              |  6 ++
 include/linux/usb/hcd.h                            |  4 +-
 ipc/mqueue.c                                       |  4 +-
 kernel/sysctl.c                                    |  3 +
 kernel/trace/trace_kprobe.c                        | 21 +++----
 mm/vmscan.c                                        |  2 +-
 net/ipv4/tcp_input.c                               | 10 ++--
 security/keys/encrypted-keys/encrypted.c           |  2 +-
 tools/include/linux/compiler.h                     |  9 +++
 tools/perf/arch/x86/tests/intel-cqm.c              |  2 +-
 tools/perf/arch/x86/util/dwarf-regs.c              |  8 +--
 tools/perf/bench/numa.c                            |  6 +-
 tools/perf/builtin-script.c                        | 70 +++++++++++-----------
 tools/perf/builtin-top.c                           |  2 +-
 tools/perf/builtin-trace.c                         |  1 +
 tools/perf/tests/parse-events.c                    |  8 +--
 tools/perf/ui/browsers/annotate.c                  |  4 +-
 tools/perf/util/event.c                            | 12 ++--
 .../perf/util/intel-pt-decoder/intel-pt-decoder.c  |  5 ++
 .../util/intel-pt-decoder/intel-pt-pkt-decoder.c   |  2 +
 tools/perf/util/parse-events.c                     | 60 +++++++++----------
 tools/perf/util/pmu.c                              |  2 +-
 tools/perf/util/scripting-engines/Build            |  2 +-
 tools/perf/util/strfilter.c                        |  1 +
 tools/perf/util/string.c                           |  2 +
 tools/perf/util/thread.c                           |  2 +-
 tools/perf/util/thread_map.c                       | 10 ++--
 61 files changed, 300 insertions(+), 175 deletions(-)
author maintainer
#1 lore raw

PATCH 1/57 fs: add a VALID_OPEN_FLAGS

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

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

From: Christoph Hellwig <[email protected]>

commit 80f18379a7c350c011d30332658aa15fe49a8fa5 upstream.

Add a central define for all valid open flags, and use it in the uniqueness check.

---
 fs/fcntl.c            |   14 ++++----------
 include/linux/fcntl.h |    6 ++++++
 2 files changed, 10 insertions(+), 10 deletions(-)
fs/fcntl.c +4 -10
@@ -740,16 +740,10 @@ static int __init fcntl_init(void)
 	 * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY
 	 * is defined as O_NONBLOCK on some platforms and not on others.
 	 */
-	BUILD_BUG_ON(21 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32(
-		O_RDONLY	| O_WRONLY	| O_RDWR	|
-		O_CREAT		| O_EXCL	| O_NOCTTY	|
-		O_TRUNC		| O_APPEND	| /* O_NONBLOCK	| */
-		__O_SYNC	| O_DSYNC	| FASYNC	|
-		O_DIRECT	| O_LARGEFILE	| O_DIRECTORY	|
-		O_NOFOLLOW	| O_NOATIME	| O_CLOEXEC	|
-		__FMODE_EXEC	| O_PATH	| __O_TMPFILE	|
-		__FMODE_NONOTIFY
-		));
+	BUILD_BUG_ON(21 - 1 /* for O_RDONLY being 0 */ !=
+		HWEIGHT32(
+			(VALID_OPEN_FLAGS & ~(O_NONBLOCK | O_NDELAY)) |
+			__FMODE_EXEC | __FMODE_NONOTIFY));
 
 	fasync_cache = kmem_cache_create("fasync_cache",
 		sizeof(struct fasync_struct), 0, SLAB_PANIC, NULL);
include/linux/fcntl.h +6 -0
@@ -3,6 +3,12 @@
 
 #include <uapi/linux/fcntl.h>
 
+/* list of all valid flags for the open/openat flags argument: */
+#define VALID_OPEN_FLAGS \
+	(O_RDONLY | O_WRONLY | O_RDWR | O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC | \
+	 O_APPEND | O_NDELAY | O_NONBLOCK | O_NDELAY | __O_SYNC | O_DSYNC | \
+	 FASYNC	| O_DIRECT | O_LARGEFILE | O_DIRECTORY | O_NOFOLLOW | \
+	 O_NOATIME | O_CLOEXEC | O_PATH | __O_TMPFILE)
 
 #ifndef force_o_largefile
 #define force_o_largefile() (BITS_PER_LONG != 32)
author maintainer
#2 lore raw

PATCH 2/57 fs: completely ignore unknown open flags

In reply to Greg Kroah-Hartman

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

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

From: Christoph Hellwig <[email protected]>

commit 629e014bb8349fcf7c1e4df19a842652ece1c945 upstream.

Currently we just stash anything we got into file->f_flags, and the report it in fcntl(F_GETFD). This patch just clears out all unknown flags so that we don't pass them to the fs or report them.

---
 fs/open.c |    6 ++++++
 1 file changed, 6 insertions(+)
fs/open.c +6 -0
@@ -885,6 +885,12 @@ static inline int build_open_flags(int f
 	int lookup_flags = 0;
 	int acc_mode;
 
+	/*
+	 * Clear out all open flags we don't know about so that we don't report
+	 * them in fcntl(F_GETFD) or similar interfaces.
+	 */
+	flags &= VALID_OPEN_FLAGS;
+
 	if (flags & (O_CREAT | __O_TMPFILE))
 		op->mode = (mode & S_IALLUGO) | S_IFREG;
 	else
author maintainer
#3 lore raw

PATCH 3/57 driver core: platform: fix race condition with driver_override

In reply to Greg Kroah-Hartman

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

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

From: Adrian Salido <[email protected]>

commit 6265539776a0810b7ce6398c27866ddb9c6bd154 upstream.

The driver_override implementation is susceptible to race condition when different threads are reading vs storing a different driver override. Add locking to avoid race condition.

Fixes 3d713e0e382e ("driver core: platform: add device binding path 'driver_override'")
---
 drivers/base/platform.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/base/platform.c +9 -2
@@ -807,7 +807,7 @@ static ssize_t driver_override_store(str
 				     const char *buf, size_t count)
 {
 	struct platform_device *pdev = to_platform_device(dev);
-	char *driver_override, *old = pdev->driver_override, *cp;
+	char *driver_override, *old, *cp;
 
 	if (count > PATH_MAX)
 		return -EINVAL;
@@ -820,12 +820,15 @@ static ssize_t driver_override_store(str
 	if (cp)
 		*cp = '\0';
 
+	device_lock(dev);
+	old = pdev->driver_override;
 	if (strlen(driver_override)) {
 		pdev->driver_override = driver_override;
 	} else {
 		kfree(driver_override);
 		pdev->driver_override = NULL;
 	}
+	device_unlock(dev);
 
 	kfree(old);
 
@@ -836,8 +839,12 @@ static ssize_t driver_override_show(stru
 				    struct device_attribute *attr, char *buf)
 {
 	struct platform_device *pdev = to_platform_device(dev);
+	ssize_t len;
 
-	return sprintf(buf, "%s\n", pdev->driver_override);
+	device_lock(dev);
+	len = sprintf(buf, "%s\n", pdev->driver_override);
+	device_unlock(dev);
+	return len;
 }
 static DEVICE_ATTR_RW(driver_override);
 
author maintainer
#4 lore raw

PATCH 5/57 mm: fix classzone_idx underflow in shrink_zones()

In reply to Greg Kroah-Hartman

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

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

From: Vlastimil Babka <[email protected]>

[Not upstream as that would take 34+ patches]

We've got reported a BUG in do_try_to_free_pages():

BUG: unable to handle kernel paging request at ffff8ffffff28990
IP: [<ffffffff8119abe0>] do_try_to_free_pages+0x140/0x490
PGD 0
Oops: 0000 [#1] SMP
megaraid_sas sg scsi_mod efivarfs autofs4
Supported: No, Unsupported modules are loaded
Workqueue: kacpi_hotplug acpi_hotplug_work_fn
task: ffff88ffd0d4c540 ti: ffff88ffd0e48000 task.ti: ffff88ffd0e48000
RIP: 0010:[<ffffffff8119abe0>]  [<ffffffff8119abe0>] do_try_to_free_pages+0x140/0x490
RSP: 0018:ffff88ffd0e4ba60  EFLAGS: 00010206
RAX: 000006fffffff900 RBX: 00000000ffffffff RCX: ffff88fffff29000
RDX: 000000ffffffff00 RSI: 0000000000000003 RDI: 00000000024200c8
RBP: 0000000001320122 R08: 0000000000000000 R09: ffff88ffd0e4bbac
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88ffd0e4bae0
R13: 0000000000000e00 R14: ffff88fffff2a500 R15: ffff88fffff2b300
FS:  0000000000000000(0000) GS:ffff88ffe6440000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffff8ffffff28990 CR3: 0000000001c0a000 CR4: 00000000003406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Stack:
 00000002db570a80 024200c80000001e ffff88fffff2b300 0000000000000000
 ffff88fffffd5700 ffff88ffd0d4c540 ffff88ffd0d4c540 ffffffff0000000c
 0000000000000000 0000000000000040 00000000024200c8 ffff88ffd0e4bae0
Call Trace:
 [<ffffffff8119afea>] try_to_free_pages+0xba/0x170
 [<ffffffff8118cf2f>] __alloc_pages_nodemask+0x53f/0xb20
 [<ffffffff811d39ff>] alloc_pages_current+0x7f/0x100
 [<ffffffff811e2232>] migrate_pages+0x202/0x710
 [<ffffffff815dadaa>] __offline_pages.constprop.23+0x4ba/0x790
 [<ffffffff81463263>] memory_subsys_offline+0x43/0x70
 [<ffffffff8144cbed>] device_offline+0x7d/0xa0
 [<ffffffff81392fa2>] acpi_bus_offline+0xa5/0xef
 [<ffffffff81394a77>] acpi_device_hotplug+0x21b/0x41f
 [<ffffffff8138dab7>] acpi_hotplug_work_fn+0x1a/0x23
 [<ffffffff81093cee>] process_one_work+0x14e/0x410
 [<ffffffff81094546>] worker_thread+0x116/0x490
 [<ffffffff810999ed>] kthread+0xbd/0xe0
 [<ffffffff815e4e7f>] ret_from_fork+0x3f/0x70

This translates to the loop in shrink_zone():

classzone_idx = requested_highidx;
while (!populated_zone(zone->zone_pgdat->node_zones +

					classzone_idx))
	classzone_idx--;

where no zone is populated, so classzone_idx becomes -1 (in RBX).

Added debugging output reveals that we enter the function with sc->gfp_mask == GFP_NOFS|__GFP_NOFAIL|__GFP_HARDWALL|__GFP_MOVABLE requested_highidx = gfp_zone(sc->gfp_mask) == 2 (ZONE_NORMAL)

Inside the for loop, however:
gfp_zone(sc->gfp_mask) == 3 (ZONE_MOVABLE)

This means we have gone through this branch:

if (buffer_heads_over_limit)

    sc->gfp_mask |= __GFP_HIGHMEM;

This changes the gfp_zone() result, but requested_highidx remains unchanged. On nodes where the only populated zone is movable, the inner while loop will check only lower zones, which are not populated, and underflow classzone_idx.

To sum up, the bug occurs in configurations with ZONE_MOVABLE (such as when booted with the movable_node parameter) and only in situations when buffer_heads_over_limit is true, and there's an allocation with __GFP_MOVABLE and without __GFP_HIGHMEM performing direct reclaim.

This patch makes sure that classzone_idx starts with the correct zone.

Mainline has been affected in versions 4.6 and 4.7, but the culprit commit has been also included in stable trees.
In mainline, this has been fixed accidentally as part of 34-patch series (plus follow-up fixes) "Move LRU page reclaim from zones to nodes", which makes the mainline commit unsuitable for stable backport, unfortunately.

Fixes 7bf52fb891b6 ("mm: vmscan: reclaim highmem zone if buffer_heads is over limit")
Obsoleted-by b2e18757f2c9 ("mm, vmscan: begin reclaiming pages on a per-node basis")
Cc Minchan Kim <[email protected]>
Cc Johannes Weiner <[email protected]>
---
 mm/vmscan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/vmscan.c +1 -1
@@ -2529,7 +2529,7 @@ static bool shrink_zones(struct zonelist
 		if (!populated_zone(zone))
 			continue;
 
-		classzone_idx = requested_highidx;
+		classzone_idx = gfp_zone(sc->gfp_mask);
 		while (!populated_zone(zone->zone_pgdat->node_zones +
 							classzone_idx))
 			classzone_idx--;
author maintainer
#5 lore raw

PATCH 6/57 tracing/kprobes: Allow to create probe with a module name starting with a digit

In reply to Greg Kroah-Hartman

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

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

From: Sabrina Dubroca <[email protected]>

commit 9e52b32567126fe146f198971364f68d3bc5233f upstream.

Always try to parse an address, since kstrtoul() will safely fail when given a symbol as input. If that fails (which will be the case for a symbol), try to parse a symbol instead.

This allows creating a probe such as:

    p:probe/vlan_gro_receive 8021q:vlan_gro_receive+0

Which is necessary for this command to work:

perf probe -m 8021q -a vlan_gro_receive

Fixes 413d37d1e ("tracing: Add kprobe-based event tracer")
---
 kernel/trace/trace_kprobe.c |   21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)
kernel/trace/trace_kprobe.c +8 -13
@@ -659,30 +659,25 @@ static int create_trace_kprobe(int argc,
 		pr_info("Probe point is not specified.\n");
 		return -EINVAL;
 	}
-	if (isdigit(argv[1][0])) {
-		if (is_return) {
-			pr_info("Return probe point must be a symbol.\n");
-			return -EINVAL;
-		}
-		/* an address specified */
-		ret = kstrtoul(&argv[1][0], 0, (unsigned long *)&addr);
-		if (ret) {
-			pr_info("Failed to parse address.\n");
-			return ret;
-		}
-	} else {
+
+	/* try to parse an address. if that fails, try to read the
+	 * input as a symbol. */
+	if (kstrtoul(argv[1], 0, (unsigned long *)&addr)) {
 		/* a symbol specified */
 		symbol = argv[1];
 		/* TODO: support .init module functions */
 		ret = traceprobe_split_symbol_offset(symbol, &offset);
 		if (ret) {
-			pr_info("Failed to parse symbol.\n");
+			pr_info("Failed to parse either an address or a symbol.\n");
 			return ret;
 		}
 		if (offset && is_return) {
 			pr_info("Return probe must be used without offset.\n");
 			return -EINVAL;
 		}
+	} else if (is_return) {
+		pr_info("Return probe point must be a symbol.\n");
+		return -EINVAL;
 	}
 	argc -= 2; argv += 2;
 
author maintainer
#6 lore raw

PATCH 8/57 usb: dwc3: replace %p with %pK

In reply to Greg Kroah-Hartman

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

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

From: Felipe Balbi <[email protected]>

commit 04fb365c453e14ff9e8a28f1c46050d920a27a4a upstream.

%p will leak kernel pointers, so let's not expose the information on dmesg and instead use %pK. %pK will only show the actual addresses if explicitly enabled under /proc/sys/kernel/kptr_restrict.

---
 drivers/usb/dwc3/dwc3-st.c |    2 +-
 drivers/usb/dwc3/gadget.c  |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/usb/dwc3/dwc3-st.c +1 -1
@@ -224,7 +224,7 @@ static int st_dwc3_probe(struct platform
 
 	dwc3_data->syscfg_reg_off = res->start;
 
-	dev_vdbg(&pdev->dev, "glue-logic addr 0x%p, syscfg-reg offset 0x%x\n",
+	dev_vdbg(&pdev->dev, "glue-logic addr 0x%pK, syscfg-reg offset 0x%x\n",
 		 dwc3_data->glue_base, dwc3_data->syscfg_reg_off);
 
 	dwc3_data->rstc_pwrdn = devm_reset_control_get(dev, "powerdown");
drivers/usb/dwc3/gadget.c +3 -3
@@ -1219,7 +1219,7 @@ static int dwc3_gadget_ep_queue(struct u
 		goto out;
 	}
 
-	if (WARN(req->dep != dep, "request %p belongs to '%s'\n",
+	if (WARN(req->dep != dep, "request %pK belongs to '%s'\n",
 				request, req->dep->name)) {
 		ret = -EINVAL;
 		goto out;
@@ -1264,7 +1264,7 @@ static int dwc3_gadget_ep_dequeue(struct
 			dwc3_stop_active_transfer(dwc, dep->number, true);
 			goto out1;
 		}
-		dev_err(dwc->dev, "request %p was not queued to %s\n",
+		dev_err(dwc->dev, "request %pK was not queued to %s\n",
 				request, ep->name);
 		ret = -EINVAL;
 		goto out0;
@@ -1866,7 +1866,7 @@ static int __dwc3_cleanup_done_trbs(stru
 		 * would help. Lets hope that if this occurs, someone
 		 * fixes the root cause instead of looking away :)
 		 */
-		dev_err(dwc->dev, "%s's TRB (%p) still owned by HW\n",
+		dev_err(dwc->dev, "%s's TRB (%pK) still owned by HW\n",
 				dep->name, trb);
 	count = trb->size & DWC3_TRB_SIZE_MASK;
 
author maintainer
#7 lore raw

PATCH 9/57 USB: serial: cp210x: add ID for CEL EM3588 USB ZigBee stick

In reply to Greg Kroah-Hartman

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

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

From: Jeremie Rapin <[email protected]>

commit fd90f73a9925f248d696bde1cfc836d9fda5570d upstream.

Added the USB serial device ID for the CEL ZigBee EM3588 radio stick.

---
 drivers/usb/serial/cp210x.c |    1 +
 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -134,6 +134,7 @@ static const struct usb_device_id id_tab
 	{ USB_DEVICE(0x10C4, 0x8977) },	/* CEL MeshWorks DevKit Device */
 	{ USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */
 	{ USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */
+	{ USB_DEVICE(0x10C4, 0x8A5E) }, /* CEL EM3588 ZigBee USB Stick Long Range */
 	{ USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
 	{ USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
 	{ USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */
author maintainer
#8 lore raw

PATCH 10/57 Add USB quirk for HVR-950q to avoid intermittent device resets

In reply to Greg Kroah-Hartman

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

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

From: Devin Heitmueller <[email protected]>

commit 6836796de4019944f4ba4c99a360e8250fd2e735 upstream.

The USB core and sysfs will attempt to enumerate certain parameters which are unsupported by the au0828 - causing inconsistent behavior and sometimes causing the chip to reset. Avoid making these calls.

This problem manifested as intermittent cases where the au8522 would be reset on analog video startup, in particular when starting up ALSA audio streaming in parallel - the sysfs entries created by snd-usb-audio on streaming startup would result in unsupported control messages being sent during tuning which would put the chip into an unknown state.

---
 drivers/usb/core/quirks.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/usb/core/quirks.c +4 -0
@@ -223,6 +223,10 @@ static const struct usb_device_id usb_qu
 	/* Blackmagic Design UltraStudio SDI */
 	{ USB_DEVICE(0x1edb, 0xbd4f), .driver_info = USB_QUIRK_NO_LPM },
 
+	/* Hauppauge HVR-950q */
+	{ USB_DEVICE(0x2040, 0x7200), .driver_info =
+			USB_QUIRK_CONFIG_INTF_STRINGS },
+
 	/* INTEL VALUE SSD */
 	{ USB_DEVICE(0x8086, 0xf1a5), .driver_info = USB_QUIRK_RESET_RESUME },
 
author maintainer
#9 lore raw

PATCH 11/57 usb: usbip: set buffer pointers to NULL after free

In reply to Greg Kroah-Hartman

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

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

From: Michael Grzeschik <[email protected]>

commit b3b51417d0af63fb9a06662dc292200aed9ea53f upstream.

The usbip stack dynamically allocates the transfer_buffer and setup_packet of each urb that got generated by the tcp to usb stub code. As these pointers are always used only once we will set them to NULL after use. This is done likewise to the free_urb code in vudc_dev.c. This patch fixes double kfree situations where the usbip remote side added the URB_FREE_BUFFER.

---
 drivers/usb/usbip/stub_main.c |    4 ++++
 drivers/usb/usbip/stub_tx.c   |    4 ++++
 2 files changed, 8 insertions(+)
drivers/usb/usbip/stub_main.c +4 -0
@@ -262,7 +262,11 @@ void stub_device_cleanup_urbs(struct stu
 		kmem_cache_free(stub_priv_cache, priv);
 
 		kfree(urb->transfer_buffer);
+		urb->transfer_buffer = NULL;
+
 		kfree(urb->setup_packet);
+		urb->setup_packet = NULL;
+
 		usb_free_urb(urb);
 	}
 }
drivers/usb/usbip/stub_tx.c +4 -0
@@ -28,7 +28,11 @@ static void stub_free_priv_and_urb(struc
 	struct urb *urb = priv->urb;
 
 	kfree(urb->setup_packet);
+	urb->setup_packet = NULL;
+
 	kfree(urb->transfer_buffer);
+	urb->transfer_buffer = NULL;
+
 	list_del(&priv->list);
 	kmem_cache_free(stub_priv_cache, priv);
 	usb_free_urb(urb);
author maintainer
#10 lore raw

PATCH 12/57 usb: Fix typo in the definition of Endpoint[out]Request

In reply to Greg Kroah-Hartman

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

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

From: Benjamin Herrenschmidt <[email protected]>

commit 7cf916bd639bd26db7214f2205bccdb4b9306256 upstream.

The current definition is wrong. This breaks my upcoming Aspeed virtual hub driver.

---
 include/linux/usb/hcd.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/usb/hcd.h +2 -2
@@ -560,9 +560,9 @@ extern void usb_ep0_reinit(struct usb_de
 	((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
 
 #define EndpointRequest \
-	((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
+	((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_ENDPOINT)<<8)
 #define EndpointOutRequest \
-	((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_INTERFACE)<<8)
+	((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_ENDPOINT)<<8)
 
 /* class requests from the USB 2.0 hub spec, table 11-15 */
 /* GetBusState and SetHubDescriptor are optional, omitted */
author maintainer
#11 lore raw

PATCH 13/57 mac80211_hwsim: Replace bogus hrtimer clockid

In reply to Greg Kroah-Hartman

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

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

From: Thomas Gleixner <[email protected]>

commit 8fbcfeb8a9cc803464d6c166e7991913711c612c upstream.

mac80211_hwsim initializes a hrtimer with clockid CLOCK_MONOTONIC_RAW. That's not supported.

Use CLOCK_MONOTONIC instead.

---
 drivers/net/wireless/mac80211_hwsim.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mac80211_hwsim.c +1 -1
@@ -2539,7 +2539,7 @@ static int mac80211_hwsim_new_radio(stru
 
 	tasklet_hrtimer_init(&data->beacon_timer,
 			     mac80211_hwsim_beacon,
-			     CLOCK_MONOTONIC_RAW, HRTIMER_MODE_ABS);
+			     CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
 
 	spin_lock_bh(&hwsim_radio_lock);
 	list_add_tail(&data->list, &hwsim_radios);
author maintainer
#12 lore raw

PATCH 14/57 sysctl: dont print negative flag for proc_douintvec

In reply to Greg Kroah-Hartman

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

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

From: Liping Zhang <[email protected]>

commit 5380e5644afbba9e3d229c36771134976f05c91e upstream.

I saw some very confusing sysctl output on my system:

  # cat /proc/sys/net/core/xfrm_aevent_rseqth
  -2
  # cat /proc/sys/net/core/xfrm_aevent_etime
  -10
  # cat /proc/sys/net/ipv4/tcp_notsent_lowat
  -4294967295

Because we forget to set the *negp flag in proc_douintvec, so it will become a garbage value.

Since the value related to proc_douintvec is always an unsigned integer, so we can set *negp to false explictily to fix this issue.

Fixes e7d316a02f68 ("sysctl: handle error writing UINT_MAX to u32 fields")
Cc Subash Abhinov Kasiviswanathan <[email protected]>
Cc Andrew Morton <[email protected]>
---
 kernel/sysctl.c |    1 +
 1 file changed, 1 insertion(+)
kernel/sysctl.c +1 -0
@@ -2070,6 +2070,7 @@ static int do_proc_douintvec_conv(bool *
 		*valp = *lvalp;
 	} else {
 		unsigned int val = *valp;
+		*negp = false;
 		*lvalp = (unsigned long)val;
 	}
 	return 0;
author maintainer
#13 lore raw

PATCH 15/57 sysctl: report EINVAL if value is larger than UINT_MAX for proc_douintvec

In reply to Greg Kroah-Hartman

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

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

From: Liping Zhang <[email protected]>

commit 425fffd886bae3d127a08fa6a17f2e31e24ed7ff upstream.

Currently, inputting the following command will succeed but actually the value will be truncated:

  # echo 0x12ffffffff > /proc/sys/net/ipv4/tcp_notsent_lowat

This is not friendly to the user, so instead, we should report error when the value is larger than UINT_MAX.

Fixes e7d316a02f68 ("sysctl: handle error writing UINT_MAX to u32 fields")
Cc Subash Abhinov Kasiviswanathan <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Eric W. Biederman <[email protected]>
---
 kernel/sysctl.c |    2 ++
 1 file changed, 2 insertions(+)
kernel/sysctl.c +2 -0
@@ -2067,6 +2067,8 @@ static int do_proc_douintvec_conv(bool *
 	if (write) {
 		if (*negp)
 			return -EINVAL;
+		if (*lvalp > UINT_MAX)
+			return -EINVAL;
 		*valp = *lvalp;
 	} else {
 		unsigned int val = *valp;
author maintainer
#14 lore raw

PATCH 16/57 pinctrl: sh-pfc: r8a7791: Fix SCIF2 pinmux data

In reply to Greg Kroah-Hartman

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

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

From: Sergei Shtylyov <[email protected]>

commit 58439280f84e6b39fd7d61f25ab30489c1aaf0a9 upstream.

PINMUX_IPSR_MSEL() macro invocation for the TX2 signal has apparently wrong 1st argument -- most probably a result of cut&paste programming...

Fixes 508845196238 ("pinctrl: sh-pfc: r8a7791 PFC support")
---
 drivers/pinctrl/sh-pfc/pfc-r8a7791.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/sh-pfc/pfc-r8a7791.c +1 -1
@@ -1102,7 +1102,7 @@ static const u16 pinmux_data[] = {
 	PINMUX_IPSR_MSEL(IP6_5_3, FMIN_E, SEL_FM_4),
 	PINMUX_IPSR_DATA(IP6_7_6, AUDIO_CLKOUT),
 	PINMUX_IPSR_MSEL(IP6_7_6, MSIOF1_SS1_B, SEL_SOF1_1),
-	PINMUX_IPSR_MSEL(IP6_5_3, TX2, SEL_SCIF2_0),
+	PINMUX_IPSR_MSEL(IP6_7_6, TX2, SEL_SCIF2_0),
 	PINMUX_IPSR_MSEL(IP6_7_6, SCIFA2_TXD, SEL_SCIFA2_0),
 	PINMUX_IPSR_DATA(IP6_9_8, IRQ0),
 	PINMUX_IPSR_MSEL(IP6_9_8, SCIFB1_RXD_D, SEL_SCIFB1_3),
author maintainer
#15 lore raw

PATCH 17/57 pinctrl: sh-pfc: r8a7791: Add missing DVC_MUTE signal

In reply to Greg Kroah-Hartman

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

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

From: Sergei Shtylyov <[email protected]>

commit 3908632fb829d73317c64c3d04f584b49f62e4ae upstream.

The R8A7791 PFC driver was apparently based on the preliminary revisions of the user's manual, which omitted the DVC_MUTE signal altogether in the PFC section. The modern manual has the signal described, so just add the necassary data to the driver...

Fixes 508845196238 ("pinctrl: sh-pfc: r8a7791 PFC support")
---
 drivers/pinctrl/sh-pfc/pfc-r8a7791.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/pinctrl/sh-pfc/pfc-r8a7791.c +4 -3
@@ -206,7 +206,7 @@ enum {
 
 	/* IPSR6 */
 	FN_AUDIO_CLKB, FN_STP_OPWM_0_B, FN_MSIOF1_SCK_B,
-	FN_SCIF_CLK, FN_BPFCLK_E,
+	FN_SCIF_CLK, FN_DVC_MUTE, FN_BPFCLK_E,
 	FN_AUDIO_CLKC, FN_SCIFB0_SCK_C, FN_MSIOF1_SYNC_B, FN_RX2,
 	FN_SCIFA2_RXD, FN_FMIN_E,
 	FN_AUDIO_CLKOUT, FN_MSIOF1_SS1_B, FN_TX2, FN_SCIFA2_TXD,
@@ -576,7 +576,7 @@ enum {
 
 	/* IPSR6 */
 	AUDIO_CLKB_MARK, STP_OPWM_0_B_MARK, MSIOF1_SCK_B_MARK,
-	SCIF_CLK_MARK, BPFCLK_E_MARK,
+	SCIF_CLK_MARK, DVC_MUTE_MARK, BPFCLK_E_MARK,
 	AUDIO_CLKC_MARK, SCIFB0_SCK_C_MARK, MSIOF1_SYNC_B_MARK, RX2_MARK,
 	SCIFA2_RXD_MARK, FMIN_E_MARK,
 	AUDIO_CLKOUT_MARK, MSIOF1_SS1_B_MARK, TX2_MARK, SCIFA2_TXD_MARK,
@@ -1093,6 +1093,7 @@ static const u16 pinmux_data[] = {
 	PINMUX_IPSR_MSEL(IP6_2_0, STP_OPWM_0_B, SEL_SSP_1),
 	PINMUX_IPSR_MSEL(IP6_2_0, MSIOF1_SCK_B, SEL_SOF1_1),
 	PINMUX_IPSR_MSEL(IP6_2_0, SCIF_CLK, SEL_SCIF_0),
+	PINMUX_IPSR_GPSR(IP6_2_0, DVC_MUTE),
 	PINMUX_IPSR_MSEL(IP6_2_0, BPFCLK_E, SEL_FM_4),
 	PINMUX_IPSR_DATA(IP6_5_3, AUDIO_CLKC),
 	PINMUX_IPSR_MSEL(IP6_5_3, SCIFB0_SCK_C, SEL_SCIFB_2),
@@ -5696,7 +5697,7 @@ static const struct pinmux_cfg_reg pinmu
 		0, 0,
 		/* IP6_2_0 [3] */
 		FN_AUDIO_CLKB, FN_STP_OPWM_0_B, FN_MSIOF1_SCK_B,
-		FN_SCIF_CLK, 0, FN_BPFCLK_E,
+		FN_SCIF_CLK, FN_DVC_MUTE, FN_BPFCLK_E,
 		0, 0, }
 	},
 	{ PINMUX_CFG_REG_VAR("IPSR7", 0xE606003C, 32,
author maintainer
#16 lore raw

PATCH 18/57 pinctrl: meson: meson8b: fix the NAND DQS pins

In reply to Greg Kroah-Hartman

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

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

From: Martin Blumenstingl <[email protected]>

commit 97ba26b8a9343008504d4e3a87d212bc07b05212 upstream.

The nand_groups table uses different names for the NAND DQS pins than the GROUP() definition in meson8b_cbus_groups (nand_dqs_0 vs nand_dqs0). This prevents using the NAND DQS pins in the devicetree.

Fix this by ensuring that the GROUP() definition and the meson8b_cbus_groups use the same name for these pins.

Fixes 0fefcb6876d0 ("pinctrl: Add support for Meson8b")
---
 drivers/pinctrl/meson/pinctrl-meson8b.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/meson/pinctrl-meson8b.c +2 -2
@@ -732,8 +732,8 @@ static const char * const sdxc_c_groups[
 static const char * const nand_groups[] = {
 	"nand_io", "nand_io_ce0", "nand_io_ce1",
 	"nand_io_rb0", "nand_ale", "nand_cle",
-	"nand_wen_clk", "nand_ren_clk", "nand_dqs0",
-	"nand_dqs1"
+	"nand_wen_clk", "nand_ren_clk", "nand_dqs_0",
+	"nand_dqs_1"
 };
 
 static const char * const nor_groups[] = {
author maintainer
#17 lore raw

PATCH 19/57 pinctrl: sunxi: Fix SPDIF function name for A83T

In reply to Greg Kroah-Hartman

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

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

From: Chen-Yu Tsai <[email protected]>

commit 7903d4f5e1dec53963cba9b1bc472a76a3532e07 upstream.

We use well known standard names for functions that have name, such as I2C, SPI, SPDIF, etc..

Fix the function name of SPDIF, which was named OWA (One Wire Audio) based on Allwinner datasheets.

Fixes 4730f33f0d82 ("pinctrl: sunxi: add allwinner A83T PIO controller

support")

---
 drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/sunxi/pinctrl-sun8i-a83t.c +1 -1
@@ -394,7 +394,7 @@ static const struct sunxi_desc_pin sun8i
 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 18),
 		  SUNXI_FUNCTION(0x0, "gpio_in"),
 		  SUNXI_FUNCTION(0x1, "gpio_out"),
-		  SUNXI_FUNCTION(0x3, "owa")),		/* DOUT */
+		  SUNXI_FUNCTION(0x3, "spdif")),	/* DOUT */
 	SUNXI_PIN(SUNXI_PINCTRL_PIN(E, 19),
 		  SUNXI_FUNCTION(0x0, "gpio_in"),
 		  SUNXI_FUNCTION(0x1, "gpio_out")),
author maintainer
#18 lore raw

PATCH 21/57 pinctrl: sh-pfc: Update info pointer after SoC-specific init

In reply to Greg Kroah-Hartman

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

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

From: Geert Uytterhoeven <[email protected]>

commit 3091ae775fae17084013021d01513bc1ad274e6a upstream.

Update the sh_pfc_soc_info pointer after calling the SoC-specific initialization function, as it may have been updated to e.g. handle different SoC revisions. This makes sure the correct subdriver name is printed later.

Fixes 0c151062f32c9db8 ("sh-pfc: Add support for SoC-specific initialization")
---
 drivers/pinctrl/sh-pfc/core.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/pinctrl/sh-pfc/core.c +3 -0
@@ -543,6 +543,9 @@ static int sh_pfc_probe(struct platform_
 		ret = info->ops->init(pfc);
 		if (ret < 0)
 			return ret;
+
+		/* .init() may have overridden pfc->info */
+		info = pfc->info;
 	}
 
 	/* Enable dummy states for those platforms without pinctrl support */
author maintainer
#19 lore raw

PATCH 24/57 gfs2: Fix glock rhashtable rcu bug

In reply to Greg Kroah-Hartman

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

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

From: Andreas Gruenbacher <[email protected]>

commit 961ae1d83d055a4b9ebbfb4cc8ca62ec1a7a3b74 upstream.

Before commit 88ffbf3e03 "GFS2: Use resizable hash table for glocks", glocks were freed via call_rcu to allow reading the glock hashtable locklessly using rcu. This was then changed to free glocks immediately, which made reading the glock hashtable unsafe. Bring back the original code for freeing glocks via call_rcu.

---
 fs/gfs2/glock.c  |   11 +++++++++--
 fs/gfs2/incore.h |    1 +
 2 files changed, 10 insertions(+), 2 deletions(-)
fs/gfs2/glock.c +9 -2
@@ -80,9 +80,9 @@ static struct rhashtable_params ht_parms
 
 static struct rhashtable gl_hash_table;
 
-void gfs2_glock_free(struct gfs2_glock *gl)
+static void gfs2_glock_dealloc(struct rcu_head *rcu)
 {
-	struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
+	struct gfs2_glock *gl = container_of(rcu, struct gfs2_glock, gl_rcu);
 
 	if (gl->gl_ops->go_flags & GLOF_ASPACE) {
 		kmem_cache_free(gfs2_glock_aspace_cachep, gl);
@@ -90,6 +90,13 @@ void gfs2_glock_free(struct gfs2_glock *
 		kfree(gl->gl_lksb.sb_lvbptr);
 		kmem_cache_free(gfs2_glock_cachep, gl);
 	}
+}
+
+void gfs2_glock_free(struct gfs2_glock *gl)
+{
+	struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
+
+	call_rcu(&gl->gl_rcu, gfs2_glock_dealloc);
 	if (atomic_dec_and_test(&sdp->sd_glock_disposal))
 		wake_up(&sdp->sd_glock_wait);
 }
fs/gfs2/incore.h +1 -0
@@ -367,6 +367,7 @@ struct gfs2_glock {
 			loff_t end;
 		} gl_vm;
 	};
+	struct rcu_head gl_rcu;
 	struct rhash_head gl_node;
 };
 
author maintainer
#20 lore raw

PATCH 26/57 x86/uaccess: Optimize copy_user_enhanced_fast_string() for short strings

In reply to Greg Kroah-Hartman

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

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

From: Paolo Abeni <[email protected]>

commit 236222d39347e0e486010f10c1493e83dbbdfba8 upstream.

According to the Intel datasheet, the REP MOVSB instruction exposes a pretty heavy setup cost (50 ticks), which hurts short string copy operations.

This change tries to avoid this cost by calling the explicit loop available in the unrolled code for strings shorter than 64 bytes.

The 64 bytes cutoff value is arbitrary from the code logic point of view - it has been selected based on measurements, as the largest value that still ensures a measurable gain.

Micro benchmarks of the __copy_from_user() function with lengths in the [0-63] range show this performance gain (shorter the string, larger the gain):

- in the [55%-4%] range on Intel Xeon(R) CPU E5-2690 v4
- in the [72%-9%] range on Intel Core i7-4810MQ

Other tested CPUs - namely Intel Atom S1260 and AMD Opteron 8216 - show no difference, because they do not expose the ERMS feature bit.

---
 arch/x86/lib/copy_user_64.S |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
arch/x86/lib/copy_user_64.S +5 -2
@@ -80,7 +80,7 @@ ENTRY(copy_user_generic_unrolled)
 	movl %edx,%ecx
 	andl $63,%edx
 	shrl $6,%ecx
-	jz 17f
+	jz .L_copy_short_string
 1:	movq (%rsi),%r8
 2:	movq 1*8(%rsi),%r9
 3:	movq 2*8(%rsi),%r10
@@ -101,7 +101,8 @@ ENTRY(copy_user_generic_unrolled)
 	leaq 64(%rdi),%rdi
 	decl %ecx
 	jnz 1b
-17:	movl %edx,%ecx
+.L_copy_short_string:
+	movl %edx,%ecx
 	andl $7,%edx
 	shrl $3,%ecx
 	jz 20f
@@ -215,6 +216,8 @@ ENDPROC(copy_user_generic_string)
  */
 ENTRY(copy_user_enhanced_fast_string)
 	ASM_STAC
+	cmpl $64,%edx
+	jb .L_copy_short_string	/* less then 64 bytes, avoid the costly 'rep' */
 	movl %edx,%ecx
 1:	rep
 	movsb
author maintainer
#21 lore raw

PATCH 27/57 ath10k: override CE5 config for QCA9377

In reply to Greg Kroah-Hartman

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

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

From: Bartosz Markowski <[email protected]>

commit b08b5b53a1ed2bd7a883f8fd29232c8f03604671 upstream.

Similarly to QCA6174, QCA9377 requires the CE5 configuration to be available for other feature. Use the ath10k_pci_override_ce_config() for it as well.

This is required for TF2.0 firmware. Previous FW revisions were working fine without this patch.

Fixes a70587b3389a ("ath10k: configure copy engine 5 for HTT messages")
---
 drivers/net/wireless/ath/ath10k/pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/pci.c +1 -1
@@ -3050,7 +3050,7 @@ static int ath10k_pci_probe(struct pci_d
 		goto err_core_destroy;
 	}
 
-	if (QCA_REV_6174(ar))
+	if (QCA_REV_6174(ar) || QCA_REV_9377(ar))
 		ath10k_pci_override_ce_config(ar);
 
 	ret = ath10k_pci_alloc_pipes(ar);
author maintainer
#22 lore raw

PATCH 28/57 KEYS: Fix an error code in request_master_key()

In reply to Greg Kroah-Hartman

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

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

From: Dan Carpenter <[email protected]>

commit 57cb17e764ba0aaa169d07796acce54ccfbc6cae upstream.

This function has two callers and neither are able to handle a NULL return. Really, -EINVAL is the correct thing return here anyway. This fixes some static checker warnings like:

security/keys/encrypted-keys/encrypted.c:709 encrypted_key_decrypt()
error: uninitialized symbol 'master_key'.

Fixes 7e70cb497850 ("keys: add new key-type encrypted")
---
 security/keys/encrypted-keys/encrypted.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/keys/encrypted-keys/encrypted.c +1 -1
@@ -428,7 +428,7 @@ static int init_blkcipher_desc(struct bl
 static struct key *request_master_key(struct encrypted_key_payload *epayload,
 				      const u8 **master_key, size_t *master_keylen)
 {
-	struct key *mkey = NULL;
+	struct key *mkey = ERR_PTR(-EINVAL);
 
 	if (!strncmp(epayload->master_desc, KEY_TRUSTED_PREFIX,
 		     KEY_TRUSTED_PREFIX_LEN)) {
author maintainer
#23 lore raw

PATCH 29/57 RDMA/uverbs: Check port number supplied by user verbs cmds

In reply to Greg Kroah-Hartman

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

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

From: Boris Pismenny <[email protected]>

commit 5ecce4c9b17bed4dc9cb58bfb10447307569b77b upstream.

The ib_uverbs_create_ah() ind ib_uverbs_modify_qp() calls receive the port number from user input as part of its attributes and assumes it is valid. Down on the stack, that parameter is used to access kernel data structures. If the value is invalid, the kernel accesses memory it should not. To prevent this, verify the port number before using it.

BUG: KASAN: use-after-free in ib_uverbs_create_ah+0x6d5/0x7b0
Read of size 4 at addr ffff880018d67ab8 by task syz-executor/313

BUG: KASAN: slab-out-of-bounds in modify_qp.isra.4+0x19d0/0x1ef0
Read of size 4 at addr ffff88006c40ec58 by task syz-executor/819
Fixes 67cdb40ca444 ("[IB] uverbs: Implement more commands")
Cc Yevgeny Kliteynik <[email protected]>
Cc Tziporet Koren <[email protected]>
Cc Alex Polak <[email protected]>

---

Modified from upstream commit: helper function rdma_is_port_valid does not exist in these kernel versions, so use manual comparisons instead.

 drivers/infiniband/core/uverbs_cmd.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/infiniband/core/uverbs_cmd.c +8 -0
@@ -2287,6 +2287,10 @@ ssize_t ib_uverbs_modify_qp(struct ib_uv
 	if (copy_from_user(&cmd, buf, sizeof cmd))
 		return -EFAULT;
 
+	if (cmd.port_num < rdma_start_port(ib_dev) ||
+	    cmd.port_num > rdma_end_port(ib_dev))
+		return -EINVAL;
+
 	INIT_UDATA(&udata, buf + sizeof cmd, NULL, in_len - sizeof cmd,
 		   out_len);
 
@@ -2827,6 +2831,10 @@ ssize_t ib_uverbs_create_ah(struct ib_uv
 	if (copy_from_user(&cmd, buf, sizeof cmd))
 		return -EFAULT;
 
+	if (cmd.attr.port_num < rdma_start_port(ib_dev) ||
+	    cmd.attr.port_num > rdma_end_port(ib_dev))
+		return -EINVAL;
+
 	uobj = kmalloc(sizeof *uobj, GFP_KERNEL);
 	if (!uobj)
 		return -ENOMEM;
#24 lore raw

RE: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied by user verbs cmds

Quoted 4 lines

Subject: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied by user verbs cmds

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

Yes, this breaks modify qp.
See https://patchwork.kernel.org/patch/9830663/

Mustafa

author maintainer
#25 lore raw

Re: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied by user verbs cmds

Quoted 7 lines · Mustafa
Quoted 4 lines

Subject: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied by user verbs cmds

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

Yes, this breaks modify qp.
See https://patchwork.kernel.org/patch/9830663/

I don't understand this response at all, sorry.

What should I do about this? Is this patch alone a problem? Is there some other patch I should apply that is in Linus's tree? Where is the problem, only in this old release?

totally confused,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#26 lore raw

RE: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied by user verbs cmds

Quoted 19 lines

-----Original Message-----
From: Greg Kroah-Hartman [mailto:[email protected]]
Sent: Thursday, July 13, 2017 11:26 AM
To: Ismail, Mustafa <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Yevgeny Kliteynik <kliteyn-VPRAkNaXOzVWk0Htik3J/[email protected]>; Tziporet Koren <tziporet-VPRAkNaXOzVWk0Htik3J/[email protected]>; Alex Polak <alexpo-VPRAkNaXOzVWk0Htik3J/[email protected]>; Boris Pismenny <borisp-VPRAkNaXOzVWk0Htik3J/[email protected]>; Leon Romanovsky <[email protected]>; Doug Ledford <[email protected]>
Subject: Re: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied
by user verbs cmds

Quoted 4 lines · Mustafa
Quoted 4 lines

Subject: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied by user verbs cmds

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

know.

Quoted 1 line
Quoted 9 lines
Quoted 2 lines

Yes, this breaks modify qp.
See https://patchwork.kernel.org/patch/9830663/

I don't understand this response at all, sorry.

What should I do about this? Is this patch alone a problem? Is there some other patch I should apply that is in Linus's tree? Where is the problem, only in this old release?

Applying this patch will break RDMA functionality with respect to modify_qp. Specifically this part:
+ if (cmd.port_num < rdma_start_port(ib_dev) ||
+ cmd.port_num > rdma_end_port(ib_dev))
+ return -EINVAL;
+
The cmd.port_num is only valid if (cmd->base.attr_mask & IB_QP_PORT). So the above can be fixed with:

	if ((cmd->base.attr_mask & IB_QP_PORT) && 
	    (cmd.port_num < rdma_start_port(ib_dev) ||
	    cmd.port_num > rdma_end_port(ib_dev)))
		return -EINVAL;

A version of this patch is in Linus's tree and it has the same problem:
commit 5ecce4c9b17bed4dc9cb58bfb10447307569b77b "RDMA/uverbs: Check port number supplied by user verbs cmds"

We will be submitting a patch to fix this shortly.

Mustafa
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#27 lore raw

Re: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied by user verbs cmds

Quoted 41 lines · Mustafa
Quoted 19 lines

-----Original Message-----
From: Greg Kroah-Hartman [mailto:[email protected]]
Sent: Thursday, July 13, 2017 11:26 AM
To: Ismail, Mustafa <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Yevgeny Kliteynik <kliteyn-VPRAkNaXOzVWk0Htik3J/[email protected]>; Tziporet Koren <tziporet-VPRAkNaXOzVWk0Htik3J/[email protected]>; Alex Polak <alexpo-VPRAkNaXOzVWk0Htik3J/[email protected]>; Boris Pismenny <borisp-VPRAkNaXOzVWk0Htik3J/[email protected]>; Leon Romanovsky <[email protected]>; Doug Ledford <[email protected]>
Subject: Re: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied
by user verbs cmds

Quoted 4 lines · Mustafa
Quoted 4 lines

Subject: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied by user verbs cmds

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

know.

Quoted 1 line
Quoted 9 lines
Quoted 2 lines

Yes, this breaks modify qp.
See https://patchwork.kernel.org/patch/9830663/

I don't understand this response at all, sorry.

What should I do about this? Is this patch alone a problem? Is there some other patch I should apply that is in Linus's tree? Where is the problem, only in this old release?

Applying this patch will break RDMA functionality with respect to modify_qp. Specifically this part:

drivers/infiniband/core/uverbs_cmd.c +4 -0
+	if (cmd.port_num < rdma_start_port(ib_dev) ||
+	    cmd.port_num > rdma_end_port(ib_dev))
+		return -EINVAL;
+

The cmd.port_num is only valid if (cmd->base.attr_mask & IB_QP_PORT). So the above can be fixed with:

	if ((cmd->base.attr_mask & IB_QP_PORT) && 
	    (cmd.port_num < rdma_start_port(ib_dev) ||
	    cmd.port_num > rdma_end_port(ib_dev)))
		return -EINVAL;
Quoted 4 lines

A version of this patch is in Linus's tree and it has the same problem:
commit 5ecce4c9b17bed4dc9cb58bfb10447307569b77b "RDMA/uverbs: Check port number supplied by user verbs cmds"

We will be submitting a patch to fix this shortly.

Ok, so we will be "bug compatible" with Linus's tree then, right? :)

Should I hold off on applying this now, or just stay in sync and wait for your fixes to land in Linus's tree? I vote stay-in-sync, as the other stable trees are also "broken" in the same way right now...

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#28 lore raw

RE: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied by user verbs cmds

Quoted 62 lines

-----Original Message-----
From: Greg Kroah-Hartman [mailto:[email protected]]
Sent: Friday, July 14, 2017 1:49 AM
To: Ismail, Mustafa <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Yevgeny Kliteynik <kliteyn-VPRAkNaXOzVWk0Htik3J/[email protected]>; Tziporet Koren <tziporet-VPRAkNaXOzVWk0Htik3J/[email protected]>; Alex Polak <alexpo-VPRAkNaXOzVWk0Htik3J/[email protected]>; Boris Pismenny <borisp-VPRAkNaXOzVWk0Htik3J/[email protected]>; Leon Romanovsky <[email protected]>; Doug Ledford <[email protected]>
Subject: Re: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied
by user verbs cmds

Quoted 8 lines · Mustafa
Quoted 8 lines

-----Original Message-----
From: Greg Kroah-Hartman [mailto:[email protected]]
Sent: Thursday, July 13, 2017 11:26 AM
To: Ismail, Mustafa <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Yevgeny Kliteynik <kliteyn-VPRAkNaXOzVWk0Htik3J/[email protected]>; Tziporet Koren <tziporet-VPRAkNaXOzVWk0Htik3J/[email protected]>; Alex Polak <alexpo-VPRAkNaXOzVWk0Htik3J/[email protected]>; Boris Pismenny <borisp-VPRAkNaXOzVWk0Htik3J/[email protected]>;

Leon

Quoted 1 line
Quoted 1 line

Romanovsky <[email protected]>; Doug Ledford

<[email protected]>

Quoted 14 lines
Quoted 14 lines

Subject: Re: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied by user verbs cmds

Quoted 5 lines · Mustafa
Quoted 5 lines

Subject: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied by user verbs cmds

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

know.

Quoted 3 lines

Yes, this breaks modify qp.
See https://patchwork.kernel.org/patch/9830663/

Quoted 7 lines
Quoted 6 lines

I don't understand this response at all, sorry.

What should I do about this? Is this patch alone a problem? Is there some other patch I should apply that is in Linus's tree? Where is the problem, only in this old release?

Applying this patch will break RDMA functionality with respect to

modify_qp.

Quoted 7 lines

Specifically this part:

drivers/infiniband/core/uverbs_cmd.c +4 -0
+	if (cmd.port_num < rdma_start_port(ib_dev) ||
+	    cmd.port_num > rdma_end_port(ib_dev))
+		return -EINVAL;
+

The cmd.port_num is only valid if (cmd->base.attr_mask & IB_QP_PORT). So the above can be fixed with:

Quoted 7 lines
	if ((cmd->base.attr_mask & IB_QP_PORT) &&
	    (cmd.port_num < rdma_start_port(ib_dev) ||
	    cmd.port_num > rdma_end_port(ib_dev)))
		return -EINVAL;

A version of this patch is in Linus's tree and it has the same problem:
commit 5ecce4c9b17bed4dc9cb58bfb10447307569b77b

"RDMA/uverbs: Check port number supplied by user verbs cmds"

Quoted 1 line
Quoted 8 lines
Quoted 1 line

We will be submitting a patch to fix this shortly.

Ok, so we will be "bug compatible" with Linus's tree then, right? :)

Should I hold off on applying this now, or just stay in sync and wait for your fixes to land in Linus's tree? I vote stay-in-sync, as the other stable trees are also "broken" in the same way right now...

I was thinking it would be better not to break iWARP and possibly other RDMA protocols, in more stable trees if possible and apply the patch and fix at the same time. But I see your point.

Regards,

Mustafa

Quoted 3 lines

thanks,

greg k-h

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#29 lore raw

RE: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied by user verbs cmds

In reply to Greg Kroah-Hartman
Quoted 14 lines

Subject: Re: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied by user verbs cmds

Quoted 1 line · Mustafa
Quoted 1 line

Subject: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied

by

Quoted 3 lines
Quoted 3 lines

user verbs cmds

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

know.

Quoted 3 lines

Yes, this breaks modify qp.
See https://patchwork.kernel.org/patch/9830663/

Quoted 8 lines

I don't understand this response at all, sorry.

What should I do about this? Is this patch alone a problem? Is there some other patch I should apply that is in Linus's tree? Where is the problem, only in this old release?

totally confused,

This patch utterly breaks qib and hfi1 on at least 4.10.11 stable kernel.

I suspect and will soon verify that v4.13-rc1 is broke as well.

Mike

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

author maintainer
#30 lore raw

Re: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied by user verbs cmds

Quoted 20 lines · Mike
Quoted 20 lines

Subject: Re: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied by user verbs cmds

Quoted 1 line · Mustafa
Quoted 1 line

Subject: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied

by

Quoted 3 lines
Quoted 3 lines

user verbs cmds

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

know.

Quoted 3 lines

Yes, this breaks modify qp.
See https://patchwork.kernel.org/patch/9830663/

I don't understand this response at all, sorry.

What should I do about this? Is this patch alone a problem? Is there some other patch I should apply that is in Linus's tree? Where is the problem, only in this old release?

Quoted 6 lines
Quoted 2 lines

totally confused,

This patch utterly breaks qib and hfi1 on at least 4.10.11 stable kernel.

I suspect and will soon verify that v4.13-rc1 is broke as well.

it should be broken, see the patches submitted already to fix it :)

#31 lore raw

RE: [PATCH 4.4 29/57] RDMA/uverbs: Check port number supplied by user verbs cmds

Quoted 1 line

it should be broken, see the patches submitted already to fix it :)

I saw that and responded with Tested-by:

Mike

author maintainer
#32 lore raw

PATCH 30/57 mqueue: fix a use-after-free in sys_mq_notify()

In reply to Greg Kroah-Hartman

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

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

From: Cong Wang <[email protected]>

commit f991af3daabaecff34684fd51fac80319d1baad1 upstream.

The retry logic for netlink_attachskb() inside sys_mq_notify() is nasty and vulnerable:

1) The sock refcnt is already released when retry is needed
2) The fd is controllable by user-space because we already release the file refcnt

so we when retry but the fd has been just closed by user-space during this small window, we end up calling netlink_detachskb() on the error path which releases the sock again, later when the user-space closes this socket a use-after-free could be triggered.

Setting 'sock' to NULL here should be sufficient to fix it.

---
 ipc/mqueue.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
ipc/mqueue.c +3 -1
@@ -1251,8 +1251,10 @@ retry:
 
 			timeo = MAX_SCHEDULE_TIMEOUT;
 			ret = netlink_attachskb(sock, nc, &timeo, NULL);
-			if (ret == 1)
+			if (ret == 1) {
+				sock = NULL;
 				goto retry;
+			}
 			if (ret) {
 				sock = NULL;
 				nc = NULL;
author maintainer
#33 lore raw

PATCH 31/57 tools include: Add a __fallthrough statement

In reply to Greg Kroah-Hartman

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

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

From: Arnaldo Carvalho de Melo <[email protected]>

commit b5bf1733d6a391c4e90ea8f8468d83023be74a2a upstream.

For cases where implicit fall through case labels are intended, to let us inform that to gcc >= 7:

CC /tmp/build/perf/util/string.o
util/string.c: In function 'perf_atoll':
util/string.c:22:7: error: this statement may fall through [-Werror=implicit-fallthrough=]

      if (*p)
         ^
  util/string.c:24:3: note: here
     case '\0':
     ^~~~

So we introduce:

  #define __fallthrough __attribute__ ((fallthrough))

And use it in such cases.

---
 tools/include/linux/compiler.h |    9 +++++++++
 1 file changed, 9 insertions(+)
tools/include/linux/compiler.h +9 -0
@@ -115,4 +115,13 @@ static __always_inline void __write_once
 #define WRITE_ONCE(x, val) \
 	({ union { typeof(x) __val; char __c[1]; } __u = { .__val = (val) }; __write_once_size(&(x), __u.__c, sizeof(x)); __u.__val; })
 
+
+#ifndef __fallthrough
+# if defined(__GNUC__) && __GNUC__ >= 7
+#  define __fallthrough __attribute__ ((fallthrough))
+# else
+#  define __fallthrough
+# endif
+#endif
+
 #endif /* _TOOLS_LINUX_COMPILER_H */
author maintainer
#34 lore raw

PATCH 32/57 tools string: Use __fallthrough in perf_atoll()

In reply to Greg Kroah-Hartman

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

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

From: Arnaldo Carvalho de Melo <[email protected]>

commit 94bdd5edb34e472980d1e18b4600d6fb92bd6b0a upstream.

The implicit fall through case label here is intended, so let us inform that to gcc >= 7:

CC /tmp/build/perf/util/string.o
util/string.c: In function 'perf_atoll':
util/string.c:22:7: error: this statement may fall through [-Werror=implicit-fallthrough=]

      if (*p)
         ^
  util/string.c:24:3: note: here
     case '\0':
     ^~~~
---
 tools/perf/util/string.c |    2 ++
 1 file changed, 2 insertions(+)
tools/perf/util/string.c +2 -0
@@ -21,6 +21,8 @@ s64 perf_atoll(const char *str)
 		case 'b': case 'B':
 			if (*p)
 				goto out_err;
+
+			__fallthrough;
 		case '\0':
 			return length;
 		default:
author maintainer
#35 lore raw

PATCH 33/57 tools strfilter: Use __fallthrough

In reply to Greg Kroah-Hartman

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

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

From: Arnaldo Carvalho de Melo <[email protected]>

commit d64b721d27aef3fbeb16ecda9dd22ee34818ff70 upstream.

The implicit fall through case label here is intended, so let us inform that to gcc >= 7:

util/strfilter.c: In function 'strfilter_node__sprint':
util/strfilter.c:270:6: error: this statement may fall through [-Werror=implicit-fallthrough=]

     if (len < 0)
        ^
  util/strfilter.c:272:2: note: here
    case '!':
    ^~~~

cc1: all warnings being treated as errors

---
 tools/perf/util/strfilter.c |    1 +
 1 file changed, 1 insertion(+)
tools/perf/util/strfilter.c +1 -0
@@ -269,6 +269,7 @@ static int strfilter_node__sprint(struct
 		len = strfilter_node__sprint_pt(node->l, buf);
 		if (len < 0)
 			return len;
+		__fallthrough;
 	case '!':
 		if (buf) {
 			*(buf + len++) = *node->p;
author maintainer
#36 lore raw

PATCH 34/57 perf top: Use __fallthrough

In reply to Greg Kroah-Hartman

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

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

From: Arnaldo Carvalho de Melo <[email protected]>

commit 7b0214b702ad8e124e039a317beeebb3f020d125 upstream.

The implicit fall through case label here is intended, so let us inform that to gcc >= 7:

CC /tmp/build/perf/builtin-top.o
builtin-top.c: In function 'display_thread':
builtin-top.c:644:7: error: this statement may fall through [-Werror=implicit-fallthrough=]

      if (errno == EINTR)
         ^

builtin-top.c:647:3: note: here
default:
^~~~~~~

---
 tools/perf/builtin-top.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-top.c +1 -1
@@ -636,7 +636,7 @@ repeat:
 		case -1:
 			if (errno == EINTR)
 				continue;
-			/* Fall trhu */
+			__fallthrough;
 		default:
 			c = getc(stdin);
 			tcsetattr(0, TCSAFLUSH, &save);
author maintainer
#37 lore raw

PATCH 35/57 perf intel-pt: Use __fallthrough

In reply to Greg Kroah-Hartman

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

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

From: Arnaldo Carvalho de Melo <[email protected]>

commit 7ea6856d6f5629d742edc23b8b76e6263371ef45 upstream.

To address new warnings emmited by gcc 7, e.g.::

CC /tmp/build/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.o
CC /tmp/build/perf/tests/parse-events.o
util/intel-pt-decoder/intel-pt-pkt-decoder.c: In function 'intel_pt_pkt_desc':
util/intel-pt-decoder/intel-pt-pkt-decoder.c:499:6: error: this statement may fall through [-Werror=implicit-fallthrough=]

     if (!(packet->count))
        ^
  util/intel-pt-decoder/intel-pt-pkt-decoder.c:501:2: note: here
    case INTEL_PT_CYC:
    ^~~~
    CC       /tmp/build/perf/util/intel-pt-decoder/intel-pt-decoder.o

cc1: all warnings being treated as errors

---
 tools/perf/util/intel-pt-decoder/intel-pt-decoder.c     |    5 +++++
 tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c |    2 ++
 2 files changed, 7 insertions(+)
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +5 -0
@@ -22,6 +22,7 @@
 #include <errno.h>
 #include <stdint.h>
 #include <inttypes.h>
+#include <linux/compiler.h>
 
 #include "../cache.h"
 #include "../util.h"
@@ -1708,6 +1709,7 @@ static int intel_pt_walk_psb(struct inte
 		switch (decoder->packet.type) {
 		case INTEL_PT_TIP_PGD:
 			decoder->continuous_period = false;
+			__fallthrough;
 		case INTEL_PT_TIP_PGE:
 		case INTEL_PT_TIP:
 			intel_pt_log("ERROR: Unexpected packet\n");
@@ -1762,6 +1764,8 @@ static int intel_pt_walk_psb(struct inte
 			decoder->pge = false;
 			decoder->continuous_period = false;
 			intel_pt_clear_tx_flags(decoder);
+			__fallthrough;
+
 		case INTEL_PT_TNT:
 			decoder->have_tma = false;
 			intel_pt_log("ERROR: Unexpected packet\n");
@@ -1802,6 +1806,7 @@ static int intel_pt_walk_to_ip(struct in
 		switch (decoder->packet.type) {
 		case INTEL_PT_TIP_PGD:
 			decoder->continuous_period = false;
+			__fallthrough;
 		case INTEL_PT_TIP_PGE:
 		case INTEL_PT_TIP:
 			decoder->pge = decoder->packet.type != INTEL_PT_TIP_PGD;
tools/perf/util/intel-pt-decoder/intel-pt-pkt-decoder.c +2 -0
@@ -17,6 +17,7 @@
 #include <string.h>
 #include <endian.h>
 #include <byteswap.h>
+#include <linux/compiler.h>
 
 #include "intel-pt-pkt-decoder.h"
 
@@ -488,6 +489,7 @@ int intel_pt_pkt_desc(const struct intel
 	case INTEL_PT_FUP:
 		if (!(packet->count))
 			return snprintf(buf, buf_len, "%s no ip", name);
+		__fallthrough;
 	case INTEL_PT_CYC:
 	case INTEL_PT_VMCS:
 	case INTEL_PT_MTC:
author maintainer
#38 lore raw

PATCH 36/57 perf thread_map: Correctly size buffer used with dirent->dt_name

In reply to Greg Kroah-Hartman

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

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

From: Arnaldo Carvalho de Melo <[email protected]>

commit bdf23a9a190d7ecea092fd5c4aabb7d4bd0a9980 upstream.

The size of dirent->dt_name is NAME_MAX + 1, but the size for the 'path' buffer is hard coded at 256, which may truncate it because we also prepend "/proc/", so that all that into account and thank gcc 7 for this warning:

/git/linux/tools/perf/util/thread_map.c: In function 'thread_map__new_by_uid':
/git/linux/tools/perf/util/thread_map.c:119:39: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 250 [-Werror=format-truncation=]

     snprintf(path, sizeof(path), "/proc/%s", dirent->d_name);
                                         ^~
  In file included from /usr/include/stdio.h:939:0,
                   from /git/linux/tools/perf/util/thread_map.c:5:
  /usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 7 and 262 bytes into a destination of size 256
     return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          __bos (__s), __fmt, __va_arg_pack ());
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 tools/perf/util/thread_map.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/thread_map.c +1 -1
@@ -92,7 +92,7 @@ struct thread_map *thread_map__new_by_ui
 {
 	DIR *proc;
 	int max_threads = 32, items, i;
-	char path[256];
+	char path[NAME_MAX + 1 + 6];
 	struct dirent dirent, *next, **namelist = NULL;
 	struct thread_map *threads = thread_map__alloc(max_threads);
 
author maintainer
#39 lore raw

PATCH 37/57 perf scripting perl: Fix compile error with some perl5 versions

In reply to Greg Kroah-Hartman

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

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

From: Wang YanQing <[email protected]>

commit d7dd112ea5cacf91ae72c0714c3b911eb6016fea upstream.

Fix below compile error:

CC util/scripting-engines/trace-event-perl.o
In file included from /usr/lib/perl5/5.22.2/i686-linux/CORE/perl.h:5673:0,
from util/scripting-engines/trace-event-perl.c:31:
/usr/lib/perl5/5.22.2/i686-linux/CORE/inline.h: In function 'S__is_utf8_char_slow':
/usr/lib/perl5/5.22.2/i686-linux/CORE/inline.h:270:5: error: nested extern declaration of 'Perl___notused' [-Werror=nested-externs]
dTHX; /* The function called below requires thread context */
^
cc1: all warnings being treated as errors

After digging perl5 repository, I find out that we will meet this compile error with perl from v5.21.1 to v5.25.4

---
 tools/perf/util/scripting-engines/Build |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/scripting-engines/Build +1 -1
@@ -1,6 +1,6 @@
 libperf-$(CONFIG_LIBPERL)   += trace-event-perl.o
 libperf-$(CONFIG_LIBPYTHON) += trace-event-python.o
 
-CFLAGS_trace-event-perl.o += $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-undef -Wno-switch-default
+CFLAGS_trace-event-perl.o += $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-nested-externs -Wno-undef -Wno-switch-default
 
 CFLAGS_trace-event-python.o += $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow
author maintainer
#40 lore raw

PATCH 38/57 perf tests: Avoid possible truncation with dirent->d_name + snprintf

In reply to Greg Kroah-Hartman

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

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

From: Arnaldo Carvalho de Melo <[email protected]>

commit 2e2bbc039fad9eabad6c4c1a473c8b2554cdd2d4 upstream.

Addressing a few cases spotted by a new warning in gcc 7:

tests/parse-events.c: In function 'test_pmu_events':
tests/parse-events.c:1790:39: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 90 [-Werror=format-truncation=]

     snprintf(name, MAX_NAME, "cpu/event=%s/u", ent->d_name);
                                       ^~
  In file included from /usr/include/stdio.h:939:0,
                   from /git/linux/tools/perf/util/map.h:9,
                   from /git/linux/tools/perf/util/symbol.h:7,
                   from /git/linux/tools/perf/util/evsel.h:10,
                   from tests/parse-events.c:3:
  /usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 13 and 268 bytes into a destination of size 100
     return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          __bos (__s), __fmt, __va_arg_pack ());
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  tests/parse-events.c:1798:29: error: '%s' directive output may be truncated writing up to 255 bytes into a region of size 100 [-Werror=format-truncation=]
     snprintf(name, MAX_NAME, "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name);
Cc Adrian Hunter <[email protected]>
Cc David Ahern <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Wang Nan <[email protected]>
Fixes 945aea220bb8 ("perf tests: Move test objects into 'tests' directory")
---
 tools/perf/tests/parse-events.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
tools/perf/tests/parse-events.c +3 -5
@@ -1727,15 +1727,14 @@ static int test_pmu_events(void)
 	}
 
 	while (!ret && (ent = readdir(dir))) {
-#define MAX_NAME 100
 		struct evlist_test e;
-		char name[MAX_NAME];
+		char name[2 * NAME_MAX + 1 + 12 + 3];
 
 		if (!strcmp(ent->d_name, ".") ||
 		    !strcmp(ent->d_name, ".."))
 			continue;
 
-		snprintf(name, MAX_NAME, "cpu/event=%s/u", ent->d_name);
+		snprintf(name, sizeof(name), "cpu/event=%s/u", ent->d_name);
 
 		e.name  = name;
 		e.check = test__checkevent_pmu_events;
@@ -1743,11 +1742,10 @@ static int test_pmu_events(void)
 		ret = test_event(&e);
 		if (ret)
 			break;
-		snprintf(name, MAX_NAME, "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name);
+		snprintf(name, sizeof(name), "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name);
 		e.name  = name;
 		e.check = test__checkevent_pmu_events_mix;
 		ret = test_event(&e);
-#undef MAX_NAME
 	}
 
 	closedir(dir);
author maintainer
#41 lore raw

PATCH 39/57 perf bench numa: Avoid possible truncation when using snprintf()

In reply to Greg Kroah-Hartman

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

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

From: Arnaldo Carvalho de Melo <[email protected]>

commit 3aff8ba0a4c9c9191bb788171a1c54778e1246a2 upstream.

Addressing this warning from gcc 7:

CC /tmp/build/perf/bench/numa.o
bench/numa.c: In function '__bench_numa':
bench/numa.c:1582:42: error: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size between 8 and 17 [-Werror=format-truncation=]

       snprintf(tname, 32, "process%d:thread%d", p, t);
                                            ^~
  bench/numa.c:1582:25: note: directive argument in the range [0, 2147483647]
       snprintf(tname, 32, "process%d:thread%d", p, t);
                           ^~~~~~~~~~~~~~~~~~~~
  In file included from /usr/include/stdio.h:939:0,
                   from bench/../util/util.h:47,
                   from bench/../builtin.h:4,
                   from bench/numa.c:11:
  /usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 17 and 35 bytes into a destination of size 32
     return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          __bos (__s), __fmt, __va_arg_pack ());
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

---
 tools/perf/bench/numa.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/bench/numa.c +3 -3
@@ -1570,13 +1570,13 @@ static int __bench_numa(const char *name
 		"GB/sec,", "total-speed",	"GB/sec total speed");
 
 	if (g->p.show_details >= 2) {
-		char tname[32];
+		char tname[14 + 2 * 10 + 1];
 		struct thread_data *td;
 		for (p = 0; p < g->p.nr_proc; p++) {
 			for (t = 0; t < g->p.nr_threads; t++) {
-				memset(tname, 0, 32);
+				memset(tname, 0, sizeof(tname));
 				td = g->threads + p*g->p.nr_threads + t;
-				snprintf(tname, 32, "process%d:thread%d", p, t);
+				snprintf(tname, sizeof(tname), "process%d:thread%d", p, t);
 				print_res(tname, td->speed_gbs,
 					"GB/sec",	"thread-speed", "GB/sec/thread speed");
 				print_res(tname, td->system_time_ns / 1e9,
author maintainer
#42 lore raw

PATCH 40/57 perf tools: Use readdir() instead of deprecated readdir_r()

In reply to Greg Kroah-Hartman

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

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

From: Arnaldo Carvalho de Melo <[email protected]>

commit 7093b4c963cc4e344e490c774924a180602a7092 upstream.

The readdir() function is thread safe as long as just one thread uses a DIR, which is the case when synthesizing events for pre-existing threads by traversing /proc, so, to avoid breaking the build with glibc-2.23.90 (upcoming 2.24), use it instead of readdir_r().

See: http://man7.org/linux/man-pages/man3/readdir.3.html

"However, in modern implementations (including the glibc implementation), concurrent calls to readdir() that specify different directory streams are thread-safe. In cases where multiple threads must read from the same directory stream, using readdir() with external synchronization is still preferable to the use of the deprecated readdir_r(3) function."

Noticed while building on a Fedora Rawhide docker container.

CC /tmp/build/perf/util/event.o
util/event.c: In function '__event__synthesize_thread':
util/event.c:466:2: error: 'readdir_r' is deprecated [-Werror=deprecated-declarations]

    while (!readdir_r(tasks, &dirent, &next) && next) {
    ^~~~~
  In file included from /usr/include/features.h:368:0,
                   from /usr/include/stdint.h:25,
                   from /usr/lib/gcc/x86_64-redhat-linux/6.0.0/include/stdint.h:9,
                   from /git/linux/tools/include/linux/types.h:6,
                   from util/event.c:1:

/usr/include/dirent.h:189:12: note: declared here

---
 tools/perf/util/event.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
tools/perf/util/event.c +6 -6
@@ -416,7 +416,7 @@ static int __event__synthesize_thread(un
 {
 	char filename[PATH_MAX];
 	DIR *tasks;
-	struct dirent dirent, *next;
+	struct dirent *dirent;
 	pid_t tgid, ppid;
 	int rc = 0;
 
@@ -445,11 +445,11 @@ static int __event__synthesize_thread(un
 		return 0;
 	}
 
-	while (!readdir_r(tasks, &dirent, &next) && next) {
+	while ((dirent = readdir(tasks)) != NULL) {
 		char *end;
 		pid_t _pid;
 
-		_pid = strtol(dirent.d_name, &end, 10);
+		_pid = strtol(dirent->d_name, &end, 10);
 		if (*end)
 			continue;
 
@@ -558,7 +558,7 @@ int perf_event__synthesize_threads(struc
 {
 	DIR *proc;
 	char proc_path[PATH_MAX];
-	struct dirent dirent, *next;
+	struct dirent *dirent;
 	union perf_event *comm_event, *mmap_event, *fork_event;
 	int err = -1;
 
@@ -583,9 +583,9 @@ int perf_event__synthesize_threads(struc
 	if (proc == NULL)
 		goto out_free_fork;
 
-	while (!readdir_r(proc, &dirent, &next) && next) {
+	while ((dirent = readdir(proc)) != NULL) {
 		char *end;
-		pid_t pid = strtol(dirent.d_name, &end, 10);
+		pid_t pid = strtol(dirent->d_name, &end, 10);
 
 		if (*end) /* only interested in proper numerical dirents */
 			continue;
author maintainer
#43 lore raw

PATCH 41/57 perf thread_map: Use readdir() instead of deprecated readdir_r()

In reply to Greg Kroah-Hartman

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

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

From: Arnaldo Carvalho de Melo <[email protected]>

commit 3354cf71104de49326d19d2f9bdb1f66eea52ef4 upstream.

The readdir() function is thread safe as long as just one thread uses a DIR, which is the case in thread_map, so, to avoid breaking the build with glibc-2.23.90 (upcoming 2.24), use it instead of readdir_r().

See: http://man7.org/linux/man-pages/man3/readdir.3.html

"However, in modern implementations (including the glibc implementation), concurrent calls to readdir() that specify different directory streams are thread-safe. In cases where multiple threads must read from the same directory stream, using readdir() with external synchronization is still preferable to the use of the deprecated readdir_r(3) function."

Noticed while building on a Fedora Rawhide docker container.

---
 tools/perf/util/thread_map.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/perf/util/thread_map.c +4 -4
@@ -93,7 +93,7 @@ struct thread_map *thread_map__new_by_ui
 	DIR *proc;
 	int max_threads = 32, items, i;
 	char path[NAME_MAX + 1 + 6];
-	struct dirent dirent, *next, **namelist = NULL;
+	struct dirent *dirent, **namelist = NULL;
 	struct thread_map *threads = thread_map__alloc(max_threads);
 
 	if (threads == NULL)
@@ -106,16 +106,16 @@ struct thread_map *thread_map__new_by_ui
 	threads->nr = 0;
 	atomic_set(&threads->refcnt, 1);
 
-	while (!readdir_r(proc, &dirent, &next) && next) {
+	while ((dirent = readdir(proc)) != NULL) {
 		char *end;
 		bool grow = false;
 		struct stat st;
-		pid_t pid = strtol(dirent.d_name, &end, 10);
+		pid_t pid = strtol(dirent->d_name, &end, 10);
 
 		if (*end) /* only interested in proper numerical dirents */
 			continue;
 
-		snprintf(path, sizeof(path), "/proc/%s", dirent.d_name);
+		snprintf(path, sizeof(path), "/proc/%s", dirent->d_name);
 
 		if (stat(path, &st) != 0)
 			continue;
author maintainer
#44 lore raw

PATCH 42/57 perf script: Use readdir() instead of deprecated readdir_r()

In reply to Greg Kroah-Hartman

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

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

From: Arnaldo Carvalho de Melo <[email protected]>

commit a5e8e825bd1704c488bf6a46936aaf3b9f203d6a upstream.

The readdir() function is thread safe as long as just one thread uses a DIR, which is the case in 'perf script', so, to avoid breaking the build with glibc-2.23.90 (upcoming 2.24), use it instead of readdir_r().

See: http://man7.org/linux/man-pages/man3/readdir.3.html

"However, in modern implementations (including the glibc implementation), concurrent calls to readdir() that specify different directory streams are thread-safe. In cases where multiple threads must read from the same directory stream, using readdir() with external synchronization is still preferable to the use of the deprecated readdir_r(3) function."

Noticed while building on a Fedora Rawhide docker container.

---
 tools/perf/builtin-script.c |   70 +++++++++++++++++++++-----------------------
 1 file changed, 34 insertions(+), 36 deletions(-)
tools/perf/builtin-script.c +34 -36
@@ -1252,21 +1252,19 @@ static int is_directory(const char *base
 	return S_ISDIR(st.st_mode);
 }
 
-#define for_each_lang(scripts_path, scripts_dir, lang_dirent, lang_next)\
-	while (!readdir_r(scripts_dir, &lang_dirent, &lang_next) &&	\
-	       lang_next)						\
-		if ((lang_dirent.d_type == DT_DIR ||			\
-		     (lang_dirent.d_type == DT_UNKNOWN &&		\
-		      is_directory(scripts_path, &lang_dirent))) &&	\
-		    (strcmp(lang_dirent.d_name, ".")) &&		\
-		    (strcmp(lang_dirent.d_name, "..")))
-
-#define for_each_script(lang_path, lang_dir, script_dirent, script_next)\
-	while (!readdir_r(lang_dir, &script_dirent, &script_next) &&	\
-	       script_next)						\
-		if (script_dirent.d_type != DT_DIR &&			\
-		    (script_dirent.d_type != DT_UNKNOWN ||		\
-		     !is_directory(lang_path, &script_dirent)))
+#define for_each_lang(scripts_path, scripts_dir, lang_dirent)		\
+	while ((lang_dirent = readdir(scripts_dir)) != NULL)		\
+		if ((lang_dirent->d_type == DT_DIR ||			\
+		     (lang_dirent->d_type == DT_UNKNOWN &&		\
+		      is_directory(scripts_path, lang_dirent))) &&	\
+		    (strcmp(lang_dirent->d_name, ".")) &&		\
+		    (strcmp(lang_dirent->d_name, "..")))
+
+#define for_each_script(lang_path, lang_dir, script_dirent)		\
+	while ((script_dirent = readdir(lang_dir)) != NULL)		\
+		if (script_dirent->d_type != DT_DIR &&			\
+		    (script_dirent->d_type != DT_UNKNOWN ||		\
+		     !is_directory(lang_path, script_dirent)))
 
 
 #define RECORD_SUFFIX			"-record"
@@ -1412,7 +1410,7 @@ static int list_available_scripts(const
 				  const char *s __maybe_unused,
 				  int unset __maybe_unused)
 {
-	struct dirent *script_next, *lang_next, script_dirent, lang_dirent;
+	struct dirent *script_dirent, *lang_dirent;
 	char scripts_path[MAXPATHLEN];
 	DIR *scripts_dir, *lang_dir;
 	char script_path[MAXPATHLEN];
@@ -1427,19 +1425,19 @@ static int list_available_scripts(const
 	if (!scripts_dir)
 		return -1;
 
-	for_each_lang(scripts_path, scripts_dir, lang_dirent, lang_next) {
+	for_each_lang(scripts_path, scripts_dir, lang_dirent) {
 		snprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path,
-			 lang_dirent.d_name);
+			 lang_dirent->d_name);
 		lang_dir = opendir(lang_path);
 		if (!lang_dir)
 			continue;
 
-		for_each_script(lang_path, lang_dir, script_dirent, script_next) {
-			script_root = get_script_root(&script_dirent, REPORT_SUFFIX);
+		for_each_script(lang_path, lang_dir, script_dirent) {
+			script_root = get_script_root(script_dirent, REPORT_SUFFIX);
 			if (script_root) {
 				desc = script_desc__findnew(script_root);
 				snprintf(script_path, MAXPATHLEN, "%s/%s",
-					 lang_path, script_dirent.d_name);
+					 lang_path, script_dirent->d_name);
 				read_script_info(desc, script_path);
 				free(script_root);
 			}
@@ -1527,7 +1525,7 @@ static int check_ev_match(char *dir_name
  */
 int find_scripts(char **scripts_array, char **scripts_path_array)
 {
-	struct dirent *script_next, *lang_next, script_dirent, lang_dirent;
+	struct dirent *script_dirent, *lang_dirent;
 	char scripts_path[MAXPATHLEN], lang_path[MAXPATHLEN];
 	DIR *scripts_dir, *lang_dir;
 	struct perf_session *session;
@@ -1550,9 +1548,9 @@ int find_scripts(char **scripts_array, c
 		return -1;
 	}
 
-	for_each_lang(scripts_path, scripts_dir, lang_dirent, lang_next) {
+	for_each_lang(scripts_path, scripts_dir, lang_dirent) {
 		snprintf(lang_path, MAXPATHLEN, "%s/%s", scripts_path,
-			 lang_dirent.d_name);
+			 lang_dirent->d_name);
 #ifdef NO_LIBPERL
 		if (strstr(lang_path, "perl"))
 			continue;
@@ -1566,16 +1564,16 @@ int find_scripts(char **scripts_array, c
 		if (!lang_dir)
 			continue;
 
-		for_each_script(lang_path, lang_dir, script_dirent, script_next) {
+		for_each_script(lang_path, lang_dir, script_dirent) {
 			/* Skip those real time scripts: xxxtop.p[yl] */
-			if (strstr(script_dirent.d_name, "top."))
+			if (strstr(script_dirent->d_name, "top."))
 				continue;
 			sprintf(scripts_path_array[i], "%s/%s", lang_path,
-				script_dirent.d_name);
-			temp = strchr(script_dirent.d_name, '.');
+				script_dirent->d_name);
+			temp = strchr(script_dirent->d_name, '.');
 			snprintf(scripts_array[i],
-				(temp - script_dirent.d_name) + 1,
-				"%s", script_dirent.d_name);
+				(temp - script_dirent->d_name) + 1,
+				"%s", script_dirent->d_name);
 
 			if (check_ev_match(lang_path,
 					scripts_array[i], session))
@@ -1593,7 +1591,7 @@ int find_scripts(char **scripts_array, c
 
 static char *get_script_path(const char *script_root, const char *suffix)
 {
-	struct dirent *script_next, *lang_next, script_dirent, lang_dirent;
+	struct dirent *script_dirent, *lang_dirent;
 	char scripts_path[MAXPATHLEN];
 	char script_path[MAXPATHLEN];
 	DIR *scripts_dir, *lang_dir;
@@ -1606,21 +1604,21 @@ static char *get_script_path(const char
 	if (!scripts_dir)
 		return NULL;
 
-	for_each_lang(scripts_path, scripts_dir, lang_dirent, lang_next) {
+	for_each_lang(scripts_path, scripts_dir, lang_dirent) {
 		snprintf(lang_path, MAXPATHLEN, "%s/%s/bin", scripts_path,
-			 lang_dirent.d_name);
+			 lang_dirent->d_name);
 		lang_dir = opendir(lang_path);
 		if (!lang_dir)
 			continue;
 
-		for_each_script(lang_path, lang_dir, script_dirent, script_next) {
-			__script_root = get_script_root(&script_dirent, suffix);
+		for_each_script(lang_path, lang_dir, script_dirent) {
+			__script_root = get_script_root(script_dirent, suffix);
 			if (__script_root && !strcmp(script_root, __script_root)) {
 				free(__script_root);
 				closedir(lang_dir);
 				closedir(scripts_dir);
 				snprintf(script_path, MAXPATHLEN, "%s/%s",
-					 lang_path, script_dirent.d_name);
+					 lang_path, script_dirent->d_name);
 				return strdup(script_path);
 			}
 			free(__script_root);
author maintainer
#45 lore raw

PATCH 43/57 perf tools: Remove duplicate const qualifier

In reply to Greg Kroah-Hartman

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

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

From: Eric Engestrom <[email protected]>

commit 3b556bced46aa6b1873da7faa18eff235e896adc upstream.

---
 tools/perf/util/thread.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/thread.c +1 -1
@@ -227,7 +227,7 @@ void thread__find_cpumode_addr_location(
 					struct addr_location *al)
 {
 	size_t i;
-	const u8 const cpumodes[] = {
+	const u8 cpumodes[] = {
 		PERF_RECORD_MISC_USER,
 		PERF_RECORD_MISC_KERNEL,
 		PERF_RECORD_MISC_GUEST_USER,
author maintainer
#46 lore raw

PATCH 44/57 perf annotate browser: Fix behaviour of Shift-Tab with nothing focussed

In reply to Greg Kroah-Hartman

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

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

From: Markus Trippelsdorf <[email protected]>

commit d4913cbd05bab685e49c8174896e563b2487d054 upstream.

The issue was pointed out by gcc-6's -Wmisleading-indentation.

---
 tools/perf/ui/browsers/annotate.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/ui/browsers/annotate.c +2 -2
@@ -755,11 +755,11 @@ static int annotate_browser__run(struct
 				nd = browser->curr_hot;
 			break;
 		case K_UNTAB:
-			if (nd != NULL)
+			if (nd != NULL) {
 				nd = rb_next(nd);
 				if (nd == NULL)
 					nd = rb_first(&browser->entries);
-			else
+			} else
 				nd = browser->curr_hot;
 			break;
 		case K_F1:
author maintainer
#47 lore raw

PATCH 45/57 perf pmu: Fix misleadingly indented assignment (whitespace)

In reply to Greg Kroah-Hartman

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

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

From: Markus Trippelsdorf <[email protected]>

commit d85ce830eef6c10d1e9617172dea4681f02b8424 upstream.

One line in perf_pmu__parse_unit() is indented wrongly, leading to a warning (=> error) from gcc 6:

util/pmu.c:156:3: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]

    sret = read(fd, alias->unit, UNIT_MAX_LEN);
    ^~~~

util/pmu.c:153:2: note: ...this 'if' clause, but it is not

    if (fd == -1)
    ^~
Cc Ben Hutchings <[email protected]>
Cc Matt Fleming <[email protected]>
Cc Peter Zijlstra <[email protected]>
Fixes 410136f5dd96 ("tools/perf/stat: Add event unit and scale support")
---
 tools/perf/util/pmu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/pmu.c +1 -1
@@ -153,7 +153,7 @@ static int perf_pmu__parse_unit(struct p
 	if (fd == -1)
 		return -1;
 
-		sret = read(fd, alias->unit, UNIT_MAX_LEN);
+	sret = read(fd, alias->unit, UNIT_MAX_LEN);
 	if (sret < 0)
 		goto error;
 
author maintainer
#48 lore raw

PATCH 46/57 perf dwarf: Guard !x86_64 definitions under #ifdef else clause

In reply to Greg Kroah-Hartman

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

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

From: Arnaldo Carvalho de Melo <[email protected]>

commit 62aa0e177d278462145a29c30d3c8501ae57e200 upstream.

To fix the build on Fedora Rawhide (gcc 6.0.0 20160311 (Red Hat 6.0.0-0.17):

CC /tmp/build/perf/arch/x86/util/dwarf-regs.o
arch/x86/util/dwarf-regs.c:66:36: error: 'x86_32_regoffset_table' defined but not used [-Werror=unused-const-variable=]

   static const struct pt_regs_offset x86_32_regoffset_table[] = {
                                      ^~~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

---
 tools/perf/arch/x86/util/dwarf-regs.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/perf/arch/x86/util/dwarf-regs.c +4 -4
@@ -63,6 +63,8 @@ struct pt_regs_offset {
 # define REG_OFFSET_NAME_32(n, r) {.name = n, .offset = offsetof(struct pt_regs, r)}
 #endif
 
+/* TODO: switching by dwarf address size */
+#ifndef __x86_64__
 static const struct pt_regs_offset x86_32_regoffset_table[] = {
 	REG_OFFSET_NAME_32("%ax",	eax),
 	REG_OFFSET_NAME_32("%cx",	ecx),
@@ -75,6 +77,8 @@ static const struct pt_regs_offset x86_3
 	REG_OFFSET_END,
 };
 
+#define regoffset_table x86_32_regoffset_table
+#else
 static const struct pt_regs_offset x86_64_regoffset_table[] = {
 	REG_OFFSET_NAME_64("%ax",	rax),
 	REG_OFFSET_NAME_64("%dx",	rdx),
@@ -95,11 +99,7 @@ static const struct pt_regs_offset x86_6
 	REG_OFFSET_END,
 };
 
-/* TODO: switching by dwarf address size */
-#ifdef __x86_64__
 #define regoffset_table x86_64_regoffset_table
-#else
-#define regoffset_table x86_32_regoffset_table
 #endif
 
 /* Minus 1 for the ending REG_OFFSET_END */
author maintainer
#49 lore raw

PATCH 47/57 perf trace: Do not process PERF_RECORD_LOST twice

In reply to Greg Kroah-Hartman

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

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

From: Arnaldo Carvalho de Melo <[email protected]>

commit 3ed5ca2efff70e9f589087c2013789572901112d upstream.

We catch this record to provide a visual indication that events are getting lost, then call the default method to allow extra logging shared with the other tools to take place.

This extra logging was done twice because we were continuing to the "default" clause where machine__process_event() will end up calling machine__process_lost_event() again, fix it.

---
 tools/perf/builtin-trace.c |    1 +
 1 file changed, 1 insertion(+)
tools/perf/builtin-trace.c +1 -0
@@ -1617,6 +1617,7 @@ static int trace__process_event(struct t
 		color_fprintf(trace->output, PERF_COLOR_RED,
 			      "LOST %" PRIu64 " events!\n", event->lost.lost);
 		ret = machine__process_lost_event(machine, event, sample);
+		break;
 	default:
 		ret = machine__process_event(machine, event, sample);
 		break;
author maintainer
#50 lore raw

PATCH 48/57 perf tests: Remove wrong semicolon in while loop in CQM test

In reply to Greg Kroah-Hartman

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

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

From: Markus Trippelsdorf <[email protected]>

commit cf89813a5b514bff9b3b5e7eaf2090f22fba62e0 upstream.

The while loop was spinning. Fix by removing a semicolon.

The issue was pointed out by gcc-6's -Wmisleading-indentation.

---
 tools/perf/arch/x86/tests/intel-cqm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/arch/x86/tests/intel-cqm.c +1 -1
@@ -17,7 +17,7 @@ static pid_t spawn(void)
 	if (pid)
 		return pid;
 
-	while(1);
+	while(1)
 		sleep(5);
 	return 0;
 }
author maintainer
#51 lore raw

PATCH 49/57 perf tools: Use readdir() instead of deprecated readdir_r() again

In reply to Greg Kroah-Hartman

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

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

From: Arnaldo Carvalho de Melo <[email protected]>

commit 22a9f41b555673e7499b97acf3ffb07bf0af31ad upstream.

The readdir() function is thread safe as long as just one thread uses a DIR, which is the case when parsing tracepoint event definitions, to avoid breaking the build with glibc-2.23.90 (upcoming 2.24), use it instead of readdir_r().

See: http://man7.org/linux/man-pages/man3/readdir.3.html

"However, in modern implementations (including the glibc implementation), concurrent calls to readdir() that specify different directory streams are thread-safe. In cases where multiple threads must read from the same directory stream, using readdir() with external synchronization is still preferable to the use of the deprecated readdir_r(3) function."

Noticed while building on a Fedora Rawhide docker container.

---
 tools/perf/util/parse-events.c |   60 ++++++++++++++++++++---------------------
 1 file changed, 30 insertions(+), 30 deletions(-)
tools/perf/util/parse-events.c +30 -30
@@ -138,11 +138,11 @@ struct event_symbol event_symbols_sw[PER
 #define PERF_EVENT_TYPE(config)		__PERF_EVENT_FIELD(config, TYPE)
 #define PERF_EVENT_ID(config)		__PERF_EVENT_FIELD(config, EVENT)
 
-#define for_each_subsystem(sys_dir, sys_dirent, sys_next)	       \
-	while (!readdir_r(sys_dir, &sys_dirent, &sys_next) && sys_next)	       \
-	if (sys_dirent.d_type == DT_DIR &&				       \
-	   (strcmp(sys_dirent.d_name, ".")) &&				       \
-	   (strcmp(sys_dirent.d_name, "..")))
+#define for_each_subsystem(sys_dir, sys_dirent)			\
+	while ((sys_dirent = readdir(sys_dir)) != NULL)		\
+		if (sys_dirent->d_type == DT_DIR &&		\
+		    (strcmp(sys_dirent->d_name, ".")) &&	\
+		    (strcmp(sys_dirent->d_name, "..")))
 
 static int tp_event_has_id(struct dirent *sys_dir, struct dirent *evt_dir)
 {
@@ -159,12 +159,12 @@ static int tp_event_has_id(struct dirent
 	return 0;
 }
 
-#define for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next)	       \
-	while (!readdir_r(evt_dir, &evt_dirent, &evt_next) && evt_next)        \
-	if (evt_dirent.d_type == DT_DIR &&				       \
-	   (strcmp(evt_dirent.d_name, ".")) &&				       \
-	   (strcmp(evt_dirent.d_name, "..")) &&				       \
-	   (!tp_event_has_id(&sys_dirent, &evt_dirent)))
+#define for_each_event(sys_dirent, evt_dir, evt_dirent)		\
+	while ((evt_dirent = readdir(evt_dir)) != NULL)		\
+		if (evt_dirent->d_type == DT_DIR &&		\
+		    (strcmp(evt_dirent->d_name, ".")) &&	\
+		    (strcmp(evt_dirent->d_name, "..")) &&	\
+		    (!tp_event_has_id(sys_dirent, evt_dirent)))
 
 #define MAX_EVENT_LENGTH 512
 
@@ -173,7 +173,7 @@ struct tracepoint_path *tracepoint_id_to
 {
 	struct tracepoint_path *path = NULL;
 	DIR *sys_dir, *evt_dir;
-	struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
+	struct dirent *sys_dirent, *evt_dirent;
 	char id_buf[24];
 	int fd;
 	u64 id;
@@ -184,18 +184,18 @@ struct tracepoint_path *tracepoint_id_to
 	if (!sys_dir)
 		return NULL;
 
-	for_each_subsystem(sys_dir, sys_dirent, sys_next) {
+	for_each_subsystem(sys_dir, sys_dirent) {
 
 		snprintf(dir_path, MAXPATHLEN, "%s/%s", tracing_events_path,
-			 sys_dirent.d_name);
+			 sys_dirent->d_name);
 		evt_dir = opendir(dir_path);
 		if (!evt_dir)
 			continue;
 
-		for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) {
+		for_each_event(sys_dirent, evt_dir, evt_dirent) {
 
 			snprintf(evt_path, MAXPATHLEN, "%s/%s/id", dir_path,
-				 evt_dirent.d_name);
+				 evt_dirent->d_name);
 			fd = open(evt_path, O_RDONLY);
 			if (fd < 0)
 				continue;
@@ -220,9 +220,9 @@ struct tracepoint_path *tracepoint_id_to
 					free(path);
 					return NULL;
 				}
-				strncpy(path->system, sys_dirent.d_name,
+				strncpy(path->system, sys_dirent->d_name,
 					MAX_EVENT_LENGTH);
-				strncpy(path->name, evt_dirent.d_name,
+				strncpy(path->name, evt_dirent->d_name,
 					MAX_EVENT_LENGTH);
 				return path;
 			}
@@ -1629,7 +1629,7 @@ void print_tracepoint_events(const char
 			     bool name_only)
 {
 	DIR *sys_dir, *evt_dir;
-	struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
+	struct dirent *sys_dirent, *evt_dirent;
 	char evt_path[MAXPATHLEN];
 	char dir_path[MAXPATHLEN];
 	char **evt_list = NULL;
@@ -1647,20 +1647,20 @@ restart:
 			goto out_close_sys_dir;
 	}
 
-	for_each_subsystem(sys_dir, sys_dirent, sys_next) {
+	for_each_subsystem(sys_dir, sys_dirent) {
 		if (subsys_glob != NULL &&
-		    !strglobmatch(sys_dirent.d_name, subsys_glob))
+		    !strglobmatch(sys_dirent->d_name, subsys_glob))
 			continue;
 
 		snprintf(dir_path, MAXPATHLEN, "%s/%s", tracing_events_path,
-			 sys_dirent.d_name);
+			 sys_dirent->d_name);
 		evt_dir = opendir(dir_path);
 		if (!evt_dir)
 			continue;
 
-		for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) {
+		for_each_event(sys_dirent, evt_dir, evt_dirent) {
 			if (event_glob != NULL &&
-			    !strglobmatch(evt_dirent.d_name, event_glob))
+			    !strglobmatch(evt_dirent->d_name, event_glob))
 				continue;
 
 			if (!evt_num_known) {
@@ -1669,7 +1669,7 @@ restart:
 			}
 
 			snprintf(evt_path, MAXPATHLEN, "%s:%s",
-				 sys_dirent.d_name, evt_dirent.d_name);
+				 sys_dirent->d_name, evt_dirent->d_name);
 
 			evt_list[evt_i] = strdup(evt_path);
 			if (evt_list[evt_i] == NULL)
@@ -1722,7 +1722,7 @@ out_close_sys_dir:
 int is_valid_tracepoint(const char *event_string)
 {
 	DIR *sys_dir, *evt_dir;
-	struct dirent *sys_next, *evt_next, sys_dirent, evt_dirent;
+	struct dirent *sys_dirent, *evt_dirent;
 	char evt_path[MAXPATHLEN];
 	char dir_path[MAXPATHLEN];
 
@@ -1730,17 +1730,17 @@ int is_valid_tracepoint(const char *even
 	if (!sys_dir)
 		return 0;
 
-	for_each_subsystem(sys_dir, sys_dirent, sys_next) {
+	for_each_subsystem(sys_dir, sys_dirent) {
 
 		snprintf(dir_path, MAXPATHLEN, "%s/%s", tracing_events_path,
-			 sys_dirent.d_name);
+			 sys_dirent->d_name);
 		evt_dir = opendir(dir_path);
 		if (!evt_dir)
 			continue;
 
-		for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) {
+		for_each_event(sys_dirent, evt_dir, evt_dirent) {
 			snprintf(evt_path, MAXPATHLEN, "%s:%s",
-				 sys_dirent.d_name, evt_dirent.d_name);
+				 sys_dirent->d_name, evt_dirent->d_name);
 			if (!strcmp(evt_path, event_string)) {
 				closedir(evt_dir);
 				closedir(sys_dir);
author maintainer
#52 lore raw

PATCH 50/57 md: fix incorrect use of lexx_to_cpu in does_sb_need_changing

In reply to Greg Kroah-Hartman

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

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

From: Jason Yan <[email protected]>

commit 1345921393ba23b60d3fcf15933e699232ad25ae upstream.

The sb->layout is of type __le32, so we shoud use le32_to_cpu.

---
 drivers/md/md.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md.c +1 -1
@@ -2273,7 +2273,7 @@ static bool does_sb_need_changing(struct
 	/* Check if any mddev parameters have changed */
 	if ((mddev->dev_sectors != le64_to_cpu(sb->size)) ||
 	    (mddev->reshape_position != le64_to_cpu(sb->reshape_position)) ||
-	    (mddev->layout != le64_to_cpu(sb->layout)) ||
+	    (mddev->layout != le32_to_cpu(sb->layout)) ||
 	    (mddev->raid_disks != le32_to_cpu(sb->raid_disks)) ||
 	    (mddev->chunk_sectors != le32_to_cpu(sb->chunksize)))
 		return true;
author maintainer
#53 lore raw

PATCH 51/57 md: fix super_offset endianness in super_1_rdev_size_change

In reply to Greg Kroah-Hartman

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

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

From: Jason Yan <[email protected]>

commit 3fb632e40d7667d8bedfabc28850ac06d5493f54 upstream.

The sb->super_offset should be big-endian, but the rdev->sb_start is in host byte order, so fix this by adding cpu_to_le64.

---
 drivers/md/md.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/md.c +1 -1
@@ -1866,7 +1866,7 @@ super_1_rdev_size_change(struct md_rdev
 	}
 	sb = page_address(rdev->sb_page);
 	sb->data_size = cpu_to_le64(num_sectors);
-	sb->super_offset = rdev->sb_start;
+	sb->super_offset = cpu_to_le64(rdev->sb_start);
 	sb->sb_csum = calc_sb_1_csum(sb);
 	md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size,
 		       rdev->sb_page);
author maintainer
#54 lore raw

PATCH 52/57 tcp: fix tcp_mark_head_lost to check skb len before fragmenting

In reply to Greg Kroah-Hartman

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

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

From: Neal Cardwell <[email protected]>

commit d88270eef4b56bd7973841dd1fed387ccfa83709 upstream.

This commit fixes a corner case in tcp_mark_head_lost() which was causing the WARN_ON(len > skb->len) in tcp_fragment() to fire.

tcp_mark_head_lost() was assuming that if a packet has tcp_skb_pcount(skb) of N, then it's safe to fragment off a prefix of M*mss bytes, for any M < N. But with the tricky way TCP pcounts are maintained, this is not always true.

For example, suppose the sender sends 4 1-byte packets and have the last 3 packet sacked. It will merge the last 3 packets in the write queue into an skb with pcount = 3 and len = 3 bytes. If another recovery happens after a sack reneging event, tcp_mark_head_lost() may attempt to split the skb assuming it has more than 2*MSS bytes.

This sounds very counterintuitive, but as the commit description for the related commit c0638c247f55 ("tcp: don't fragment SACKed skbs in tcp_mark_head_lost()") notes, this is because tcp_shifted_skb() coalesces adjacent regions of SACKed skbs, and when doing this it preserves the sum of their packet counts in order to reflect the real-world dynamics on the wire. The c0638c247f55 commit tried to avoid problems by not fragmenting SACKed skbs, since SACKed skbs are where the non-proportionality between pcount and skb->len/mss is known to be possible. However, that commit did not handle the case where during a reneging event one of these weird SACKed skbs becomes an un-SACKed skb, which tcp_mark_head_lost() can then try to fragment.

The fix is to simply mark the entire skb lost when this happens. This makes the recovery slightly more aggressive in such corner cases before we detect reordering. But once we detect reordering this code path is by-passed because FACK is disabled.

---
 net/ipv4/tcp_input.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
net/ipv4/tcp_input.c +5 -5
@@ -2165,8 +2165,7 @@ static void tcp_mark_head_lost(struct so
 {
 	struct tcp_sock *tp = tcp_sk(sk);
 	struct sk_buff *skb;
-	int cnt, oldcnt;
-	int err;
+	int cnt, oldcnt, lost;
 	unsigned int mss;
 	/* Use SACK to deduce losses of new sequences sent during recovery */
 	const u32 loss_high = tcp_is_sack(tp) ?  tp->snd_nxt : tp->high_seq;
@@ -2206,9 +2205,10 @@ static void tcp_mark_head_lost(struct so
 				break;
 
 			mss = tcp_skb_mss(skb);
-			err = tcp_fragment(sk, skb, (packets - oldcnt) * mss,
-					   mss, GFP_ATOMIC);
-			if (err < 0)
+			/* If needed, chop off the prefix to mark as lost. */
+			lost = (packets - oldcnt) * mss;
+			if (lost < skb->len &&
+			    tcp_fragment(sk, skb, lost, mss, GFP_ATOMIC) < 0)
 				break;
 			cnt = packets;
 		}
author maintainer
#55 lore raw

PATCH 53/57 staging: vt6556: vnt_start Fix missing call to vnt_key_init_table.

In reply to Greg Kroah-Hartman

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

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

From: Malcolm Priestley <[email protected]>

commit dc32190f2cd41c7dba25363ea7d618d4f5172b4e upstream.

The key table is not intialized correctly without this call.

---
 drivers/staging/vt6656/main_usb.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/staging/vt6656/main_usb.c +3 -0
@@ -529,6 +529,9 @@ static int vnt_start(struct ieee80211_hw
 		goto free_all;
 	}
 
+	if (vnt_key_init_table(priv))
+		goto free_all;
+
 	priv->int_interval = 1;  /* bInterval is set to 1 */
 
 	vnt_int_start_interrupt(priv);
author maintainer
#56 lore raw

PATCH 54/57 staging: comedi: fix clean-up of comedi_class in comedi_init()

In reply to Greg Kroah-Hartman

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

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

From: Ian Abbott <[email protected]>

commit a9332e9ad09c2644c99058fcf6ae2f355e93ce74 upstream.

There is a clean-up bug in the core comedi module initialization functions, comedi_init(). If the comedi_num_legacy_minors module parameter is non-zero (and valid), it creates that many "legacy" devices and registers them in SysFS. A failure causes the function to clean up and return an error. Unfortunately, it fails to destroy the "comedi" class that was created earlier. Fix it by adding a call to class_destroy(comedi_class) at the appropriate place in the clean-up sequence.

---
 drivers/staging/comedi/comedi_fops.c |    1 +
 1 file changed, 1 insertion(+)
drivers/staging/comedi/comedi_fops.c +1 -0
@@ -2911,6 +2911,7 @@ static int __init comedi_init(void)
 		dev = comedi_alloc_board_minor(NULL);
 		if (IS_ERR(dev)) {
 			comedi_cleanup_board_minors();
+			class_destroy(comedi_class);
 			cdev_del(&comedi_cdev);
 			unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0),
 						 COMEDI_NUM_MINORS);
author maintainer
#57 lore raw

PATCH 55/57 ext4: check return value of kstrtoull correctly in reserved_clusters_store

In reply to Greg Kroah-Hartman

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

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

From: Chao Yu <[email protected]>

commit 1ea1516fbbab2b30bf98c534ecaacba579a35208 upstream.

kstrtoull returns 0 on success, however, in reserved_clusters_store we will return -EINVAL if kstrtoull returns 0, it makes us fail to update reserved_clusters value through sysfs.

Fixes 76d33bca5581b1dd5c3157fa168db849a784ada4
---
 fs/ext4/sysfs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/sysfs.c +1 -1
@@ -100,7 +100,7 @@ static ssize_t reserved_clusters_store(s
 	int ret;
 
 	ret = kstrtoull(skip_spaces(buf), 0, &val);
-	if (!ret || val >= clusters)
+	if (ret || val >= clusters)
 		return -EINVAL;
 
 	atomic64_set(&sbi->s_resv_clusters, val);
author maintainer
#58 lore raw

PATCH 56/57 x86/mm/pat: Dont report PAT on CPUs that dont support it

In reply to Greg Kroah-Hartman

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

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

From: Mikulas Patocka <[email protected]>

commit 99c13b8c8896d7bcb92753bf0c63a8de4326e78d upstream.

The pat_enabled() logic is broken on CPUs which do not support PAT and where the initialization code fails to call pat_init(). Due to that the enabled flag stays true and pat_enabled() returns true wrongfully.

As a consequence the mappings, e.g. for Xorg, are set up with the wrong caching mode and the required MTRR setups are omitted.

To cure this the following changes are required:

1) Make pat_enabled() return true only if PAT initialization was invoked and successful.

2) Invoke init_cache_modes() unconditionally in setup_arch() and remove the extra callsites in pat_disable() and the pat disabled code path in pat_init().

Also rename __pat_enabled to pat_disabled to reflect the real purpose of this variable.

Fixes 9cd25aac1f44 ("x86/mm/pat: Emulate PAT when it is disabled")
Cc Bernhard Held <[email protected]>
Cc Denys Vlasenko <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Brian Gerst <[email protected]>
Cc "Luis R. Rodriguez" <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Josh Poimboeuf <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Linus Torvalds <[email protected]>
---
 arch/x86/include/asm/pat.h |    1 +
 arch/x86/kernel/setup.c    |    7 +++++++
 arch/x86/mm/pat.c          |   28 ++++++++++++----------------
 3 files changed, 20 insertions(+), 16 deletions(-)
arch/x86/include/asm/pat.h +1 -0
@@ -7,6 +7,7 @@
 bool pat_enabled(void);
 void pat_disable(const char *reason);
 extern void pat_init(void);
+extern void init_cache_modes(void);
 
 extern int reserve_memtype(u64 start, u64 end,
 		enum page_cache_mode req_pcm, enum page_cache_mode *ret_pcm);
arch/x86/kernel/setup.c +7 -0
@@ -1048,6 +1048,13 @@ void __init setup_arch(char **cmdline_p)
 	if (mtrr_trim_uncached_memory(max_pfn))
 		max_pfn = e820_end_of_ram_pfn();
 
+	/*
+	 * This call is required when the CPU does not support PAT. If
+	 * mtrr_bp_init() invoked it already via pat_init() the call has no
+	 * effect.
+	 */
+	init_cache_modes();
+
 #ifdef CONFIG_X86_32
 	/* max_low_pfn get updated here */
 	find_low_pfn_range();
arch/x86/mm/pat.c +12 -16
@@ -36,14 +36,14 @@
 #undef pr_fmt
 #define pr_fmt(fmt) "" fmt
 
-static bool boot_cpu_done;
-
-static int __read_mostly __pat_enabled = IS_ENABLED(CONFIG_X86_PAT);
-static void init_cache_modes(void);
+static bool __read_mostly boot_cpu_done;
+static bool __read_mostly pat_disabled = !IS_ENABLED(CONFIG_X86_PAT);
+static bool __read_mostly pat_initialized;
+static bool __read_mostly init_cm_done;
 
 void pat_disable(const char *reason)
 {
-	if (!__pat_enabled)
+	if (pat_disabled)
 		return;
 
 	if (boot_cpu_done) {
@@ -51,10 +51,8 @@ void pat_disable(const char *reason)
 		return;
 	}
 
-	__pat_enabled = 0;
+	pat_disabled = true;
 	pr_info("x86/PAT: %s\n", reason);
-
-	init_cache_modes();
 }
 
 static int __init nopat(char *str)
@@ -66,7 +64,7 @@ early_param("nopat", nopat);
 
 bool pat_enabled(void)
 {
-	return !!__pat_enabled;
+	return pat_initialized;
 }
 EXPORT_SYMBOL_GPL(pat_enabled);
 
@@ -204,6 +202,8 @@ static void __init_cache_modes(u64 pat)
 		update_cache_mode_entry(i, cache);
 	}
 	pr_info("x86/PAT: Configuration [0-7]: %s\n", pat_msg);
+
+	init_cm_done = true;
 }
 
 #define PAT(x, y)	((u64)PAT_ ## y << ((x)*8))
@@ -224,6 +224,7 @@ static void pat_bsp_init(u64 pat)
 	}
 
 	wrmsrl(MSR_IA32_CR_PAT, pat);
+	pat_initialized = true;
 
 	__init_cache_modes(pat);
 }
@@ -241,10 +242,9 @@ static void pat_ap_init(u64 pat)
 	wrmsrl(MSR_IA32_CR_PAT, pat);
 }
 
-static void init_cache_modes(void)
+void init_cache_modes(void)
 {
 	u64 pat = 0;
-	static int init_cm_done;
 
 	if (init_cm_done)
 		return;
@@ -286,8 +286,6 @@ static void init_cache_modes(void)
 	}
 
 	__init_cache_modes(pat);
-
-	init_cm_done = 1;
 }
 
 /**
@@ -305,10 +303,8 @@ void pat_init(void)
 	u64 pat;
 	struct cpuinfo_x86 *c = &boot_cpu_data;
 
-	if (!pat_enabled()) {
-		init_cache_modes();
+	if (pat_disabled)
 		return;
-	}
 
 	if ((c->x86_vendor == X86_VENDOR_INTEL) &&
 	    (((c->x86 == 0x6) && (c->x86_model <= 0xd)) ||
author maintainer
#59 lore raw

PATCH 57/57 saa7134: fix warm Medion 7134 EEPROM read

In reply to Greg Kroah-Hartman

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

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

From: Maciej S. Szmigiero <[email protected]>

commit 5a91206ff0d0548939f3e85a65fb76b400fb0e89 upstream.

When saa7134 module driving a Medion 7134 card is reloaded reads of this card EEPROM (required for automatic detection of tuner model) will be corrupted due to I2C gate in DVB-T demod being left closed. This sometimes also happens on first saa7134 module load after a warm reboot.

Fix this by opening this I2C gate before doing EEPROM read during i2c initialization.

---
 drivers/media/pci/saa7134/saa7134-i2c.c |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
drivers/media/pci/saa7134/saa7134-i2c.c +31 -0
@@ -355,12 +355,43 @@ static struct i2c_client saa7134_client_
 
 /* ----------------------------------------------------------- */
 
+/* On Medion 7134 reading EEPROM needs DVB-T demod i2c gate open */
+static void saa7134_i2c_eeprom_md7134_gate(struct saa7134_dev *dev)
+{
+	u8 subaddr = 0x7, dmdregval;
+	u8 data[2];
+	int ret;
+	struct i2c_msg i2cgatemsg_r[] = { {.addr = 0x08, .flags = 0,
+					   .buf = &subaddr, .len = 1},
+					  {.addr = 0x08,
+					   .flags = I2C_M_RD,
+					   .buf = &dmdregval, .len = 1}
+					};
+	struct i2c_msg i2cgatemsg_w[] = { {.addr = 0x08, .flags = 0,
+					   .buf = data, .len = 2} };
+
+	ret = i2c_transfer(&dev->i2c_adap, i2cgatemsg_r, 2);
+	if ((ret == 2) && (dmdregval & 0x2)) {
+		pr_debug("%s: DVB-T demod i2c gate was left closed\n",
+			 dev->name);
+
+		data[0] = subaddr;
+		data[1] = (dmdregval & ~0x2);
+		if (i2c_transfer(&dev->i2c_adap, i2cgatemsg_w, 1) != 1)
+			pr_err("%s: EEPROM i2c gate open failure\n",
+			  dev->name);
+	}
+}
+
 static int
 saa7134_i2c_eeprom(struct saa7134_dev *dev, unsigned char *eedata, int len)
 {
 	unsigned char buf;
 	int i,err;
 
+	if (dev->board == SAA7134_BOARD_MD7134)
+		saa7134_i2c_eeprom_md7134_gate(dev);
+
 	dev->i2c_client.addr = 0xa0 >> 1;
 	buf = 0;
 	if (1 != (err = i2c_master_send(&dev->i2c_client,&buf,1))) {
#60 lore raw
In reply to Greg Kroah-Hartman
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.4.77 release. There are 57 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 Sat Jul 15 15:39:40 UTC 2017. Anything received after that time might be too late.

Build results:

	total: 145 pass: 143 fail: 2

Failed builds:
arm:allmodconfig
arm:shmobile_defconfig
Qemu test results:

	total: 115 pass: 103 fail: 12
Failed tests:
	arm:beagle:multi_v7_defconfig:omap3-beagle
	arm:beaglexm:multi_v7_defconfig:omap3-beagle-xm
	arm:overo:multi_v7_defconfig:omap3-overo-tobi
	arm:sabrelite:multi_v7_defconfig:imx6dl-sabrelite
	arm:vexpress-a9:multi_v7_defconfig:vexpress-v2p-ca9
	arm:vexpress-a15:multi_v7_defconfig:vexpress-v2p-ca15-tc1
	arm:vexpress-a15-a7:multi_v7_defconfig:vexpress-v2p-ca15_a7
	arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zc702
	arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zc706
	arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zed
	arm:midway:multi_v7_defconfig:ecx-2000
	arm:smdkc210:multi_v7_defconfig:exynos4210-smdkv310

Build failures:

drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:2: error: implicit declaration of function 'PINMUX_IPSR_GPSR' drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:19: error: 'IP6_2_0' undeclared here drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:28: error: 'DVC_MUTE' undeclared here

The build failures are also the cause of the qemu test failures.

Details are available at http://kerneltests.org/builders.

Guenter

author maintainer
#61 lore raw
Quoted 31 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.4.77 release. There are 57 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 Sat Jul 15 15:39:40 UTC 2017. Anything received after that time might be too late.

Build results:

	total: 145 pass: 143 fail: 2

Failed builds:
arm:allmodconfig
arm:shmobile_defconfig
Qemu test results:

	total: 115 pass: 103 fail: 12
Failed tests:
	arm:beagle:multi_v7_defconfig:omap3-beagle
	arm:beaglexm:multi_v7_defconfig:omap3-beagle-xm
	arm:overo:multi_v7_defconfig:omap3-overo-tobi
	arm:sabrelite:multi_v7_defconfig:imx6dl-sabrelite
	arm:vexpress-a9:multi_v7_defconfig:vexpress-v2p-ca9
	arm:vexpress-a15:multi_v7_defconfig:vexpress-v2p-ca15-tc1
	arm:vexpress-a15-a7:multi_v7_defconfig:vexpress-v2p-ca15_a7
	arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zc702
	arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zc706
	arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zed
	arm:midway:multi_v7_defconfig:ecx-2000
	arm:smdkc210:multi_v7_defconfig:exynos4210-smdkv310
Quoted 7 lines

Build failures:

drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:2: error: implicit declaration of function 'PINMUX_IPSR_GPSR' drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:19: error: 'IP6_2_0' undeclared here drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:28: error: 'DVC_MUTE' undeclared here

The build failures are also the cause of the qemu test failures.

Ok, I've found the bad patch, the author marked that it should have applied for this kernel, but obviously it didn't :)

Now dropped, so all should be well.

thanks,

greg k-h

#62 lore raw
Quoted 38 lines · Greg Kroah-Hartman
Quoted 37 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.4.77 release. There are 57 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 Sat Jul 15 15:39:40 UTC 2017. Anything received after that time might be too late.

Build results:

	total: 145 pass: 143 fail: 2

Failed builds:
arm:allmodconfig
arm:shmobile_defconfig
Qemu test results:

	total: 115 pass: 103 fail: 12
Failed tests:
	arm:beagle:multi_v7_defconfig:omap3-beagle
	arm:beaglexm:multi_v7_defconfig:omap3-beagle-xm
	arm:overo:multi_v7_defconfig:omap3-overo-tobi
	arm:sabrelite:multi_v7_defconfig:imx6dl-sabrelite
	arm:vexpress-a9:multi_v7_defconfig:vexpress-v2p-ca9
	arm:vexpress-a15:multi_v7_defconfig:vexpress-v2p-ca15-tc1
	arm:vexpress-a15-a7:multi_v7_defconfig:vexpress-v2p-ca15_a7
	arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zc702
	arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zc706
	arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zed
	arm:midway:multi_v7_defconfig:ecx-2000
	arm:smdkc210:multi_v7_defconfig:exynos4210-smdkv310

Build failures:

drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:2: error: implicit declaration of function 'PINMUX_IPSR_GPSR' drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:19: error: 'IP6_2_0' undeclared here drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:28: error: 'DVC_MUTE' undeclared here

Quoted 7 lines
Quoted 1 line

The build failures are also the cause of the qemu test failures.

Ok, I've found the bad patch, the author marked that it should have applied for this kernel, but obviously it didn't :)

Now dropped, so all should be well.

Confirmed.

Thanks,
Guenter

author maintainer
#63 lore raw
Quoted 39 lines · Guenter Roeck
Quoted 38 lines · Greg Kroah-Hartman
Quoted 37 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman

This is the start of the stable review cycle for the 4.4.77 release. There are 57 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 Sat Jul 15 15:39:40 UTC 2017. Anything received after that time might be too late.

Build results:

	total: 145 pass: 143 fail: 2

Failed builds:
arm:allmodconfig
arm:shmobile_defconfig
Qemu test results:

	total: 115 pass: 103 fail: 12
Failed tests:
	arm:beagle:multi_v7_defconfig:omap3-beagle
	arm:beaglexm:multi_v7_defconfig:omap3-beagle-xm
	arm:overo:multi_v7_defconfig:omap3-overo-tobi
	arm:sabrelite:multi_v7_defconfig:imx6dl-sabrelite
	arm:vexpress-a9:multi_v7_defconfig:vexpress-v2p-ca9
	arm:vexpress-a15:multi_v7_defconfig:vexpress-v2p-ca15-tc1
	arm:vexpress-a15-a7:multi_v7_defconfig:vexpress-v2p-ca15_a7
	arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zc702
	arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zc706
	arm:xilinx-zynq-a9:multi_v7_defconfig:zynq-zed
	arm:midway:multi_v7_defconfig:ecx-2000
	arm:smdkc210:multi_v7_defconfig:exynos4210-smdkv310

Build failures:

drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:2: error: implicit declaration of function 'PINMUX_IPSR_GPSR' drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:19: error: 'IP6_2_0' undeclared here drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:28: error: 'DVC_MUTE' undeclared here

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

The build failures are also the cause of the qemu test failures.

Ok, I've found the bad patch, the author marked that it should have applied for this kernel, but obviously it didn't :)

Now dropped, so all should be well.

Confirmed.

Wonderful, thanks!

greg k-h

A message that is not in the archive (sent off-list or not yet received): [email protected]

author maintainer
#65 lore raw
Quoted 1 line · kernelci.org bot

stable-rc/linux-4.4.y boot: 99 boots: 1 failed, 92 passed with 5 offline, 1 conflict (v4.4.76-58-g1a12e8e8a429)

Any idea how 0-day and Guenter's system found problems with this release, but you all didn't? Do you not have any SH systems in kernelci?

thanks,

greg k-h

#66 lore raw
Quoted 6 lines · Greg Kroah-Hartman
Quoted 1 line · kernelci.org bot

stable-rc/linux-4.4.y boot: 99 boots: 1 failed, 92 passed with 5 offline, 1 conflict (v4.4.76-58-g1a12e8e8a429)

Any idea how 0-day and Guenter's system found problems with this release, but you all didn't? Do you not have any SH systems in kernelci?

kernelci does not do any SH builds, but it did catch this driver in the allmodconfig
builds and a couple of ARM builds that use the same one, see the mail with subject "stable-rc/linux-4.4.y build: 199 builds: 10 failed, 189 passed, 30 errors,
4 warnings (v4.4.76-58-g1a12e8e8a429)":

Errors summary:

     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:2: error: implicit
declaration of function 'PINMUX_IPSR_GPSR'
[-Werror=implicit-function-declaration]
     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:28: error:
'DVC_MUTE' undeclared here (not in a function)
     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:19: error:

'IP6_2_0' undeclared here (not in a function)

Arnd

author maintainer
#67 lore raw
Quoted 18 lines · Arnd Bergmann
Quoted 6 lines · Greg Kroah-Hartman
Quoted 1 line · kernelci.org bot

stable-rc/linux-4.4.y boot: 99 boots: 1 failed, 92 passed with 5 offline, 1 conflict (v4.4.76-58-g1a12e8e8a429)

Any idea how 0-day and Guenter's system found problems with this release, but you all didn't? Do you not have any SH systems in kernelci?

kernelci does not do any SH builds, but it did catch this driver in the allmodconfig
builds and a couple of ARM builds that use the same one, see the mail with subject "stable-rc/linux-4.4.y build: 199 builds: 10 failed, 189 passed, 30 errors,
4 warnings (v4.4.76-58-g1a12e8e8a429)":

Errors summary:

Quoted 7 lines
     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:2: error: implicit
declaration of function 'PINMUX_IPSR_GPSR'
[-Werror=implicit-function-declaration]
     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:28: error:
'DVC_MUTE' undeclared here (not in a function)
     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:19: error:

'IP6_2_0' undeclared here (not in a function)

Where is that email? I never got that, I only got this email response...

thanks,

greg k-h

#68 lore raw
Quoted 27 lines · Greg Kroah-Hartman
Quoted 18 lines · Arnd Bergmann
Quoted 6 lines · Greg Kroah-Hartman
Quoted 1 line · kernelci.org bot

stable-rc/linux-4.4.y boot: 99 boots: 1 failed, 92 passed with 5 offline, 1 conflict (v4.4.76-58-g1a12e8e8a429)

Any idea how 0-day and Guenter's system found problems with this release, but you all didn't? Do you not have any SH systems in kernelci?

kernelci does not do any SH builds, but it did catch this driver in the allmodconfig
builds and a couple of ARM builds that use the same one, see the mail with subject "stable-rc/linux-4.4.y build: 199 builds: 10 failed, 189 passed, 30 errors,
4 warnings (v4.4.76-58-g1a12e8e8a429)":

Errors summary:

Quoted 7 lines
     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:2: error: implicit
declaration of function 'PINMUX_IPSR_GPSR'
[-Werror=implicit-function-declaration]
     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:28: error:
'DVC_MUTE' undeclared here (not in a function)
     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:19: error:

'IP6_2_0' undeclared here (not in a function)

Quoted 2 lines

Where is that email? I never got that, I only got this email response...

Indeed, I see now that for some reason, only the stable/{3.16,3.18,4.4,4.9} build results get sent to the mailing list by kernelci, while the stable-rc builds only get sent to a short list of individuals that I happen to be on. I never noticed this before as I sort them in my inbox according to the sender address rather than the mailing list.

Clearly those build reports should include either you or the mailing list.

I also see that there are no builds for stable/{4.1,4.11,4.12} and stable-rc/4.1. This is apparently a result of the kernelci build bot intentionally only checking specific branches, while some of the other bots simply build all branches on the trees they watch.

Adding Kevin and [email protected] to Cc, this should be easy to resolve for future builds.

Arnd

#69 lore raw
Quoted 32 lines · Arnd Bergmann
Quoted 27 lines · Greg Kroah-Hartman
Quoted 18 lines · Arnd Bergmann
Quoted 6 lines · Greg Kroah-Hartman
Quoted 1 line · kernelci.org bot

stable-rc/linux-4.4.y boot: 99 boots: 1 failed, 92 passed with 5 offline, 1 conflict (v4.4.76-58-g1a12e8e8a429)

Any idea how 0-day and Guenter's system found problems with this release, but you all didn't? Do you not have any SH systems in kernelci?

kernelci does not do any SH builds, but it did catch this driver in the allmodconfig
builds and a couple of ARM builds that use the same one, see the mail with subject "stable-rc/linux-4.4.y build: 199 builds: 10 failed, 189 passed, 30 errors,
4 warnings (v4.4.76-58-g1a12e8e8a429)":

Errors summary:

Quoted 7 lines
     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:2: error: implicit
declaration of function 'PINMUX_IPSR_GPSR'
[-Werror=implicit-function-declaration]
     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:28: error:
'DVC_MUTE' undeclared here (not in a function)
     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:19: error:

'IP6_2_0' undeclared here (not in a function)

Quoted 2 lines

Where is that email? I never got that, I only got this email response...

Quoted 7 lines

Indeed, I see now that for some reason, only the stable/{3.16,3.18,4.4,4.9} build results get sent to the mailing list by kernelci, while the stable-rc builds only get sent to a short list of individuals that I happen to be on. I never noticed this before as I sort them in my inbox according to the sender address rather than the mailing list.

Clearly those build reports should include either you or the mailing list.

I've added stable-rc to the trees that go to the public lists.

Quoted 4 lines

I also see that there are no builds for stable/{4.1,4.11,4.12} and stable-rc/4.1. This is apparently a result of the kernelci build bot intentionally only checking specific branches, while some of the other bots simply build all branches on the trees they watch.

v4.11 and v4.12 were added recently, and you've probably noticed they've started showing up now, both for stable and stable-rc.

Kevin

#70 lore raw
In reply to Greg Kroah-Hartman

Hi Greg,

Quoted 11 lines · Greg Kroah-Hartman
Quoted 10 lines · Arnd Bergmann
Quoted 6 lines · Greg Kroah-Hartman
Quoted 1 line · kernelci.org bot

stable-rc/linux-4.4.y boot: 99 boots: 1 failed, 92 passed with 5 offline, 1 conflict (v4.4.76-58-g1a12e8e8a429)

Any idea how 0-day and Guenter's system found problems with this release, but you all didn't? Do you not have any SH systems in kernelci?

kernelci does not do any SH builds, but it did catch this driver in

Despite the sh-pfc name (from legacy "shmobile"), this is a pinctrl driver for an ARM SoC.

Quoted 16 lines
Quoted 8 lines

the allmodconfig
builds and a couple of ARM builds that use the same one, see the mail with subject "stable-rc/linux-4.4.y build: 199 builds: 10 failed, 189 passed, 30 errors,
4 warnings (v4.4.76-58-g1a12e8e8a429)":

Errors summary:

Quoted 7 lines
     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:2: error: implicit
declaration of function 'PINMUX_IPSR_GPSR'
[-Werror=implicit-function-declaration]
     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:28: error:
'DVC_MUTE' undeclared here (not in a function)
     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:19: error:

'IP6_2_0' undeclared here (not in a function)

Quoted 2 lines

Where is that email? I never got that, I only got this email response...

BTW, both you and I should have received the following email from kbuild test robot <[email protected]>:

[linux-stable-rc:linux-4.4.y 4899/4940] drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:2: error: implicit declaration of function 'PINMUX_IPSR_GPSR'

Unfortunately I had a day off, so I couldn't reply in time that that commit depends on commit e01678e35f4be547 ("pinctrl: sh-pfc: Rename PINMUX_IPSR_DATA() to PINMUX_IPSR_GPSR()"). As that one is
a bit heavy to backport, an alternative way to backport 3908632fb829d733 ("pinctrl: sh-pfc: r8a7791: Add missing DVC_MUTE signal") is this (gmail-webinterface-whitespace-damaged) diff:

(quoted diff) +0 -0

b/drivers/pinctrl/sh-pfc/pfc-r8a7791.c
index 3d0490392adb7fb2..3d9e36ebcc6c6913 100644

drivers/pinctrl/sh-pfc/pfc-r8a7791.c +1 -1
@@ -1093,7 +1093,7 @@ static const u16 pinmux_data[] = {
        PINMUX_IPSR_MSEL(IP6_2_0, STP_OPWM_0_B, SEL_SSP_1),
        PINMUX_IPSR_MSEL(IP6_2_0, MSIOF1_SCK_B, SEL_SOF1_1),
        PINMUX_IPSR_MSEL(IP6_2_0, SCIF_CLK, SEL_SCIF_0),
-       PINMUX_IPSR_GPSR(IP6_2_0, DVC_MUTE),
+       PINMUX_IPSR_DATA(IP6_2_0, DVC_MUTE),
        PINMUX_IPSR_MSEL(IP6_2_0, BPFCLK_E, SEL_FM_4),
        PINMUX_IPSR_DATA(IP6_5_3, AUDIO_CLKC),
        PINMUX_IPSR_MSEL(IP6_5_3, SCIFB0_SCK_C, SEL_SCIFB_2),

However, as probably nobody uses the DVC_MUTE signal, dropping its backporting should be OK, too.

Sorry for the fuzz...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#71 lore raw
Quoted 38 lines · Geert Uytterhoeven

Hi Greg,

Quoted 11 lines · Greg Kroah-Hartman
Quoted 10 lines · Arnd Bergmann
Quoted 6 lines · Greg Kroah-Hartman
Quoted 1 line · kernelci.org bot

stable-rc/linux-4.4.y boot: 99 boots: 1 failed, 92 passed with 5 offline, 1 conflict (v4.4.76-58-g1a12e8e8a429)

Any idea how 0-day and Guenter's system found problems with this release, but you all didn't? Do you not have any SH systems in kernelci?

kernelci does not do any SH builds, but it did catch this driver in

Despite the sh-pfc name (from legacy "shmobile"), this is a pinctrl driver for an ARM SoC.

Quoted 16 lines
Quoted 8 lines

the allmodconfig
builds and a couple of ARM builds that use the same one, see the mail with subject "stable-rc/linux-4.4.y build: 199 builds: 10 failed, 189 passed, 30 errors,
4 warnings (v4.4.76-58-g1a12e8e8a429)":

Errors summary:

Quoted 7 lines
     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:2: error: implicit
declaration of function 'PINMUX_IPSR_GPSR'
[-Werror=implicit-function-declaration]
     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:28: error:
'DVC_MUTE' undeclared here (not in a function)
     10  drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:19: error:

'IP6_2_0' undeclared here (not in a function)

Quoted 2 lines

Where is that email? I never got that, I only got this email response...

Quoted 6 lines

BTW, both you and I should have received the following email from kbuild test robot <[email protected]>:

[linux-stable-rc:linux-4.4.y 4899/4940] drivers/pinctrl/sh-pfc/pfc-r8a7791.c:1096:2: error: implicit declaration of function 'PINMUX_IPSR_GPSR'

Yes, I got the 0-day bot email, as I stated way up above, I was wondering why kernel.ci didn't catch it. Looks like it did, just that it never told me about it :)

thanks,

greg k-h-

#72 lore raw
In reply to Greg Kroah-Hartman
Quoted 6 lines · Greg Kroah-Hartman
Quoted 1 line · kernelci.org bot

stable-rc/linux-4.4.y boot: 99 boots: 1 failed, 92 passed with 5 offline, 1 conflict (v4.4.76-58-g1a12e8e8a429)

Any idea how 0-day and Guenter's system found problems with this release, but you all didn't? Do you not have any SH systems in kernelci?

No, SH is really not at all widely available. We do boot a few qemu things but just for architectures that we're booting physical systems with and there's no SH ones.

author maintainer
#73 lore raw
Quoted 11 lines · Mark Brown
Quoted 6 lines · Greg Kroah-Hartman
Quoted 1 line · kernelci.org bot

stable-rc/linux-4.4.y boot: 99 boots: 1 failed, 92 passed with 5 offline, 1 conflict (v4.4.76-58-g1a12e8e8a429)

Any idea how 0-day and Guenter's system found problems with this release, but you all didn't? Do you not have any SH systems in kernelci?

No, SH is really not at all widely available. We do boot a few qemu things but just for architectures that we're booting physical systems with and there's no SH ones.

Ah, ok, fair enough, thanks.

greg k-h