linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3.18 00/68] 3.18.52-stable review
@ 2017-05-05 18:31 Greg Kroah-Hartman
  2017-05-05 18:31 ` [PATCH 3.18 01/68] f2fs: do more integrity verification for superblock Greg Kroah-Hartman
                   ` (67 more replies)
  0 siblings, 68 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, torvalds, akpm, linux, shuahkh, patches,
	ben.hutchings, stable

This is the start of the stable review cycle for the 3.18.52 release.
There are 68 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 Sun May  7 18:31:52 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/v3.x/stable-review/patch-3.18.52-rc1.gz
or in the git tree and branch at:
  git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-3.18.y
and the diffstat can be found below.

thanks,

greg k-h

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

Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Linux 3.18.52-rc1

Masahiro Yamada <yamada.masahiro@socionext.com>
    kbuild: mergeconfig: fix "jobserver unavailable" warning

Arnd Bergmann <arnd@arndb.de>
    gfs2: remove IS_ERR_VALUE abuse

Jeff Kirsher <jeffrey.t.kirsher@intel.com>
    e1000e: fix call to do_div() to use u64 arg

Rusty Russell <rusty@rustcorp.com.au>
    cpumask_set_cpu_local_first => cpumask_local_spread, lament

Paul Gortmaker <paul.gortmaker@windriver.com>
    modpost: don't emit section mismatch warnings for compiler optimizations

Paul Gortmaker <paul.gortmaker@windriver.com>
    modpost: expand pattern matching to support substring matches

Arnd Bergmann <arnd@arndb.de>
    scsi: advansys: remove #warning message

Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    message: i2o: fix 64bit build warnings

Benjamin Romer <benjamin.romer@unisys.com>
    staging: unisys: correctly handle return value from queue_delayed_work()

Ralf Baechle <ralf@linux-mips.org>
    MIPS: elf2ecoff: Fix warning due to dead code.

Ralf Baechle <ralf@linux-mips.org>
    MIPS: elf2ecoff: Ignore PT_MIPS_ABIFLAGS program headers.

Arnd Bergmann <arnd@arndb.de>
    MIPS: jz4740: fix build error in irq.h

Stephen Rothwell <sfr@canb.auug.org.au>
    mm/cma: silence warnings due to max() usage

Arnd Bergmann <arnd@arndb.de>
    arm64: build vdso without libgcov

Arnd Bergmann <arnd@arndb.de>
    mISDN: avoid arch specific __builtin_return_address call

James Bottomley <JBottomley@Odin.com>
    ips: remove pointless #warning

Arnd Bergmann <arnd@arndb.de>
    infiniband: mlx5: avoid a compile-time warning

Arnd Bergmann <arnd@arndb.de>
    tty/isicom: fix big-endian compile warning

Arnd Bergmann <arnd@arndb.de>
    IB/ehca: fix maybe-uninitialized warnings

Arnd Bergmann <arnd@arndb.de>
    IB/qib: rename BITS_PER_PAGE to RVT_BITS_PER_PAGE

Arnd Bergmann <arnd@arndb.de>
    staging: bcm: add 32-bit host dependency

Arnd Bergmann <arnd@arndb.de>
    staging: imx-drm: fix indentation warning

Arnd Bergmann <arnd@arndb.de>
    staging: vt6655: fix overly large stack usage

Fabio Estevam <fabio.estevam@freescale.com>
    arm64: Provide a namespace to NCAPS

Arnd Bergmann <arnd@arndb.de>
    ARM: cns3xxx: shut up frame size warning

Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    mm: avoid setting up anonymous pages into file mapping

Eric Dumazet <edumazet@google.com>
    net: avoid signed overflows for SO_{SND|RCV}BUFFORCE

Guillaume Nault <g.nault@alphalink.fr>
    l2tp: fix racy SOCK_ZAPPED flag check in l2tp_ip{,6}_bind()

Jan Kara <jack@suse.cz>
    posix_acl: Clear SGID bit when setting file permissions

Peter Zijlstra <peterz@infradead.org>
    perf: Tighten (and fix) the grouping condition

Seung-Woo Kim <sw0312.kim@samsung.com>
    regulator: core: Fix regualtor_ena_gpio_free not to access pin after freeing

Takashi Iwai <tiwai@suse.de>
    ALSA: pcm : Call kill_fasync() in stream lock

Sachin Prabhu <sprabhu@redhat.com>
    Handle mismatched open calls

Thomas Gleixner <tglx@linutronix.de>
    timerfd: Protect the might cancel mechanism proper

Arnd Bergmann <arnd@arndb.de>
    net: tg3: avoid uninitialized variable warning

Arnd Bergmann <arnd@arndb.de>
    cred/userns: define current_user_ns() as a function

Arnd Bergmann <arnd@arndb.de>
    ALSA: ppc/awacs: shut up maybe-uninitialized warning

Arnd Bergmann <arnd@arndb.de>
    PCI: xilinx: Fix harmless format string warning

Arnd Bergmann <arnd@arndb.de>
    mlx5: avoid build warnings on 32-bit

Arnd Bergmann <arnd@arndb.de>
    mtd: avoid stack overflow in MTD CFI code

Sagi Grimberg <sagig@mellanox.com>
    IB/iser: Fix sparse warnings

Lars Ellenberg <lars.ellenberg@linbit.com>
    drbd: avoid redefinition of BITS_PER_PAGE

Khem Raj <raj.khem@gmail.com>
    powerpc/ptrace: Fix out of bounds array access warning

Josh Poimboeuf <jpoimboe@redhat.com>
    ftrace/x86: Fix triple fault with graph tracing and suspend-to-ram

J. Bruce Fields <bfields@redhat.com>
    nfsd: check for oversized NFSv2/v3 arguments

Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Input: i8042 - add Clevo P650RS to the i8042 reset list

Al Viro <viro@zeniv.linux.org.uk>
    p9_client_readdir() fix

James Hogan <james.hogan@imgtec.com>
    MIPS: KGDB: Use kernel context for sleeping threads

Takashi Iwai <tiwai@suse.de>
    ALSA: seq: Don't break snd_use_lock_sync() loop by timeout

Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
    ip6mr: fix notification device destruction

Tushar Dave <tushar.n.dave@oracle.com>
    netpoll: Check for skb->queue_mapping

Xin Long <lucien.xin@gmail.com>
    sctp: listen on the sock only when it's state is listening or closed

Florian Larysch <fl@n621.de>
    net: ipv4: fix multipath RTM_GETROUTE behavior when iif is given

Andrey Konovalov <andreyknvl@google.com>
    net/packet: fix overflow in check for tp_reserve

Andrey Konovalov <andreyknvl@google.com>
    net/packet: fix overflow in check for tp_frame_nr

Guillaume Nault <g.nault@alphalink.fr>
    l2tp: purge socket queues in the .destruct() callback

Nathan Sullivan <nathan.sullivan@ni.com>
    net: phy: handle state correctly in phy_stop_machine

Eric Dumazet <edumazet@google.com>
    net: neigh: guard against NULL solicit() method

Tom Hromatka <tom.hromatka@oracle.com>
    sparc64: Fix kernel panic due to erroneous #ifdef surrounding pmd_write()

bob picco <bob.picco@oracle.com>
    sparc64: kern_addr_valid regression

Stefano Stabellini <sstabellini@kernel.org>
    xen/x86: don't lose event interrupts

Felipe F. Tonello <eu@felipetonello.com>
    usb: gadget: f_midi: Fixed a bug when buflen was smaller than wMaxPacketSize

santosh.shilimkar@oracle.com <santosh.shilimkar@oracle.com>
    RDS: Fix the atomicity for congestion map update

Corey Minyard <cminyard@mvista.com>
    MIPS: Fix crash registers on non-crashing CPUs

Wei Fang <fangwei1@huawei.com>
    md:raid1: fix a dead loop when read from a WriteMostly disk

Theodore Ts'o <tytso@mit.edu>
    ext4: check if in-inode xattr is corrupted in ext4_expand_extra_isize_ea()

Dan Carpenter <dan.carpenter@oracle.com>
    xc2028: unlock on error in xc2028_set_config()

Chao Yu <chao2.yu@samsung.com>
    f2fs: do more integrity verification for superblock


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

Diffstat:

 Makefile                                          |  4 +-
 arch/arm/mach-cns3xxx/Makefile                    |  1 +
 arch/arm64/include/asm/cpufeature.h               | 10 +--
 arch/arm64/kernel/setup.c                         |  2 +-
 arch/arm64/kernel/vdso/Makefile                   |  3 +
 arch/mips/boot/elf2ecoff.c                        | 10 +--
 arch/mips/jz4740/irq.h                            |  2 +
 arch/mips/kernel/crash.c                          | 16 +++-
 arch/mips/kernel/kgdb.c                           | 48 +++++++----
 arch/powerpc/kernel/ptrace.c                      |  4 +-
 arch/sparc/include/asm/pgtable_64.h               | 15 ++--
 arch/sparc/mm/init_64.c                           |  2 +-
 arch/x86/kernel/ftrace.c                          | 12 +++
 arch/x86/xen/time.c                               |  6 +-
 drivers/block/drbd/drbd_bitmap.c                  |  6 ++
 drivers/infiniband/hw/ehca/ehca_mrmw.c            |  3 +-
 drivers/infiniband/hw/mlx5/mem.c                  |  2 +-
 drivers/infiniband/hw/qib/qib_qp.c                | 18 ++---
 drivers/infiniband/ulp/iser/iser_memory.c         |  1 -
 drivers/infiniband/ulp/iser/iser_verbs.c          | 15 ++--
 drivers/input/serio/i8042-x86ia64io.h             |  7 ++
 drivers/isdn/hardware/mISDN/mISDNipac.c           | 12 ++-
 drivers/isdn/hardware/mISDN/w6692.c               |  6 +-
 drivers/md/raid1.c                                |  2 +-
 drivers/media/tuners/tuner-xc2028.c               |  7 +-
 drivers/message/i2o/i2o_config.c                  |  4 +-
 drivers/mtd/chips/Kconfig                         |  1 +
 drivers/net/ethernet/broadcom/tg3.c               |  2 +-
 drivers/net/ethernet/intel/e1000e/ich8lan.c       | 13 +--
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c    | 10 +--
 drivers/net/ethernet/mellanox/mlx4/en_tx.c        |  6 +-
 drivers/net/ethernet/mellanox/mlx5/core/debugfs.c |  6 +-
 drivers/net/phy/phy.c                             |  2 +-
 drivers/pci/host/pcie-xilinx.c                    |  4 +-
 drivers/regulator/core.c                          |  2 +
 drivers/scsi/advansys.c                           |  3 +-
 drivers/scsi/ips.c                                |  9 ++-
 drivers/staging/bcm/Kconfig                       |  1 +
 drivers/staging/imx-drm/imx-hdmi.c                |  2 +-
 drivers/staging/unisys/visorutil/periodic_work.c  |  8 +-
 drivers/staging/vt6655/device_main.c              | 10 ++-
 drivers/tty/isicom.c                              |  2 +-
 drivers/usb/gadget/function/f_midi.c              |  4 +-
 fs/9p/acl.c                                       | 40 ++++-----
 fs/btrfs/acl.c                                    |  6 +-
 fs/ceph/acl.c                                     |  6 +-
 fs/cifs/cifsglob.h                                | 11 +++
 fs/cifs/cifssmb.c                                 |  4 +
 fs/cifs/connect.c                                 | 13 ++-
 fs/cifs/smb2misc.c                                | 44 ++++++++++
 fs/cifs/smb2ops.c                                 |  4 +
 fs/cifs/smb2proto.h                               |  7 ++
 fs/cifs/smb2transport.c                           | 58 ++++++++++++--
 fs/cifs/transport.c                               |  2 +
 fs/ext2/acl.c                                     | 12 +--
 fs/ext4/acl.c                                     | 12 +--
 fs/ext4/xattr.c                                   | 32 +++++++-
 fs/f2fs/acl.c                                     |  6 +-
 fs/f2fs/super.c                                   | 98 +++++++++++++++++++++++
 fs/gfs2/acl.c                                     | 12 +--
 fs/gfs2/dir.c                                     | 15 ++--
 fs/hfsplus/posix_acl.c                            |  4 +-
 fs/jffs2/acl.c                                    |  9 +--
 fs/jfs/acl.c                                      |  6 +-
 fs/nfsd/nfssvc.c                                  | 36 +++++++++
 fs/ocfs2/acl.c                                    | 20 ++---
 fs/posix_acl.c                                    | 31 +++++++
 fs/reiserfs/xattr_acl.c                           |  8 +-
 fs/timerfd.c                                      | 17 +++-
 fs/xfs/xfs_acl.c                                  | 13 +--
 include/linux/capability.h                        |  2 -
 include/linux/cpumask.h                           |  6 +-
 include/linux/cred.h                              |  5 +-
 include/linux/mtd/map.h                           | 19 ++---
 include/linux/perf_event.h                        |  6 --
 include/linux/posix_acl.h                         |  1 +
 kernel/events/core.c                              | 15 +++-
 lib/cpumask.c                                     | 74 ++++++-----------
 mm/cma.c                                          |  7 +-
 mm/memory.c                                       | 13 ++-
 net/9p/client.c                                   |  4 +
 net/core/neighbour.c                              |  3 +-
 net/core/netpoll.c                                | 10 ++-
 net/core/sock.c                                   |  4 +-
 net/ipv4/route.c                                  |  2 +-
 net/ipv6/ip6mr.c                                  | 13 ++-
 net/l2tp/l2tp_ip.c                                |  5 +-
 net/l2tp/l2tp_ip6.c                               |  5 +-
 net/l2tp/l2tp_ppp.c                               |  7 +-
 net/packet/af_packet.c                            |  4 +
 net/rds/cong.c                                    |  4 +-
 net/sctp/socket.c                                 |  3 +
 scripts/kconfig/Makefile                          |  2 +-
 scripts/mod/modpost.c                             | 34 +++++++-
 sound/core/pcm_lib.c                              |  2 +-
 sound/core/seq/seq_lock.c                         |  9 +--
 sound/ppc/awacs.c                                 |  1 +
 97 files changed, 742 insertions(+), 347 deletions(-)

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 01/68] f2fs: do more integrity verification for superblock
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
@ 2017-05-05 18:31 ` Greg Kroah-Hartman
  2017-05-05 18:31 ` [PATCH 3.18 02/68] [media] xc2028: unlock on error in xc2028_set_config() Greg Kroah-Hartman
                   ` (66 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Chao Yu, Jaegeuk Kim

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

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

From: Chao Yu <chao2.yu@samsung.com>

commit 9a59b62fd88196844cee5fff851bee2cfd7afb6e upstream.

Do more sanity check for superblock during ->mount.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/f2fs/super.c |   98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 98 insertions(+)

--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -772,6 +772,79 @@ static loff_t max_file_size(unsigned bit
 	return result;
 }
 
+static inline bool sanity_check_area_boundary(struct super_block *sb,
+					struct f2fs_super_block *raw_super)
+{
+	u32 segment0_blkaddr = le32_to_cpu(raw_super->segment0_blkaddr);
+	u32 cp_blkaddr = le32_to_cpu(raw_super->cp_blkaddr);
+	u32 sit_blkaddr = le32_to_cpu(raw_super->sit_blkaddr);
+	u32 nat_blkaddr = le32_to_cpu(raw_super->nat_blkaddr);
+	u32 ssa_blkaddr = le32_to_cpu(raw_super->ssa_blkaddr);
+	u32 main_blkaddr = le32_to_cpu(raw_super->main_blkaddr);
+	u32 segment_count_ckpt = le32_to_cpu(raw_super->segment_count_ckpt);
+	u32 segment_count_sit = le32_to_cpu(raw_super->segment_count_sit);
+	u32 segment_count_nat = le32_to_cpu(raw_super->segment_count_nat);
+	u32 segment_count_ssa = le32_to_cpu(raw_super->segment_count_ssa);
+	u32 segment_count_main = le32_to_cpu(raw_super->segment_count_main);
+	u32 segment_count = le32_to_cpu(raw_super->segment_count);
+	u32 log_blocks_per_seg = le32_to_cpu(raw_super->log_blocks_per_seg);
+
+	if (segment0_blkaddr != cp_blkaddr) {
+		f2fs_msg(sb, KERN_INFO,
+			"Mismatch start address, segment0(%u) cp_blkaddr(%u)",
+			segment0_blkaddr, cp_blkaddr);
+		return true;
+	}
+
+	if (cp_blkaddr + (segment_count_ckpt << log_blocks_per_seg) !=
+							sit_blkaddr) {
+		f2fs_msg(sb, KERN_INFO,
+			"Wrong CP boundary, start(%u) end(%u) blocks(%u)",
+			cp_blkaddr, sit_blkaddr,
+			segment_count_ckpt << log_blocks_per_seg);
+		return true;
+	}
+
+	if (sit_blkaddr + (segment_count_sit << log_blocks_per_seg) !=
+							nat_blkaddr) {
+		f2fs_msg(sb, KERN_INFO,
+			"Wrong SIT boundary, start(%u) end(%u) blocks(%u)",
+			sit_blkaddr, nat_blkaddr,
+			segment_count_sit << log_blocks_per_seg);
+		return true;
+	}
+
+	if (nat_blkaddr + (segment_count_nat << log_blocks_per_seg) !=
+							ssa_blkaddr) {
+		f2fs_msg(sb, KERN_INFO,
+			"Wrong NAT boundary, start(%u) end(%u) blocks(%u)",
+			nat_blkaddr, ssa_blkaddr,
+			segment_count_nat << log_blocks_per_seg);
+		return true;
+	}
+
+	if (ssa_blkaddr + (segment_count_ssa << log_blocks_per_seg) !=
+							main_blkaddr) {
+		f2fs_msg(sb, KERN_INFO,
+			"Wrong SSA boundary, start(%u) end(%u) blocks(%u)",
+			ssa_blkaddr, main_blkaddr,
+			segment_count_ssa << log_blocks_per_seg);
+		return true;
+	}
+
+	if (main_blkaddr + (segment_count_main << log_blocks_per_seg) !=
+		segment0_blkaddr + (segment_count << log_blocks_per_seg)) {
+		f2fs_msg(sb, KERN_INFO,
+			"Wrong MAIN_AREA boundary, start(%u) end(%u) blocks(%u)",
+			main_blkaddr,
+			segment0_blkaddr + (segment_count << log_blocks_per_seg),
+			segment_count_main << log_blocks_per_seg);
+		return true;
+	}
+
+	return false;
+}
+
 static int sanity_check_raw_super(struct super_block *sb,
 			struct f2fs_super_block *raw_super)
 {
@@ -801,6 +874,14 @@ static int sanity_check_raw_super(struct
 		return 1;
 	}
 
+	/* check log blocks per segment */
+	if (le32_to_cpu(raw_super->log_blocks_per_seg) != 9) {
+		f2fs_msg(sb, KERN_INFO,
+			"Invalid log blocks per segment (%u)\n",
+			le32_to_cpu(raw_super->log_blocks_per_seg));
+		return 1;
+	}
+
 	/* Currently, support 512/1024/2048/4096 bytes sector size */
 	if (le32_to_cpu(raw_super->log_sectorsize) >
 				F2FS_MAX_LOG_SECTOR_SIZE ||
@@ -819,6 +900,23 @@ static int sanity_check_raw_super(struct
 			le32_to_cpu(raw_super->log_sectorsize));
 		return 1;
 	}
+
+	/* check reserved ino info */
+	if (le32_to_cpu(raw_super->node_ino) != 1 ||
+		le32_to_cpu(raw_super->meta_ino) != 2 ||
+		le32_to_cpu(raw_super->root_ino) != 3) {
+		f2fs_msg(sb, KERN_INFO,
+			"Invalid Fs Meta Ino: node(%u) meta(%u) root(%u)",
+			le32_to_cpu(raw_super->node_ino),
+			le32_to_cpu(raw_super->meta_ino),
+			le32_to_cpu(raw_super->root_ino));
+		return 1;
+	}
+
+	/* check CP/SIT/NAT/SSA/MAIN_AREA area boundary */
+	if (sanity_check_area_boundary(sb, raw_super))
+		return 1;
+
 	return 0;
 }
 

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 02/68] [media] xc2028: unlock on error in xc2028_set_config()
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
  2017-05-05 18:31 ` [PATCH 3.18 01/68] f2fs: do more integrity verification for superblock Greg Kroah-Hartman
@ 2017-05-05 18:31 ` Greg Kroah-Hartman
  2017-05-05 18:31 ` [PATCH 3.18 03/68] ext4: check if in-inode xattr is corrupted in ext4_expand_extra_isize_ea() Greg Kroah-Hartman
                   ` (65 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dan Carpenter, Mauro Carvalho Chehab

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

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

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 210bd104c6acd31c3c6b8b075b3f12d4a9f6b60d upstream.

We have to unlock before returning -ENOMEM.

Fixes: 8dfbcc4351a0 ('[media] xc2028: avoid use after free')

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/media/tuners/tuner-xc2028.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/drivers/media/tuners/tuner-xc2028.c
+++ b/drivers/media/tuners/tuner-xc2028.c
@@ -1407,8 +1407,10 @@ static int xc2028_set_config(struct dvb_
 	memcpy(&priv->ctrl, p, sizeof(priv->ctrl));
 	if (p->fname) {
 		priv->ctrl.fname = kstrdup(p->fname, GFP_KERNEL);
-		if (priv->ctrl.fname == NULL)
-			return -ENOMEM;
+		if (priv->ctrl.fname == NULL) {
+			rc = -ENOMEM;
+			goto unlock;
+		}
 	}
 
 	/*
@@ -1440,6 +1442,7 @@ static int xc2028_set_config(struct dvb_
 		} else
 			priv->state = XC2028_WAITING_FIRMWARE;
 	}
+unlock:
 	mutex_unlock(&priv->lock);
 
 	return rc;

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 03/68] ext4: check if in-inode xattr is corrupted in ext4_expand_extra_isize_ea()
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
  2017-05-05 18:31 ` [PATCH 3.18 01/68] f2fs: do more integrity verification for superblock Greg Kroah-Hartman
  2017-05-05 18:31 ` [PATCH 3.18 02/68] [media] xc2028: unlock on error in xc2028_set_config() Greg Kroah-Hartman
@ 2017-05-05 18:31 ` Greg Kroah-Hartman
  2017-05-05 18:31 ` [PATCH 3.18 04/68] md:raid1: fix a dead loop when read from a WriteMostly disk Greg Kroah-Hartman
                   ` (64 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Theodore Tso, Julia Lawall

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

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

From: Theodore Ts'o <tytso@mit.edu>

commit 9e92f48c34eb2b9af9d12f892e2fe1fce5e8ce35 upstream.

We aren't checking to see if the in-inode extended attribute is
corrupted before we try to expand the inode's extra isize fields.

This can lead to potential crashes caused by the BUG_ON() check in
ext4_xattr_shift_entries().

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ext4/xattr.c |   32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -233,6 +233,27 @@ ext4_xattr_check_block(struct inode *ino
 	return error;
 }
 
+static int
+__xattr_check_inode(struct inode *inode, struct ext4_xattr_ibody_header *header,
+			 void *end, const char *function, unsigned int line)
+{
+	struct ext4_xattr_entry *entry = IFIRST(header);
+	int error = -EIO;
+
+	if (((void *) header >= end) ||
+	    (header->h_magic != le32_to_cpu(EXT4_XATTR_MAGIC)))
+		goto errout;
+	error = ext4_xattr_check_names(entry, end, entry);
+errout:
+	if (error)
+		__ext4_error_inode(inode, function, line, 0,
+				   "corrupted in-inode xattr");
+	return error;
+}
+
+#define xattr_check_inode(inode, header, end) \
+	__xattr_check_inode((inode), (header), (end), __func__, __LINE__)
+
 static inline int
 ext4_xattr_check_entry(struct ext4_xattr_entry *entry, size_t size)
 {
@@ -344,7 +365,7 @@ ext4_xattr_ibody_get(struct inode *inode
 	header = IHDR(inode, raw_inode);
 	entry = IFIRST(header);
 	end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
-	error = ext4_xattr_check_names(entry, end, entry);
+	error = xattr_check_inode(inode, header, end);
 	if (error)
 		goto cleanup;
 	error = ext4_xattr_find_entry(&entry, name_index, name,
@@ -476,7 +497,7 @@ ext4_xattr_ibody_list(struct dentry *den
 	raw_inode = ext4_raw_inode(&iloc);
 	header = IHDR(inode, raw_inode);
 	end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
-	error = ext4_xattr_check_names(IFIRST(header), end, IFIRST(header));
+	error = xattr_check_inode(inode, header, end);
 	if (error)
 		goto cleanup;
 	error = ext4_xattr_list_entries(dentry, IFIRST(header),
@@ -993,8 +1014,7 @@ int ext4_xattr_ibody_find(struct inode *
 	is->s.here = is->s.first;
 	is->s.end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
 	if (ext4_test_inode_state(inode, EXT4_STATE_XATTR)) {
-		error = ext4_xattr_check_names(IFIRST(header), is->s.end,
-					       IFIRST(header));
+		error = xattr_check_inode(inode, header, is->s.end);
 		if (error)
 			return error;
 		/* Find the named attribute. */
@@ -1291,6 +1311,10 @@ retry:
 	last = entry;
 	total_ino = sizeof(struct ext4_xattr_ibody_header);
 
+	error = xattr_check_inode(inode, header, end);
+	if (error)
+		goto cleanup;
+
 	free = ext4_xattr_free_space(last, &min_offs, base, &total_ino);
 	if (free >= new_extra_isize) {
 		entry = IFIRST(header);

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 04/68] md:raid1: fix a dead loop when read from a WriteMostly disk
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2017-05-05 18:31 ` [PATCH 3.18 03/68] ext4: check if in-inode xattr is corrupted in ext4_expand_extra_isize_ea() Greg Kroah-Hartman
@ 2017-05-05 18:31 ` Greg Kroah-Hartman
  2017-05-05 18:31 ` [PATCH 3.18 05/68] MIPS: Fix crash registers on non-crashing CPUs Greg Kroah-Hartman
                   ` (63 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Wei Fang, Shaohua Li, Julia Lawall

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

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

From: Wei Fang <fangwei1@huawei.com>

commit 816b0acf3deb6d6be5d0519b286fdd4bafade905 upstream.

If first_bad == this_sector when we get the WriteMostly disk
in read_balance(), valid disk will be returned with zero
max_sectors. It'll lead to a dead loop in make_request(), and
OOM will happen because of endless allocation of struct bio.

Since we can't get data from this disk in this case, so
continue for another disk.

Signed-off-by: Wei Fang <fangwei1@huawei.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/md/raid1.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -563,7 +563,7 @@ static int read_balance(struct r1conf *c
 			if (best_dist_disk < 0) {
 				if (is_badblock(rdev, this_sector, sectors,
 						&first_bad, &bad_sectors)) {
-					if (first_bad < this_sector)
+					if (first_bad <= this_sector)
 						/* Cannot use this */
 						continue;
 					best_good_sectors = first_bad - this_sector;

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 05/68] MIPS: Fix crash registers on non-crashing CPUs
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2017-05-05 18:31 ` [PATCH 3.18 04/68] md:raid1: fix a dead loop when read from a WriteMostly disk Greg Kroah-Hartman
@ 2017-05-05 18:31 ` Greg Kroah-Hartman
  2017-05-05 18:31 ` [PATCH 3.18 06/68] RDS: Fix the atomicity for congestion map update Greg Kroah-Hartman
                   ` (62 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Corey Minyard, David Daney,
	linux-mips, Ralf Baechle, Julia Lawall

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

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

From: Corey Minyard <cminyard@mvista.com>

commit c80e1b62ffca52e2d1d865ee58bc79c4c0c55005 upstream.

As part of handling a crash on an SMP system, an IPI is send to
all other CPUs to save their current registers and stop.  It was
using task_pt_regs(current) to get the registers, but that will
only be accurate if the CPU was interrupted running in userland.
Instead allow the architecture to pass in the registers (all
pass NULL now, but allow for the future) and then use get_irq_regs()
which should be accurate as we are in an interrupt.  Fall back to
task_pt_regs(current) if nothing else is available.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: David Daney <ddaney@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/13050/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/mips/kernel/crash.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

--- a/arch/mips/kernel/crash.c
+++ b/arch/mips/kernel/crash.c
@@ -14,12 +14,22 @@ static int crashing_cpu = -1;
 static cpumask_t cpus_in_crash = CPU_MASK_NONE;
 
 #ifdef CONFIG_SMP
-static void crash_shutdown_secondary(void *ignore)
+static void crash_shutdown_secondary(void *passed_regs)
 {
-	struct pt_regs *regs;
+	struct pt_regs *regs = passed_regs;
 	int cpu = smp_processor_id();
 
-	regs = task_pt_regs(current);
+	/*
+	 * If we are passed registers, use those.  Otherwise get the
+	 * regs from the last interrupt, which should be correct, as
+	 * we are in an interrupt.  But if the regs are not there,
+	 * pull them from the top of the stack.  They are probably
+	 * wrong, but we need something to keep from crashing again.
+	 */
+	if (!regs)
+		regs = get_irq_regs();
+	if (!regs)
+		regs = task_pt_regs(current);
 
 	if (!cpu_online(cpu))
 		return;

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 06/68] RDS: Fix the atomicity for congestion map update
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2017-05-05 18:31 ` [PATCH 3.18 05/68] MIPS: Fix crash registers on non-crashing CPUs Greg Kroah-Hartman
@ 2017-05-05 18:31 ` Greg Kroah-Hartman
  2017-05-05 18:31 ` [PATCH 3.18 07/68] usb: gadget: f_midi: Fixed a bug when buflen was smaller than wMaxPacketSize Greg Kroah-Hartman
                   ` (61 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Leon Romanovsky, Wengang Wang,
	Santosh Shilimkar, David S. Miller, Julia Lawall

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

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

From: santosh.shilimkar@oracle.com <santosh.shilimkar@oracle.com>

commit e47db94e10447fc467777a40302f2b393e9af2fa upstream.

Two different threads with different rds sockets may be in
rds_recv_rcvbuf_delta() via receive path. If their ports
both map to the same word in the congestion map, then
using non-atomic ops to update it could cause the map to
be incorrect. Lets use atomics to avoid such an issue.

Full credit to Wengang <wen.gang.wang@oracle.com> for
finding the issue, analysing it and also pointing out
to offending code with spin lock based fix.

Reviewed-by: Leon Romanovsky <leon@leon.nu>
Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/rds/cong.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/rds/cong.c
+++ b/net/rds/cong.c
@@ -285,7 +285,7 @@ void rds_cong_set_bit(struct rds_cong_ma
 	i = be16_to_cpu(port) / RDS_CONG_MAP_PAGE_BITS;
 	off = be16_to_cpu(port) % RDS_CONG_MAP_PAGE_BITS;
 
-	__set_bit_le(off, (void *)map->m_page_addrs[i]);
+	set_bit_le(off, (void *)map->m_page_addrs[i]);
 }
 
 void rds_cong_clear_bit(struct rds_cong_map *map, __be16 port)
@@ -299,7 +299,7 @@ void rds_cong_clear_bit(struct rds_cong_
 	i = be16_to_cpu(port) / RDS_CONG_MAP_PAGE_BITS;
 	off = be16_to_cpu(port) % RDS_CONG_MAP_PAGE_BITS;
 
-	__clear_bit_le(off, (void *)map->m_page_addrs[i]);
+	clear_bit_le(off, (void *)map->m_page_addrs[i]);
 }
 
 static int rds_cong_test_bit(struct rds_cong_map *map, __be16 port)

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 07/68] usb: gadget: f_midi: Fixed a bug when buflen was smaller than wMaxPacketSize
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2017-05-05 18:31 ` [PATCH 3.18 06/68] RDS: Fix the atomicity for congestion map update Greg Kroah-Hartman
@ 2017-05-05 18:31 ` Greg Kroah-Hartman
  2017-05-05 18:31 ` [PATCH 3.18 08/68] xen/x86: dont lose event interrupts Greg Kroah-Hartman
                   ` (60 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Michal Nazarewicz, Felipe F. Tonello,
	Felipe Balbi, Julia Lawall

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

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

From: Felipe F. Tonello <eu@felipetonello.com>

commit 03d27ade4941076b34c823d63d91dc895731a595 upstream.

buflen by default (256) is smaller than wMaxPacketSize (512) in high-speed
devices.

That caused the OUT endpoint to freeze if the host send any data packet of
length greater than 256 bytes.

This is an example dump of what happended on that enpoint:
HOST:   [DATA][Length=260][...]
DEVICE: [NAK]
HOST:   [PING]
DEVICE: [NAK]
HOST:   [PING]
DEVICE: [NAK]
...
HOST:   [PING]
DEVICE: [NAK]

This patch fixes this problem by setting the minimum usb_request's buffer size
for the OUT endpoint as its wMaxPacketSize.

Acked-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/usb/gadget/function/f_midi.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -357,7 +357,9 @@ static int f_midi_set_alt(struct usb_fun
 	/* allocate a bunch of read buffers and queue them all at once. */
 	for (i = 0; i < midi->qlen && err == 0; i++) {
 		struct usb_request *req =
-			midi_alloc_ep_req(midi->out_ep, midi->buflen);
+			midi_alloc_ep_req(midi->out_ep,
+				max_t(unsigned, midi->buflen,
+					bulk_out_desc.wMaxPacketSize));
 		if (req == NULL)
 			return -ENOMEM;
 

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 08/68] xen/x86: dont lose event interrupts
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (6 preceding siblings ...)
  2017-05-05 18:31 ` [PATCH 3.18 07/68] usb: gadget: f_midi: Fixed a bug when buflen was smaller than wMaxPacketSize Greg Kroah-Hartman
@ 2017-05-05 18:31 ` Greg Kroah-Hartman
  2017-05-05 18:31 ` [PATCH 3.18 09/68] sparc64: kern_addr_valid regression Greg Kroah-Hartman
                   ` (59 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Stefano Stabellini, Juergen Gross,
	Julia Lawall

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

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

From: Stefano Stabellini <sstabellini@kernel.org>

commit c06b6d70feb32d28f04ba37aa3df17973fd37b6b upstream.

On slow platforms with unreliable TSC, such as QEMU emulated machines,
it is possible for the kernel to request the next event in the past. In
that case, in the current implementation of xen_vcpuop_clockevent, we
simply return -ETIME. To be precise the Xen returns -ETIME and we pass
it on. However the result of this is a missed event, which simply causes
the kernel to hang.

Instead it is better to always ask the hypervisor for a timer event,
even if the timeout is in the past. That way there are no lost
interrupts and the kernel survives. To do that, remove the
VCPU_SSHOTTMR_future flag.

Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Juergen Gross <jgross@suse.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/xen/time.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -362,11 +362,11 @@ static int xen_vcpuop_set_next_event(uns
 	WARN_ON(evt->mode != CLOCK_EVT_MODE_ONESHOT);
 
 	single.timeout_abs_ns = get_abs_timeout(delta);
-	single.flags = VCPU_SSHOTTMR_future;
+	/* Get an event anyway, even if the timeout is already expired */
+	single.flags = 0;
 
 	ret = HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, cpu, &single);
-
-	BUG_ON(ret != 0 && ret != -ETIME);
+	BUG_ON(ret != 0);
 
 	return ret;
 }

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 09/68] sparc64: kern_addr_valid regression
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (7 preceding siblings ...)
  2017-05-05 18:31 ` [PATCH 3.18 08/68] xen/x86: dont lose event interrupts Greg Kroah-Hartman
@ 2017-05-05 18:31 ` Greg Kroah-Hartman
  2017-05-05 18:31 ` [PATCH 3.18 10/68] sparc64: Fix kernel panic due to erroneous #ifdef surrounding pmd_write() Greg Kroah-Hartman
                   ` (58 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Bob Picco, David S. Miller

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

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

From: bob picco <bob.picco@oracle.com>


[ Upstream commit adfae8a5d833fa2b46577a8081f350e408851f5b ]

I encountered this bug when using /proc/kcore to examine the kernel. Plus a
coworker inquired about debugging tools. We computed pa but did
not use it during the maximum physical address bits test. Instead we used
the identity mapped virtual address which will always fail this test.

I believe the defect came in here:
[bpicco@zareason linus.git]$ git describe --contains bb4e6e85daa52
v3.18-rc1~87^2~4
.

Signed-off-by: Bob Picco <bob.picco@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/sparc/mm/init_64.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -1377,7 +1377,7 @@ bool kern_addr_valid(unsigned long addr)
 	if ((long)addr < 0L) {
 		unsigned long pa = __pa(addr);
 
-		if ((addr >> max_phys_bits) != 0UL)
+		if ((pa >> max_phys_bits) != 0UL)
 			return false;
 
 		return pfn_valid(pa >> PAGE_SHIFT);

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 10/68] sparc64: Fix kernel panic due to erroneous #ifdef surrounding pmd_write()
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (8 preceding siblings ...)
  2017-05-05 18:31 ` [PATCH 3.18 09/68] sparc64: kern_addr_valid regression Greg Kroah-Hartman
@ 2017-05-05 18:31 ` Greg Kroah-Hartman
  2017-05-05 18:31 ` [PATCH 3.18 11/68] net: neigh: guard against NULL solicit() method Greg Kroah-Hartman
                   ` (57 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Tom Hromatka, David S. Miller

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

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

From: Tom Hromatka <tom.hromatka@oracle.com>


[ Upstream commit 9ae34dbd8afd790cb5f52467e4f816434379eafa ]

This commit moves sparc64's prototype of pmd_write() outside
of the CONFIG_TRANSPARENT_HUGEPAGE ifdef.

In 2013, commit a7b9403f0e6d ("sparc64: Encode huge PMDs using PTE
encoding.") exposed a path where pmd_write() could be called without
CONFIG_TRANSPARENT_HUGEPAGE defined.  This can result in the panic below.

The diff is awkward to read, but the changes are straightforward.
pmd_write() was moved outside of #ifdef CONFIG_TRANSPARENT_HUGEPAGE.
Also, __HAVE_ARCH_PMD_WRITE was defined.

kernel BUG at include/asm-generic/pgtable.h:576!
              \|/ ____ \|/
              "@'/ .. \`@"
              /_| \__/ |_\
                 \__U_/
oracle_8114_cdb(8114): Kernel bad sw trap 5 [#1]
CPU: 120 PID: 8114 Comm: oracle_8114_cdb Not tainted
4.1.12-61.7.1.el6uek.rc1.sparc64 #1
task: fff8400700a24d60 ti: fff8400700bc4000 task.ti: fff8400700bc4000
TSTATE: 0000004411e01607 TPC: 00000000004609f8 TNPC: 00000000004609fc Y:
00000005    Not tainted
TPC: <gup_huge_pmd+0x198/0x1e0>
g0: 000000000001c000 g1: 0000000000ef3954 g2: 0000000000000000 g3: 0000000000000001
g4: fff8400700a24d60 g5: fff8001fa5c10000 g6: fff8400700bc4000 g7: 0000000000000720
o0: 0000000000bc5058 o1: 0000000000000240 o2: 0000000000006000 o3: 0000000000001c00
o4: 0000000000000000 o5: 0000048000080000 sp: fff8400700bc6ab1 ret_pc: 00000000004609f0
RPC: <gup_huge_pmd+0x190/0x1e0>
l0: fff8400700bc74fc l1: 0000000000020000 l2: 0000000000002000 l3: 0000000000000000
l4: fff8001f93250950 l5: 000000000113f800 l6: 0000000000000004 l7: 0000000000000000
i0: fff8400700ca46a0 i1: bd0000085e800453 i2: 000000026a0c4000 i3: 000000026a0c6000
i4: 0000000000000001 i5: fff800070c958de8 i6: fff8400700bc6b61 i7: 0000000000460dd0
I7: <gup_pud_range+0x170/0x1a0>
Call Trace:
 [0000000000460dd0] gup_pud_range+0x170/0x1a0
 [0000000000460e84] get_user_pages_fast+0x84/0x120
 [00000000006f5a18] iov_iter_get_pages+0x98/0x240
 [00000000005fa744] do_direct_IO+0xf64/0x1e00
 [00000000005fbbc0] __blockdev_direct_IO+0x360/0x15a0
 [00000000101f74fc] ext4_ind_direct_IO+0xdc/0x400 [ext4]
 [00000000101af690] ext4_ext_direct_IO+0x1d0/0x2c0 [ext4]
 [00000000101af86c] ext4_direct_IO+0xec/0x220 [ext4]
 [0000000000553bd4] generic_file_read_iter+0x114/0x140
 [00000000005bdc2c] __vfs_read+0xac/0x100
 [00000000005bf254] vfs_read+0x54/0x100
 [00000000005bf368] SyS_pread64+0x68/0x80

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/sparc/include/asm/pgtable_64.h |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -666,26 +666,27 @@ static inline unsigned long pmd_pfn(pmd_
 	return pte_pfn(pte);
 }
 
-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
-static inline unsigned long pmd_dirty(pmd_t pmd)
+#define __HAVE_ARCH_PMD_WRITE
+static inline unsigned long pmd_write(pmd_t pmd)
 {
 	pte_t pte = __pte(pmd_val(pmd));
 
-	return pte_dirty(pte);
+	return pte_write(pte);
 }
 
-static inline unsigned long pmd_young(pmd_t pmd)
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+static inline unsigned long pmd_dirty(pmd_t pmd)
 {
 	pte_t pte = __pte(pmd_val(pmd));
 
-	return pte_young(pte);
+	return pte_dirty(pte);
 }
 
-static inline unsigned long pmd_write(pmd_t pmd)
+static inline unsigned long pmd_young(pmd_t pmd)
 {
 	pte_t pte = __pte(pmd_val(pmd));
 
-	return pte_write(pte);
+	return pte_young(pte);
 }
 
 static inline unsigned long pmd_trans_huge(pmd_t pmd)

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 11/68] net: neigh: guard against NULL solicit() method
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (9 preceding siblings ...)
  2017-05-05 18:31 ` [PATCH 3.18 10/68] sparc64: Fix kernel panic due to erroneous #ifdef surrounding pmd_write() Greg Kroah-Hartman
@ 2017-05-05 18:31 ` Greg Kroah-Hartman
  2017-05-05 18:31 ` [PATCH 3.18 12/68] net: phy: handle state correctly in phy_stop_machine Greg Kroah-Hartman
                   ` (56 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Eric Dumazet, Dmitry Vyukov, David S. Miller

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

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

From: Eric Dumazet <edumazet@google.com>


[ Upstream commit 48481c8fa16410ffa45939b13b6c53c2ca609e5f ]

Dmitry posted a nice reproducer of a bug triggering in neigh_probe()
when dereferencing a NULL neigh->ops->solicit method.

This can happen for arp_direct_ops/ndisc_direct_ops and similar,
which can be used for NUD_NOARP neighbours (created when dev->header_ops
is NULL). Admin can then force changing nud_state to some other state
that would fire neigh timer.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/core/neighbour.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -875,7 +875,8 @@ static void neigh_probe(struct neighbour
 	if (skb)
 		skb = skb_copy(skb, GFP_ATOMIC);
 	write_unlock(&neigh->lock);
-	neigh->ops->solicit(neigh, skb);
+	if (neigh->ops->solicit)
+		neigh->ops->solicit(neigh, skb);
 	atomic_inc(&neigh->probes);
 	kfree_skb(skb);
 }

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 12/68] net: phy: handle state correctly in phy_stop_machine
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (10 preceding siblings ...)
  2017-05-05 18:31 ` [PATCH 3.18 11/68] net: neigh: guard against NULL solicit() method Greg Kroah-Hartman
@ 2017-05-05 18:31 ` Greg Kroah-Hartman
  2017-05-05 18:31 ` [PATCH 3.18 13/68] l2tp: purge socket queues in the .destruct() callback Greg Kroah-Hartman
                   ` (55 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Nathan Sullivan, Brad Mouring,
	Xander Huff, Kyle Roeschley, Florian Fainelli, David S. Miller

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

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

From: Nathan Sullivan <nathan.sullivan@ni.com>


[ Upstream commit 49d52e8108a21749dc2114b924c907db43358984 ]

If the PHY is halted on stop, then do not set the state to PHY_UP.  This
ensures the phy will be restarted later in phy_start when the machine is
started again.

Fixes: 00db8189d984 ("This patch adds a PHY Abstraction Layer to the Linux Kernel, enabling ethernet drivers to remain as ignorant as is reasonable of the connected PHY's design and operation details.")
Signed-off-by: Nathan Sullivan <nathan.sullivan@ni.com>
Signed-off-by: Brad Mouring <brad.mouring@ni.com>
Acked-by: Xander Huff <xander.huff@ni.com>
Acked-by: Kyle Roeschley <kyle.roeschley@ni.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/phy/phy.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -506,7 +506,7 @@ void phy_stop_machine(struct phy_device
 	cancel_delayed_work_sync(&phydev->state_queue);
 
 	mutex_lock(&phydev->lock);
-	if (phydev->state > PHY_UP)
+	if (phydev->state > PHY_UP && phydev->state != PHY_HALTED)
 		phydev->state = PHY_UP;
 	mutex_unlock(&phydev->lock);
 }

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 13/68] l2tp: purge socket queues in the .destruct() callback
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (11 preceding siblings ...)
  2017-05-05 18:31 ` [PATCH 3.18 12/68] net: phy: handle state correctly in phy_stop_machine Greg Kroah-Hartman
@ 2017-05-05 18:31 ` Greg Kroah-Hartman
  2017-05-05 18:31 ` [PATCH 3.18 14/68] net/packet: fix overflow in check for tp_frame_nr Greg Kroah-Hartman
                   ` (54 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Guillaume Nault, David S. Miller

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

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

From: Guillaume Nault <g.nault@alphalink.fr>


[ Upstream commit e91793bb615cf6cdd59c0b6749fe173687bb0947 ]

The Rx path may grab the socket right before pppol2tp_release(), but
nothing guarantees that it will enqueue packets before
skb_queue_purge(). Therefore, the socket can be destroyed without its
queues fully purged.

Fix this by purging queues in pppol2tp_session_destruct() where we're
guaranteed nothing is still referencing the socket.

Fixes: 9e9cb6221aa7 ("l2tp: fix userspace reception on plain L2TP sockets")
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/l2tp/l2tp_ppp.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/net/l2tp/l2tp_ppp.c
+++ b/net/l2tp/l2tp_ppp.c
@@ -469,6 +469,10 @@ static void pppol2tp_session_close(struc
 static void pppol2tp_session_destruct(struct sock *sk)
 {
 	struct l2tp_session *session = sk->sk_user_data;
+
+	skb_queue_purge(&sk->sk_receive_queue);
+	skb_queue_purge(&sk->sk_write_queue);
+
 	if (session) {
 		sk->sk_user_data = NULL;
 		BUG_ON(session->magic != L2TP_SESSION_MAGIC);
@@ -507,9 +511,6 @@ static int pppol2tp_release(struct socke
 		l2tp_session_queue_purge(session);
 		sock_put(sk);
 	}
-	skb_queue_purge(&sk->sk_receive_queue);
-	skb_queue_purge(&sk->sk_write_queue);
-
 	release_sock(sk);
 
 	/* This will delete the session context via

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 14/68] net/packet: fix overflow in check for tp_frame_nr
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (12 preceding siblings ...)
  2017-05-05 18:31 ` [PATCH 3.18 13/68] l2tp: purge socket queues in the .destruct() callback Greg Kroah-Hartman
@ 2017-05-05 18:31 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 15/68] net/packet: fix overflow in check for tp_reserve Greg Kroah-Hartman
                   ` (53 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andrey Konovalov, Eric Dumazet,
	David S. Miller

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

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

From: Andrey Konovalov <andreyknvl@google.com>


[ Upstream commit 8f8d28e4d6d815a391285e121c3a53a0b6cb9e7b ]

When calculating rb->frames_per_block * req->tp_block_nr the result
can overflow.

Add a check that tp_block_size * tp_block_nr <= UINT_MAX.

Since frames_per_block <= tp_block_size, the expression would
never overflow.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/packet/af_packet.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -3820,6 +3820,8 @@ static int packet_set_ring(struct sock *
 		rb->frames_per_block = req->tp_block_size/req->tp_frame_size;
 		if (unlikely(rb->frames_per_block <= 0))
 			goto out;
+		if (unlikely(req->tp_block_size > UINT_MAX / req->tp_block_nr))
+			goto out;
 		if (unlikely((rb->frames_per_block * req->tp_block_nr) !=
 					req->tp_frame_nr))
 			goto out;

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 15/68] net/packet: fix overflow in check for tp_reserve
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (13 preceding siblings ...)
  2017-05-05 18:31 ` [PATCH 3.18 14/68] net/packet: fix overflow in check for tp_frame_nr Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 16/68] net: ipv4: fix multipath RTM_GETROUTE behavior when iif is given Greg Kroah-Hartman
                   ` (52 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andrey Konovalov, Eric Dumazet,
	David S. Miller

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

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

From: Andrey Konovalov <andreyknvl@google.com>


[ Upstream commit bcc5364bdcfe131e6379363f089e7b4108d35b70 ]

When calculating po->tp_hdrlen + po->tp_reserve the result can overflow.

Fix by checking that tp_reserve <= INT_MAX on assign.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/packet/af_packet.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -3314,6 +3314,8 @@ packet_setsockopt(struct socket *sock, i
 			return -EBUSY;
 		if (copy_from_user(&val, optval, sizeof(val)))
 			return -EFAULT;
+		if (val > INT_MAX)
+			return -EINVAL;
 		po->tp_reserve = val;
 		return 0;
 	}

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 16/68] net: ipv4: fix multipath RTM_GETROUTE behavior when iif is given
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (14 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 15/68] net/packet: fix overflow in check for tp_reserve Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 17/68] sctp: listen on the sock only when its state is listening or closed Greg Kroah-Hartman
                   ` (51 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Florian Larysch, David S. Miller

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

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

From: Florian Larysch <fl@n621.de>


[ Upstream commit a8801799c6975601fd58ae62f48964caec2eb83f ]

inet_rtm_getroute synthesizes a skeletal ICMP skb, which is passed to
ip_route_input when iif is given. If a multipath route is present for
the designated destination, ip_multipath_icmp_hash ends up being called,
which uses the source/destination addresses within the skb to calculate
a hash. However, those are not set in the synthetic skb, causing it to
return an arbitrary and incorrect result.

Instead, use UDP, which gets no such special treatment.

Signed-off-by: Florian Larysch <fl@n621.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv4/route.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2436,7 +2436,7 @@ static int inet_rtm_getroute(struct sk_b
 	skb_reset_network_header(skb);
 
 	/* Bugfix: need to give ip_route_input enough of an IP header to not gag. */
-	ip_hdr(skb)->protocol = IPPROTO_ICMP;
+	ip_hdr(skb)->protocol = IPPROTO_UDP;
 	skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr));
 
 	src = tb[RTA_SRC] ? nla_get_be32(tb[RTA_SRC]) : 0;

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 17/68] sctp: listen on the sock only when its state is listening or closed
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (15 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 16/68] net: ipv4: fix multipath RTM_GETROUTE behavior when iif is given Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 18/68] netpoll: Check for skb->queue_mapping Greg Kroah-Hartman
                   ` (50 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andrey Konovalov, Xin Long,
	Marcelo Ricardo Leitner, David S. Miller

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

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

From: Xin Long <lucien.xin@gmail.com>


[ Upstream commit 34b2789f1d9bf8dcca9b5cb553d076ca2cd898ee ]

Now sctp doesn't check sock's state before listening on it. It could
even cause changing a sock with any state to become a listening sock
when doing sctp_listen.

This patch is to fix it by checking sock's state in sctp_listen, so
that it will listen on the sock with right state.

Reported-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/sctp/socket.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -6400,6 +6400,9 @@ int sctp_inet_listen(struct socket *sock
 	if (sock->state != SS_UNCONNECTED)
 		goto out;
 
+	if (!sctp_sstate(sk, LISTENING) && !sctp_sstate(sk, CLOSED))
+		goto out;
+
 	/* If backlog is zero, disable listening. */
 	if (!backlog) {
 		if (sctp_sstate(sk, CLOSED))

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 18/68] netpoll: Check for skb->queue_mapping
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (16 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 17/68] sctp: listen on the sock only when its state is listening or closed Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 19/68] ip6mr: fix notification device destruction Greg Kroah-Hartman
                   ` (49 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Tushar Dave, David S. Miller

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

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

From: Tushar Dave <tushar.n.dave@oracle.com>


[ Upstream commit c70b17b775edb21280e9de7531acf6db3b365274 ]

Reducing real_num_tx_queues needs to be in sync with skb queue_mapping
otherwise skbs with queue_mapping greater than real_num_tx_queues
can be sent to the underlying driver and can result in kernel panic.

One such event is running netconsole and enabling VF on the same
device. Or running netconsole and changing number of tx queues via
ethtool on same device.

e.g.
Unable to handle kernel NULL pointer dereference
tsk->{mm,active_mm}->context = 0000000000001525
tsk->{mm,active_mm}->pgd = fff800130ff9a000
              \|/ ____ \|/
              "@'/ .. \`@"
              /_| \__/ |_\
                 \__U_/
kworker/48:1(475): Oops [#1]
CPU: 48 PID: 475 Comm: kworker/48:1 Tainted: G           OE
4.11.0-rc3-davem-net+ #7
Workqueue: events queue_process
task: fff80013113299c0 task.stack: fff800131132c000
TSTATE: 0000004480e01600 TPC: 00000000103f9e3c TNPC: 00000000103f9e40 Y:
00000000    Tainted: G           OE
TPC: <ixgbe_xmit_frame_ring+0x7c/0x6c0 [ixgbe]>
g0: 0000000000000000 g1: 0000000000003fff g2: 0000000000000000 g3:
0000000000000001
g4: fff80013113299c0 g5: fff8001fa6808000 g6: fff800131132c000 g7:
00000000000000c0
o0: fff8001fa760c460 o1: fff8001311329a50 o2: fff8001fa7607504 o3:
0000000000000003
o4: fff8001f96e63a40 o5: fff8001311d77ec0 sp: fff800131132f0e1 ret_pc:
000000000049ed94
RPC: <set_next_entity+0x34/0xb80>
l0: 0000000000000000 l1: 0000000000000800 l2: 0000000000000000 l3:
0000000000000000
l4: 000b2aa30e34b10d l5: 0000000000000000 l6: 0000000000000000 l7:
fff8001fa7605028
i0: fff80013111a8a00 i1: fff80013155a0780 i2: 0000000000000000 i3:
0000000000000000
i4: 0000000000000000 i5: 0000000000100000 i6: fff800131132f1a1 i7:
00000000103fa4b0
I7: <ixgbe_xmit_frame+0x30/0xa0 [ixgbe]>
Call Trace:
 [00000000103fa4b0] ixgbe_xmit_frame+0x30/0xa0 [ixgbe]
 [0000000000998c74] netpoll_start_xmit+0xf4/0x200
 [0000000000998e10] queue_process+0x90/0x160
 [0000000000485fa8] process_one_work+0x188/0x480
 [0000000000486410] worker_thread+0x170/0x4c0
 [000000000048c6b8] kthread+0xd8/0x120
 [0000000000406064] ret_from_fork+0x1c/0x2c
 [0000000000000000]           (null)
Disabling lock debugging due to kernel taint
Caller[00000000103fa4b0]: ixgbe_xmit_frame+0x30/0xa0 [ixgbe]
Caller[0000000000998c74]: netpoll_start_xmit+0xf4/0x200
Caller[0000000000998e10]: queue_process+0x90/0x160
Caller[0000000000485fa8]: process_one_work+0x188/0x480
Caller[0000000000486410]: worker_thread+0x170/0x4c0
Caller[000000000048c6b8]: kthread+0xd8/0x120
Caller[0000000000406064]: ret_from_fork+0x1c/0x2c
Caller[0000000000000000]:           (null)

Signed-off-by: Tushar Dave <tushar.n.dave@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/core/netpoll.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -105,15 +105,21 @@ static void queue_process(struct work_st
 	while ((skb = skb_dequeue(&npinfo->txq))) {
 		struct net_device *dev = skb->dev;
 		struct netdev_queue *txq;
+		unsigned int q_index;
 
 		if (!netif_device_present(dev) || !netif_running(dev)) {
 			kfree_skb(skb);
 			continue;
 		}
 
-		txq = skb_get_tx_queue(dev, skb);
-
 		local_irq_save(flags);
+		/* check if skb->queue_mapping is still valid */
+		q_index = skb_get_queue_mapping(skb);
+		if (unlikely(q_index >= dev->real_num_tx_queues)) {
+			q_index = q_index % dev->real_num_tx_queues;
+			skb_set_queue_mapping(skb, q_index);
+		}
+		txq = netdev_get_tx_queue(dev, q_index);
 		HARD_TX_LOCK(dev, txq, smp_processor_id());
 		if (netif_xmit_frozen_or_stopped(txq) ||
 		    netpoll_start_xmit(skb, dev, txq) != NETDEV_TX_OK) {

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 19/68] ip6mr: fix notification device destruction
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (17 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 18/68] netpoll: Check for skb->queue_mapping Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 20/68] ALSA: seq: Dont break snd_use_lock_sync() loop by timeout Greg Kroah-Hartman
                   ` (48 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Andrey Konovalov,
	Nikolay Aleksandrov, David S. Miller

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

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

From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>


[ Upstream commit 723b929ca0f79c0796f160c2eeda4597ee98d2b8 ]

Andrey Konovalov reported a BUG caused by the ip6mr code which is caused
because we call unregister_netdevice_many for a device that is already
being destroyed. In IPv4's ipmr that has been resolved by two commits
long time ago by introducing the "notify" parameter to the delete
function and avoiding the unregister when called from a notifier, so
let's do the same for ip6mr.

The trace from Andrey:
------------[ cut here ]------------
kernel BUG at net/core/dev.c:6813!
invalid opcode: 0000 [#1] SMP KASAN
Modules linked in:
CPU: 1 PID: 1165 Comm: kworker/u4:3 Not tainted 4.11.0-rc7+ #251
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs
01/01/2011
Workqueue: netns cleanup_net
task: ffff880069208000 task.stack: ffff8800692d8000
RIP: 0010:rollback_registered_many+0x348/0xeb0 net/core/dev.c:6813
RSP: 0018:ffff8800692de7f0 EFLAGS: 00010297
RAX: ffff880069208000 RBX: 0000000000000002 RCX: 0000000000000001
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88006af90569
RBP: ffff8800692de9f0 R08: ffff8800692dec60 R09: 0000000000000000
R10: 0000000000000006 R11: 0000000000000000 R12: ffff88006af90070
R13: ffff8800692debf0 R14: dffffc0000000000 R15: ffff88006af90000
FS:  0000000000000000(0000) GS:ffff88006cb00000(0000)
knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fe7e897d870 CR3: 00000000657e7000 CR4: 00000000000006e0
Call Trace:
 unregister_netdevice_many.part.105+0x87/0x440 net/core/dev.c:7881
 unregister_netdevice_many+0xc8/0x120 net/core/dev.c:7880
 ip6mr_device_event+0x362/0x3f0 net/ipv6/ip6mr.c:1346
 notifier_call_chain+0x145/0x2f0 kernel/notifier.c:93
 __raw_notifier_call_chain kernel/notifier.c:394
 raw_notifier_call_chain+0x2d/0x40 kernel/notifier.c:401
 call_netdevice_notifiers_info+0x51/0x90 net/core/dev.c:1647
 call_netdevice_notifiers net/core/dev.c:1663
 rollback_registered_many+0x919/0xeb0 net/core/dev.c:6841
 unregister_netdevice_many.part.105+0x87/0x440 net/core/dev.c:7881
 unregister_netdevice_many net/core/dev.c:7880
 default_device_exit_batch+0x4fa/0x640 net/core/dev.c:8333
 ops_exit_list.isra.4+0x100/0x150 net/core/net_namespace.c:144
 cleanup_net+0x5a8/0xb40 net/core/net_namespace.c:463
 process_one_work+0xc04/0x1c10 kernel/workqueue.c:2097
 worker_thread+0x223/0x19c0 kernel/workqueue.c:2231
 kthread+0x35e/0x430 kernel/kthread.c:231
 ret_from_fork+0x31/0x40 arch/x86/entry/entry_64.S:430
Code: 3c 32 00 0f 85 70 0b 00 00 48 b8 00 02 00 00 00 00 ad de 49 89
47 78 e9 93 fe ff ff 49 8d 57 70 49 8d 5f 78 eb 9e e8 88 7a 14 fe <0f>
0b 48 8b 9d 28 fe ff ff e8 7a 7a 14 fe 48 b8 00 00 00 00 00
RIP: rollback_registered_many+0x348/0xeb0 RSP: ffff8800692de7f0
---[ end trace e0b29c57e9b3292c ]---

Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv6/ip6mr.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -776,7 +776,8 @@ failure:
  *	Delete a VIF entry
  */
 
-static int mif6_delete(struct mr6_table *mrt, int vifi, struct list_head *head)
+static int mif6_delete(struct mr6_table *mrt, int vifi, int notify,
+		       struct list_head *head)
 {
 	struct mif_device *v;
 	struct net_device *dev;
@@ -822,7 +823,7 @@ static int mif6_delete(struct mr6_table
 					     dev->ifindex, &in6_dev->cnf);
 	}
 
-	if (v->flags & MIFF_REGISTER)
+	if ((v->flags & MIFF_REGISTER) && !notify)
 		unregister_netdevice_queue(dev, head);
 
 	dev_put(dev);
@@ -1331,7 +1332,6 @@ static int ip6mr_device_event(struct not
 	struct mr6_table *mrt;
 	struct mif_device *v;
 	int ct;
-	LIST_HEAD(list);
 
 	if (event != NETDEV_UNREGISTER)
 		return NOTIFY_DONE;
@@ -1340,10 +1340,9 @@ static int ip6mr_device_event(struct not
 		v = &mrt->vif6_table[0];
 		for (ct = 0; ct < mrt->maxvif; ct++, v++) {
 			if (v->dev == dev)
-				mif6_delete(mrt, ct, &list);
+				mif6_delete(mrt, ct, 1, NULL);
 		}
 	}
-	unregister_netdevice_many(&list);
 
 	return NOTIFY_DONE;
 }
@@ -1552,7 +1551,7 @@ static void mroute_clean_tables(struct m
 	for (i = 0; i < mrt->maxvif; i++) {
 		if (!all && (mrt->vif6_table[i].flags & VIFF_STATIC))
 			continue;
-		mif6_delete(mrt, i, &list);
+		mif6_delete(mrt, i, 0, &list);
 	}
 	unregister_netdevice_many(&list);
 
@@ -1705,7 +1704,7 @@ int ip6_mroute_setsockopt(struct sock *s
 		if (copy_from_user(&mifi, optval, sizeof(mifi_t)))
 			return -EFAULT;
 		rtnl_lock();
-		ret = mif6_delete(mrt, mifi, NULL);
+		ret = mif6_delete(mrt, mifi, 0, NULL);
 		rtnl_unlock();
 		return ret;
 

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 20/68] ALSA: seq: Dont break snd_use_lock_sync() loop by timeout
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (18 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 19/68] ip6mr: fix notification device destruction Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 21/68] MIPS: KGDB: Use kernel context for sleeping threads Greg Kroah-Hartman
                   ` (47 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ben Hutchings, Takashi Iwai

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

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

From: Takashi Iwai <tiwai@suse.de>

commit 4e7655fd4f47c23e5249ea260dc802f909a64611 upstream.

The snd_use_lock_sync() (thus its implementation
snd_use_lock_sync_helper()) has the 5 seconds timeout to break out of
the sync loop.  It was introduced from the beginning, just to be
"safer", in terms of avoiding the stupid bugs.

However, as Ben Hutchings suggested, this timeout rather introduces a
potential leak or use-after-free that was apparently fixed by the
commit 2d7d54002e39 ("ALSA: seq: Fix race during FIFO resize"):
for example, snd_seq_fifo_event_in() -> snd_seq_event_dup() ->
copy_from_user() could block for a long time, and snd_use_lock_sync()
goes timeout and still leaves the cell at releasing the pool.

For fixing such a problem, we remove the break by the timeout while
still keeping the warning.

Suggested-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/core/seq/seq_lock.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

--- a/sound/core/seq/seq_lock.c
+++ b/sound/core/seq/seq_lock.c
@@ -28,19 +28,16 @@
 /* wait until all locks are released */
 void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line)
 {
-	int max_count = 5 * HZ;
+	int warn_count = 5 * HZ;
 
 	if (atomic_read(lockp) < 0) {
 		pr_warn("ALSA: seq_lock: lock trouble [counter = %d] in %s:%d\n", atomic_read(lockp), file, line);
 		return;
 	}
 	while (atomic_read(lockp) > 0) {
-		if (max_count == 0) {
-			pr_warn("ALSA: seq_lock: timeout [%d left] in %s:%d\n", atomic_read(lockp), file, line);
-			break;
-		}
+		if (warn_count-- == 0)
+			pr_warn("ALSA: seq_lock: waiting [%d left] in %s:%d\n", atomic_read(lockp), file, line);
 		schedule_timeout_uninterruptible(1);
-		max_count--;
 	}
 }
 

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 21/68] MIPS: KGDB: Use kernel context for sleeping threads
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (19 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 20/68] ALSA: seq: Dont break snd_use_lock_sync() loop by timeout Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 22/68] p9_client_readdir() fix Greg Kroah-Hartman
                   ` (46 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, James Hogan, Jason Wessel,
	linux-mips, Ralf Baechle

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

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

From: James Hogan <james.hogan@imgtec.com>

commit 162b270c664dca2e0944308e92f9fcc887151a72 upstream.

KGDB is a kernel debug stub and it can't be used to debug userland as it
can only safely access kernel memory.

On MIPS however KGDB has always got the register state of sleeping
processes from the userland register context at the beginning of the
kernel stack. This is meaningless for kernel threads (which never enter
userland), and for user threads it prevents the user seeing what it is
doing while in the kernel:

(gdb) info threads
  Id   Target Id         Frame
  ...
  3    Thread 2 (kthreadd) 0x0000000000000000 in ?? ()
  2    Thread 1 (init)   0x000000007705c4b4 in ?? ()
  1    Thread -2 (shadowCPU0) 0xffffffff8012524c in arch_kgdb_breakpoint () at arch/mips/kernel/kgdb.c:201

Get the register state instead from the (partial) kernel register
context stored in the task's thread_struct for resume() to restore. All
threads now correctly appear to be in context_switch():

(gdb) info threads
  Id   Target Id         Frame
  ...
  3    Thread 2 (kthreadd) context_switch (rq=<optimized out>, cookie=..., next=<optimized out>, prev=0x0) at kernel/sched/core.c:2903
  2    Thread 1 (init)   context_switch (rq=<optimized out>, cookie=..., next=<optimized out>, prev=0x0) at kernel/sched/core.c:2903
  1    Thread -2 (shadowCPU0) 0xffffffff8012524c in arch_kgdb_breakpoint () at arch/mips/kernel/kgdb.c:201

Call clobbered registers which aren't saved and exception registers
(BadVAddr & Cause) which can't be easily determined without stack
unwinding are reported as 0. The PC is taken from the return address,
such that the state presented matches that found immediately after
returning from resume().

Fixes: 8854700115ec ("[MIPS] kgdb: add arch support for the kernel's kgdb core")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/15829/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/mips/kernel/kgdb.c |   48 +++++++++++++++++++++++++++++++++---------------
 1 file changed, 33 insertions(+), 15 deletions(-)

--- a/arch/mips/kernel/kgdb.c
+++ b/arch/mips/kernel/kgdb.c
@@ -244,9 +244,6 @@ static int compute_signal(int tt)
 void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
 {
 	int reg;
-	struct thread_info *ti = task_thread_info(p);
-	unsigned long ksp = (unsigned long)ti + THREAD_SIZE - 32;
-	struct pt_regs *regs = (struct pt_regs *)ksp - 1;
 #if (KGDB_GDB_REG_SIZE == 32)
 	u32 *ptr = (u32 *)gdb_regs;
 #else
@@ -254,25 +251,46 @@ void sleeping_thread_to_gdb_regs(unsigne
 #endif
 
 	for (reg = 0; reg < 16; reg++)
-		*(ptr++) = regs->regs[reg];
+		*(ptr++) = 0;
 
 	/* S0 - S7 */
-	for (reg = 16; reg < 24; reg++)
-		*(ptr++) = regs->regs[reg];
+	*(ptr++) = p->thread.reg16;
+	*(ptr++) = p->thread.reg17;
+	*(ptr++) = p->thread.reg18;
+	*(ptr++) = p->thread.reg19;
+	*(ptr++) = p->thread.reg20;
+	*(ptr++) = p->thread.reg21;
+	*(ptr++) = p->thread.reg22;
+	*(ptr++) = p->thread.reg23;
 
 	for (reg = 24; reg < 28; reg++)
 		*(ptr++) = 0;
 
 	/* GP, SP, FP, RA */
-	for (reg = 28; reg < 32; reg++)
-		*(ptr++) = regs->regs[reg];
-
-	*(ptr++) = regs->cp0_status;
-	*(ptr++) = regs->lo;
-	*(ptr++) = regs->hi;
-	*(ptr++) = regs->cp0_badvaddr;
-	*(ptr++) = regs->cp0_cause;
-	*(ptr++) = regs->cp0_epc;
+	*(ptr++) = (long)p;
+	*(ptr++) = p->thread.reg29;
+	*(ptr++) = p->thread.reg30;
+	*(ptr++) = p->thread.reg31;
+
+	*(ptr++) = p->thread.cp0_status;
+
+	/* lo, hi */
+	*(ptr++) = 0;
+	*(ptr++) = 0;
+
+	/*
+	 * BadVAddr, Cause
+	 * Ideally these would come from the last exception frame up the stack
+	 * but that requires unwinding, otherwise we can't know much for sure.
+	 */
+	*(ptr++) = 0;
+	*(ptr++) = 0;
+
+	/*
+	 * PC
+	 * use return address (RA), i.e. the moment after return from resume()
+	 */
+	*(ptr++) = p->thread.reg31;
 }
 
 void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 22/68] p9_client_readdir() fix
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (20 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 21/68] MIPS: KGDB: Use kernel context for sleeping threads Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 25/68] ftrace/x86: Fix triple fault with graph tracing and suspend-to-ram Greg Kroah-Hartman
                   ` (45 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Al Viro

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

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

From: Al Viro <viro@zeniv.linux.org.uk>

commit 71d6ad08379304128e4bdfaf0b4185d54375423e upstream.

Don't assume that server is sane and won't return more data than
asked for.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/9p/client.c |    4 ++++
 1 file changed, 4 insertions(+)

--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -2106,6 +2106,10 @@ int p9_client_readdir(struct p9_fid *fid
 		trace_9p_protocol_dump(clnt, req->rc);
 		goto free_and_error;
 	}
+	if (rsize < count) {
+		pr_err("bogus RREADDIR count (%d > %d)\n", count, rsize);
+		count = rsize;
+	}
 
 	p9_debug(P9_DEBUG_9P, "<<< RREADDIR count %d\n", count);
 

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 25/68] ftrace/x86: Fix triple fault with graph tracing and suspend-to-ram
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (21 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 22/68] p9_client_readdir() fix Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 26/68] powerpc/ptrace: Fix out of bounds array access warning Greg Kroah-Hartman
                   ` (44 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Paul Menzel, Josh Poimboeuf,
	Steven Rostedt (VMware),
	Rafael J . Wysocki, linux-acpi, Borislav Petkov, Len Brown,
	Thomas Gleixner

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

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

From: Josh Poimboeuf <jpoimboe@redhat.com>

commit 34a477e5297cbaa6ecc6e17c042a866e1cbe80d6 upstream.

On x86-32, with CONFIG_FIRMWARE and multiple CPUs, if you enable function
graph tracing and then suspend to RAM, it will triple fault and reboot when
it resumes.

The first fault happens when booting a secondary CPU:

startup_32_smp()
  load_ucode_ap()
    prepare_ftrace_return()
      ftrace_graph_is_dead()
        (accesses 'kill_ftrace_graph')

The early head_32.S code calls into load_ucode_ap(), which has an an
ftrace hook, so it calls prepare_ftrace_return(), which calls
ftrace_graph_is_dead(), which tries to access the global
'kill_ftrace_graph' variable with a virtual address, causing a fault
because the CPU is still in real mode.

The fix is to add a check in prepare_ftrace_return() to make sure it's
running in protected mode before continuing.  The check makes sure the
stack pointer is a virtual kernel address.  It's a bit of a hack, but
it's not very intrusive and it works well enough.

For reference, here are a few other (more difficult) ways this could
have potentially been fixed:

- Move startup_32_smp()'s call to load_ucode_ap() down to *after* paging
  is enabled.  (No idea what that would break.)

- Track down load_ucode_ap()'s entire callee tree and mark all the
  functions 'notrace'.  (Probably not realistic.)

- Pause graph tracing in ftrace_suspend_notifier_call() or bringup_cpu()
  or __cpu_up(), and ensure that the pause facility can be queried from
  real mode.

Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Tested-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: "Rafael J . Wysocki" <rjw@rjwysocki.net>
Cc: linux-acpi@vger.kernel.org
Cc: Borislav Petkov <bp@alien8.de>
Cc: Len Brown <lenb@kernel.org>
Link: http://lkml.kernel.org/r/5c1272269a580660703ed2eccf44308e790c7a98.1492123841.git.jpoimboe@redhat.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/kernel/ftrace.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -703,6 +703,18 @@ void prepare_ftrace_return(unsigned long
 	unsigned long return_hooker = (unsigned long)
 				&return_to_handler;
 
+	/*
+	 * When resuming from suspend-to-ram, this function can be indirectly
+	 * called from early CPU startup code while the CPU is in real mode,
+	 * which would fail miserably.  Make sure the stack pointer is a
+	 * virtual address.
+	 *
+	 * This check isn't as accurate as virt_addr_valid(), but it should be
+	 * good enough for this purpose, and it's fast.
+	 */
+	if (unlikely((long)__builtin_frame_address(0) >= 0))
+		return;
+
 	if (unlikely(ftrace_graph_is_dead()))
 		return;
 

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 26/68] powerpc/ptrace: Fix out of bounds array access warning
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (22 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 25/68] ftrace/x86: Fix triple fault with graph tracing and suspend-to-ram Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 27/68] drbd: avoid redefinition of BITS_PER_PAGE Greg Kroah-Hartman
                   ` (43 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Khem Raj, Kees Cook,
	Michael Ellerman, Segher Boessenkool, Aaro Koskinen,
	Olof Johansson, Arnd Bergmann

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

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

From: Khem Raj <raj.khem@gmail.com>

commit 1e407ee3b21f981140491d5b8a36422979ca246f upstream.

gcc-6 correctly warns about a out of bounds access

arch/powerpc/kernel/ptrace.c:407:24: warning: index 32 denotes an offset greater than size of 'u64[32][1] {aka long long unsigned int[32][1]}' [-Warray-bounds]
        offsetof(struct thread_fp_state, fpr[32][0]));
                        ^

check the end of array instead of beginning of next element to fix this

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Acked-by: Olof Johansson <olof@lixom.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/powerpc/kernel/ptrace.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -376,7 +376,7 @@ static int fpr_get(struct task_struct *t
 
 #else
 	BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) !=
-		     offsetof(struct thread_fp_state, fpr[32][0]));
+		     offsetof(struct thread_fp_state, fpr[32]));
 
 	return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
 				   &target->thread.fp_state, 0, -1);
@@ -404,7 +404,7 @@ static int fpr_set(struct task_struct *t
 	return 0;
 #else
 	BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) !=
-		     offsetof(struct thread_fp_state, fpr[32][0]));
+		     offsetof(struct thread_fp_state, fpr[32]));
 
 	return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
 				  &target->thread.fp_state, 0, -1);

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 27/68] drbd: avoid redefinition of BITS_PER_PAGE
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (23 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 26/68] powerpc/ptrace: Fix out of bounds array access warning Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 28/68] IB/iser: Fix sparse warnings Greg Kroah-Hartman
                   ` (42 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Philipp Reisner, Lars Ellenberg,
	Jens Axboe, Arnd Bergmann

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

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

From: Lars Ellenberg <lars.ellenberg@linbit.com>

commit 2630628b2dbc3fc320aafaf84836119e4e3d62f1 upstream.

Apparently we now implicitly get definitions for BITS_PER_PAGE and
BITS_PER_PAGE_MASK from the pid_namespace.h

Instead of renaming our defines, I chose to define only if not yet
defined, but to double check the value if already defined.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/block/drbd/drbd_bitmap.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/drivers/block/drbd/drbd_bitmap.c
+++ b/drivers/block/drbd/drbd_bitmap.c
@@ -479,8 +479,14 @@ void drbd_bm_cleanup(struct drbd_device
  * this masks out the remaining bits.
  * Returns the number of bits cleared.
  */
+#ifndef BITS_PER_PAGE
 #define BITS_PER_PAGE		(1UL << (PAGE_SHIFT + 3))
 #define BITS_PER_PAGE_MASK	(BITS_PER_PAGE - 1)
+#else
+# if BITS_PER_PAGE != (1UL << (PAGE_SHIFT + 3))
+#  error "ambiguous BITS_PER_PAGE"
+# endif
+#endif
 #define BITS_PER_LONG_MASK	(BITS_PER_LONG - 1)
 static int bm_clear_surplus(struct drbd_bitmap *b)
 {

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 28/68] IB/iser: Fix sparse warnings
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (24 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 27/68] drbd: avoid redefinition of BITS_PER_PAGE Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 29/68] mtd: avoid stack overflow in MTD CFI code Greg Kroah-Hartman
                   ` (41 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Sagi Grimberg, Or Gerlitz,
	Roland Dreier, Arnd Bergmann

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

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

From: Sagi Grimberg <sagig@mellanox.com>

commit 49df2781b101a729e9f46eddc845a587fc5665a8 upstream.

Use uintptr_t to handle wr_id casting, which was found by Kbuild test
robot and smatch.  Also remove an internal definition of variable which
potentially shadows an external one (and make sparse happy).

Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/ulp/iser/iser_memory.c |    1 -
 drivers/infiniband/ulp/iser/iser_verbs.c  |   15 ++++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

--- a/drivers/infiniband/ulp/iser/iser_memory.c
+++ b/drivers/infiniband/ulp/iser/iser_memory.c
@@ -73,7 +73,6 @@ static int iser_start_rdma_unaligned_sg(
 
 	if (cmd_dir == ISER_DIR_OUT) {
 		/* copy the unaligned sg the buffer which is used for RDMA */
-		int i;
 		char *p, *from;
 
 		sgl = (struct scatterlist *)data->buf;
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -1052,7 +1052,7 @@ int iser_post_recvl(struct iser_conn *is
 	sge.length = ISER_RX_LOGIN_SIZE;
 	sge.lkey   = ib_conn->device->mr->lkey;
 
-	rx_wr.wr_id   = (unsigned long)iser_conn->login_resp_buf;
+	rx_wr.wr_id   = (uintptr_t)iser_conn->login_resp_buf;
 	rx_wr.sg_list = &sge;
 	rx_wr.num_sge = 1;
 	rx_wr.next    = NULL;
@@ -1076,7 +1076,7 @@ int iser_post_recvm(struct iser_conn *is
 
 	for (rx_wr = ib_conn->rx_wr, i = 0; i < count; i++, rx_wr++) {
 		rx_desc		= &iser_conn->rx_descs[my_rx_head];
-		rx_wr->wr_id	= (unsigned long)rx_desc;
+		rx_wr->wr_id	= (uintptr_t)rx_desc;
 		rx_wr->sg_list	= &rx_desc->rx_sg;
 		rx_wr->num_sge	= 1;
 		rx_wr->next	= rx_wr + 1;
@@ -1113,7 +1113,7 @@ int iser_post_send(struct ib_conn *ib_co
 				      DMA_TO_DEVICE);
 
 	send_wr.next	   = NULL;
-	send_wr.wr_id	   = (unsigned long)tx_desc;
+	send_wr.wr_id	   = (uintptr_t)tx_desc;
 	send_wr.sg_list	   = tx_desc->tx_sg;
 	send_wr.num_sge	   = tx_desc->num_sge;
 	send_wr.opcode	   = IB_WR_SEND;
@@ -1163,6 +1163,7 @@ static void
 iser_handle_comp_error(struct ib_conn *ib_conn,
 		       struct ib_wc *wc)
 {
+	void *wr_id = (void *)(uintptr_t)wc->wr_id;
 	struct iser_conn *iser_conn = container_of(ib_conn, struct iser_conn,
 						   ib_conn);
 
@@ -1171,8 +1172,8 @@ iser_handle_comp_error(struct ib_conn *i
 			iscsi_conn_failure(iser_conn->iscsi_conn,
 					   ISCSI_ERR_CONN_FAILED);
 
-	if (is_iser_tx_desc(iser_conn, (void *)wc->wr_id)) {
-		struct iser_tx_desc *desc = (struct iser_tx_desc *)wc->wr_id;
+	if (is_iser_tx_desc(iser_conn, wr_id)) {
+		struct iser_tx_desc *desc = wr_id;
 
 		if (desc->type == ISCSI_TX_DATAOUT)
 			kmem_cache_free(ig.desc_cache, desc);
@@ -1198,12 +1199,12 @@ static void iser_handle_wc(struct ib_wc
 	ib_conn = wc->qp->qp_context;
 	if (wc->status == IB_WC_SUCCESS) {
 		if (wc->opcode == IB_WC_RECV) {
-			rx_desc = (struct iser_rx_desc *)wc->wr_id;
+			rx_desc = (struct iser_rx_desc *)(uintptr_t)wc->wr_id;
 			iser_rcv_completion(rx_desc, wc->byte_len,
 					    ib_conn);
 		} else
 		if (wc->opcode == IB_WC_SEND) {
-			tx_desc = (struct iser_tx_desc *)wc->wr_id;
+			tx_desc = (struct iser_tx_desc *)(uintptr_t)wc->wr_id;
 			iser_snd_completion(tx_desc, ib_conn);
 		} else {
 			iser_err("Unknown wc opcode %d\n", wc->opcode);

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 29/68] mtd: avoid stack overflow in MTD CFI code
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (25 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 28/68] IB/iser: Fix sparse warnings Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 30/68] mlx5: avoid build warnings on 32-bit Greg Kroah-Hartman
                   ` (40 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, Brian Norris

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit fddcca5107051adf9e4481d2a79ae0616577fd2c upstream.

When map_word gets too large, we use a lot of kernel stack, and for
MTD_MAP_BANK_WIDTH_32, this means we use more than the recommended
1024 bytes in a number of functions:

drivers/mtd/chips/cfi_cmdset_0020.c: In function 'cfi_staa_write_buffers':
drivers/mtd/chips/cfi_cmdset_0020.c:651:1: warning: the frame size of 1336 bytes is larger than 1024 bytes [-Wframe-larger-than=]
drivers/mtd/chips/cfi_cmdset_0020.c: In function 'cfi_staa_erase_varsize':
drivers/mtd/chips/cfi_cmdset_0020.c:972:1: warning: the frame size of 1208 bytes is larger than 1024 bytes [-Wframe-larger-than=]
drivers/mtd/chips/cfi_cmdset_0001.c: In function 'do_write_buffer':
drivers/mtd/chips/cfi_cmdset_0001.c:1835:1: warning: the frame size of 1240 bytes is larger than 1024 bytes [-Wframe-larger-than=]

This can be avoided if all operations on the map word are done
indirectly and the stack gets reused between the calls. We can
mostly achieve this by selecting MTD_COMPLEX_MAPPINGS whenever
MTD_MAP_BANK_WIDTH_32 is set, but for the case that no other
bank width is enabled, we also need to use a non-constant
map_bankwidth() to convince the compiler to use less stack.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
[Brian: this patch mostly achieves its goal by forcing
    MTD_COMPLEX_MAPPINGS (and the accompanying indirection) for 256-bit
    mappings; the rest of the change is mostly a wash, though it helps
    reduce stack size slightly. If we really care about supporting
    256-bit mappings though, we should consider rewriting some of this
    code to avoid keeping and assigning so many 256-bit objects on the
    stack.]
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/mtd/chips/Kconfig |    1 +
 include/linux/mtd/map.h   |   19 +++++++------------
 2 files changed, 8 insertions(+), 12 deletions(-)

--- a/drivers/mtd/chips/Kconfig
+++ b/drivers/mtd/chips/Kconfig
@@ -110,6 +110,7 @@ config MTD_MAP_BANK_WIDTH_16
 
 config MTD_MAP_BANK_WIDTH_32
 	bool "Support 256-bit buswidth" if MTD_CFI_GEOMETRY
+	select MTD_COMPLEX_MAPPINGS if HAS_IOMEM
 	default n
 	help
 	  If you wish to support CFI devices on a physical bus which is
--- a/include/linux/mtd/map.h
+++ b/include/linux/mtd/map.h
@@ -122,18 +122,13 @@
 #endif
 
 #ifdef CONFIG_MTD_MAP_BANK_WIDTH_32
-# ifdef map_bankwidth
-#  undef map_bankwidth
-#  define map_bankwidth(map) ((map)->bankwidth)
-#  undef map_bankwidth_is_large
-#  define map_bankwidth_is_large(map) (map_bankwidth(map) > BITS_PER_LONG/8)
-#  undef map_words
-#  define map_words(map) map_calc_words(map)
-# else
-#  define map_bankwidth(map) 32
-#  define map_bankwidth_is_large(map) (1)
-#  define map_words(map) map_calc_words(map)
-# endif
+/* always use indirect access for 256-bit to preserve kernel stack */
+# undef map_bankwidth
+# define map_bankwidth(map) ((map)->bankwidth)
+# undef map_bankwidth_is_large
+# define map_bankwidth_is_large(map) (map_bankwidth(map) > BITS_PER_LONG/8)
+# undef map_words
+# define map_words(map) map_calc_words(map)
 #define map_bankwidth_is_32(map) (map_bankwidth(map) == 32)
 #undef MAX_MAP_BANKWIDTH
 #define MAX_MAP_BANKWIDTH 32

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 30/68] mlx5: avoid build warnings on 32-bit
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (26 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 29/68] mtd: avoid stack overflow in MTD CFI code Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 31/68] PCI: xilinx: Fix harmless format string warning Greg Kroah-Hartman
                   ` (39 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, David S. Miller

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit 065bd8c28ba37d04c9a5b732173c1508954b1f58 upstream.

The mlx5 driver passes a string pointer in through a 'u64' variable,
which on 32-bit machines causes a build warning:

drivers/net/ethernet/mellanox/mlx5/core/debugfs.c: In function 'qp_read_field':
drivers/net/ethernet/mellanox/mlx5/core/debugfs.c:303:11: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

The code is in fact safe, so we can shut up the warning by adding
extra type casts.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/mellanox/mlx5/core/debugfs.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/debugfs.c
@@ -300,11 +300,11 @@ static u64 qp_read_field(struct mlx5_cor
 		param = qp->pid;
 		break;
 	case QP_STATE:
-		param = (u64)mlx5_qp_state_str(be32_to_cpu(ctx->flags) >> 28);
+		param = (unsigned long)mlx5_qp_state_str(be32_to_cpu(ctx->flags) >> 28);
 		*is_str = 1;
 		break;
 	case QP_XPORT:
-		param = (u64)mlx5_qp_type_str((be32_to_cpu(ctx->flags) >> 16) & 0xff);
+		param = (unsigned long)mlx5_qp_type_str((be32_to_cpu(ctx->flags) >> 16) & 0xff);
 		*is_str = 1;
 		break;
 	case QP_MTU:
@@ -464,7 +464,7 @@ static ssize_t dbg_read(struct file *fil
 
 
 	if (is_str)
-		ret = snprintf(tbuf, sizeof(tbuf), "%s\n", (const char *)field);
+		ret = snprintf(tbuf, sizeof(tbuf), "%s\n", (const char *)(unsigned long)field);
 	else
 		ret = snprintf(tbuf, sizeof(tbuf), "0x%llx\n", field);
 

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 31/68] PCI: xilinx: Fix harmless format string warning
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (27 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 30/68] mlx5: avoid build warnings on 32-bit Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 32/68] ALSA: ppc/awacs: shut up maybe-uninitialized warning Greg Kroah-Hartman
                   ` (38 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, Bjorn Helgaas,
	Maxime Coquelin

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit abc596b9a2f3d24b8b0d637bdb071aae7f09801d upstream.

The xilinx PCIe driver prints a register value whose type is propagated to
the type returned by the GENMASK() macro.  Unfortunately, that type has
recently changed as the result of a bug fix, so now we get a warning about
the type:

  drivers/pci/host/pcie-xilinx.c: In function 'xilinx_pcie_clear_err_interrupts':
  drivers/pci/host/pcie-xilinx.c:154:3: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]

Change the code so we always print the number as an 'unsigned long' type to
avoid the warning.  The original code was fine on 32-bit architectures but
not on 64-bit.  Now it works as expected on both.

Fixes: 00b4d9a1412 ("bitops: Fix shift overflow in GENMASK macros")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/pci/host/pcie-xilinx.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/pci/host/pcie-xilinx.c
+++ b/drivers/pci/host/pcie-xilinx.c
@@ -148,10 +148,10 @@ static inline bool xilinx_pcie_link_is_u
  */
 static void xilinx_pcie_clear_err_interrupts(struct xilinx_pcie_port *port)
 {
-	u32 val = pcie_read(port, XILINX_PCIE_REG_RPEFR);
+	unsigned long val = pcie_read(port, XILINX_PCIE_REG_RPEFR);
 
 	if (val & XILINX_PCIE_RPEFR_ERR_VALID) {
-		dev_dbg(port->dev, "Requester ID %d\n",
+		dev_dbg(port->dev, "Requester ID %lu\n",
 			val & XILINX_PCIE_RPEFR_REQ_ID);
 		pcie_write(port, XILINX_PCIE_RPEFR_ALL_MASK,
 			   XILINX_PCIE_REG_RPEFR);

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 32/68] ALSA: ppc/awacs: shut up maybe-uninitialized warning
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (28 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 31/68] PCI: xilinx: Fix harmless format string warning Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 33/68] cred/userns: define current_user_ns() as a function Greg Kroah-Hartman
                   ` (37 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, Takashi Iwai

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit b268c34e5ee92a4cc3099b0caaf26e6bfbdf0f18 upstream.

The awacs sound driver produces a false-positive warning in ppc64_defconfig:

sound/ppc/awacs.c: In function 'snd_pmac_awacs_init':
include/sound/control.h:219:9: warning: 'master_vol' may be used uninitialized in this function [-Wmaybe-uninitialized]

I haven't come up with a good way to rewrite the code to avoid the
warning, so here is a bad one: I initialize the variable before
the conditionall initialization so gcc no longer has to worry about
it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 sound/ppc/awacs.c |    1 +
 1 file changed, 1 insertion(+)

--- a/sound/ppc/awacs.c
+++ b/sound/ppc/awacs.c
@@ -991,6 +991,7 @@ snd_pmac_awacs_init(struct snd_pmac *chi
 		if (err < 0)
 			return err;
 	}
+	master_vol = NULL;
 	if (pm7500)
 		err = build_mixers(chip,
 				   ARRAY_SIZE(snd_pmac_awacs_mixers_pmac7500),

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 33/68] cred/userns: define current_user_ns() as a function
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (29 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 32/68] ALSA: ppc/awacs: shut up maybe-uninitialized warning Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 34/68] net: tg3: avoid uninitialized variable warning Greg Kroah-Hartman
                   ` (36 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, Serge Hallyn,
	David Howells, Yaowei Bai, James Morris, Paul E. McKenney,
	Andrew Morton, Linus Torvalds

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit 0335695dfa4df01edff5bb102b9a82a0668ee51e upstream.

The current_user_ns() macro currently returns &init_user_ns when user
namespaces are disabled, and that causes several warnings when building
with gcc-6.0 in code that compares the result of the macro to
&init_user_ns itself:

  fs/xfs/xfs_ioctl.c: In function 'xfs_ioctl_setattr_check_projid':
  fs/xfs/xfs_ioctl.c:1249:22: error: self-comparison always evaluates to true [-Werror=tautological-compare]
    if (current_user_ns() == &init_user_ns)

This is a legitimate warning in principle, but here it isn't really
helpful, so I'm reprasing the definition in a way that shuts up the
warning.  Apparently gcc only warns when comparing identical literals,
but it can figure out that the result of an inline function can be
identical to a constant expression in order to optimize a condition yet
not warn about the fact that the condition is known at compile time.
This is exactly what we want here, and it looks reasonable because we
generally prefer inline functions over macros anyway.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
Cc: James Morris <james.l.morris@oracle.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/linux/capability.h |    2 --
 include/linux/cred.h       |    5 ++++-
 2 files changed, 4 insertions(+), 3 deletions(-)

--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -40,8 +40,6 @@ struct inode;
 struct dentry;
 struct user_namespace;
 
-struct user_namespace *current_user_ns(void);
-
 extern const kernel_cap_t __cap_empty_set;
 extern const kernel_cap_t __cap_init_eff_set;
 
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -354,7 +354,10 @@ extern struct user_namespace init_user_n
 #ifdef CONFIG_USER_NS
 #define current_user_ns()	(current_cred_xxx(user_ns))
 #else
-#define current_user_ns()	(&init_user_ns)
+static inline struct user_namespace *current_user_ns(void)
+{
+	return &init_user_ns;
+}
 #endif
 
 

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 34/68] net: tg3: avoid uninitialized variable warning
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (30 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 33/68] cred/userns: define current_user_ns() as a function Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 35/68] timerfd: Protect the might cancel mechanism proper Greg Kroah-Hartman
                   ` (35 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, David S. Miller

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit e434e04110704eb91acfecbd0fb8ca8e2da9c29b upstream.

The tg3_set_eeprom() function correctly initializes the 'start' variable,
but gcc generates a false warning:

drivers/net/ethernet/broadcom/tg3.c: In function 'tg3_set_eeprom':
drivers/net/ethernet/broadcom/tg3.c:12057:4: warning: 'start' may be used uninitialized in this function [-Wmaybe-uninitialized]

I have not come up with a way to restructure the code in a way that
avoids the warning without making it less readable, so this adds an
initialization for the declaration to shut up that warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/broadcom/tg3.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -12021,7 +12021,7 @@ static int tg3_set_eeprom(struct net_dev
 	int ret;
 	u32 offset, len, b_offset, odd_len;
 	u8 *buf;
-	__be32 start, end;
+	__be32 start = 0, end;
 
 	if (tg3_flag(tp, NO_NVRAM) ||
 	    eeprom->magic != TG3_EEPROM_MAGIC)

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 35/68] timerfd: Protect the might cancel mechanism proper
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (31 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 34/68] net: tg3: avoid uninitialized variable warning Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 36/68] Handle mismatched open calls Greg Kroah-Hartman
                   ` (34 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Dmitry Vyukov, Thomas Gleixner,
	syzkaller, Al Viro, linux-fsdevel

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

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

From: Thomas Gleixner <tglx@linutronix.de>

commit 1e38da300e1e395a15048b0af1e5305bd91402f6 upstream.

The handling of the might_cancel queueing is not properly protected, so
parallel operations on the file descriptor can race with each other and
lead to list corruptions or use after free.

Protect the context for these operations with a seperate lock.

The wait queue lock cannot be reused for this because that would create a
lock inversion scenario vs. the cancel lock. Replacing might_cancel with an
atomic (atomic_t or atomic bit) does not help either because it still can
race vs. the actual list operation.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: "linux-fsdevel@vger.kernel.org"
Cc: syzkaller <syzkaller@googlegroups.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1701311521430.3457@nanos
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/timerfd.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -40,6 +40,7 @@ struct timerfd_ctx {
 	short unsigned settime_flags;	/* to show in fdinfo */
 	struct rcu_head rcu;
 	struct list_head clist;
+	spinlock_t cancel_lock;
 	bool might_cancel;
 };
 
@@ -112,7 +113,7 @@ void timerfd_clock_was_set(void)
 	rcu_read_unlock();
 }
 
-static void timerfd_remove_cancel(struct timerfd_ctx *ctx)
+static void __timerfd_remove_cancel(struct timerfd_ctx *ctx)
 {
 	if (ctx->might_cancel) {
 		ctx->might_cancel = false;
@@ -122,6 +123,13 @@ static void timerfd_remove_cancel(struct
 	}
 }
 
+static void timerfd_remove_cancel(struct timerfd_ctx *ctx)
+{
+	spin_lock(&ctx->cancel_lock);
+	__timerfd_remove_cancel(ctx);
+	spin_unlock(&ctx->cancel_lock);
+}
+
 static bool timerfd_canceled(struct timerfd_ctx *ctx)
 {
 	if (!ctx->might_cancel || ctx->moffs.tv64 != KTIME_MAX)
@@ -132,6 +140,7 @@ static bool timerfd_canceled(struct time
 
 static void timerfd_setup_cancel(struct timerfd_ctx *ctx, int flags)
 {
+	spin_lock(&ctx->cancel_lock);
 	if ((ctx->clockid == CLOCK_REALTIME ||
 	     ctx->clockid == CLOCK_REALTIME_ALARM) &&
 	    (flags & TFD_TIMER_ABSTIME) && (flags & TFD_TIMER_CANCEL_ON_SET)) {
@@ -141,9 +150,10 @@ static void timerfd_setup_cancel(struct
 			list_add_rcu(&ctx->clist, &cancel_list);
 			spin_unlock(&cancel_lock);
 		}
-	} else if (ctx->might_cancel) {
-		timerfd_remove_cancel(ctx);
+	} else {
+		__timerfd_remove_cancel(ctx);
 	}
+	spin_unlock(&ctx->cancel_lock);
 }
 
 static ktime_t timerfd_get_remaining(struct timerfd_ctx *ctx)
@@ -394,6 +404,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clo
 		return -ENOMEM;
 
 	init_waitqueue_head(&ctx->wqh);
+	spin_lock_init(&ctx->cancel_lock);
 	ctx->clockid = clockid;
 
 	if (isalarm(ctx))

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 36/68] Handle mismatched open calls
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (32 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 35/68] timerfd: Protect the might cancel mechanism proper Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-07-14 16:42   ` Ben Hutchings
  2017-05-05 18:32 ` [PATCH 3.18 37/68] ALSA: pcm : Call kill_fasync() in stream lock Greg Kroah-Hartman
                   ` (33 subsequent siblings)
  67 siblings, 1 reply; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Sachin Prabhu, Pavel Shilovsky

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

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

From: Sachin Prabhu <sprabhu@redhat.com>

commit 38bd49064a1ecb67baad33598e3d824448ab11ec upstream.

A signal can interrupt a SendReceive call which result in incoming
responses to the call being ignored. This is a problem for calls such as
open which results in the successful response being ignored. This
results in an open file resource on the server.

The patch looks into responses which were cancelled after being sent and
in case of successful open closes the open fids.

For this patch, the check is only done in SendReceive2()

RH-bz: 1403319

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Acked-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/cifs/cifsglob.h      |   11 +++++++++
 fs/cifs/cifssmb.c       |    4 +++
 fs/cifs/connect.c       |   13 +++++++++-
 fs/cifs/smb2misc.c      |   44 ++++++++++++++++++++++++++++++++++++
 fs/cifs/smb2ops.c       |    4 +++
 fs/cifs/smb2proto.h     |    7 +++++
 fs/cifs/smb2transport.c |   58 +++++++++++++++++++++++++++++++++++++++++++-----
 fs/cifs/transport.c     |    2 +
 8 files changed, 135 insertions(+), 8 deletions(-)

--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -223,6 +223,7 @@ struct smb_version_operations {
 	/* verify the message */
 	int (*check_message)(char *, unsigned int);
 	bool (*is_oplock_break)(char *, struct TCP_Server_Info *);
+	int (*handle_cancelled_mid)(char *, struct TCP_Server_Info *);
 	void (*downgrade_oplock)(struct TCP_Server_Info *,
 					struct cifsInodeInfo *, bool);
 	/* process transaction2 response */
@@ -1264,12 +1265,19 @@ struct mid_q_entry {
 	void *callback_data;	  /* general purpose pointer for callback */
 	void *resp_buf;		/* pointer to received SMB header */
 	int mid_state;	/* wish this were enum but can not pass to wait_event */
+	unsigned int mid_flags;
 	__le16 command;		/* smb command code */
 	bool large_buf:1;	/* if valid response, is pointer to large buf */
 	bool multiRsp:1;	/* multiple trans2 responses for one request  */
 	bool multiEnd:1;	/* both received */
 };
 
+struct close_cancelled_open {
+	struct cifs_fid         fid;
+	struct cifs_tcon        *tcon;
+	struct work_struct      work;
+};
+
 /*	Make code in transport.c a little cleaner by moving
 	update of optional stats into function below */
 #ifdef CONFIG_CIFS_STATS2
@@ -1401,6 +1409,9 @@ static inline void free_dfs_info_array(s
 #define   MID_RESPONSE_MALFORMED 0x10
 #define   MID_SHUTDOWN		 0x20
 
+/* Flags */
+#define   MID_WAIT_CANCELLED	 1 /* Cancelled while waiting for response */
+
 /* Types of response buffer returned from SendReceive2 */
 #define   CIFS_NO_BUFFER        0    /* Response buffer not returned */
 #define   CIFS_SMALL_BUFFER     1
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -1422,6 +1422,8 @@ cifs_readv_discard(struct TCP_Server_Inf
 
 	length = discard_remaining_data(server);
 	dequeue_mid(mid, rdata->result);
+	mid->resp_buf = server->smallbuf;
+	server->smallbuf = NULL;
 	return length;
 }
 
@@ -1536,6 +1538,8 @@ cifs_readv_receive(struct TCP_Server_Inf
 		return cifs_readv_discard(server, mid);
 
 	dequeue_mid(mid, false);
+	mid->resp_buf = server->smallbuf;
+	server->smallbuf = NULL;
 	return length;
 }
 
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -914,10 +914,19 @@ cifs_demultiplex_thread(void *p)
 
 		server->lstrp = jiffies;
 		if (mid_entry != NULL) {
+			if ((mid_entry->mid_flags & MID_WAIT_CANCELLED) &&
+			     mid_entry->mid_state == MID_RESPONSE_RECEIVED &&
+					server->ops->handle_cancelled_mid)
+				server->ops->handle_cancelled_mid(
+							mid_entry->resp_buf,
+							server);
+
 			if (!mid_entry->multiRsp || mid_entry->multiEnd)
 				mid_entry->callback(mid_entry);
-		} else if (!server->ops->is_oplock_break ||
-			   !server->ops->is_oplock_break(buf, server)) {
+		} else if (server->ops->is_oplock_break &&
+			   server->ops->is_oplock_break(buf, server)) {
+			cifs_dbg(FYI, "Received oplock break\n");
+		} else {
 			cifs_dbg(VFS, "No task to wake, unknown frame received! NumMids %d\n",
 				 atomic_read(&midCount));
 			cifs_dump_mem("Received Data is: ", buf,
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -628,3 +628,47 @@ smb2_is_valid_oplock_break(char *buffer,
 	cifs_dbg(FYI, "Can not process oplock break for non-existent connection\n");
 	return false;
 }
+
+void
+smb2_cancelled_close_fid(struct work_struct *work)
+{
+	struct close_cancelled_open *cancelled = container_of(work,
+					struct close_cancelled_open, work);
+
+	cifs_dbg(VFS, "Close unmatched open\n");
+
+	SMB2_close(0, cancelled->tcon, cancelled->fid.persistent_fid,
+		   cancelled->fid.volatile_fid);
+	cifs_put_tcon(cancelled->tcon);
+	kfree(cancelled);
+}
+
+int
+smb2_handle_cancelled_mid(char *buffer, struct TCP_Server_Info *server)
+{
+	struct smb2_hdr *hdr = (struct smb2_hdr *)buffer;
+	struct smb2_create_rsp *rsp = (struct smb2_create_rsp *)buffer;
+	struct cifs_tcon *tcon;
+	struct close_cancelled_open *cancelled;
+
+	if (hdr->Command != SMB2_CREATE || hdr->Status != STATUS_SUCCESS)
+		return 0;
+
+	cancelled = kzalloc(sizeof(*cancelled), GFP_KERNEL);
+	if (!cancelled)
+		return -ENOMEM;
+
+	tcon = smb2_find_smb_tcon(server, hdr->SessionId, hdr->TreeId);
+	if (!tcon) {
+		kfree(cancelled);
+		return -ENOENT;
+	}
+
+	cancelled->fid.persistent_fid = rsp->PersistentFileId;
+	cancelled->fid.volatile_fid = rsp->VolatileFileId;
+	cancelled->tcon = tcon;
+	INIT_WORK(&cancelled->work, smb2_cancelled_close_fid);
+	queue_work(cifsiod_wq, &cancelled->work);
+
+	return 0;
+}
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -1461,6 +1461,8 @@ struct smb_version_operations smb21_oper
 	.clear_stats = smb2_clear_stats,
 	.print_stats = smb2_print_stats,
 	.is_oplock_break = smb2_is_valid_oplock_break,
+	.handle_cancelled_mid = smb2_handle_cancelled_mid,
+	.handle_cancelled_mid = smb2_handle_cancelled_mid,
 	.downgrade_oplock = smb2_downgrade_oplock,
 	.need_neg = smb2_need_neg,
 	.negotiate = smb2_negotiate,
@@ -1542,6 +1544,8 @@ struct smb_version_operations smb30_oper
 	.print_stats = smb2_print_stats,
 	.dump_share_caps = smb2_dump_share_caps,
 	.is_oplock_break = smb2_is_valid_oplock_break,
+	.handle_cancelled_mid = smb2_handle_cancelled_mid,
+	.handle_cancelled_mid = smb2_handle_cancelled_mid,
 	.downgrade_oplock = smb2_downgrade_oplock,
 	.need_neg = smb2_need_neg,
 	.negotiate = smb2_negotiate,
--- a/fs/cifs/smb2proto.h
+++ b/fs/cifs/smb2proto.h
@@ -47,6 +47,10 @@ extern struct mid_q_entry *smb2_setup_re
 			      struct smb_rqst *rqst);
 extern struct mid_q_entry *smb2_setup_async_request(
 			struct TCP_Server_Info *server, struct smb_rqst *rqst);
+extern struct cifs_ses *smb2_find_smb_ses(struct TCP_Server_Info *server,
+					   __u64 ses_id);
+extern struct cifs_tcon *smb2_find_smb_tcon(struct TCP_Server_Info *server,
+						__u64 ses_id, __u32  tid);
 extern int smb2_calc_signature(struct smb_rqst *rqst,
 				struct TCP_Server_Info *server);
 extern int smb3_calc_signature(struct smb_rqst *rqst,
@@ -157,6 +161,9 @@ extern int SMB2_set_compression(const un
 extern int SMB2_oplock_break(const unsigned int xid, struct cifs_tcon *tcon,
 			     const u64 persistent_fid, const u64 volatile_fid,
 			     const __u8 oplock_level);
+extern int smb2_handle_cancelled_mid(char *buffer,
+					struct TCP_Server_Info *server);
+void smb2_cancelled_close_fid(struct work_struct *work);
 extern int SMB2_QFS_info(const unsigned int xid, struct cifs_tcon *tcon,
 			 u64 persistent_file_id, u64 volatile_file_id,
 			 struct kstatfs *FSData);
--- a/fs/cifs/smb2transport.c
+++ b/fs/cifs/smb2transport.c
@@ -115,22 +115,68 @@ smb3_crypto_shash_allocate(struct TCP_Se
 }
 
 static struct cifs_ses *
-smb2_find_smb_ses(struct smb2_hdr *smb2hdr, struct TCP_Server_Info *server)
+smb2_find_smb_ses_unlocked(struct TCP_Server_Info *server, __u64 ses_id)
 {
 	struct cifs_ses *ses;
 
-	spin_lock(&cifs_tcp_ses_lock);
 	list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
-		if (ses->Suid != smb2hdr->SessionId)
+		if (ses->Suid != ses_id)
 			continue;
-		spin_unlock(&cifs_tcp_ses_lock);
 		return ses;
 	}
+
+	return NULL;
+}
+
+struct cifs_ses *
+smb2_find_smb_ses(struct TCP_Server_Info *server, __u64 ses_id)
+{
+	struct cifs_ses *ses;
+
+	spin_lock(&cifs_tcp_ses_lock);
+	ses = smb2_find_smb_ses_unlocked(server, ses_id);
 	spin_unlock(&cifs_tcp_ses_lock);
 
+	return ses;
+}
+
+static struct cifs_tcon *
+smb2_find_smb_sess_tcon_unlocked(struct cifs_ses *ses, __u32  tid)
+{
+	struct cifs_tcon *tcon;
+
+	list_for_each_entry(tcon, &ses->tcon_list, tcon_list) {
+		if (tcon->tid != tid)
+			continue;
+		++tcon->tc_count;
+		return tcon;
+	}
+
 	return NULL;
 }
 
+/*
+ * Obtain tcon corresponding to the tid in the given
+ * cifs_ses
+ */
+
+struct cifs_tcon *
+smb2_find_smb_tcon(struct TCP_Server_Info *server, __u64 ses_id, __u32 tid)
+{
+	struct cifs_ses *ses;
+	struct cifs_tcon *tcon;
+
+	spin_lock(&cifs_tcp_ses_lock);
+	ses = smb2_find_smb_ses_unlocked(server, ses_id);
+	if (!ses) {
+		spin_unlock(&cifs_tcp_ses_lock);
+		return NULL;
+	}
+	tcon = smb2_find_smb_sess_tcon_unlocked(ses, tid);
+	spin_unlock(&cifs_tcp_ses_lock);
+
+	return tcon;
+}
 
 int
 smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)
@@ -143,7 +189,7 @@ smb2_calc_signature(struct smb_rqst *rqs
 	struct smb2_hdr *smb2_pdu = (struct smb2_hdr *)iov[0].iov_base;
 	struct cifs_ses *ses;
 
-	ses = smb2_find_smb_ses(smb2_pdu, server);
+	ses = smb2_find_smb_ses(server, smb2_pdu->SessionId);
 	if (!ses) {
 		cifs_dbg(VFS, "%s: Could not find session\n", __func__);
 		return 0;
@@ -314,7 +360,7 @@ smb3_calc_signature(struct smb_rqst *rqs
 	struct smb2_hdr *smb2_pdu = (struct smb2_hdr *)iov[0].iov_base;
 	struct cifs_ses *ses;
 
-	ses = smb2_find_smb_ses(smb2_pdu, server);
+	ses = smb2_find_smb_ses(server, smb2_pdu->SessionId);
 	if (!ses) {
 		cifs_dbg(VFS, "%s: Could not find session\n", __func__);
 		return 0;
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -784,9 +784,11 @@ SendReceive2(const unsigned int xid, str
 
 	rc = wait_for_response(ses->server, midQ);
 	if (rc != 0) {
+		cifs_dbg(FYI, "Cancelling wait for mid %llu\n",	midQ->mid);
 		send_cancel(ses->server, buf, midQ);
 		spin_lock(&GlobalMid_Lock);
 		if (midQ->mid_state == MID_REQUEST_SUBMITTED) {
+			midQ->mid_flags |= MID_WAIT_CANCELLED;
 			midQ->callback = DeleteMidQEntry;
 			spin_unlock(&GlobalMid_Lock);
 			cifs_small_buf_release(buf);

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 37/68] ALSA: pcm : Call kill_fasync() in stream lock
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (33 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 36/68] Handle mismatched open calls Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 38/68] regulator: core: Fix regualtor_ena_gpio_free not to access pin after freeing Greg Kroah-Hartman
                   ` (32 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Baozeng Ding, Takashi Iwai, Amit Pundir

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

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

From: Takashi Iwai <tiwai@suse.de>

commit 3aa02cb664c5fb1042958c8d1aa8c35055a2ebc4 upstream.

Currently kill_fasync() is called outside the stream lock in
snd_pcm_period_elapsed().  This is potentially racy, since the stream
may get released even during the irq handler is running.  Although
snd_pcm_release_substream() calls snd_pcm_drop(), this doesn't
guarantee that the irq handler finishes, thus the kill_fasync() call
outside the stream spin lock may be invoked after the substream is
detached, as recently reported by KASAN.

As a quick workaround, move kill_fasync() call inside the stream
lock.  The fasync is rarely used interface, so this shouldn't have a
big impact from the performance POV.

Ideally, we should implement some sync mechanism for the proper finish
of stream and irq handler.  But this oneliner should suffice for most
cases, so far.

Reported-by: Baozeng Ding <sploving1@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/core/pcm_lib.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -1858,10 +1858,10 @@ void snd_pcm_period_elapsed(struct snd_p
 	if (substream->timer_running)
 		snd_timer_interrupt(substream->timer, 1);
  _end:
+	kill_fasync(&runtime->fasync, SIGIO, POLL_IN);
 	snd_pcm_stream_unlock_irqrestore(substream, flags);
 	if (runtime->transfer_ack_end)
 		runtime->transfer_ack_end(substream);
-	kill_fasync(&runtime->fasync, SIGIO, POLL_IN);
 }
 
 EXPORT_SYMBOL(snd_pcm_period_elapsed);

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 38/68] regulator: core: Fix regualtor_ena_gpio_free not to access pin after freeing
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (34 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 37/68] ALSA: pcm : Call kill_fasync() in stream lock Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 39/68] perf: Tighten (and fix) the grouping condition Greg Kroah-Hartman
                   ` (31 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Seung-Woo Kim, Mark Brown, Amit Pundir

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

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

From: Seung-Woo Kim <sw0312.kim@samsung.com>

commit 60a2362f769cf549dc466134efe71c8bf9fbaaba upstream.

After freeing pin from regulator_ena_gpio_free, loop can access
the pin. So this patch fixes not to access pin after freeing.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/regulator/core.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1720,6 +1720,8 @@ static void regulator_ena_gpio_free(stru
 				gpiod_put(pin->gpiod);
 				list_del(&pin->list);
 				kfree(pin);
+				rdev->ena_pin = NULL;
+				return;
 			} else {
 				pin->request_count--;
 			}

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 39/68] perf: Tighten (and fix) the grouping condition
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (35 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 38/68] regulator: core: Fix regualtor_ena_gpio_free not to access pin after freeing Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 40/68] posix_acl: Clear SGID bit when setting file permissions Greg Kroah-Hartman
                   ` (30 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Peter Zijlstra (Intel),
	Arnaldo Carvalho de Melo, Jiri Olsa, Linus Torvalds, Ingo Molnar,
	Amit Pundir

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

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

From: Peter Zijlstra <peterz@infradead.org>

commit c3c87e770458aa004bd7ed3f29945ff436fd6511 upstream.

The fix from 9fc81d87420d ("perf: Fix events installation during
moving group") was incomplete in that it failed to recognise that
creating a group with events for different CPUs is semantically
broken -- they cannot be co-scheduled.

Furthermore, it leads to real breakage where, when we create an event
for CPU Y and then migrate it to form a group on CPU X, the code gets
confused where the counter is programmed -- triggered in practice
as well by me via the perf fuzzer.

Fix this by tightening the rules for creating groups. Only allow
grouping of counters that can be co-scheduled in the same context.
This means for the same task and/or the same cpu.

Fixes: 9fc81d87420d ("perf: Fix events installation during moving group")
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/20150123125834.090683288@infradead.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/linux/perf_event.h |    6 ------
 kernel/events/core.c       |   15 +++++++++++++--
 2 files changed, 13 insertions(+), 8 deletions(-)

--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -455,11 +455,6 @@ struct perf_event {
 #endif /* CONFIG_PERF_EVENTS */
 };
 
-enum perf_event_context_type {
-	task_context,
-	cpu_context,
-};
-
 /**
  * struct perf_event_context - event context structure
  *
@@ -467,7 +462,6 @@ enum perf_event_context_type {
  */
 struct perf_event_context {
 	struct pmu			*pmu;
-	enum perf_event_context_type	type;
 	/*
 	 * Protect the states of the events in the list,
 	 * nr_active, and the list:
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6803,7 +6803,6 @@ skip_type:
 		__perf_event_init_context(&cpuctx->ctx);
 		lockdep_set_class(&cpuctx->ctx.mutex, &cpuctx_mutex);
 		lockdep_set_class(&cpuctx->ctx.lock, &cpuctx_lock);
-		cpuctx->ctx.type = cpu_context;
 		cpuctx->ctx.pmu = pmu;
 
 		__perf_cpu_hrtimer_init(cpuctx, cpu);
@@ -7445,7 +7444,19 @@ SYSCALL_DEFINE5(perf_event_open,
 		 * task or CPU context:
 		 */
 		if (move_group) {
-			if (group_leader->ctx->type != ctx->type)
+			/*
+			 * Make sure we're both on the same task, or both
+			 * per-cpu events.
+			 */
+			if (group_leader->ctx->task != ctx->task)
+				goto err_context;
+
+			/*
+			 * Make sure we're both events for the same CPU;
+			 * grouping events for different CPUs is broken; since
+			 * you can never concurrently schedule them anyhow.
+			 */
+			if (group_leader->cpu != event->cpu)
 				goto err_context;
 		} else {
 			if (group_leader->ctx != ctx)

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 40/68] posix_acl: Clear SGID bit when setting file permissions
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (36 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 39/68] perf: Tighten (and fix) the grouping condition Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 41/68] l2tp: fix racy SOCK_ZAPPED flag check in l2tp_ip{,6}_bind() Greg Kroah-Hartman
                   ` (29 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Christoph Hellwig, Jeff Layton,
	Jan Kara, Andreas Gruenbacher, Amit Pundir

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

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

From: Jan Kara <jack@suse.cz>

commit 073931017b49d9458aa351605b43a7e34598caef upstream.

When file permissions are modified via chmod(2) and the user is not in
the owning group or capable of CAP_FSETID, the setgid bit is cleared in
inode_change_ok().  Setting a POSIX ACL via setxattr(2) sets the file
permissions as well as the new ACL, but doesn't clear the setgid bit in
a similar way; this allows to bypass the check in chmod(2).  Fix that.

References: CVE-2016-7097
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/9p/acl.c               |   40 +++++++++++++++++-----------------------
 fs/btrfs/acl.c            |    6 ++----
 fs/ceph/acl.c             |    6 ++----
 fs/ext2/acl.c             |   12 ++++--------
 fs/ext4/acl.c             |   12 ++++--------
 fs/f2fs/acl.c             |    6 ++----
 fs/gfs2/acl.c             |   12 +++---------
 fs/hfsplus/posix_acl.c    |    4 ++--
 fs/jffs2/acl.c            |    9 ++++-----
 fs/jfs/acl.c              |    6 ++----
 fs/ocfs2/acl.c            |   20 ++++++++------------
 fs/posix_acl.c            |   31 +++++++++++++++++++++++++++++++
 fs/reiserfs/xattr_acl.c   |    8 ++------
 fs/xfs/xfs_acl.c          |   13 ++++---------
 include/linux/posix_acl.h |    1 +
 15 files changed, 88 insertions(+), 98 deletions(-)

--- a/fs/9p/acl.c
+++ b/fs/9p/acl.c
@@ -320,32 +320,26 @@ static int v9fs_xattr_set_acl(struct den
 	case ACL_TYPE_ACCESS:
 		name = POSIX_ACL_XATTR_ACCESS;
 		if (acl) {
-			umode_t mode = inode->i_mode;
-			retval = posix_acl_equiv_mode(acl, &mode);
-			if (retval < 0)
+			struct iattr iattr;
+
+			retval = posix_acl_update_mode(inode, &iattr.ia_mode, &acl);
+			if (retval)
 				goto err_out;
-			else {
-				struct iattr iattr;
-				if (retval == 0) {
-					/*
-					 * ACL can be represented
-					 * by the mode bits. So don't
-					 * update ACL.
-					 */
-					acl = NULL;
-					value = NULL;
-					size = 0;
-				}
-				/* Updte the mode bits */
-				iattr.ia_mode = ((mode & S_IALLUGO) |
-						 (inode->i_mode & ~S_IALLUGO));
-				iattr.ia_valid = ATTR_MODE;
-				/* FIXME should we update ctime ?
-				 * What is the following setxattr update the
-				 * mode ?
+			if (!acl) {
+				/*
+				 * ACL can be represented
+				 * by the mode bits. So don't
+				 * update ACL.
 				 */
-				v9fs_vfs_setattr_dotl(dentry, &iattr);
+				value = NULL;
+				size = 0;
 			}
+			iattr.ia_valid = ATTR_MODE;
+			/* FIXME should we update ctime ?
+			 * What is the following setxattr update the
+			 * mode ?
+			 */
+			v9fs_vfs_setattr_dotl(dentry, &iattr);
 		}
 		break;
 	case ACL_TYPE_DEFAULT:
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -83,11 +83,9 @@ static int __btrfs_set_acl(struct btrfs_
 	case ACL_TYPE_ACCESS:
 		name = POSIX_ACL_XATTR_ACCESS;
 		if (acl) {
-			ret = posix_acl_equiv_mode(acl, &inode->i_mode);
-			if (ret < 0)
+			ret = posix_acl_update_mode(inode, &inode->i_mode, &acl);
+			if (ret)
 				return ret;
-			if (ret == 0)
-				acl = NULL;
 		}
 		ret = 0;
 		break;
--- a/fs/ceph/acl.c
+++ b/fs/ceph/acl.c
@@ -108,11 +108,9 @@ int ceph_set_acl(struct inode *inode, st
 	case ACL_TYPE_ACCESS:
 		name = POSIX_ACL_XATTR_ACCESS;
 		if (acl) {
-			ret = posix_acl_equiv_mode(acl, &new_mode);
-			if (ret < 0)
+			ret = posix_acl_update_mode(inode, &new_mode, &acl);
+			if (ret)
 				goto out;
-			if (ret == 0)
-				acl = NULL;
 		}
 		break;
 	case ACL_TYPE_DEFAULT:
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -193,15 +193,11 @@ ext2_set_acl(struct inode *inode, struct
 		case ACL_TYPE_ACCESS:
 			name_index = EXT2_XATTR_INDEX_POSIX_ACL_ACCESS;
 			if (acl) {
-				error = posix_acl_equiv_mode(acl, &inode->i_mode);
-				if (error < 0)
+				error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
+				if (error)
 					return error;
-				else {
-					inode->i_ctime = CURRENT_TIME_SEC;
-					mark_inode_dirty(inode);
-					if (error == 0)
-						acl = NULL;
-				}
+				inode->i_ctime = CURRENT_TIME_SEC;
+				mark_inode_dirty(inode);
 			}
 			break;
 
--- a/fs/ext4/acl.c
+++ b/fs/ext4/acl.c
@@ -201,15 +201,11 @@ __ext4_set_acl(handle_t *handle, struct
 	case ACL_TYPE_ACCESS:
 		name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
 		if (acl) {
-			error = posix_acl_equiv_mode(acl, &inode->i_mode);
-			if (error < 0)
+			error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
+			if (error)
 				return error;
-			else {
-				inode->i_ctime = ext4_current_time(inode);
-				ext4_mark_inode_dirty(handle, inode);
-				if (error == 0)
-					acl = NULL;
-			}
+			inode->i_ctime = ext4_current_time(inode);
+			ext4_mark_inode_dirty(handle, inode);
 		}
 		break;
 
--- a/fs/f2fs/acl.c
+++ b/fs/f2fs/acl.c
@@ -207,12 +207,10 @@ static int __f2fs_set_acl(struct inode *
 	case ACL_TYPE_ACCESS:
 		name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS;
 		if (acl) {
-			error = posix_acl_equiv_mode(acl, &inode->i_mode);
-			if (error < 0)
+			error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
+			if (error)
 				return error;
 			set_acl_inode(fi, inode->i_mode);
-			if (error == 0)
-				acl = NULL;
 		}
 		break;
 
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -79,17 +79,11 @@ int gfs2_set_acl(struct inode *inode, st
 	if (type == ACL_TYPE_ACCESS) {
 		umode_t mode = inode->i_mode;
 
-		error = posix_acl_equiv_mode(acl, &mode);
-		if (error < 0)
+		error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
+		if (error)
 			return error;
-
-		if (error == 0)
-			acl = NULL;
-
-		if (mode != inode->i_mode) {
-			inode->i_mode = mode;
+		if (mode != inode->i_mode)
 			mark_inode_dirty(inode);
-		}
 	}
 
 	if (acl) {
--- a/fs/hfsplus/posix_acl.c
+++ b/fs/hfsplus/posix_acl.c
@@ -68,8 +68,8 @@ int hfsplus_set_posix_acl(struct inode *
 	case ACL_TYPE_ACCESS:
 		xattr_name = POSIX_ACL_XATTR_ACCESS;
 		if (acl) {
-			err = posix_acl_equiv_mode(acl, &inode->i_mode);
-			if (err < 0)
+			err = posix_acl_update_mode(inode, &inode->i_mode, &acl);
+			if (err)
 				return err;
 		}
 		err = 0;
--- a/fs/jffs2/acl.c
+++ b/fs/jffs2/acl.c
@@ -235,9 +235,10 @@ int jffs2_set_acl(struct inode *inode, s
 	case ACL_TYPE_ACCESS:
 		xprefix = JFFS2_XPREFIX_ACL_ACCESS;
 		if (acl) {
-			umode_t mode = inode->i_mode;
-			rc = posix_acl_equiv_mode(acl, &mode);
-			if (rc < 0)
+			umode_t mode;
+
+			rc = posix_acl_update_mode(inode, &mode, &acl);
+			if (rc)
 				return rc;
 			if (inode->i_mode != mode) {
 				struct iattr attr;
@@ -249,8 +250,6 @@ int jffs2_set_acl(struct inode *inode, s
 				if (rc < 0)
 					return rc;
 			}
-			if (rc == 0)
-				acl = NULL;
 		}
 		break;
 	case ACL_TYPE_DEFAULT:
--- a/fs/jfs/acl.c
+++ b/fs/jfs/acl.c
@@ -84,13 +84,11 @@ static int __jfs_set_acl(tid_t tid, stru
 	case ACL_TYPE_ACCESS:
 		ea_name = POSIX_ACL_XATTR_ACCESS;
 		if (acl) {
-			rc = posix_acl_equiv_mode(acl, &inode->i_mode);
-			if (rc < 0)
+			rc = posix_acl_update_mode(inode, &inode->i_mode, &acl);
+			if (rc)
 				return rc;
 			inode->i_ctime = CURRENT_TIME;
 			mark_inode_dirty(inode);
-			if (rc == 0)
-				acl = NULL;
 		}
 		break;
 	case ACL_TYPE_DEFAULT:
--- a/fs/ocfs2/acl.c
+++ b/fs/ocfs2/acl.c
@@ -241,20 +241,16 @@ int ocfs2_set_acl(handle_t *handle,
 	case ACL_TYPE_ACCESS:
 		name_index = OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS;
 		if (acl) {
-			umode_t mode = inode->i_mode;
-			ret = posix_acl_equiv_mode(acl, &mode);
-			if (ret < 0)
-				return ret;
-			else {
-				if (ret == 0)
-					acl = NULL;
+			umode_t mode;
 
-				ret = ocfs2_acl_set_mode(inode, di_bh,
-							 handle, mode);
-				if (ret)
-					return ret;
+			ret = posix_acl_update_mode(inode, &mode, &acl);
+			if (ret)
+				return ret;
 
-			}
+			ret = ocfs2_acl_set_mode(inode, di_bh,
+						 handle, mode);
+			if (ret)
+				return ret;
 		}
 		break;
 	case ACL_TYPE_DEFAULT:
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -594,6 +594,37 @@ no_acl:
 }
 EXPORT_SYMBOL_GPL(posix_acl_create);
 
+/**
+ * posix_acl_update_mode  -  update mode in set_acl
+ *
+ * Update the file mode when setting an ACL: compute the new file permission
+ * bits based on the ACL.  In addition, if the ACL is equivalent to the new
+ * file mode, set *acl to NULL to indicate that no ACL should be set.
+ *
+ * As with chmod, clear the setgit bit if the caller is not in the owning group
+ * or capable of CAP_FSETID (see inode_change_ok).
+ *
+ * Called from set_acl inode operations.
+ */
+int posix_acl_update_mode(struct inode *inode, umode_t *mode_p,
+			  struct posix_acl **acl)
+{
+	umode_t mode = inode->i_mode;
+	int error;
+
+	error = posix_acl_equiv_mode(*acl, &mode);
+	if (error < 0)
+		return error;
+	if (error == 0)
+		*acl = NULL;
+	if (!in_group_p(inode->i_gid) &&
+	    !capable_wrt_inode_uidgid(inode, CAP_FSETID))
+		mode &= ~S_ISGID;
+	*mode_p = mode;
+	return 0;
+}
+EXPORT_SYMBOL(posix_acl_update_mode);
+
 /*
  * Fix up the uids and gids in posix acl extended attributes in place.
  */
--- a/fs/reiserfs/xattr_acl.c
+++ b/fs/reiserfs/xattr_acl.c
@@ -246,13 +246,9 @@ __reiserfs_set_acl(struct reiserfs_trans
 	case ACL_TYPE_ACCESS:
 		name = POSIX_ACL_XATTR_ACCESS;
 		if (acl) {
-			error = posix_acl_equiv_mode(acl, &inode->i_mode);
-			if (error < 0)
+			error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
+			if (error)
 				return error;
-			else {
-				if (error == 0)
-					acl = NULL;
-			}
 		}
 		break;
 	case ACL_TYPE_DEFAULT:
--- a/fs/xfs/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
@@ -286,16 +286,11 @@ xfs_set_acl(struct inode *inode, struct
 		return error;
 
 	if (type == ACL_TYPE_ACCESS) {
-		umode_t mode = inode->i_mode;
-		error = posix_acl_equiv_mode(acl, &mode);
-
-		if (error <= 0) {
-			acl = NULL;
-
-			if (error < 0)
-				return error;
-		}
+		umode_t mode;
 
+		error = posix_acl_update_mode(inode, &mode, &acl);
+		if (error)
+			return error;
 		error = xfs_set_mode(inode, mode);
 		if (error)
 			return error;
--- a/include/linux/posix_acl.h
+++ b/include/linux/posix_acl.h
@@ -95,6 +95,7 @@ extern int set_posix_acl(struct inode *,
 extern int posix_acl_chmod(struct inode *, umode_t);
 extern int posix_acl_create(struct inode *, umode_t *, struct posix_acl **,
 		struct posix_acl **);
+extern int posix_acl_update_mode(struct inode *, umode_t *, struct posix_acl **);
 
 extern int simple_set_acl(struct inode *, struct posix_acl *, int);
 extern int simple_acl_create(struct inode *, struct inode *);

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 41/68] l2tp: fix racy SOCK_ZAPPED flag check in l2tp_ip{,6}_bind()
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (37 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 40/68] posix_acl: Clear SGID bit when setting file permissions Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 42/68] net: avoid signed overflows for SO_{SND|RCV}BUFFORCE Greg Kroah-Hartman
                   ` (28 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Baozeng Ding, Andrey Konovalov,
	Guillaume Nault, David S. Miller, Amit Pundir

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

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

From: Guillaume Nault <g.nault@alphalink.fr>

commit 32c231164b762dddefa13af5a0101032c70b50ef upstream.

Lock socket before checking the SOCK_ZAPPED flag in l2tp_ip6_bind().
Without lock, a concurrent call could modify the socket flags between
the sock_flag(sk, SOCK_ZAPPED) test and the lock_sock() call. This way,
a socket could be inserted twice in l2tp_ip6_bind_table. Releasing it
would then leave a stale pointer there, generating use-after-free
errors when walking through the list or modifying adjacent entries.

BUG: KASAN: use-after-free in l2tp_ip6_close+0x22e/0x290 at addr ffff8800081b0ed8
Write of size 8 by task syz-executor/10987
CPU: 0 PID: 10987 Comm: syz-executor Not tainted 4.8.0+ #39
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.8.2-0-g33fbe13 by qemu-project.org 04/01/2014
 ffff880031d97838 ffffffff829f835b ffff88001b5a1640 ffff8800081b0ec0
 ffff8800081b15a0 ffff8800081b6d20 ffff880031d97860 ffffffff8174d3cc
 ffff880031d978f0 ffff8800081b0e80 ffff88001b5a1640 ffff880031d978e0
Call Trace:
 [<ffffffff829f835b>] dump_stack+0xb3/0x118 lib/dump_stack.c:15
 [<ffffffff8174d3cc>] kasan_object_err+0x1c/0x70 mm/kasan/report.c:156
 [<     inline     >] print_address_description mm/kasan/report.c:194
 [<ffffffff8174d666>] kasan_report_error+0x1f6/0x4d0 mm/kasan/report.c:283
 [<     inline     >] kasan_report mm/kasan/report.c:303
 [<ffffffff8174db7e>] __asan_report_store8_noabort+0x3e/0x40 mm/kasan/report.c:329
 [<     inline     >] __write_once_size ./include/linux/compiler.h:249
 [<     inline     >] __hlist_del ./include/linux/list.h:622
 [<     inline     >] hlist_del_init ./include/linux/list.h:637
 [<ffffffff8579047e>] l2tp_ip6_close+0x22e/0x290 net/l2tp/l2tp_ip6.c:239
 [<ffffffff850b2dfd>] inet_release+0xed/0x1c0 net/ipv4/af_inet.c:415
 [<ffffffff851dc5a0>] inet6_release+0x50/0x70 net/ipv6/af_inet6.c:422
 [<ffffffff84c4581d>] sock_release+0x8d/0x1d0 net/socket.c:570
 [<ffffffff84c45976>] sock_close+0x16/0x20 net/socket.c:1017
 [<ffffffff817a108c>] __fput+0x28c/0x780 fs/file_table.c:208
 [<ffffffff817a1605>] ____fput+0x15/0x20 fs/file_table.c:244
 [<ffffffff813774f9>] task_work_run+0xf9/0x170
 [<ffffffff81324aae>] do_exit+0x85e/0x2a00
 [<ffffffff81326dc8>] do_group_exit+0x108/0x330
 [<ffffffff81348cf7>] get_signal+0x617/0x17a0 kernel/signal.c:2307
 [<ffffffff811b49af>] do_signal+0x7f/0x18f0
 [<ffffffff810039bf>] exit_to_usermode_loop+0xbf/0x150 arch/x86/entry/common.c:156
 [<     inline     >] prepare_exit_to_usermode arch/x86/entry/common.c:190
 [<ffffffff81006060>] syscall_return_slowpath+0x1a0/0x1e0 arch/x86/entry/common.c:259
 [<ffffffff85e4d726>] entry_SYSCALL_64_fastpath+0xc4/0xc6
Object at ffff8800081b0ec0, in cache L2TP/IPv6 size: 1448
Allocated:
PID = 10987
 [ 1116.897025] [<ffffffff811ddcb6>] save_stack_trace+0x16/0x20
 [ 1116.897025] [<ffffffff8174c736>] save_stack+0x46/0xd0
 [ 1116.897025] [<ffffffff8174c9ad>] kasan_kmalloc+0xad/0xe0
 [ 1116.897025] [<ffffffff8174cee2>] kasan_slab_alloc+0x12/0x20
 [ 1116.897025] [<     inline     >] slab_post_alloc_hook mm/slab.h:417
 [ 1116.897025] [<     inline     >] slab_alloc_node mm/slub.c:2708
 [ 1116.897025] [<     inline     >] slab_alloc mm/slub.c:2716
 [ 1116.897025] [<ffffffff817476a8>] kmem_cache_alloc+0xc8/0x2b0 mm/slub.c:2721
 [ 1116.897025] [<ffffffff84c4f6a9>] sk_prot_alloc+0x69/0x2b0 net/core/sock.c:1326
 [ 1116.897025] [<ffffffff84c58ac8>] sk_alloc+0x38/0xae0 net/core/sock.c:1388
 [ 1116.897025] [<ffffffff851ddf67>] inet6_create+0x2d7/0x1000 net/ipv6/af_inet6.c:182
 [ 1116.897025] [<ffffffff84c4af7b>] __sock_create+0x37b/0x640 net/socket.c:1153
 [ 1116.897025] [<     inline     >] sock_create net/socket.c:1193
 [ 1116.897025] [<     inline     >] SYSC_socket net/socket.c:1223
 [ 1116.897025] [<ffffffff84c4b46f>] SyS_socket+0xef/0x1b0 net/socket.c:1203
 [ 1116.897025] [<ffffffff85e4d685>] entry_SYSCALL_64_fastpath+0x23/0xc6
Freed:
PID = 10987
 [ 1116.897025] [<ffffffff811ddcb6>] save_stack_trace+0x16/0x20
 [ 1116.897025] [<ffffffff8174c736>] save_stack+0x46/0xd0
 [ 1116.897025] [<ffffffff8174cf61>] kasan_slab_free+0x71/0xb0
 [ 1116.897025] [<     inline     >] slab_free_hook mm/slub.c:1352
 [ 1116.897025] [<     inline     >] slab_free_freelist_hook mm/slub.c:1374
 [ 1116.897025] [<     inline     >] slab_free mm/slub.c:2951
 [ 1116.897025] [<ffffffff81748b28>] kmem_cache_free+0xc8/0x330 mm/slub.c:2973
 [ 1116.897025] [<     inline     >] sk_prot_free net/core/sock.c:1369
 [ 1116.897025] [<ffffffff84c541eb>] __sk_destruct+0x32b/0x4f0 net/core/sock.c:1444
 [ 1116.897025] [<ffffffff84c5aca4>] sk_destruct+0x44/0x80 net/core/sock.c:1452
 [ 1116.897025] [<ffffffff84c5ad33>] __sk_free+0x53/0x220 net/core/sock.c:1460
 [ 1116.897025] [<ffffffff84c5af23>] sk_free+0x23/0x30 net/core/sock.c:1471
 [ 1116.897025] [<ffffffff84c5cb6c>] sk_common_release+0x28c/0x3e0 ./include/net/sock.h:1589
 [ 1116.897025] [<ffffffff8579044e>] l2tp_ip6_close+0x1fe/0x290 net/l2tp/l2tp_ip6.c:243
 [ 1116.897025] [<ffffffff850b2dfd>] inet_release+0xed/0x1c0 net/ipv4/af_inet.c:415
 [ 1116.897025] [<ffffffff851dc5a0>] inet6_release+0x50/0x70 net/ipv6/af_inet6.c:422
 [ 1116.897025] [<ffffffff84c4581d>] sock_release+0x8d/0x1d0 net/socket.c:570
 [ 1116.897025] [<ffffffff84c45976>] sock_close+0x16/0x20 net/socket.c:1017
 [ 1116.897025] [<ffffffff817a108c>] __fput+0x28c/0x780 fs/file_table.c:208
 [ 1116.897025] [<ffffffff817a1605>] ____fput+0x15/0x20 fs/file_table.c:244
 [ 1116.897025] [<ffffffff813774f9>] task_work_run+0xf9/0x170
 [ 1116.897025] [<ffffffff81324aae>] do_exit+0x85e/0x2a00
 [ 1116.897025] [<ffffffff81326dc8>] do_group_exit+0x108/0x330
 [ 1116.897025] [<ffffffff81348cf7>] get_signal+0x617/0x17a0 kernel/signal.c:2307
 [ 1116.897025] [<ffffffff811b49af>] do_signal+0x7f/0x18f0
 [ 1116.897025] [<ffffffff810039bf>] exit_to_usermode_loop+0xbf/0x150 arch/x86/entry/common.c:156
 [ 1116.897025] [<     inline     >] prepare_exit_to_usermode arch/x86/entry/common.c:190
 [ 1116.897025] [<ffffffff81006060>] syscall_return_slowpath+0x1a0/0x1e0 arch/x86/entry/common.c:259
 [ 1116.897025] [<ffffffff85e4d726>] entry_SYSCALL_64_fastpath+0xc4/0xc6
Memory state around the buggy address:
 ffff8800081b0d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8800081b0e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8800081b0e80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                                    ^
 ffff8800081b0f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8800081b0f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb

==================================================================

The same issue exists with l2tp_ip_bind() and l2tp_ip_bind_table.

Fixes: c51ce49735c1 ("l2tp: fix oops in L2TP IP sockets for connect() AF_UNSPEC case")
Reported-by: Baozeng Ding <sploving1@gmail.com>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Baozeng Ding <sploving1@gmail.com>
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/l2tp/l2tp_ip.c  |    5 +++--
 net/l2tp/l2tp_ip6.c |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -252,8 +252,6 @@ static int l2tp_ip_bind(struct sock *sk,
 	int ret;
 	int chk_addr_ret;
 
-	if (!sock_flag(sk, SOCK_ZAPPED))
-		return -EINVAL;
 	if (addr_len < sizeof(struct sockaddr_l2tpip))
 		return -EINVAL;
 	if (addr->l2tp_family != AF_INET)
@@ -268,6 +266,9 @@ static int l2tp_ip_bind(struct sock *sk,
 	read_unlock_bh(&l2tp_ip_lock);
 
 	lock_sock(sk);
+	if (!sock_flag(sk, SOCK_ZAPPED))
+		goto out;
+
 	if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_l2tpip))
 		goto out;
 
--- a/net/l2tp/l2tp_ip6.c
+++ b/net/l2tp/l2tp_ip6.c
@@ -266,8 +266,6 @@ static int l2tp_ip6_bind(struct sock *sk
 	int addr_type;
 	int err;
 
-	if (!sock_flag(sk, SOCK_ZAPPED))
-		return -EINVAL;
 	if (addr->l2tp_family != AF_INET6)
 		return -EINVAL;
 	if (addr_len < sizeof(*addr))
@@ -293,6 +291,9 @@ static int l2tp_ip6_bind(struct sock *sk
 	lock_sock(sk);
 
 	err = -EINVAL;
+	if (!sock_flag(sk, SOCK_ZAPPED))
+		goto out_unlock;
+
 	if (sk->sk_state != TCP_CLOSE)
 		goto out_unlock;
 

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 42/68] net: avoid signed overflows for SO_{SND|RCV}BUFFORCE
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (38 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 41/68] l2tp: fix racy SOCK_ZAPPED flag check in l2tp_ip{,6}_bind() Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 43/68] mm: avoid setting up anonymous pages into file mapping Greg Kroah-Hartman
                   ` (27 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Eric Dumazet, Andrey Konovalov,
	David S. Miller, Amit Pundir

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

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

From: Eric Dumazet <edumazet@google.com>

commit b98b0bc8c431e3ceb4b26b0dfc8db509518fb290 upstream.

CAP_NET_ADMIN users should not be allowed to set negative
sk_sndbuf or sk_rcvbuf values, as it can lead to various memory
corruptions, crashes, OOM...

Note that before commit 82981930125a ("net: cleanups in
sock_setsockopt()"), the bug was even more serious, since SO_SNDBUF
and SO_RCVBUF were vulnerable.

This needs to be backported to all known linux kernels.

Again, many thanks to syzkaller team for discovering this gem.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/core/sock.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -733,7 +733,7 @@ int sock_setsockopt(struct socket *sock,
 		val = min_t(u32, val, sysctl_wmem_max);
 set_sndbuf:
 		sk->sk_userlocks |= SOCK_SNDBUF_LOCK;
-		sk->sk_sndbuf = max_t(u32, val * 2, SOCK_MIN_SNDBUF);
+		sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF);
 		/* Wake up sending tasks if we upped the value. */
 		sk->sk_write_space(sk);
 		break;
@@ -769,7 +769,7 @@ set_rcvbuf:
 		 * returning the value we actually used in getsockopt
 		 * is the most desirable behavior.
 		 */
-		sk->sk_rcvbuf = max_t(u32, val * 2, SOCK_MIN_RCVBUF);
+		sk->sk_rcvbuf = max_t(int, val * 2, SOCK_MIN_RCVBUF);
 		break;
 
 	case SO_RCVBUFFORCE:

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 43/68] mm: avoid setting up anonymous pages into file mapping
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (39 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 42/68] net: avoid signed overflows for SO_{SND|RCV}BUFFORCE Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 44/68] ARM: cns3xxx: shut up frame size warning Greg Kroah-Hartman
                   ` (26 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Kirill A. Shutemov, Oleg Nesterov,
	Andrew Morton, Willy Tarreau, Linus Torvalds, Amit Pundir

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

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

From: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

commit 6b7339f4c31ad69c8e9c0b2859276e22cf72176d upstream.

Reading page fault handler code I've noticed that under right
circumstances kernel would map anonymous pages into file mappings: if
the VMA doesn't have vm_ops->fault() and the VMA wasn't fully populated
on ->mmap(), kernel would handle page fault to not populated pte with
do_anonymous_page().

Let's change page fault handler to use do_anonymous_page() only on
anonymous VMA (->vm_ops == NULL) and make sure that the VMA is not
shared.

For file mappings without vm_ops->fault() or shred VMA without vm_ops,
page fault on pte_none() entry would lead to SIGBUS.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Willy Tarreau <w@1wt.eu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 mm/memory.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2629,6 +2629,10 @@ static int do_anonymous_page(struct mm_s
 
 	pte_unmap(page_table);
 
+	/* File mapping without ->vm_ops ? */
+	if (vma->vm_flags & VM_SHARED)
+		return VM_FAULT_SIGBUS;
+
 	/* Check if we need to add a guard page to the stack */
 	if (check_stack_guard_page(vma, address) < 0)
 		return VM_FAULT_SIGSEGV;
@@ -3033,6 +3037,9 @@ static int do_linear_fault(struct mm_str
 			- vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
 
 	pte_unmap(page_table);
+	/* The VMA was not fully populated on mmap() or missing VM_DONTEXPAND */
+	if (!vma->vm_ops->fault)
+		return VM_FAULT_SIGBUS;
 	if (!(flags & FAULT_FLAG_WRITE))
 		return do_read_fault(mm, vma, address, pmd, pgoff, flags,
 				orig_pte);
@@ -3198,11 +3205,9 @@ static int handle_pte_fault(struct mm_st
 	entry = ACCESS_ONCE(*pte);
 	if (!pte_present(entry)) {
 		if (pte_none(entry)) {
-			if (vma->vm_ops) {
-				if (likely(vma->vm_ops->fault))
-					return do_linear_fault(mm, vma, address,
+			if (vma->vm_ops)
+				return do_linear_fault(mm, vma, address,
 						pte, pmd, flags, entry);
-			}
 			return do_anonymous_page(mm, vma, address,
 						 pte, pmd, flags);
 		}

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 44/68] ARM: cns3xxx: shut up frame size warning
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (40 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 43/68] mm: avoid setting up anonymous pages into file mapping Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 45/68] arm64: Provide a namespace to NCAPS Greg Kroah-Hartman
                   ` (25 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, stable@vger.kernel.org,
	Arnd Bergmann, Arnd Bergmann

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

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

From: Arnd Bergmann <arnd@arndb.de>

This shuts up a warning in the 3.18-stable series that has been fixed
in newer kernels with commit 498a92d42596 ("ARM: cns3xxx: pci: avoid
potential stack overflow"):

arch/arm/mach-cns3xxx/pcie.c: In function 'cns3xxx_pcie_hw_init':
arch/arm/mach-cns3xxx/pcie.c:313:1: error: the frame size of 1080 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]

The fix that went into v4.4 is known to be buggy and was later
fixed again with commit 88e9da9a2a70 ("CNS3xxx: Fix PCI
cns3xxx_write_config()"). While we could backport both to 3.18,
they are fairly invasive and the warning is definitely harmless
here as the call chain is known to not overflow the stack of the
init task.

This simply adds a Makefile flag to extend the limit for this one
file.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
We do want 88e9da9a2a70 ("CNS3xxx: Fix PCI cns3xxx_write_config()")
backported into v4.4 though.
---
 arch/arm/mach-cns3xxx/Makefile |    1 +
 1 file changed, 1 insertion(+)

--- a/arch/arm/mach-cns3xxx/Makefile
+++ b/arch/arm/mach-cns3xxx/Makefile
@@ -2,4 +2,5 @@ obj-$(CONFIG_ARCH_CNS3XXX)		+= cns3xxx.o
 cns3xxx-y				+= core.o pm.o
 cns3xxx-$(CONFIG_ATAGS)			+= devices.o
 cns3xxx-$(CONFIG_PCI)			+= pcie.o
+CFLAGS_pcie.o				+= -Wframe-larger-than=1536 # override default 1024, this is safe here
 cns3xxx-$(CONFIG_MACH_CNS3420VB)	+= cns3420vb.o

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 45/68] arm64: Provide a namespace to NCAPS
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (41 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 44/68] ARM: cns3xxx: shut up frame size warning Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 46/68] staging: vt6655: fix overly large stack usage Greg Kroah-Hartman
                   ` (24 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Olofs autobuilder, Fabio Estevam,
	Will Deacon, Arnd Bergmann

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

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

From: Fabio Estevam <fabio.estevam@freescale.com>

commit 06f9eb884be81431d54d7d37390043e3b5b7f14a upstream.

Building arm64.allmodconfig leads to the following warning:

usb/gadget/function/f_ncm.c:203:0: warning: "NCAPS" redefined
 #define NCAPS (USB_CDC_NCM_NCAP_ETH_FILTER | USB_CDC_NCM_NCAP_CRC_MODE)
 ^
In file included from /home/build/work/batch/arch/arm64/include/asm/io.h:32:0,
                 from /home/build/work/batch/include/linux/clocksource.h:19,
                 from /home/build/work/batch/include/clocksource/arm_arch_timer.h:19,
                 from /home/build/work/batch/arch/arm64/include/asm/arch_timer.h:27,
                 from /home/build/work/batch/arch/arm64/include/asm/timex.h:19,
                 from /home/build/work/batch/include/linux/timex.h:65,
                 from /home/build/work/batch/include/linux/sched.h:19,
                 from /home/build/work/batch/arch/arm64/include/asm/compat.h:25,
                 from /home/build/work/batch/arch/arm64/include/asm/stat.h:23,
                 from /home/build/work/batch/include/linux/stat.h:5,
                 from /home/build/work/batch/include/linux/module.h:10,
                 from /home/build/work/batch/drivers/usb/gadget/function/f_ncm.c:19:
arch/arm64/include/asm/cpufeature.h:27:0: note: this is the location of the previous definition
 #define NCAPS     2

So add a ARM64 prefix to avoid such problem.

Reported-by: Olof's autobuilder <build@lixom.net>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/include/asm/cpufeature.h |   10 +++++-----
 arch/arm64/kernel/setup.c           |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

--- a/arch/arm64/include/asm/cpufeature.h
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -25,11 +25,11 @@
 #define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE	1
 #define ARM64_WORKAROUND_845719			2
 
-#define NCAPS					3
+#define ARM64_NCAPS				3
 
 #ifndef __ASSEMBLY__
 
-extern DECLARE_BITMAP(cpu_hwcaps, NCAPS);
+extern DECLARE_BITMAP(cpu_hwcaps, ARM64_NCAPS);
 
 static inline bool cpu_have_feature(unsigned int num)
 {
@@ -38,16 +38,16 @@ static inline bool cpu_have_feature(unsi
 
 static inline bool cpus_have_cap(unsigned int num)
 {
-	if (num >= NCAPS)
+	if (num >= ARM64_NCAPS)
 		return false;
 	return test_bit(num, cpu_hwcaps);
 }
 
 static inline void cpus_set_cap(unsigned int num)
 {
-	if (num >= NCAPS)
+	if (num >= ARM64_NCAPS)
 		pr_warn("Attempt to set an illegal CPU capability (%d >= %d)\n",
-			num, NCAPS);
+			num, ARM64_NCAPS);
 	else
 		__set_bit(num, cpu_hwcaps);
 }
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -80,7 +80,7 @@ unsigned int compat_elf_hwcap __read_mos
 unsigned int compat_elf_hwcap2 __read_mostly;
 #endif
 
-DECLARE_BITMAP(cpu_hwcaps, NCAPS);
+DECLARE_BITMAP(cpu_hwcaps, ARM64_NCAPS);
 
 static const char *cpu_name;
 phys_addr_t __fdt_pointer __initdata;

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 46/68] staging: vt6655: fix overly large stack usage
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (42 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 45/68] arm64: Provide a namespace to NCAPS Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 47/68] staging: imx-drm: fix indentation warning Greg Kroah-Hartman
                   ` (23 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, stable@vger.kernel.org,
	Arnd Bergmann, Arnd Bergmann

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

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

From: Arnd Bergmann <arnd@arndb.de>

We get a warning for the large stack usage in some configurations:

drivers/staging/vt6655/device_main.c: In function 'device_ioctl':
drivers/staging/vt6655/device_main.c:2974:1: warning: the frame size of 1304 bytes is larger than 1024 bytes [-Wframe-larger-than=]

This is addressed in linux-3.19 with commit 67013f2c0e58 ("staging: vt6655:
mac80211 conversion add main mac80211 functions"), which obsoletes the
device_ioctl() function, but as that does not apply to stable kernels,
this picks an easier way out by using dynamic allocation.

The driver was merged in 2.6.31, and the fix applies to all versions
before 3.19.

Fixes: 5449c685a4b3 ("Staging: Add pristine upstream vt6655 driver sources")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/vt6655/device_main.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -2818,11 +2818,13 @@ static int  device_ioctl(struct net_devi
 		pr_debug(" SIOCSIWSENS\n");
 		rc = -EOPNOTSUPP;
 		break;
-
 	case SIOCGIWAPLIST: {
-		char buffer[IW_MAX_AP * (sizeof(struct sockaddr) + sizeof(struct iw_quality))];
+		char *buffer = kzalloc(IW_MAX_AP * (sizeof(struct sockaddr) +
+				       sizeof(struct iw_quality)), GFP_KERNEL);
 
-		if (wrq->u.data.pointer) {
+		if (!buffer) {
+			rc = -ENOMEM;
+		} else if (wrq->u.data.pointer) {
 			rc = iwctl_giwaplist(dev, NULL, &(wrq->u.data), buffer);
 			if (rc == 0) {
 				if (copy_to_user(wrq->u.data.pointer,
@@ -2832,6 +2834,7 @@ static int  device_ioctl(struct net_devi
 					rc = -EFAULT;
 			}
 		}
+		kfree(buffer);
 	}
 	break;
 
@@ -2878,7 +2881,6 @@ static int  device_ioctl(struct net_devi
 		pr_debug(" SIOCGIWGENIE\n");
 		rc = iwctl_giwgenie(dev, NULL, &(wrq->u.data), wrq->u.data.pointer);
 		break;
-
 	case SIOCSIWENCODEEXT: {
 		char extra[sizeof(struct iw_encode_ext)+MAX_KEY_LEN+1];
 

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 47/68] staging: imx-drm: fix indentation warning
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (43 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 46/68] staging: vt6655: fix overly large stack usage Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 48/68] staging: bcm: add 32-bit host dependency Greg Kroah-Hartman
                   ` (22 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, stable@vger.kernel.org,
	Arnd Bergmann, Arnd Bergmann

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

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

From: Arnd Bergmann <arnd@arndb.de>

gcc-6 produces a harmless warning:

drivers/staging/imx-drm/imx-hdmi.c: In function 'hdmi_config_AVI':
drivers/staging/imx-drm/imx-hdmi.c:967:2: error: this 'else' clause does not guard... [-Werror=misleading-indentation]

Commit d083c312cba2 ("drm: bridge/dw_hdmi: simplify hdmi_config_AVI() a little")
in linux-4.3 fixes this with a larger rewrite that is not applicable here.
After that rewrite, the variable that gets assigned here no longer exists.

The assignment is rather pointless here, as we just set a variable to zero
that is later added into another variable using a bitwise or operator, and
that has no effect, so I'm just changing the indentation here to shut up
the warning.

The driver was originally merged in linux-3.13, and the fix applies
to all versions between that and 4.2.

Fixes: 9aaf880ed4ee ("imx-drm: Add mx6 hdmi transmitter support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/imx-drm/imx-hdmi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/staging/imx-drm/imx-hdmi.c
+++ b/drivers/staging/imx-drm/imx-hdmi.c
@@ -967,7 +967,7 @@ static void hdmi_config_AVI(struct imx_h
 	else
 		pix_fmt = HDMI_FC_AVICONF0_PIX_FMT_RGB;
 
-		under_scan =  HDMI_FC_AVICONF0_SCAN_INFO_NODATA;
+	under_scan =  HDMI_FC_AVICONF0_SCAN_INFO_NODATA;
 
 	/*
 	 * Active format identification data is present in the AVI InfoFrame.

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 48/68] staging: bcm: add 32-bit host dependency
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (44 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 47/68] staging: imx-drm: fix indentation warning Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 49/68] IB/qib: rename BITS_PER_PAGE to RVT_BITS_PER_PAGE Greg Kroah-Hartman
                   ` (21 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, stable@vger.kernel.org,
	Arnd Bergmann, Arnd Bergmann

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

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

From: Arnd Bergmann <arnd@arndb.de>

The driver uses a 32-bit variable to store a pointer, causing a couple of
warnings:

../drivers/staging/bcm/CmHost.c: In function 'StoreCmControlResponseMessage':
../drivers/staging/bcm/CmHost.c:1503:3: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
   (struct bcm_connect_mgr_params *) ntohl(
   ^
../drivers/staging/bcm/CmHost.c:1546:3: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
   (struct bcm_connect_mgr_params *) ntohl(
   ^
../drivers/staging/bcm/CmHost.c:1564:3: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
   (struct bcm_connect_mgr_params *) ntohl(

I fixed other warnings in an earlier commit 9f1c75ac2dba ("staging/bcm: fix most
build warnings"), but couldn't figure out what was the intended behavior on
64-bit machines here.

The driver was removed in linux-3.19, commit d09e9b160fc1 ("staging: bcm: remove
driver") which explains that it never worked on 64-bit machines. This adds
a Kconfig dependency instead to prevent it from being built in the known
broken configuration. This workaround applies to v2.6.37 or higher.

Fixes: f8942e07a3db ("staging: Beeceem USB Wimax driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/bcm/Kconfig |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/staging/bcm/Kconfig
+++ b/drivers/staging/bcm/Kconfig
@@ -1,6 +1,7 @@
 config BCM_WIMAX
        tristate "Beceem BCS200/BCS220-3 and BCSM250 wimax support"
        depends on USB && NET
+	depends on !64BIT
        help
          This is an experimental driver for the Beceem WIMAX chipset used
 	 by Sprint 4G.

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 49/68] IB/qib: rename BITS_PER_PAGE to RVT_BITS_PER_PAGE
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (45 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 48/68] staging: bcm: add 32-bit host dependency Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 50/68] IB/ehca: fix maybe-uninitialized warnings Greg Kroah-Hartman
                   ` (20 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, stable@vger.kernel.org,
	Arnd Bergmann, Arnd Bergmann

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

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

From: Arnd Bergmann <arnd@arndb.de>

We get this build warning on arm64

drivers/infiniband/hw/qib/qib_qp.c:44:0: error: "BITS_PER_PAGE" redefined [-Werror]
 #define BITS_PER_PAGE           (PAGE_SIZE*BITS_PER_BYTE)

This is fixed upstream in commit 898fa52b4ac3 ("IB/qib: Remove qpn, qp tables and
related variables from qib"), which does a lot of other things as well.

Instead, I just backport the rename of the local BITS_PER_PAGE definition to
RVT_BITS_PER_PAGE.

The driver first showed up in linux-2.6.35, and the fixup should still apply
to that. The upstream fix went into v4.6, so we could apply this workaround
to both 3.18 and 4.4.

Fixes: f931551bafe1 ("IB/qib: Add new qib driver for QLogic PCIe InfiniBand adapters")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/infiniband/hw/qib/qib_qp.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

--- a/drivers/infiniband/hw/qib/qib_qp.c
+++ b/drivers/infiniband/hw/qib/qib_qp.c
@@ -41,13 +41,13 @@
 
 #include "qib.h"
 
-#define BITS_PER_PAGE           (PAGE_SIZE*BITS_PER_BYTE)
-#define BITS_PER_PAGE_MASK      (BITS_PER_PAGE-1)
+#define RVT_BITS_PER_PAGE           (PAGE_SIZE*BITS_PER_BYTE)
+#define RVT_BITS_PER_PAGE_MASK      (RVT_BITS_PER_PAGE-1)
 
 static inline unsigned mk_qpn(struct qib_qpn_table *qpt,
 			      struct qpn_map *map, unsigned off)
 {
-	return (map - qpt->map) * BITS_PER_PAGE + off;
+	return (map - qpt->map) * RVT_BITS_PER_PAGE + off;
 }
 
 static inline unsigned find_next_offset(struct qib_qpn_table *qpt,
@@ -59,7 +59,7 @@ static inline unsigned find_next_offset(
 		if (((off & qpt->mask) >> 1) >= n)
 			off = (off | qpt->mask) + 2;
 	} else
-		off = find_next_zero_bit(map->page, BITS_PER_PAGE, off);
+		off = find_next_zero_bit(map->page, RVT_BITS_PER_PAGE, off);
 	return off;
 }
 
@@ -147,8 +147,8 @@ static int alloc_qpn(struct qib_devdata
 		qpn = 2;
 	if (qpt->mask && ((qpn & qpt->mask) >> 1) >= dd->n_krcv_queues)
 		qpn = (qpn | qpt->mask) + 2;
-	offset = qpn & BITS_PER_PAGE_MASK;
-	map = &qpt->map[qpn / BITS_PER_PAGE];
+	offset = qpn & RVT_BITS_PER_PAGE_MASK;
+	map = &qpt->map[qpn / RVT_BITS_PER_PAGE];
 	max_scan = qpt->nmaps - !offset;
 	for (i = 0;;) {
 		if (unlikely(!map->page)) {
@@ -173,7 +173,7 @@ static int alloc_qpn(struct qib_devdata
 			 * We just need to be sure we don't loop
 			 * forever.
 			 */
-		} while (offset < BITS_PER_PAGE && qpn < QPN_MAX);
+		} while (offset < RVT_BITS_PER_PAGE && qpn < QPN_MAX);
 		/*
 		 * In order to keep the number of pages allocated to a
 		 * minimum, we scan the all existing pages before increasing
@@ -204,9 +204,9 @@ static void free_qpn(struct qib_qpn_tabl
 {
 	struct qpn_map *map;
 
-	map = qpt->map + qpn / BITS_PER_PAGE;
+	map = qpt->map + qpn / RVT_BITS_PER_PAGE;
 	if (map->page)
-		clear_bit(qpn & BITS_PER_PAGE_MASK, map->page);
+		clear_bit(qpn & RVT_BITS_PER_PAGE_MASK, map->page);
 }
 
 static inline unsigned qpn_hash(struct qib_ibdev *dev, u32 qpn)

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 50/68] IB/ehca: fix maybe-uninitialized warnings
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (46 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 49/68] IB/qib: rename BITS_PER_PAGE to RVT_BITS_PER_PAGE Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 51/68] tty/isicom: fix big-endian compile warning Greg Kroah-Hartman
                   ` (19 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, stable@vger.kernel.org,
	Arnd Bergmann, Arnd Bergmann

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

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

From: Arnd Bergmann <arnd@arndb.de>

The driver causes two warnings about possibly uninitialized variables:

drivers/infiniband/hw/ehca/ehca_mrmw.c: In function 'ehca_set_pagebuf':
drivers/infiniband/hw/ehca/ehca_mrmw.c:1908:4: warning: 'prev_pgaddr' may be used uninitialized in this function [-Wmaybe-uninitialized]
drivers/infiniband/hw/ehca/ehca_mrmw.c:1924:14: note: 'prev_pgaddr' was declared here
drivers/infiniband/hw/ehca/ehca_mrmw.c: In function 'ehca_reg_mr':
drivers/infiniband/hw/ehca/ehca_mrmw.c:2430:5: warning: 'hret' may be used uninitialized in this function [-Wmaybe-uninitialized]

The first one is definitely a false positive, the second one may or may not
be one. In both cases, adding an intialization is the safe and easy
workaround.

The driver was removed in mainline in commit e581d111dad3
("staging/rdma: remove deprecated ehca driver"), in linux-4.6.
In 4.4, the file is located in drivers/staging/rdma/ehca/ehca_mrmw.c,
and the fix still applies.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/infiniband/hw/ehca/ehca_mrmw.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -1921,7 +1921,7 @@ static int ehca_set_pagebuf_user2(struct
 				  u64 *kpage)
 {
 	int ret = 0;
-	u64 pgaddr, prev_pgaddr;
+	u64 pgaddr, prev_pgaddr = 0;
 	u32 j = 0;
 	int kpages_per_hwpage = pginfo->hwpage_size / PAGE_SIZE;
 	int nr_kpages = kpages_per_hwpage;
@@ -2417,6 +2417,7 @@ static int ehca_reg_bmap_mr_rpages(struc
 		ehca_err(&shca->ib_device, "kpage alloc failed");
 		return -ENOMEM;
 	}
+	hret = H_SUCCESS;
 	for (top = 0; top < EHCA_MAP_ENTRIES; top++) {
 		if (!ehca_bmap_valid(ehca_bmap->top[top]))
 			continue;

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 51/68] tty/isicom: fix big-endian compile warning
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (47 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 50/68] IB/ehca: fix maybe-uninitialized warnings Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 52/68] infiniband: mlx5: avoid a compile-time warning Greg Kroah-Hartman
                   ` (18 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Arnd Bergmann

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit f3e2d56dce47dbd0bb3f69f84741b439542fef37 upstream.

Building an arm allmodconfig kernel triggers a lengthy but harmless
warning in the isicom driver:

drvers/tty/isicom.c: In function 'isicom_send_break':
uapi/linux/swab.h:13:15: warning: integer overflow in expression [-Woverflow]
  (((__u16)(x) & (__u16)0x00ffU) << 8) |   \
               ^
uapi/linux/swab.h:107:2: note: in expansion of macro '___constant_swab16'
  ___constant_swab16(x) :   \
  ^
uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab16'
 #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
                                           ^
linux/byteorder/generic.h:89:21: note: in expansion of macro '__cpu_to_le16'
 #define cpu_to_le16 __cpu_to_le16
                     ^
include/asm/io.h:270:6: note: in expansion of macro 'cpu_to_le16'
      cpu_to_le16(v),__io(p)); })
      ^
drivers/tty/isicom.c:1058:2: note: in expansion of macro 'outw'
  outw((length & 0xff00), base);
  ^

Apparently, the problem is related to the fact that the value 0xff00,
when used as a 16-bit number, is negative and passed into bitwise
operands of the generic byte swapping code.

Marking the input argument as unsigned in both technically correct
and avoids the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/tty/isicom.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/tty/isicom.c
+++ b/drivers/tty/isicom.c
@@ -1055,7 +1055,7 @@ static int isicom_send_break(struct tty_
 
 	outw(0x8000 | ((port->channel) << (card->shift_count)) | 0x3, base);
 	outw((length & 0xff) << 8 | 0x00, base);
-	outw((length & 0xff00), base);
+	outw((length & 0xff00u), base);
 	InterruptTheCard(base);
 
 	unlock_card(card);

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 52/68] infiniband: mlx5: avoid a compile-time warning
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (48 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 51/68] tty/isicom: fix big-endian compile warning Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 53/68] ips: remove pointless #warning Greg Kroah-Hartman
                   ` (17 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, Eli Cohen, David S. Miller

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit 7835bfb5261501590a508b3de3379e2231cb4853 upstream.

The return type of find_first_bit() is architecture specific,
on ARM it is 'unsigned int', while the asm-generic code used
on x86 and a lot of other architectures returns 'unsigned long'.

When building the mlx5 driver on ARM, we get a warning about
this:

infiniband/hw/mlx5/mem.c: In function 'mlx5_ib_cont_pages':
infiniband/hw/mlx5/mem.c:84:143: warning: comparison of distinct pointer types lacks a cast
     m = min(m, find_first_bit(&tmp, sizeof(tmp)));

This patch changes the driver to use min_t to make it behave
the same way on all architectures.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/infiniband/hw/mlx5/mem.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/infiniband/hw/mlx5/mem.c
+++ b/drivers/infiniband/hw/mlx5/mem.c
@@ -69,7 +69,7 @@ void mlx5_ib_cont_pages(struct ib_umem *
 		for (k = 0; k < len; k++) {
 			if (!(i & mask)) {
 				tmp = (unsigned long)pfn;
-				m = min(m, find_first_bit(&tmp, sizeof(tmp)));
+				m = min_t(unsigned long, m, find_first_bit(&tmp, sizeof(tmp)));
 				skip = 1 << m;
 				mask = skip - 1;
 				base = pfn;

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 53/68] ips: remove pointless #warning
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (49 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 52/68] infiniband: mlx5: avoid a compile-time warning Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 54/68] mISDN: avoid arch specific __builtin_return_address call Greg Kroah-Hartman
                   ` (16 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, James Bottomley

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

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

From: James Bottomley <JBottomley@Odin.com>

commit e03c2da6574223081b786960e39c1e5ecf5d492d upstream.

non-x86 builds want the #warning in the IPS code about compiling on the wrong
architecture removed because it keeps triggering on their platforms build
farms.  Transform from a compile time warning into a runtime one with taint to
preserve the original intent of the authors.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/scsi/ips.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -206,10 +206,6 @@ module_param(ips, charp, 0);
 #define IPS_VERSION_HIGH        IPS_VER_MAJOR_STRING "." IPS_VER_MINOR_STRING
 #define IPS_VERSION_LOW         "." IPS_VER_BUILD_STRING " "
 
-#if !defined(__i386__) && !defined(__ia64__) && !defined(__x86_64__)
-#warning "This driver has only been tested on the x86/ia64/x86_64 platforms"
-#endif
-
 #define IPS_DMA_DIR(scb) ((!scb->scsi_cmd || ips_is_passthru(scb->scsi_cmd) || \
                          DMA_NONE == scb->scsi_cmd->sc_data_direction) ? \
                          PCI_DMA_BIDIRECTIONAL : \
@@ -6789,6 +6785,11 @@ ips_remove_device(struct pci_dev *pci_de
 static int __init
 ips_module_init(void)
 {
+#if !defined(__i386__) && !defined(__ia64__) && !defined(__x86_64__)
+	printk(KERN_ERR "ips: This driver has only been tested on the x86/ia64/x86_64 platforms\n");
+	add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK);
+#endif
+
 	if (pci_register_driver(&ips_pci_driver) < 0)
 		return -ENODEV;
 	ips_driver_template.module = THIS_MODULE;

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 54/68] mISDN: avoid arch specific __builtin_return_address call
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (50 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 53/68] ips: remove pointless #warning Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 55/68] arm64: build vdso without libgcov Greg Kroah-Hartman
                   ` (15 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, David S. Miller

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit 3e7a8716e20b759eec0ad88145255bb33174f0c8 upstream.

Not all architectures are able to call __builtin_return_address().
On ARM, the mISDN code produces this warning:

hardware/mISDN/w6692.c: In function 'w6692_dctrl':
hardware/mISDN/w6692.c:1181:75: warning: unsupported argument to '__builtin_return_address'
  pr_debug("%s: %s dev(%d) open from %p\n", card->name, __func__,
                                                                           ^
hardware/mISDN/mISDNipac.c: In function 'open_dchannel':
hardware/mISDN/mISDNipac.c:759:75: warning: unsupported argument to '__builtin_return_address'
  pr_debug("%s: %s dev(%d) open from %p\n", isac->name, __func__,
                                                                           ^

In a lot of cases, this is relatively easy to work around by
passing the value of __builtin_return_address(0) from the
callers into the functions that want it. One exception is
the indirect 'open' function call in struct isac_hw. While it
would be possible to fix this as well, this patch only addresses
the other callers properly and lets this one return the direct
parent function, which should be good enough.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/isdn/hardware/mISDN/mISDNipac.c |   12 +++++++++---
 drivers/isdn/hardware/mISDN/w6692.c     |    6 +++---
 2 files changed, 12 insertions(+), 6 deletions(-)

--- a/drivers/isdn/hardware/mISDN/mISDNipac.c
+++ b/drivers/isdn/hardware/mISDN/mISDNipac.c
@@ -754,10 +754,10 @@ dbusy_timer_handler(struct isac_hw *isac
 }
 
 static int
-open_dchannel(struct isac_hw *isac, struct channel_req *rq)
+open_dchannel_caller(struct isac_hw *isac, struct channel_req *rq, void *caller)
 {
 	pr_debug("%s: %s dev(%d) open from %p\n", isac->name, __func__,
-		 isac->dch.dev.id, __builtin_return_address(1));
+		 isac->dch.dev.id, caller);
 	if (rq->protocol != ISDN_P_TE_S0)
 		return -EINVAL;
 	if (rq->adr.channel == 1)
@@ -771,6 +771,12 @@ open_dchannel(struct isac_hw *isac, stru
 	return 0;
 }
 
+static int
+open_dchannel(struct isac_hw *isac, struct channel_req *rq)
+{
+	return open_dchannel_caller(isac, rq, __builtin_return_address(0));
+}
+
 static const char *ISACVer[] =
 {"2086/2186 V1.1", "2085 B1", "2085 B2",
  "2085 V2.3"};
@@ -1548,7 +1554,7 @@ ipac_dctrl(struct mISDNchannel *ch, u32
 	case OPEN_CHANNEL:
 		rq = arg;
 		if (rq->protocol == ISDN_P_TE_S0)
-			err = open_dchannel(isac, rq);
+			err = open_dchannel_caller(isac, rq, __builtin_return_address(0));
 		else
 			err = open_bchannel(ipac, rq);
 		if (err)
--- a/drivers/isdn/hardware/mISDN/w6692.c
+++ b/drivers/isdn/hardware/mISDN/w6692.c
@@ -1176,10 +1176,10 @@ w6692_l1callback(struct dchannel *dch, u
 }
 
 static int
-open_dchannel(struct w6692_hw *card, struct channel_req *rq)
+open_dchannel(struct w6692_hw *card, struct channel_req *rq, void *caller)
 {
 	pr_debug("%s: %s dev(%d) open from %p\n", card->name, __func__,
-		 card->dch.dev.id, __builtin_return_address(1));
+		 card->dch.dev.id, caller);
 	if (rq->protocol != ISDN_P_TE_S0)
 		return -EINVAL;
 	if (rq->adr.channel == 1)
@@ -1207,7 +1207,7 @@ w6692_dctrl(struct mISDNchannel *ch, u32
 	case OPEN_CHANNEL:
 		rq = arg;
 		if (rq->protocol == ISDN_P_TE_S0)
-			err = open_dchannel(card, rq);
+			err = open_dchannel(card, rq, __builtin_return_address(0));
 		else
 			err = open_bchannel(card, rq);
 		if (err)

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 55/68] arm64: build vdso without libgcov
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (51 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 54/68] mISDN: avoid arch specific __builtin_return_address call Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 56/68] mm/cma: silence warnings due to max() usage Greg Kroah-Hartman
                   ` (14 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Arnd Bergmann, Catalin Marinas

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

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

From: Arnd Bergmann <arnd@arndb.de>

commit 543097843ca7c9ac3758d0b5879ea2a6f44089de upstream.

On a cross-toolchain without glibc support, libgcov may not be
available, and attempting to build an arm64 kernel with GCOV
enabled then results in a build error:

/home/arnd/cross-gcc/lib/gcc/aarch64-linux/5.2.1/../../../../aarch64-linux/bin/ld: cannot find -lgcov

We don't really want to link libgcov into the vdso anyway, so
this patch just disables GCOV in the vdso directory, just as
we do for most other architectures.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/arm64/kernel/vdso/Makefile |    3 +++
 1 file changed, 3 insertions(+)

--- a/arch/arm64/kernel/vdso/Makefile
+++ b/arch/arm64/kernel/vdso/Makefile
@@ -15,6 +15,9 @@ ccflags-y := -shared -fno-common -fno-bu
 ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 \
 		$(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
 
+# Disable gcov profiling for VDSO code
+GCOV_PROFILE := n
+
 # Workaround for bare-metal (ELF) toolchains that neglect to pass -shared
 # down to collect2, resulting in silent corruption of the vDSO image.
 ccflags-y += -Wl,-shared

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 56/68] mm/cma: silence warnings due to max() usage
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (52 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 55/68] arm64: build vdso without libgcov Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 57/68] MIPS: jz4740: fix build error in irq.h Greg Kroah-Hartman
                   ` (13 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Stephen Rothwell, Andrew Morton,
	Linus Torvalds, Arnd Bergmann

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

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

From: Stephen Rothwell <sfr@canb.auug.org.au>

commit badbda53e505089062e194c614e6f23450bc98b2 upstream.

pageblock_order can be (at least) an unsigned int or an unsigned long
depending on the kernel config and architecture, so use max_t(unsigned
long, ...) when comparing it.

fixes these warnings:

In file included from include/asm-generic/bug.h:13:0,
                 from arch/powerpc/include/asm/bug.h:127,
                 from include/linux/bug.h:4,
                 from include/linux/mmdebug.h:4,
                 from include/linux/mm.h:8,
                 from include/linux/memblock.h:18,
                 from mm/cma.c:28:
mm/cma.c: In function 'cma_init_reserved_mem':
include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast
  (void) (&_max1 == &_max2);                   ^
mm/cma.c:186:27: note: in expansion of macro 'max'
  alignment = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order);
                           ^
mm/cma.c: In function 'cma_declare_contiguous':
include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast
  (void) (&_max1 == &_max2);                   ^
include/linux/kernel.h:747:9: note: in definition of macro 'max'
  typeof(y) _max2 = (y);            ^
mm/cma.c:270:29: note: in expansion of macro 'max'
   (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order));
                             ^
include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast
  (void) (&_max1 == &_max2);                   ^
include/linux/kernel.h:747:21: note: in definition of macro 'max'
  typeof(y) _max2 = (y);                        ^
mm/cma.c:270:29: note: in expansion of macro 'max'
   (phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order));
                             ^

[akpm@linux-foundation.org: coding-style fixes]
Link: http://lkml.kernel.org/r/20160526150748.5be38a4f@canb.auug.org.au
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 mm/cma.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/mm/cma.c
+++ b/mm/cma.c
@@ -168,7 +168,8 @@ int __init cma_init_reserved_mem(phys_ad
 		return -EINVAL;
 
 	/* ensure minimal alignment requied by mm core */
-	alignment = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order);
+	alignment = PAGE_SIZE <<
+			max_t(unsigned long, MAX_ORDER - 1, pageblock_order);
 
 	/* alignment should be aligned with order_per_bit */
 	if (!IS_ALIGNED(alignment >> PAGE_SHIFT, 1 << order_per_bit))
@@ -250,8 +251,8 @@ int __init cma_declare_contiguous(phys_a
 	 * migratetype page by page allocator's buddy algorithm. In the case,
 	 * you couldn't get a contiguous memory, which is not what we want.
 	 */
-	alignment = max(alignment,
-		(phys_addr_t)PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order));
+	alignment = max(alignment,  (phys_addr_t)PAGE_SIZE <<
+			  max_t(unsigned long, MAX_ORDER - 1, pageblock_order));
 	base = ALIGN(base, alignment);
 	size = ALIGN(size, alignment);
 	limit &= ~(alignment - 1);

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 57/68] MIPS: jz4740: fix build error in irq.h
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (53 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 56/68] mm/cma: silence warnings due to max() usage Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 58/68] MIPS: elf2ecoff: Ignore PT_MIPS_ABIFLAGS program headers Greg Kroah-Hartman
                   ` (12 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Lars-Peter Clausen, Arnd Bergmann

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

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

From: Arnd Bergmann <arnd@arndb.de>

kernelci found build error on the 3.18 stable tree that don't
show up in later versions:

arch/mips/jz4740/irq.h:21:38: error: 'struct irq_data' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
arch/mips/jz4740/irq.h:20:39: error: 'struct irq_data' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
include/linux/irqdesc.h:92:33: error: 'NR_IRQS' undeclared here (not in a function)
arch/mips/jz4740/irq.c:91:41: error: 'JZ4740_IRQ_BASE' undeclared (first use in this function)
arch/mips/jz4740/irq.c:68:6: error: conflicting types for 'jz4740_irq_resume'
arch/mips/jz4740/irq.c:62:6: error: conflicting types for 'jz4740_irq_suspend'
arch/mips/jz4740/irq.c:49:39: error: 'JZ4740_IRQ_BASE' undeclared (first use in this function)
arch/mips/jz4740/gpio.c:47:32: error: initializer element is not constant
arch/mips/jz4740/gpio.c:46:32: error: initializer element is not constant
arch/mips/jz4740/gpio.c:45:32: error: initializer element is not constant
arch/mips/jz4740/gpio.c:44:32: error: initializer element is not constant
arch/mips/jz4740/gpio.c:447:22: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
arch/mips/jz4740/gpio.c:446:23: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
arch/mips/jz4740/gpio.c:427:14: error: implicit declaration of function 'JZ4740_IRQ_INTC_GPIO' [-Werror=implicit-function-declaration]
arch/mips/jz4740/gpio.c:269:9: error: implicit declaration of function 'JZ4740_IRQ_GPIO' [-Werror=implicit-function-declaration]

The problem seems to be caused by commit 83bc76920080 ("MIPS: JZ4740: Use
generic irq chip") from linux-3.2, but only showed up in a defconfig
build when qi_lb60_defconfig was added in linux-3.13 and that configuration
never successfully built.

The code has changed in a number of ways before 4.4, which builds fine.
While I did not bisect the problem to a specific change, I found a simple
fix by including the obviously missing header.

Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/mips/jz4740/irq.h |    2 ++
 1 file changed, 2 insertions(+)

--- a/arch/mips/jz4740/irq.h
+++ b/arch/mips/jz4740/irq.h
@@ -16,7 +16,9 @@
 #define __MIPS_JZ4740_IRQ_H__
 
 #include <linux/irq.h>
+#include <asm/mach-jz4740/irq.h>
 
+struct irq_data;
 extern void jz4740_irq_suspend(struct irq_data *data);
 extern void jz4740_irq_resume(struct irq_data *data);
 

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 58/68] MIPS: elf2ecoff: Ignore PT_MIPS_ABIFLAGS program headers.
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (54 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 57/68] MIPS: jz4740: fix build error in irq.h Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 60/68] staging: unisys: correctly handle return value from queue_delayed_work() Greg Kroah-Hartman
                   ` (11 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Ralf Baechle, Arnd Bergmann

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

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

From: Ralf Baechle <ralf@linux-mips.org>

commit 26f7c4bd05cf34e63a4a794150ab66a40a5a84a9 upstream.

These are generated by very recent toolchains and result in an error
message when attenpting to convert a kernel from ELF to ECOFF.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/mips/boot/elf2ecoff.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/arch/mips/boot/elf2ecoff.c
+++ b/arch/mips/boot/elf2ecoff.c
@@ -49,7 +49,8 @@
 /*
  * Some extra ELF definitions
  */
-#define PT_MIPS_REGINFO 0x70000000	/* Register usage information */
+#define PT_MIPS_REGINFO 	0x70000000	/* Register usage information */
+#define PT_MIPS_ABIFLAGS	0x70000003	/* Records ABI related flags  */
 
 /* -------------------------------------------------------------------- */
 
@@ -351,7 +352,8 @@ int main(int argc, char *argv[])
 		/* Section types we can ignore... */
 		if (ph[i].p_type == PT_NULL || ph[i].p_type == PT_NOTE ||
 		    ph[i].p_type == PT_PHDR
-		    || ph[i].p_type == PT_MIPS_REGINFO)
+		    || ph[i].p_type == PT_MIPS_REGINFO
+		    || ph[i].p_type == PT_MIPS_ABIFLAGS)
 			continue;
 		/* Section types we can't handle... */
 		else if (ph[i].p_type != PT_LOAD) {

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 60/68] staging: unisys: correctly handle return value from queue_delayed_work()
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (55 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 58/68] MIPS: elf2ecoff: Ignore PT_MIPS_ABIFLAGS program headers Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 61/68] message: i2o: fix 64bit build warnings Greg Kroah-Hartman
                   ` (10 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Benjamin Romer, Arnd Bergmann

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

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

From: Benjamin Romer <benjamin.romer@unisys.com>

commit f84bd6267d623b49f196d54ba9edc41ff1c4d5e3 upstream.

Properly handle the return value from queue_delayed_work() - it's a
bool, not an int, so using a less than comparison isn't appropriate.

This mistake was found by David Binderman <dcb314@hotmail.com>.

[arnd: the fix is from 4.4 but needed some minor fixup to adapt
 to context changes]

Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/unisys/visorutil/periodic_work.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- a/drivers/staging/unisys/visorutil/periodic_work.c
+++ b/drivers/staging/unisys/visorutil/periodic_work.c
@@ -98,8 +98,8 @@ BOOL visor_periodic_work_nextperiod(stru
 		pw->want_to_stop = FALSE;
 		rc = TRUE;  /* yes, TRUE; see visor_periodic_work_stop() */
 		goto unlock;
-	} else if (queue_delayed_work(pw->workqueue, &pw->work,
-				      pw->jiffy_interval) < 0) {
+	} else if (!queue_delayed_work(pw->workqueue, &pw->work,
+				       pw->jiffy_interval)) {
 		ERRDEV(pw->devnam, "queue_delayed_work failed!");
 		pw->is_scheduled = FALSE;
 		rc = FALSE;
@@ -134,8 +134,8 @@ BOOL visor_periodic_work_start(struct pe
 		goto unlock;
 	}
 	INIT_DELAYED_WORK(&pw->work, &periodic_work_func);
-	if (queue_delayed_work(pw->workqueue, &pw->work,
-			       pw->jiffy_interval) < 0) {
+	if (!queue_delayed_work(pw->workqueue, &pw->work,
+				pw->jiffy_interval)) {
 		ERRDEV(pw->devnam, "%s queue_delayed_work failed!", __func__);
 		rc = FALSE;
 		goto unlock;

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 61/68] message: i2o: fix 64bit build warnings
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (56 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 60/68] staging: unisys: correctly handle return value from queue_delayed_work() Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 62/68] scsi: advansys: remove #warning message Greg Kroah-Hartman
                   ` (9 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Arnd Bergmann

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

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

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

It seems that most of the 64bit build warnings were fixed up in this
driver, but 2 were forgotten.  This code is long deleted from newer
kernels, so the fix is not needed there, but make it here in the 3.18
tree to keep the build quiet.

Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


---
 drivers/message/i2o/i2o_config.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/message/i2o/i2o_config.c
+++ b/drivers/message/i2o/i2o_config.c
@@ -890,7 +890,7 @@ static int i2o_cfg_passthru(unsigned lon
 			    flag_count & 0x04000000 /*I2O_SGL_FLAGS_DIR */ ) {
 				// TODO 64bit fix
 				if (copy_from_user
-				    (p->virt, (void __user *)sg[i].addr_bus,
+				    (p->virt, (void __user *)(u64)sg[i].addr_bus,
 				     sg_size)) {
 					printk(KERN_DEBUG
 					       "%s: Could not copy SG buf %d FROM user\n",
@@ -950,7 +950,7 @@ static int i2o_cfg_passthru(unsigned lon
 				sg_size = sg[j].flag_count & 0xffffff;
 				// TODO 64bit fix
 				if (copy_to_user
-				    ((void __user *)sg[j].addr_bus, sg_list[j].virt,
+				    ((void __user *)(u64)sg[j].addr_bus, sg_list[j].virt,
 				     sg_size)) {
 					printk(KERN_WARNING
 					       "%s: Could not copy %p TO user %x\n",

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 62/68] scsi: advansys: remove #warning message
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (57 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 61/68] message: i2o: fix 64bit build warnings Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 63/68] modpost: expand pattern matching to support substring matches Greg Kroah-Hartman
                   ` (8 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Hannes Reinecke, Arnd Bergmann

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

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

From: Arnd Bergmann <arnd@arndb.de>

The advansys driver was converted to the proper DMA API in linux-4.2, but
the 3.18-stable kernel still warns about this:

drivers/scsi/advansys.c:71:2: warning: #warning this driver is still not properly converted to the DMA API [-Wcpp]

The warning clearly is not helpful in 3.18 any more, it just clutters up
the build log. This removes the warning instead, and clarifies the
comment above it.

Cc: Hannes Reinecke <hare@suse.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/scsi/advansys.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -49,7 +49,7 @@
 #include <scsi/scsi.h>
 #include <scsi/scsi_host.h>
 
-/* FIXME:
+/* Fixed in linux-4.2, not backported to 3.18:
  *
  *  1. Although all of the necessary command mapping places have the
  *     appropriate dma_map.. APIs, the driver still processes its internal
@@ -68,7 +68,6 @@
  *  7. advansys_info is not safe against multiple simultaneous callers
  *  8. Add module_param to override ISA/VLB ioport array
  */
-#warning this driver is still not properly converted to the DMA API
 
 /* Enable driver /proc statistics. */
 #define ADVANSYS_STATS

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 63/68] modpost: expand pattern matching to support substring matches
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (58 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 62/68] scsi: advansys: remove #warning message Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 64/68] modpost: dont emit section mismatch warnings for compiler optimizations Greg Kroah-Hartman
                   ` (7 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Paul Gortmaker, Rusty Russell, Arnd Bergmann

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

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

From: Paul Gortmaker <paul.gortmaker@windriver.com>

commit 09c20c032b0f753969ae778d9783d946f054d7fe upstream.

Currently the match() function supports a leading * to match any
prefix and a trailing * to match any suffix.  However there currently
is not a combination of both that can be used to target matches of
whole families of functions that share a common substring.

Here we expand the *foo and foo* match to also support *foo* with
the goal of targeting compiler generated symbol names that contain
strings like ".constprop." and ".isra."

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 scripts/mod/modpost.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -776,6 +776,7 @@ static const char *sech_name(struct elf_
  * "foo" will match an exact string equal to "foo"
  * "*foo" will match a string that ends with "foo"
  * "foo*" will match a string that begins with "foo"
+ * "*foo*" will match a string that contains "foo"
  */
 static int match(const char *sym, const char * const pat[])
 {
@@ -784,8 +785,17 @@ static int match(const char *sym, const
 		p = *pat++;
 		const char *endp = p + strlen(p) - 1;
 
+		/* "*foo*" */
+		if (*p == '*' && *endp == '*') {
+			char *here, *bare = strndup(p + 1, strlen(p) - 2);
+
+			here = strstr(sym, bare);
+			free(bare);
+			if (here != NULL)
+				return 1;
+		}
 		/* "*foo" */
-		if (*p == '*') {
+		else if (*p == '*') {
 			if (strrcmp(sym, p + 1) == 0)
 				return 1;
 		}

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 64/68] modpost: dont emit section mismatch warnings for compiler optimizations
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (59 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 63/68] modpost: expand pattern matching to support substring matches Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 65/68] cpumask_set_cpu_local_first => cpumask_local_spread, lament Greg Kroah-Hartman
                   ` (6 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Paul Gortmaker, Rusty Russell, Arnd Bergmann

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

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

From: Paul Gortmaker <paul.gortmaker@windriver.com>

commit 4a3893d069b788f3570c19c12d9e986e8e15870f upstream.

Currently an allyesconfig build [gcc-4.9.1] can generate the following:

   WARNING: vmlinux.o(.text.unlikely+0x3864): Section mismatch in
   reference from the function cpumask_empty.constprop.3() to the
   variable .init.data:nmi_ipi_mask

which comes from the cpumask_empty usage in arch/x86/kernel/nmi_selftest.c.

Normally we would not see a symbol entry for cpumask_empty since it is:

	static inline bool cpumask_empty(const struct cpumask *srcp)

however in this case, the variant of the symbol gets emitted when GCC does
constant propagation optimization.

Fix things up so that any locally optimized constprop variants don't warn
when accessing variables that live in the __init sections.

[arnd: adapted text_sections definition to 3.18]

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 scripts/mod/modpost.c |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -902,6 +902,10 @@ static const char *const init_sections[]
 static const char *const init_exit_sections[] =
 	{ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS, NULL };
 
+/* all text sections */
+static const char *const text_sections[] = { ALL_INIT_TEXT_SECTIONS,
+				ALL_EXIT_TEXT_SECTIONS, TEXT_SECTIONS, NULL };
+
 /* data section */
 static const char *const data_sections[] = { DATA_SECTIONS, NULL };
 
@@ -920,6 +924,7 @@ static const char *const data_sections[]
 static const char *const head_sections[] = { ".head.text*", NULL };
 static const char *const linker_symbols[] =
 	{ "__init_begin", "_sinittext", "_einittext", NULL };
+static const char *const optim_symbols[] = { "*.constprop.*", NULL };
 
 enum mismatch {
 	TEXT_TO_ANY_INIT,
@@ -1077,6 +1082,17 @@ static const struct sectioncheck *sectio
  *   This pattern is identified by
  *   refsymname = __init_begin, _sinittext, _einittext
  *
+ * Pattern 5:
+ *   GCC may optimize static inlines when fed constant arg(s) resulting
+ *   in functions like cpumask_empty() -- generating an associated symbol
+ *   cpumask_empty.constprop.3 that appears in the audit.  If the const that
+ *   is passed in comes from __init, like say nmi_ipi_mask, we get a
+ *   meaningless section warning.  May need to add isra symbols too...
+ *   This pattern is identified by
+ *   tosec   = init section
+ *   fromsec = text section
+ *   refsymname = *.constprop.*
+ *
  **/
 static int secref_whitelist(const struct sectioncheck *mismatch,
 			    const char *fromsec, const char *fromsym,
@@ -1109,6 +1125,12 @@ static int secref_whitelist(const struct
 	if (match(tosym, linker_symbols))
 		return 0;
 
+	/* Check for pattern 5 */
+	if (match(fromsec, text_sections) &&
+	    match(tosec, init_sections) &&
+	    match(fromsym, optim_symbols))
+		return 0;
+
 	return 1;
 }
 

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 65/68] cpumask_set_cpu_local_first => cpumask_local_spread, lament
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (60 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 64/68] modpost: dont emit section mismatch warnings for compiler optimizations Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 66/68] e1000e: fix call to do_div() to use u64 arg Greg Kroah-Hartman
                   ` (5 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Amir Vadai, David S. Miller,
	Arnd Bergmann, Rusty Russell

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

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

From: Rusty Russell <rusty@rustcorp.com.au>

commit f36963c9d3f6f415732710da3acdd8608a9fa0e5 upstream.

da91309e0a7e (cpumask: Utility function to set n'th cpu...) created a
genuinely weird function.  I never saw it before, it went through DaveM.
(He only does this to make us other maintainers feel better about our own
mistakes.)

cpumask_set_cpu_local_first's purpose is say "I need to spread things
across N online cpus, choose the ones on this numa node first"; you call
it in a loop.

It can fail.  One of the two callers ignores this, the other aborts and
fails the device open.

It can fail in two ways: allocating the off-stack cpumask, or through a
convoluted codepath which AFAICT can only occur if cpu_online_mask
changes.  Which shouldn't happen, because if cpu_online_mask can change
while you call this, it could return a now-offline cpu anyway.

It contains a nonsensical test "!cpumask_of_node(numa_node)".  This was
drawn to my attention by Geert, who said this causes a warning on Sparc.
It sets a single bit in a cpumask instead of returning a cpu number,
because that's what the callers want.

It could be made more efficient by passing the previous cpu rather than
an index, but that would be more invasive to the callers.

[backporting for 3.18: only two callers exist, otherwise no change.
 The same warning shows up for "!cpumask_of_node()", and I thought
 about just addressing the warning, but using the whole fix seemed
 better in the end as one of the two callers also lacks the error
 handling]

Fixes: da91309e0a7e8966d916a74cce42ed170fde06bf
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (then rebased)
Tested-by: Amir Vadai <amirv@mellanox.com>
Acked-by: Amir Vadai <amirv@mellanox.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c |   10 +--
 drivers/net/ethernet/mellanox/mlx4/en_tx.c     |    6 +-
 include/linux/cpumask.h                        |    6 --
 lib/cpumask.c                                  |   72 ++++++++-----------------
 4 files changed, 33 insertions(+), 61 deletions(-)

--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -1500,17 +1500,13 @@ static int mlx4_en_init_affinity_hint(st
 {
 	struct mlx4_en_rx_ring *ring = priv->rx_ring[ring_idx];
 	int numa_node = priv->mdev->dev->numa_node;
-	int ret = 0;
 
 	if (!zalloc_cpumask_var(&ring->affinity_mask, GFP_KERNEL))
 		return -ENOMEM;
 
-	ret = cpumask_set_cpu_local_first(ring_idx, numa_node,
-					  ring->affinity_mask);
-	if (ret)
-		free_cpumask_var(ring->affinity_mask);
-
-	return ret;
+	cpumask_set_cpu(cpumask_local_spread(ring_idx, numa_node),
+			ring->affinity_mask);
+	return 0;
 }
 
 static void mlx4_en_free_affinity_hint(struct mlx4_en_priv *priv, int ring_idx)
--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c
@@ -139,9 +139,9 @@ int mlx4_en_create_tx_ring(struct mlx4_e
 	ring->queue_index = queue_index;
 
 	if (queue_index < priv->num_tx_rings_p_up)
-		cpumask_set_cpu_local_first(queue_index,
-					    priv->mdev->dev->numa_node,
-					    &ring->affinity_mask);
+		cpumask_set_cpu(cpumask_local_spread(queue_index,
+						     priv->mdev->dev->numa_node),
+				&ring->affinity_mask);
 
 	*pring = ring;
 	return 0;
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -142,10 +142,8 @@ static inline unsigned int cpumask_any_b
 	return 1;
 }
 
-static inline int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp)
+static inline unsigned int cpumask_local_spread(unsigned int i, int node)
 {
-	set_bit(0, cpumask_bits(dstp));
-
 	return 0;
 }
 
@@ -199,7 +197,7 @@ static inline unsigned int cpumask_next_
 
 int cpumask_next_and(int n, const struct cpumask *, const struct cpumask *);
 int cpumask_any_but(const struct cpumask *mask, unsigned int cpu);
-int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp);
+unsigned int cpumask_local_spread(unsigned int i, int node);
 
 /**
  * for_each_cpu - iterate over every cpu in a mask
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -166,64 +166,42 @@ void __init free_bootmem_cpumask_var(cpu
 #endif
 
 /**
- * cpumask_set_cpu_local_first - set i'th cpu with local numa cpu's first
- *
+ * cpumask_local_spread - select the i'th cpu with local numa cpu's first
  * @i: index number
- * @numa_node: local numa_node
- * @dstp: cpumask with the relevant cpu bit set according to the policy
+ * @node: local numa_node
  *
- * This function sets the cpumask according to a numa aware policy.
- * cpumask could be used as an affinity hint for the IRQ related to a
- * queue. When the policy is to spread queues across cores - local cores
- * first.
+ * This function selects an online CPU according to a numa aware policy;
+ * local cpus are returned first, followed by non-local ones, then it
+ * wraps around.
  *
- * Returns 0 on success, -ENOMEM for no memory, and -EAGAIN when failed to set
- * the cpu bit and need to re-call the function.
+ * It's not very efficient, but useful for setup.
  */
-int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp)
+unsigned int cpumask_local_spread(unsigned int i, int node)
 {
-	cpumask_var_t mask;
 	int cpu;
-	int ret = 0;
-
-	if (!zalloc_cpumask_var(&mask, GFP_KERNEL))
-		return -ENOMEM;
 
+	/* Wrap: we always want a cpu. */
 	i %= num_online_cpus();
 
-	if (numa_node == -1 || !cpumask_of_node(numa_node)) {
-		/* Use all online cpu's for non numa aware system */
-		cpumask_copy(mask, cpu_online_mask);
+	if (node == -1) {
+		for_each_cpu(cpu, cpu_online_mask)
+			if (i-- == 0)
+				return cpu;
 	} else {
-		int n;
-
-		cpumask_and(mask,
-			    cpumask_of_node(numa_node), cpu_online_mask);
+		/* NUMA first. */
+		for_each_cpu_and(cpu, cpumask_of_node(node), cpu_online_mask)
+			if (i-- == 0)
+				return cpu;
+
+		for_each_cpu(cpu, cpu_online_mask) {
+			/* Skip NUMA nodes, done above. */
+			if (cpumask_test_cpu(cpu, cpumask_of_node(node)))
+				continue;
 
-		n = cpumask_weight(mask);
-		if (i >= n) {
-			i -= n;
-
-			/* If index > number of local cpu's, mask out local
-			 * cpu's
-			 */
-			cpumask_andnot(mask, cpu_online_mask, mask);
+			if (i-- == 0)
+				return cpu;
 		}
 	}
-
-	for_each_cpu(cpu, mask) {
-		if (--i < 0)
-			goto out;
-	}
-
-	ret = -EAGAIN;
-
-out:
-	free_cpumask_var(mask);
-
-	if (!ret)
-		cpumask_set_cpu(cpu, dstp);
-
-	return ret;
+	BUG();
 }
-EXPORT_SYMBOL(cpumask_set_cpu_local_first);
+EXPORT_SYMBOL(cpumask_local_spread);

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 66/68] e1000e: fix call to do_div() to use u64 arg
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (61 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 65/68] cpumask_set_cpu_local_first => cpumask_local_spread, lament Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 67/68] gfs2: remove IS_ERR_VALUE abuse Greg Kroah-Hartman
                   ` (4 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yanjiang Jin, Yanir Lubetkin,
	Jeff Kirsher, Aaron Brown, Arnd Bergmann

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

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

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

commit 30544af5483755b11bb5924736e9e0b45ef0644a upstream.

We were using s64 for lat_ns (latency nano-second value) since in
our calculations a negative value could be a resultant.  For negative
values, we then assign lat_ns to be zero, so the value passed to
do_div() was never negative, but do_div() expects the argument type
to be u64, so do a cast to resolve a compile warning seen on
PowerPC.

CC: Yanjiang Jin <yanjiang.jin@windriver.com>
CC: Yanir Lubetkin <yanirx.lubetkin@intel.com>
Reported-by: Yanjiang Jin <yanjiang.jin@windriver.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/ethernet/intel/e1000e/ich8lan.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -983,7 +983,7 @@ static s32 e1000_platform_pm_pch_lpt(str
 		u16 max_snoop, max_nosnoop;
 		u16 max_ltr_enc;	/* max LTR latency encoded */
 		s64 lat_ns;	/* latency (ns) */
-		s64 value;
+		u64 value;
 		u32 rxa;
 
 		if (!hw->adapter->max_frame_size) {
@@ -1010,12 +1010,13 @@ static s32 e1000_platform_pm_pch_lpt(str
 		 */
 		lat_ns = ((s64)rxa * 1024 -
 			  (2 * (s64)hw->adapter->max_frame_size)) * 8 * 1000;
-		if (lat_ns < 0)
-			lat_ns = 0;
-		else
-			do_div(lat_ns, speed);
+		if (lat_ns < 0) {
+			value = 0;
+		} else {
+			value = lat_ns;
+			do_div(value, speed);
+		}
 
-		value = lat_ns;
 		while (value > PCI_LTR_VALUE_MASK) {
 			scale++;
 			value = DIV_ROUND_UP(value, (1 << 5));

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 67/68] gfs2: remove IS_ERR_VALUE abuse
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (62 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 66/68] e1000e: fix call to do_div() to use u64 arg Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-05 18:32 ` [PATCH 3.18 68/68] kbuild: mergeconfig: fix "jobserver unavailable" warning Greg Kroah-Hartman
                   ` (3 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, stable@vger.kernel.org,
	Arnd Bergmann, Arnd Bergmann

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

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

From: Arnd Bergmann <arnd@arndb.de>

Picked from commit 287980e49ffc0f6d911601e7e352a812ed27768e ("remove lots
of IS_ERR_VALUE abuses") upstream.

The original fix that was backported to 3.18 already addressed the warning
in some configurations, but not in others, leaving us with the same output:

../fs/gfs2/dir.c: In function 'get_first_leaf':
../fs/gfs2/dir.c:768:9: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized]
   error = get_leaf(dip, leaf_no, bh_out);
         ^
../fs/gfs2/dir.c: In function 'dir_split_leaf.isra.20':
../fs/gfs2/dir.c:987:8: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized]

This takes the approach that we took in later versions in mainline,
but does not backport the entire patch, as that would be too large
for stable and IIRC caused regressions in other drivers.

Fixes: 9d46d31e9aea ("gfs2: avoid uninitialized variable warning")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/gfs2/dir.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -749,12 +749,15 @@ static int get_leaf_nr(struct gfs2_inode
 		       u64 *leaf_out)
 {
 	__be64 *hash;
+	int error;
 
 	hash = gfs2_dir_get_hash_table(dip);
-	if (IS_ERR(hash))
-		return PTR_ERR(hash);
-	*leaf_out = be64_to_cpu(*(hash + index));
-	return 0;
+	error = PTR_ERR_OR_ZERO(hash);
+
+	if (!error)
+		*leaf_out = be64_to_cpu(*(hash + index));
+
+	return error;
 }
 
 static int get_first_leaf(struct gfs2_inode *dip, u32 index,
@@ -764,7 +767,7 @@ static int get_first_leaf(struct gfs2_in
 	int error;
 
 	error = get_leaf_nr(dip, index, &leaf_no);
-	if (!IS_ERR_VALUE(error))
+	if (!error)
 		error = get_leaf(dip, leaf_no, bh_out);
 
 	return error;
@@ -980,7 +983,7 @@ static int dir_split_leaf(struct inode *
 
 	index = name->hash >> (32 - dip->i_depth);
 	error = get_leaf_nr(dip, index, &leaf_no);
-	if (IS_ERR_VALUE(error))
+	if (error)
 		return error;
 
 	/*  Get the old leaf block  */

^ permalink raw reply	[flat|nested] 75+ messages in thread

* [PATCH 3.18 68/68] kbuild: mergeconfig: fix "jobserver unavailable" warning
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (63 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 67/68] gfs2: remove IS_ERR_VALUE abuse Greg Kroah-Hartman
@ 2017-05-05 18:32 ` Greg Kroah-Hartman
  2017-05-06  1:58 ` [PATCH 3.18 00/68] 3.18.52-stable review Shuah Khan
                   ` (2 subsequent siblings)
  67 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-05-05 18:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Masahiro Yamada, Josh Triplett,
	Darren Hart, Michal Marek, Arnd Bergmann

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

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

From: Masahiro Yamada <yamada.masahiro@socionext.com>

commit de4619937229378e81f95e99c9866acc8e207d34 upstream.

If "make kvmconfig" is run with "-j" option, a warning message,
"jobserver unavailable: using -j1.  Add `+' to parent make rule.",
is displayed.

  $ make -s defconfig
  *** Default configuration is based on 'x86_64_defconfig'
  #
  # configuration written to .config
  #
  $ make -j8 kvmconfig
  Using ./.config as base
  Merging ./arch/x86/configs/kvm_guest.config
    [ snip ]
  #
  # merged configuration written to ./.config (needs make)
  #
  make[2]: warning: jobserver unavailable: using -j1.  Add `+' to
  parent make rule.
  scripts/kconfig/conf --oldconfig Kconfig
    [ snip ]
  #
  # configuration written to .config
  #

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 scripts/kconfig/Makefile |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -110,7 +110,7 @@ define mergeconfig
 $(if $(wildcard $(objtree)/.config),, $(error You need an existing .config for this target))
 $(if $(call configfiles,$(1)),, $(error No configuration exists for this target on this architecture))
 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m -O $(objtree) $(objtree)/.config $(call configfiles,$(1))
-$(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig
++$(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig
 endef
 
 PHONY += kvmconfig

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 3.18 00/68] 3.18.52-stable review
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (64 preceding siblings ...)
  2017-05-05 18:32 ` [PATCH 3.18 68/68] kbuild: mergeconfig: fix "jobserver unavailable" warning Greg Kroah-Hartman
@ 2017-05-06  1:58 ` Shuah Khan
  2017-05-07 19:35 ` Guenter Roeck
       [not found] ` <590d0d30.01b9370a.e3d65.b17a@mx.google.com>
  67 siblings, 0 replies; 75+ messages in thread
From: Shuah Khan @ 2017-05-06  1:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, patches, ben.hutchings, stable, Shuah Khan

On 05/05/2017 12:31 PM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 3.18.52 release.
> There are 68 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 Sun May  7 18:31:52 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/v3.x/stable-review/patch-3.18.52-rc1.gz
> or in the git tree and branch at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-3.18.y
> and the diffstat can be found below.
> 
> thanks,
> 
> greg k-h
> 

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 3.18 00/68] 3.18.52-stable review
  2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
                   ` (65 preceding siblings ...)
  2017-05-06  1:58 ` [PATCH 3.18 00/68] 3.18.52-stable review Shuah Khan
@ 2017-05-07 19:35 ` Guenter Roeck
       [not found] ` <590d0d30.01b9370a.e3d65.b17a@mx.google.com>
  67 siblings, 0 replies; 75+ messages in thread
From: Guenter Roeck @ 2017-05-07 19:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, shuahkh, patches, ben.hutchings, stable

On 05/05/2017 11:31 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 3.18.52 release.
> There are 68 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 Sun May  7 18:31:52 UTC 2017.
> Anything received after that time might be too late.
>

Build results:
	total: 136 pass: 136 fail: 0
Qemu test results:
	total: 111 pass: 111 fail: 0

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

Guenter

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 3.18 00/68] 3.18.52-stable review
       [not found]   ` <m2tw4vdxnk.fsf@baylibre.com>
@ 2017-05-09  7:47     ` Alexandre Belloni
  2017-05-31 19:47     ` Alexandre Belloni
  1 sibling, 0 replies; 75+ messages in thread
From: Alexandre Belloni @ 2017-05-09  7:47 UTC (permalink / raw)
  To: Kevin Hilman
  Cc: kernelci.org bot, Greg Kroah-Hartman, linux-kernel, torvalds,
	akpm, linux, shuahkh, patches, ben.hutchings, stable,
	Jan Lübbe, dinguyen

On 08/05/2017 at 11:13:51 -0700, Kevin Hilman wrote:
> + relevant soc/board maintainers
> 
> kernelci.org bot <bot@kernelci.org> writes:
> 
> > stable-rc/linux-3.18.y boot: 77 boots: 2 failed, 75 passed (v3.18.51-69-gdab3331ef5e9)
> >
> > Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/branch/linux-3.18.y/kernel/v3.18.51-69-gdab3331ef5e9/
> > Full Build Summary: https://kernelci.org/build/stable-rc/branch/linux-3.18.y/kernel/v3.18.51-69-gdab3331ef5e9/
> >
> > Tree: stable-rc
> > Branch: linux-3.18.y
> > Git Describe: v3.18.51-69-gdab3331ef5e9
> > Git Commit: dab3331ef5e9aa7d0fa3a88776051028c2f1ed20
> > Git URL: http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
> > Tested: 14 unique boards, 8 SoC families, 20 builds out of 204
> >
> > Boot Failures Detected:
> >
> > arm:
> >
> >     at91_dt_defconfig
> >         at91sam9261ek: 1 failed lab
> 
> Alexandre, can you have a look at this one?
> 

I think we already solved that in a 4.x stable but I don't remember the
details right now. I'll check.


-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 3.18 00/68] 3.18.52-stable review
       [not found]   ` <m2tw4vdxnk.fsf@baylibre.com>
  2017-05-09  7:47     ` Alexandre Belloni
@ 2017-05-31 19:47     ` Alexandre Belloni
  2017-06-06 20:52       ` Kevin Hilman
  1 sibling, 1 reply; 75+ messages in thread
From: Alexandre Belloni @ 2017-05-31 19:47 UTC (permalink / raw)
  To: Kevin Hilman, Nicolas Ferre
  Cc: kernelci.org bot, Greg Kroah-Hartman, linux-kernel, torvalds,
	akpm, linux, shuahkh, patches, ben.hutchings, stable,
	Jan Lübbe, dinguyen

Hi,

On 08/05/2017 at 11:13:51 -0700, Kevin Hilman wrote:
> + relevant soc/board maintainers
> 
> kernelci.org bot <bot@kernelci.org> writes:
> 
> > stable-rc/linux-3.18.y boot: 77 boots: 2 failed, 75 passed (v3.18.51-69-gdab3331ef5e9)
> >
> > Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/branch/linux-3.18.y/kernel/v3.18.51-69-gdab3331ef5e9/
> > Full Build Summary: https://kernelci.org/build/stable-rc/branch/linux-3.18.y/kernel/v3.18.51-69-gdab3331ef5e9/
> >
> > Tree: stable-rc
> > Branch: linux-3.18.y
> > Git Describe: v3.18.51-69-gdab3331ef5e9
> > Git Commit: dab3331ef5e9aa7d0fa3a88776051028c2f1ed20
> > Git URL: http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
> > Tested: 14 unique boards, 8 SoC families, 20 builds out of 204
> >
> > Boot Failures Detected:
> >
> > arm:
> >
> >     at91_dt_defconfig
> >         at91sam9261ek: 1 failed lab
> 
> Alexandre, can you have a look at this one?
> 

Ok, I had a close look at it today. This will simply not work in 3.18,
the at91sam9261ek was fully supported using a board file and partially
supported using a device tree. The USB gadget driver will not work using
device tree on 3.18.

There are multiple solutions:
 - Stop trying to boot kernels before v4.0 using DT on at91sam9 boards
 - Add a quick fix to ioremap the matrix when using DT.
 - Backport 20 or so patches to v3.18

I would personally go for the first solution as there is probably not
much interest in v3.18 on that board.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 3.18 00/68] 3.18.52-stable review
  2017-05-31 19:47     ` Alexandre Belloni
@ 2017-06-06 20:52       ` Kevin Hilman
  0 siblings, 0 replies; 75+ messages in thread
From: Kevin Hilman @ 2017-06-06 20:52 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Nicolas Ferre, kernelci.org bot, Greg Kroah-Hartman,
	linux-kernel, torvalds, akpm, linux, shuahkh, patches,
	ben.hutchings, stable, Jan Lübbe, dinguyen

Alexandre Belloni <alexandre.belloni@free-electrons.com> writes:

> Hi,
>
> On 08/05/2017 at 11:13:51 -0700, Kevin Hilman wrote:
>> + relevant soc/board maintainers
>> 
>> kernelci.org bot <bot@kernelci.org> writes:
>> 
>> > stable-rc/linux-3.18.y boot: 77 boots: 2 failed, 75 passed (v3.18.51-69-gdab3331ef5e9)
>> >
>> > Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/branch/linux-3.18.y/kernel/v3.18.51-69-gdab3331ef5e9/
>> > Full Build Summary: https://kernelci.org/build/stable-rc/branch/linux-3.18.y/kernel/v3.18.51-69-gdab3331ef5e9/
>> >
>> > Tree: stable-rc
>> > Branch: linux-3.18.y
>> > Git Describe: v3.18.51-69-gdab3331ef5e9
>> > Git Commit: dab3331ef5e9aa7d0fa3a88776051028c2f1ed20
>> > Git URL: http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
>> > Tested: 14 unique boards, 8 SoC families, 20 builds out of 204
>> >
>> > Boot Failures Detected:
>> >
>> > arm:
>> >
>> >     at91_dt_defconfig
>> >         at91sam9261ek: 1 failed lab
>> 
>> Alexandre, can you have a look at this one?
>> 
>
> Ok, I had a close look at it today. This will simply not work in 3.18,
> the at91sam9261ek was fully supported using a board file and partially
> supported using a device tree. The USB gadget driver will not work using
> device tree on 3.18.
>
> There are multiple solutions:
>  - Stop trying to boot kernels before v4.0 using DT on at91sam9 boards
>  - Add a quick fix to ioremap the matrix when using DT.
>  - Backport 20 or so patches to v3.18
>
> I would personally go for the first solution as there is probably not
> much interest in v3.18 on that board.

That sounds good to me.

Kevin

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 3.18 36/68] Handle mismatched open calls
  2017-05-05 18:32 ` [PATCH 3.18 36/68] Handle mismatched open calls Greg Kroah-Hartman
@ 2017-07-14 16:42   ` Ben Hutchings
  2017-07-19 18:39     ` Pavel Shilovskiy
  2017-11-15  9:08     ` Greg Kroah-Hartman
  0 siblings, 2 replies; 75+ messages in thread
From: Ben Hutchings @ 2017-07-14 16:42 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel, Sachin Prabhu; +Cc: stable, Pavel Shilovsky

[-- Attachment #1: Type: text/plain, Size: 1458 bytes --]

On Fri, 2017-05-05 at 11:32 -0700, Greg Kroah-Hartman wrote:
> 3.18-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Sachin Prabhu <sprabhu@redhat.com>
> 
> commit 38bd49064a1ecb67baad33598e3d824448ab11ec upstream.
[...]
> --- a/fs/cifs/smb2ops.c
> +++ b/fs/cifs/smb2ops.c
> @@ -1461,6 +1461,8 @@ struct smb_version_operations smb21_oper
>  	.clear_stats = smb2_clear_stats,
>  	.print_stats = smb2_print_stats,
>  	.is_oplock_break = smb2_is_valid_oplock_break,
> +	.handle_cancelled_mid = smb2_handle_cancelled_mid,
> +	.handle_cancelled_mid = smb2_handle_cancelled_mid,
>  	.downgrade_oplock = smb2_downgrade_oplock,
>  	.need_neg = smb2_need_neg,
>  	.negotiate = smb2_negotiate,
> @@ -1542,6 +1544,8 @@ struct smb_version_operations smb30_oper
>  	.print_stats = smb2_print_stats,
>  	.dump_share_caps = smb2_dump_share_caps,
>  	.is_oplock_break = smb2_is_valid_oplock_break,
> +	.handle_cancelled_mid = smb2_handle_cancelled_mid,
> +	.handle_cancelled_mid = smb2_handle_cancelled_mid,
>  	.downgrade_oplock = smb2_downgrade_oplock,
>  	.need_neg = smb2_need_neg,
>  	.negotiate = smb2_negotiate,
[...]

This doesn't look right.  handle_cancelled_mid should be initialised
once in each of the 3 smb_version_operations structures, shouldn't it?

Ben.

-- 
Ben Hutchings
If the facts do not conform to your theory, they must be disposed of.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 75+ messages in thread

* RE: [PATCH 3.18 36/68] Handle mismatched open calls
  2017-07-14 16:42   ` Ben Hutchings
@ 2017-07-19 18:39     ` Pavel Shilovskiy
  2017-07-22 12:46       ` Greg Kroah-Hartman
  2017-11-15  9:08     ` Greg Kroah-Hartman
  1 sibling, 1 reply; 75+ messages in thread
From: Pavel Shilovskiy @ 2017-07-19 18:39 UTC (permalink / raw)
  To: Ben Hutchings, Greg Kroah-Hartman, linux-kernel, Sachin Prabhu; +Cc: stable

[-- Attachment #1: Type: text/plain, Size: 1719 bytes --]

2017-07-14 9:43 Ben Hutchings <ben@decadent.org.uk>:
> On Fri, 2017-05-05 at 11:32 -0700, Greg Kroah-Hartman wrote:
> > 3.18-stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Sachin Prabhu <sprabhu@redhat.com>
> > 
> > commit 38bd49064a1ecb67baad33598e3d824448ab11ec upstream.
> [...]
> > --- a/fs/cifs/smb2ops.c
> > +++ b/fs/cifs/smb2ops.c
> > @@ -1461,6 +1461,8 @@ struct smb_version_operations smb21_oper
> >  	.clear_stats = smb2_clear_stats,
> >  	.print_stats = smb2_print_stats,
> >  	.is_oplock_break = smb2_is_valid_oplock_break,
> > +	.handle_cancelled_mid = smb2_handle_cancelled_mid,
> > +	.handle_cancelled_mid = smb2_handle_cancelled_mid,
> >  	.downgrade_oplock = smb2_downgrade_oplock,
> >  	.need_neg = smb2_need_neg,
> >  	.negotiate = smb2_negotiate,
> > @@ -1542,6 +1544,8 @@ struct smb_version_operations smb30_oper
> >  	.print_stats = smb2_print_stats,
> >  	.dump_share_caps = smb2_dump_share_caps,
> >  	.is_oplock_break = smb2_is_valid_oplock_break,
> > +	.handle_cancelled_mid = smb2_handle_cancelled_mid,
> > +	.handle_cancelled_mid = smb2_handle_cancelled_mid,
> >  	.downgrade_oplock = smb2_downgrade_oplock,
> >  	.need_neg = smb2_need_neg,
> >  	.negotiate = smb2_negotiate,
> [...]
> 
> This doesn't look right.  handle_cancelled_mid should be initialised once in each of the 3 smb_version_operations structures, shouldn't it?
>
> Ben.

Yes, you are right. Thanks for pointing it out.

Greg, I provided the patch to fix the above bug (see the attachment). Could you please look at it and apply to the 3.18.x kernel if it is suitable?

Best regards,
Pavel Shilovsky

[-- Attachment #2: 0001-CIFS-Fix-handle_cancelled_mid-callback-initializatio.patch --]
[-- Type: application/octet-stream, Size: 1884 bytes --]

From aa0d57e4dd351fa7492351509357514e93aab37b Mon Sep 17 00:00:00 2001
From: Pavel Shilovsky <pshilov@microsoft.com>
Date: Wed, 19 Jul 2017 11:26:02 -0700
Subject: [PATCH] CIFS: Fix handle_cancelled_mid callback initialization

Commit 99e214e006cf ("Handle mismatched open calls") was applied with
errors that result in initializing handle_cancelled_mid callback twice
in smb21_operations and smb30_operations structures but not initializing
it in smb20_operations structure.

Cc: <stable@vger.kernel.org> # 3.18.x
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
---
 fs/cifs/smb2ops.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index a74f433..881af94 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -1383,6 +1383,7 @@ struct smb_version_operations smb20_operations = {
 	.clear_stats = smb2_clear_stats,
 	.print_stats = smb2_print_stats,
 	.is_oplock_break = smb2_is_valid_oplock_break,
+	.handle_cancelled_mid = smb2_handle_cancelled_mid,
 	.downgrade_oplock = smb2_downgrade_oplock,
 	.need_neg = smb2_need_neg,
 	.negotiate = smb2_negotiate,
@@ -1462,7 +1463,6 @@ struct smb_version_operations smb21_operations = {
 	.print_stats = smb2_print_stats,
 	.is_oplock_break = smb2_is_valid_oplock_break,
 	.handle_cancelled_mid = smb2_handle_cancelled_mid,
-	.handle_cancelled_mid = smb2_handle_cancelled_mid,
 	.downgrade_oplock = smb2_downgrade_oplock,
 	.need_neg = smb2_need_neg,
 	.negotiate = smb2_negotiate,
@@ -1545,7 +1545,6 @@ struct smb_version_operations smb30_operations = {
 	.dump_share_caps = smb2_dump_share_caps,
 	.is_oplock_break = smb2_is_valid_oplock_break,
 	.handle_cancelled_mid = smb2_handle_cancelled_mid,
-	.handle_cancelled_mid = smb2_handle_cancelled_mid,
 	.downgrade_oplock = smb2_downgrade_oplock,
 	.need_neg = smb2_need_neg,
 	.negotiate = smb2_negotiate,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 75+ messages in thread

* Re: [PATCH 3.18 36/68] Handle mismatched open calls
  2017-07-19 18:39     ` Pavel Shilovskiy
@ 2017-07-22 12:46       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-07-22 12:46 UTC (permalink / raw)
  To: Pavel Shilovskiy; +Cc: Ben Hutchings, linux-kernel, Sachin Prabhu, stable

On Wed, Jul 19, 2017 at 06:39:13PM +0000, Pavel Shilovskiy wrote:
> 2017-07-14 9:43 Ben Hutchings <ben@decadent.org.uk>:
> > On Fri, 2017-05-05 at 11:32 -0700, Greg Kroah-Hartman wrote:
> > > 3.18-stable review patch.  If anyone has any objections, please let me know.
> > > 
> > > ------------------
> > > 
> > > From: Sachin Prabhu <sprabhu@redhat.com>
> > > 
> > > commit 38bd49064a1ecb67baad33598e3d824448ab11ec upstream.
> > [...]
> > > --- a/fs/cifs/smb2ops.c
> > > +++ b/fs/cifs/smb2ops.c
> > > @@ -1461,6 +1461,8 @@ struct smb_version_operations smb21_oper
> > >  	.clear_stats = smb2_clear_stats,
> > >  	.print_stats = smb2_print_stats,
> > >  	.is_oplock_break = smb2_is_valid_oplock_break,
> > > +	.handle_cancelled_mid = smb2_handle_cancelled_mid,
> > > +	.handle_cancelled_mid = smb2_handle_cancelled_mid,
> > >  	.downgrade_oplock = smb2_downgrade_oplock,
> > >  	.need_neg = smb2_need_neg,
> > >  	.negotiate = smb2_negotiate,
> > > @@ -1542,6 +1544,8 @@ struct smb_version_operations smb30_oper
> > >  	.print_stats = smb2_print_stats,
> > >  	.dump_share_caps = smb2_dump_share_caps,
> > >  	.is_oplock_break = smb2_is_valid_oplock_break,
> > > +	.handle_cancelled_mid = smb2_handle_cancelled_mid,
> > > +	.handle_cancelled_mid = smb2_handle_cancelled_mid,
> > >  	.downgrade_oplock = smb2_downgrade_oplock,
> > >  	.need_neg = smb2_need_neg,
> > >  	.negotiate = smb2_negotiate,
> > [...]
> > 
> > This doesn't look right.  handle_cancelled_mid should be initialised once in each of the 3 smb_version_operations structures, shouldn't it?
> >
> > Ben.
> 
> Yes, you are right. Thanks for pointing it out.
> 
> Greg, I provided the patch to fix the above bug (see the attachment).
> Could you please look at it and apply to the 3.18.x kernel if it is
> suitable?

Looks good, now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 75+ messages in thread

* Re: [PATCH 3.18 36/68] Handle mismatched open calls
  2017-07-14 16:42   ` Ben Hutchings
  2017-07-19 18:39     ` Pavel Shilovskiy
@ 2017-11-15  9:08     ` Greg Kroah-Hartman
  1 sibling, 0 replies; 75+ messages in thread
From: Greg Kroah-Hartman @ 2017-11-15  9:08 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: linux-kernel, Sachin Prabhu, stable, Pavel Shilovsky

On Fri, Jul 14, 2017 at 05:42:32PM +0100, Ben Hutchings wrote:
> On Fri, 2017-05-05 at 11:32 -0700, Greg Kroah-Hartman wrote:
> > 3.18-stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Sachin Prabhu <sprabhu@redhat.com>
> > 
> > commit 38bd49064a1ecb67baad33598e3d824448ab11ec upstream.
> [...]
> > --- a/fs/cifs/smb2ops.c
> > +++ b/fs/cifs/smb2ops.c
> > @@ -1461,6 +1461,8 @@ struct smb_version_operations smb21_oper
> >  	.clear_stats = smb2_clear_stats,
> >  	.print_stats = smb2_print_stats,
> >  	.is_oplock_break = smb2_is_valid_oplock_break,
> > +	.handle_cancelled_mid = smb2_handle_cancelled_mid,
> > +	.handle_cancelled_mid = smb2_handle_cancelled_mid,
> >  	.downgrade_oplock = smb2_downgrade_oplock,
> >  	.need_neg = smb2_need_neg,
> >  	.negotiate = smb2_negotiate,
> > @@ -1542,6 +1544,8 @@ struct smb_version_operations smb30_oper
> >  	.print_stats = smb2_print_stats,
> >  	.dump_share_caps = smb2_dump_share_caps,
> >  	.is_oplock_break = smb2_is_valid_oplock_break,
> > +	.handle_cancelled_mid = smb2_handle_cancelled_mid,
> > +	.handle_cancelled_mid = smb2_handle_cancelled_mid,
> >  	.downgrade_oplock = smb2_downgrade_oplock,
> >  	.need_neg = smb2_need_neg,
> >  	.negotiate = smb2_negotiate,
> [...]
> 
> This doesn't look right.  handle_cancelled_mid should be initialised
> once in each of the 3 smb_version_operations structures, shouldn't it?

Yeah, something is odd with this, I'll look into it later today, thanks
for flagging it.

greg k-h

^ permalink raw reply	[flat|nested] 75+ messages in thread

end of thread, other threads:[~2017-11-15  9:08 UTC | newest]

Thread overview: 75+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-05 18:31 [PATCH 3.18 00/68] 3.18.52-stable review Greg Kroah-Hartman
2017-05-05 18:31 ` [PATCH 3.18 01/68] f2fs: do more integrity verification for superblock Greg Kroah-Hartman
2017-05-05 18:31 ` [PATCH 3.18 02/68] [media] xc2028: unlock on error in xc2028_set_config() Greg Kroah-Hartman
2017-05-05 18:31 ` [PATCH 3.18 03/68] ext4: check if in-inode xattr is corrupted in ext4_expand_extra_isize_ea() Greg Kroah-Hartman
2017-05-05 18:31 ` [PATCH 3.18 04/68] md:raid1: fix a dead loop when read from a WriteMostly disk Greg Kroah-Hartman
2017-05-05 18:31 ` [PATCH 3.18 05/68] MIPS: Fix crash registers on non-crashing CPUs Greg Kroah-Hartman
2017-05-05 18:31 ` [PATCH 3.18 06/68] RDS: Fix the atomicity for congestion map update Greg Kroah-Hartman
2017-05-05 18:31 ` [PATCH 3.18 07/68] usb: gadget: f_midi: Fixed a bug when buflen was smaller than wMaxPacketSize Greg Kroah-Hartman
2017-05-05 18:31 ` [PATCH 3.18 08/68] xen/x86: dont lose event interrupts Greg Kroah-Hartman
2017-05-05 18:31 ` [PATCH 3.18 09/68] sparc64: kern_addr_valid regression Greg Kroah-Hartman
2017-05-05 18:31 ` [PATCH 3.18 10/68] sparc64: Fix kernel panic due to erroneous #ifdef surrounding pmd_write() Greg Kroah-Hartman
2017-05-05 18:31 ` [PATCH 3.18 11/68] net: neigh: guard against NULL solicit() method Greg Kroah-Hartman
2017-05-05 18:31 ` [PATCH 3.18 12/68] net: phy: handle state correctly in phy_stop_machine Greg Kroah-Hartman
2017-05-05 18:31 ` [PATCH 3.18 13/68] l2tp: purge socket queues in the .destruct() callback Greg Kroah-Hartman
2017-05-05 18:31 ` [PATCH 3.18 14/68] net/packet: fix overflow in check for tp_frame_nr Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 15/68] net/packet: fix overflow in check for tp_reserve Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 16/68] net: ipv4: fix multipath RTM_GETROUTE behavior when iif is given Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 17/68] sctp: listen on the sock only when its state is listening or closed Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 18/68] netpoll: Check for skb->queue_mapping Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 19/68] ip6mr: fix notification device destruction Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 20/68] ALSA: seq: Dont break snd_use_lock_sync() loop by timeout Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 21/68] MIPS: KGDB: Use kernel context for sleeping threads Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 22/68] p9_client_readdir() fix Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 25/68] ftrace/x86: Fix triple fault with graph tracing and suspend-to-ram Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 26/68] powerpc/ptrace: Fix out of bounds array access warning Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 27/68] drbd: avoid redefinition of BITS_PER_PAGE Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 28/68] IB/iser: Fix sparse warnings Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 29/68] mtd: avoid stack overflow in MTD CFI code Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 30/68] mlx5: avoid build warnings on 32-bit Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 31/68] PCI: xilinx: Fix harmless format string warning Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 32/68] ALSA: ppc/awacs: shut up maybe-uninitialized warning Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 33/68] cred/userns: define current_user_ns() as a function Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 34/68] net: tg3: avoid uninitialized variable warning Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 35/68] timerfd: Protect the might cancel mechanism proper Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 36/68] Handle mismatched open calls Greg Kroah-Hartman
2017-07-14 16:42   ` Ben Hutchings
2017-07-19 18:39     ` Pavel Shilovskiy
2017-07-22 12:46       ` Greg Kroah-Hartman
2017-11-15  9:08     ` Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 37/68] ALSA: pcm : Call kill_fasync() in stream lock Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 38/68] regulator: core: Fix regualtor_ena_gpio_free not to access pin after freeing Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 39/68] perf: Tighten (and fix) the grouping condition Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 40/68] posix_acl: Clear SGID bit when setting file permissions Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 41/68] l2tp: fix racy SOCK_ZAPPED flag check in l2tp_ip{,6}_bind() Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 42/68] net: avoid signed overflows for SO_{SND|RCV}BUFFORCE Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 43/68] mm: avoid setting up anonymous pages into file mapping Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 44/68] ARM: cns3xxx: shut up frame size warning Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 45/68] arm64: Provide a namespace to NCAPS Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 46/68] staging: vt6655: fix overly large stack usage Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 47/68] staging: imx-drm: fix indentation warning Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 48/68] staging: bcm: add 32-bit host dependency Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 49/68] IB/qib: rename BITS_PER_PAGE to RVT_BITS_PER_PAGE Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 50/68] IB/ehca: fix maybe-uninitialized warnings Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 51/68] tty/isicom: fix big-endian compile warning Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 52/68] infiniband: mlx5: avoid a compile-time warning Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 53/68] ips: remove pointless #warning Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 54/68] mISDN: avoid arch specific __builtin_return_address call Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 55/68] arm64: build vdso without libgcov Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 56/68] mm/cma: silence warnings due to max() usage Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 57/68] MIPS: jz4740: fix build error in irq.h Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 58/68] MIPS: elf2ecoff: Ignore PT_MIPS_ABIFLAGS program headers Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 60/68] staging: unisys: correctly handle return value from queue_delayed_work() Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 61/68] message: i2o: fix 64bit build warnings Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 62/68] scsi: advansys: remove #warning message Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 63/68] modpost: expand pattern matching to support substring matches Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 64/68] modpost: dont emit section mismatch warnings for compiler optimizations Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 65/68] cpumask_set_cpu_local_first => cpumask_local_spread, lament Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 66/68] e1000e: fix call to do_div() to use u64 arg Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 67/68] gfs2: remove IS_ERR_VALUE abuse Greg Kroah-Hartman
2017-05-05 18:32 ` [PATCH 3.18 68/68] kbuild: mergeconfig: fix "jobserver unavailable" warning Greg Kroah-Hartman
2017-05-06  1:58 ` [PATCH 3.18 00/68] 3.18.52-stable review Shuah Khan
2017-05-07 19:35 ` Guenter Roeck
     [not found] ` <590d0d30.01b9370a.e3d65.b17a@mx.google.com>
     [not found]   ` <m2tw4vdxnk.fsf@baylibre.com>
2017-05-09  7:47     ` Alexandre Belloni
2017-05-31 19:47     ` Alexandre Belloni
2017-06-06 20:52       ` Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).