All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4.9 00/18] 4.9.48-stable review
@ 2017-09-05  7:11 Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 01/18] irqchip: mips-gic: SYNC after enabling GIC region Greg Kroah-Hartman
                   ` (18 more replies)
  0 siblings, 19 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05  7:11 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 4.9.48 release.
There are 18 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 Thu Sep  7 07:09:06 UTC 2017.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.48-rc1.gz
or in the git tree and branch at:
  git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.

thanks,

greg k-h

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

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

Oleg Nesterov <oleg@redhat.com>
    epoll: fix race between ep_poll_callback(POLLFREE) and ep_free()/ep_remove()

Suzuki K Poulose <suzuki.poulose@arm.com>
    kvm: arm/arm64: Force reading uncached stage2 PGD

Xiangliang.Yu <Xiangliang.Yu@amd.com>
    drm/ttm: Fix accounting error when fail to get pages for pool

Vladis Dronov <vdronov@redhat.com>
    xfrm: policy: check policy direction value

Stephan Mueller <smueller@chronox.de>
    lib/mpi: kunmap after finishing accessing buffer

Cong Wang <xiyou.wangcong@gmail.com>
    wl1251: add a missing spin_lock_init()

Steve French <smfrench@gmail.com>
    CIFS: remove endian related sparse warning

Pavel Shilovsky <pshilov@microsoft.com>
    CIFS: Fix maximum SMB2 header size

Ben Hutchings <ben@decadent.org.uk>
    alpha: uapi: Add support for __SANE_USERSPACE_TYPES__

Waiman Long <longman@redhat.com>
    cpuset: Fix incorrect memory_pressure control file mapping

Tejun Heo <tj@kernel.org>
    cpumask: fix spurious cpumask_of_node() on non-NUMA multi-node configs

Yan, Zheng <zyan@redhat.com>
    ceph: fix readpage from fscache

Mel Gorman <mgorman@techsingularity.net>
    mm, madvise: ensure poisoned pages are removed from per-cpu lists

Eric Biggers <ebiggers@google.com>
    mm, uprobes: fix multiple free of ->uprobes_state.xol_area

Stephan Mueller <smueller@chronox.de>
    crypto: algif_skcipher - only call put_page on referenced and used pages

Stephen Douthit <stephend@adiengineering.com>
    i2c: ismt: Return EMSGSIZE for block reads with bogus length

Stephen Douthit <stephend@adiengineering.com>
    i2c: ismt: Don't duplicate the receive length for block reads

James Hogan <james.hogan@imgtec.com>
    irqchip: mips-gic: SYNC after enabling GIC region


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

Diffstat:

 Makefile                              |  4 ++--
 arch/alpha/include/asm/types.h        |  2 +-
 arch/alpha/include/uapi/asm/types.h   | 12 +++++++++-
 arch/arm/kvm/mmu.c                    |  2 +-
 crypto/algif_skcipher.c               |  9 ++++++--
 drivers/gpu/drm/ttm/ttm_page_alloc.c  |  2 +-
 drivers/i2c/busses/i2c-ismt.c         |  6 +++--
 drivers/irqchip/irq-mips-gic.c        |  5 ++++-
 drivers/net/wireless/ti/wl1251/main.c |  1 +
 fs/ceph/addr.c                        | 24 ++++++++++++--------
 fs/ceph/cache.c                       | 12 +++-------
 fs/cifs/dir.c                         |  2 +-
 fs/cifs/smb2pdu.h                     |  4 ++--
 fs/eventpoll.c                        | 42 ++++++++++++++++++++++-------------
 include/asm-generic/topology.h        |  6 ++++-
 kernel/cpuset.c                       |  1 +
 kernel/events/uprobes.c               |  2 --
 kernel/fork.c                         |  8 +++++++
 lib/mpi/mpicoder.c                    |  4 +++-
 mm/madvise.c                          |  7 ++++++
 net/xfrm/xfrm_policy.c                |  6 +++++
 21 files changed, 109 insertions(+), 52 deletions(-)

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

* [PATCH 4.9 01/18] irqchip: mips-gic: SYNC after enabling GIC region
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
@ 2017-09-05  7:11 ` Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 02/18] i2c: ismt: Dont duplicate the receive length for block reads Greg Kroah-Hartman
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05  7:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, James Hogan, Paul Burton,
	Marc Zyngier, Thomas Gleixner, Jason Cooper, linux-mips,
	Ralf Baechle

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

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

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

commit 2c0e8382386f618c85d20cb05e7cf7df8cdd382c upstream.

A SYNC is required between enabling the GIC region and actually trying
to use it, even if the first access is a read, otherwise its possible
depending on the timing (and in my case depending on the precise
alignment of certain kernel code) to hit CM bus errors on that first
access.

Add the SYNC straight after setting the GIC base.

[paul.burton@imgtec.com:
  Changes later in this series increase our likelihood of hitting this
  by reducing the amount of code that runs between enabling the GIC &
  accessing it.]

Fixes: a7057270c280 ("irqchip: mips-gic: Add device-tree support")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/17019/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/irqchip/irq-mips-gic.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

--- a/drivers/irqchip/irq-mips-gic.c
+++ b/drivers/irqchip/irq-mips-gic.c
@@ -1115,8 +1115,11 @@ static int __init gic_of_init(struct dev
 		gic_len = resource_size(&res);
 	}
 
-	if (mips_cm_present())
+	if (mips_cm_present()) {
 		write_gcr_gic_base(gic_base | CM_GCR_GIC_BASE_GICEN_MSK);
+		/* Ensure GIC region is enabled before trying to access it */
+		__sync();
+	}
 	gic_present = true;
 
 	__gic_init(gic_base, gic_len, cpu_vec, 0, node);

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

* [PATCH 4.9 02/18] i2c: ismt: Dont duplicate the receive length for block reads
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 01/18] irqchip: mips-gic: SYNC after enabling GIC region Greg Kroah-Hartman
@ 2017-09-05  7:11 ` Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 03/18] i2c: ismt: Return EMSGSIZE for block reads with bogus length Greg Kroah-Hartman
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05  7:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Stephen Douthit, Dan Priamo,
	Neil Horman, Wolfram Sang

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

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

From: Stephen Douthit <stephend@adiengineering.com>

commit b6c159a9cb69c2cf0bf59d4e12c3a2da77e4d994 upstream.

According to Table 15-14 of the C2000 EDS (Intel doc #510524) the
rx data pointed to by the descriptor dptr contains the byte count.

desc->rxbytes reports all bytes read on the wire, including the
"byte count" byte.  So if a device sends 4 bytes in response to a
block read, on the wire and in the DMA buffer we see:

count data1 data2 data3 data4
 0x04  0xde  0xad  0xbe  0xef

That's what we want to return in data->block to the next level.

Instead we were actually prefixing that with desc->rxbytes:

bad
count count data1 data2 data3 data4
 0x05  0x04  0xde  0xad  0xbe  0xef

This was discovered while developing a BMC solution relying on the
ipmi_ssif.c driver which was trying to interpret the bogus length
field as part of the IPMI response.

Signed-off-by: Stephen Douthit <stephend@adiengineering.com>
Tested-by: Dan Priamo <danp@adiengineering.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/i2c/busses/i2c-ismt.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/i2c/busses/i2c-ismt.c
+++ b/drivers/i2c/busses/i2c-ismt.c
@@ -341,8 +341,8 @@ static int ismt_process_desc(const struc
 			break;
 		case I2C_SMBUS_BLOCK_DATA:
 		case I2C_SMBUS_I2C_BLOCK_DATA:
-			memcpy(&data->block[1], dma_buffer, desc->rxbytes);
-			data->block[0] = desc->rxbytes;
+			memcpy(data->block, dma_buffer, desc->rxbytes);
+			data->block[0] = desc->rxbytes - 1;
 			break;
 		}
 		return 0;

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

* [PATCH 4.9 03/18] i2c: ismt: Return EMSGSIZE for block reads with bogus length
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 01/18] irqchip: mips-gic: SYNC after enabling GIC region Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 02/18] i2c: ismt: Dont duplicate the receive length for block reads Greg Kroah-Hartman
@ 2017-09-05  7:11 ` Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 04/18] crypto: algif_skcipher - only call put_page on referenced and used pages Greg Kroah-Hartman
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05  7:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Stephen Douthit, Dan Priamo,
	Neil Horman, Wolfram Sang

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

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

From: Stephen Douthit <stephend@adiengineering.com>

commit ba201c4f5ebe13d7819081756378777d8153f23e upstream.

Compare the number of bytes actually seen on the wire to the byte
count field returned by the slave device.

Previously we just overwrote the byte count returned by the slave
with the real byte count and let the caller figure out if the
message was sane.

Signed-off-by: Stephen Douthit <stephend@adiengineering.com>
Tested-by: Dan Priamo <danp@adiengineering.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/i2c/busses/i2c-ismt.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/i2c/busses/i2c-ismt.c
+++ b/drivers/i2c/busses/i2c-ismt.c
@@ -341,8 +341,10 @@ static int ismt_process_desc(const struc
 			break;
 		case I2C_SMBUS_BLOCK_DATA:
 		case I2C_SMBUS_I2C_BLOCK_DATA:
+			if (desc->rxbytes != dma_buffer[0] + 1)
+				return -EMSGSIZE;
+
 			memcpy(data->block, dma_buffer, desc->rxbytes);
-			data->block[0] = desc->rxbytes - 1;
 			break;
 		}
 		return 0;

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

* [PATCH 4.9 04/18] crypto: algif_skcipher - only call put_page on referenced and used pages
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2017-09-05  7:11 ` [PATCH 4.9 03/18] i2c: ismt: Return EMSGSIZE for block reads with bogus length Greg Kroah-Hartman
@ 2017-09-05  7:11 ` Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 05/18] mm, uprobes: fix multiple free of ->uprobes_state.xol_area Greg Kroah-Hartman
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05  7:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Stephan Mueller, Herbert Xu

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

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

From: Stephan Mueller <smueller@chronox.de>

commit 445a582738de6802669aeed9c33ca406c23c3b1f upstream.

For asynchronous operation, SGs are allocated without a page mapped to
them or with a page that is not used (ref-counted). If the SGL is freed,
the code must only call put_page for an SG if there was a page assigned
and ref-counted in the first place.

This fixes a kernel crash when using io_submit with more than one iocb
using the sendmsg and sendpage (vmsplice/splice) interface.

Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 crypto/algif_skcipher.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--- a/crypto/algif_skcipher.c
+++ b/crypto/algif_skcipher.c
@@ -86,8 +86,13 @@ static void skcipher_free_async_sgls(str
 	}
 	sgl = sreq->tsg;
 	n = sg_nents(sgl);
-	for_each_sg(sgl, sg, n, i)
-		put_page(sg_page(sg));
+	for_each_sg(sgl, sg, n, i) {
+		struct page *page = sg_page(sg);
+
+		/* some SGs may not have a page mapped */
+		if (page && page_ref_count(page))
+			put_page(page);
+	}
 
 	kfree(sreq->tsg);
 }

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

* [PATCH 4.9 05/18] mm, uprobes: fix multiple free of ->uprobes_state.xol_area
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2017-09-05  7:11 ` [PATCH 4.9 04/18] crypto: algif_skcipher - only call put_page on referenced and used pages Greg Kroah-Hartman
@ 2017-09-05  7:11 ` Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 06/18] mm, madvise: ensure poisoned pages are removed from per-cpu lists Greg Kroah-Hartman
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05  7:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Eric Biggers, Oleg Nesterov,
	Alexander Shishkin, Arnaldo Carvalho de Melo, Dmitry Vyukov,
	Ingo Molnar, Konstantin Khlebnikov, Mark Rutland, Michal Hocko,
	Peter Zijlstra, Vlastimil Babka, Andrew Morton, Linus Torvalds

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

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

From: Eric Biggers <ebiggers@google.com>

commit 355627f518978b5167256d27492fe0b343aaf2f2 upstream.

Commit 7c051267931a ("mm, fork: make dup_mmap wait for mmap_sem for
write killable") made it possible to kill a forking task while it is
waiting to acquire its ->mmap_sem for write, in dup_mmap().

However, it was overlooked that this introduced an new error path before
the new mm_struct's ->uprobes_state.xol_area has been set to NULL after
being copied from the old mm_struct by the memcpy in dup_mm().  For a
task that has previously hit a uprobe tracepoint, this resulted in the
'struct xol_area' being freed multiple times if the task was killed at
just the right time while forking.

Fix it by setting ->uprobes_state.xol_area to NULL in mm_init() rather
than in uprobe_dup_mmap().

With CONFIG_UPROBE_EVENTS=y, the bug can be reproduced by the same C
program given by commit 2b7e8665b4ff ("fork: fix incorrect fput of
->exe_file causing use-after-free"), provided that a uprobe tracepoint
has been set on the fork_thread() function.  For example:

    $ gcc reproducer.c -o reproducer -lpthread
    $ nm reproducer | grep fork_thread
    0000000000400719 t fork_thread
    $ echo "p $PWD/reproducer:0x719" > /sys/kernel/debug/tracing/uprobe_events
    $ echo 1 > /sys/kernel/debug/tracing/events/uprobes/enable
    $ ./reproducer

Here is the use-after-free reported by KASAN:

    BUG: KASAN: use-after-free in uprobe_clear_state+0x1c4/0x200
    Read of size 8 at addr ffff8800320a8b88 by task reproducer/198

    CPU: 1 PID: 198 Comm: reproducer Not tainted 4.13.0-rc7-00015-g36fde05f3fb5 #255
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-20170228_101828-anatol 04/01/2014
    Call Trace:
     dump_stack+0xdb/0x185
     print_address_description+0x7e/0x290
     kasan_report+0x23b/0x350
     __asan_report_load8_noabort+0x19/0x20
     uprobe_clear_state+0x1c4/0x200
     mmput+0xd6/0x360
     do_exit+0x740/0x1670
     do_group_exit+0x13f/0x380
     get_signal+0x597/0x17d0
     do_signal+0x99/0x1df0
     exit_to_usermode_loop+0x166/0x1e0
     syscall_return_slowpath+0x258/0x2c0
     entry_SYSCALL_64_fastpath+0xbc/0xbe

    ...

    Allocated by task 199:
     save_stack_trace+0x1b/0x20
     kasan_kmalloc+0xfc/0x180
     kmem_cache_alloc_trace+0xf3/0x330
     __create_xol_area+0x10f/0x780
     uprobe_notify_resume+0x1674/0x2210
     exit_to_usermode_loop+0x150/0x1e0
     prepare_exit_to_usermode+0x14b/0x180
     retint_user+0x8/0x20

    Freed by task 199:
     save_stack_trace+0x1b/0x20
     kasan_slab_free+0xa8/0x1a0
     kfree+0xba/0x210
     uprobe_clear_state+0x151/0x200
     mmput+0xd6/0x360
     copy_process.part.8+0x605f/0x65d0
     _do_fork+0x1a5/0xbd0
     SyS_clone+0x19/0x20
     do_syscall_64+0x22f/0x660
     return_from_SYSCALL_64+0x0/0x7a

Note: without KASAN, you may instead see a "Bad page state" message, or
simply a general protection fault.

Link: http://lkml.kernel.org/r/20170830033303.17927-1-ebiggers3@gmail.com
Fixes: 7c051267931a ("mm, fork: make dup_mmap wait for mmap_sem for write killable")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reported-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
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>

---
 kernel/events/uprobes.c |    2 --
 kernel/fork.c           |    8 ++++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -1254,8 +1254,6 @@ void uprobe_end_dup_mmap(void)
 
 void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm)
 {
-	newmm->uprobes_state.xol_area = NULL;
-
 	if (test_bit(MMF_HAS_UPROBES, &oldmm->flags)) {
 		set_bit(MMF_HAS_UPROBES, &newmm->flags);
 		/* unconditionally, dup_mmap() skips VM_DONTCOPY vmas */
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -745,6 +745,13 @@ static void mm_init_owner(struct mm_stru
 #endif
 }
 
+static void mm_init_uprobes_state(struct mm_struct *mm)
+{
+#ifdef CONFIG_UPROBES
+	mm->uprobes_state.xol_area = NULL;
+#endif
+}
+
 static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,
 	struct user_namespace *user_ns)
 {
@@ -772,6 +779,7 @@ static struct mm_struct *mm_init(struct
 #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS
 	mm->pmd_huge_pte = NULL;
 #endif
+	mm_init_uprobes_state(mm);
 
 	if (current->mm) {
 		mm->flags = current->mm->flags & MMF_INIT_MASK;

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

* [PATCH 4.9 06/18] mm, madvise: ensure poisoned pages are removed from per-cpu lists
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2017-09-05  7:11 ` [PATCH 4.9 05/18] mm, uprobes: fix multiple free of ->uprobes_state.xol_area Greg Kroah-Hartman
@ 2017-09-05  7:11 ` Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 07/18] ceph: fix readpage from fscache Greg Kroah-Hartman
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05  7:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Mel Gorman, Wang, Wendy,
	David Rientjes, Vlastimil Babka, Hansen, Dave, Luck, Tony,
	Naoya Horiguchi, Andrew Morton, Linus Torvalds

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

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

From: Mel Gorman <mgorman@techsingularity.net>

commit c461ad6a63b37ba74632e90c063d14823c884247 upstream.

Wendy Wang reported off-list that a RAS HWPOISON-SOFT test case failed
and bisected it to the commit 479f854a207c ("mm, page_alloc: defer
debugging checks of pages allocated from the PCP").

The problem is that a page that was poisoned with madvise() is reused.
The commit removed a check that would trigger if DEBUG_VM was enabled
but re-enabling the check only fixes the problem as a side-effect by
printing a bad_page warning and recovering.

The root of the problem is that an madvise() can leave a poisoned page
on the per-cpu list.  This patch drains all per-cpu lists after pages
are poisoned so that they will not be reused.  Wendy reports that the
test case in question passes with this patch applied.  While this could
be done in a targeted fashion, it is over-complicated for such a rare
operation.

Link: http://lkml.kernel.org/r/20170828133414.7qro57jbepdcyz5x@techsingularity.net
Fixes: 479f854a207c ("mm, page_alloc: defer debugging checks of pages allocated from the PCP")
Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Reported-by: Wang, Wendy <wendy.wang@intel.com>
Tested-by: Wang, Wendy <wendy.wang@intel.com>
Acked-by: David Rientjes <rientjes@google.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: "Hansen, Dave" <dave.hansen@intel.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.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>

---
 mm/madvise.c |    7 +++++++
 1 file changed, 7 insertions(+)

--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -533,6 +533,8 @@ static long madvise_remove(struct vm_are
 static int madvise_hwpoison(int bhv, unsigned long start, unsigned long end)
 {
 	struct page *p;
+	struct zone *zone;
+
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
 	for (; start < end; start += PAGE_SIZE <<
@@ -561,6 +563,11 @@ static int madvise_hwpoison(int bhv, uns
 		if (ret)
 			return ret;
 	}
+
+	/* Ensure that all poisoned pages are removed from per-cpu lists */
+	for_each_populated_zone(zone)
+		drain_all_pages(zone);
+
 	return 0;
 }
 #endif

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

* [PATCH 4.9 07/18] ceph: fix readpage from fscache
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2017-09-05  7:11 ` [PATCH 4.9 06/18] mm, madvise: ensure poisoned pages are removed from per-cpu lists Greg Kroah-Hartman
@ 2017-09-05  7:11 ` Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 08/18] cpumask: fix spurious cpumask_of_node() on non-NUMA multi-node configs Greg Kroah-Hartman
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05  7:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Yan, Zheng, Jeff Layton, Ilya Dryomov

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

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

From: Yan, Zheng <zyan@redhat.com>

commit dd2bc473482eedc60c29cf00ad12568ce40ce511 upstream.

ceph_readpage() unlocks page prematurely prematurely in the case
that page is reading from fscache. Caller of readpage expects that
page is uptodate when it get unlocked. So page shoule get locked
by completion callback of fscache_read_or_alloc_pages()

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/ceph/addr.c  |   24 +++++++++++++++---------
 fs/ceph/cache.c |   12 +++---------
 2 files changed, 18 insertions(+), 18 deletions(-)

--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -188,7 +188,7 @@ static int ceph_releasepage(struct page
 /*
  * read a single page, without unlocking it.
  */
-static int readpage_nounlock(struct file *filp, struct page *page)
+static int ceph_do_readpage(struct file *filp, struct page *page)
 {
 	struct inode *inode = file_inode(filp);
 	struct ceph_inode_info *ci = ceph_inode(inode);
@@ -218,7 +218,7 @@ static int readpage_nounlock(struct file
 
 	err = ceph_readpage_from_fscache(inode, page);
 	if (err == 0)
-		goto out;
+		return -EINPROGRESS;
 
 	dout("readpage inode %p file %p page %p index %lu\n",
 	     inode, filp, page, page->index);
@@ -248,8 +248,11 @@ out:
 
 static int ceph_readpage(struct file *filp, struct page *page)
 {
-	int r = readpage_nounlock(filp, page);
-	unlock_page(page);
+	int r = ceph_do_readpage(filp, page);
+	if (r != -EINPROGRESS)
+		unlock_page(page);
+	else
+		r = 0;
 	return r;
 }
 
@@ -1235,7 +1238,7 @@ retry_locked:
 			goto retry_locked;
 		r = writepage_nounlock(page, NULL);
 		if (r < 0)
-			goto fail_nosnap;
+			goto fail_unlock;
 		goto retry_locked;
 	}
 
@@ -1263,11 +1266,14 @@ retry_locked:
 	}
 
 	/* we need to read it. */
-	r = readpage_nounlock(file, page);
-	if (r < 0)
-		goto fail_nosnap;
+	r = ceph_do_readpage(file, page);
+	if (r < 0) {
+		if (r == -EINPROGRESS)
+			return -EAGAIN;
+		goto fail_unlock;
+	}
 	goto retry_locked;
-fail_nosnap:
+fail_unlock:
 	unlock_page(page);
 	return r;
 }
--- a/fs/ceph/cache.c
+++ b/fs/ceph/cache.c
@@ -240,13 +240,7 @@ void ceph_fscache_file_set_cookie(struct
 	}
 }
 
-static void ceph_vfs_readpage_complete(struct page *page, void *data, int error)
-{
-	if (!error)
-		SetPageUptodate(page);
-}
-
-static void ceph_vfs_readpage_complete_unlock(struct page *page, void *data, int error)
+static void ceph_readpage_from_fscache_complete(struct page *page, void *data, int error)
 {
 	if (!error)
 		SetPageUptodate(page);
@@ -274,7 +268,7 @@ int ceph_readpage_from_fscache(struct in
 		return -ENOBUFS;
 
 	ret = fscache_read_or_alloc_page(ci->fscache, page,
-					 ceph_vfs_readpage_complete, NULL,
+					 ceph_readpage_from_fscache_complete, NULL,
 					 GFP_KERNEL);
 
 	switch (ret) {
@@ -303,7 +297,7 @@ int ceph_readpages_from_fscache(struct i
 		return -ENOBUFS;
 
 	ret = fscache_read_or_alloc_pages(ci->fscache, mapping, pages, nr_pages,
-					  ceph_vfs_readpage_complete_unlock,
+					  ceph_readpage_from_fscache_complete,
 					  NULL, mapping_gfp_mask(mapping));
 
 	switch (ret) {

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

* [PATCH 4.9 08/18] cpumask: fix spurious cpumask_of_node() on non-NUMA multi-node configs
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
                   ` (6 preceding siblings ...)
  2017-09-05  7:11 ` [PATCH 4.9 07/18] ceph: fix readpage from fscache Greg Kroah-Hartman
@ 2017-09-05  7:11 ` Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 09/18] cpuset: Fix incorrect memory_pressure control file mapping Greg Kroah-Hartman
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05  7:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Tejun Heo, Linus Torvalds

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

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

From: Tejun Heo <tj@kernel.org>

commit b339752d054fb32863418452dff350a1086885b1 upstream.

When !NUMA, cpumask_of_node(@node) equals cpu_online_mask regardless of
@node.  The assumption seems that if !NUMA, there shouldn't be more than
one node and thus reporting cpu_online_mask regardless of @node is
correct.  However, that assumption was broken years ago to support
DISCONTIGMEM and whether a system has multiple nodes or not is
separately controlled by NEED_MULTIPLE_NODES.

This means that, on a system with !NUMA && NEED_MULTIPLE_NODES,
cpumask_of_node() will report cpu_online_mask for all possible nodes,
indicating that the CPUs are associated with multiple nodes which is an
impossible configuration.

This bug has been around forever but doesn't look like it has caused any
noticeable symptoms.  However, it triggers a WARN recently added to
workqueue to verify NUMA affinity configuration.

Fix it by reporting empty cpumask on non-zero nodes if !NUMA.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-and-tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/asm-generic/topology.h |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/include/asm-generic/topology.h
+++ b/include/asm-generic/topology.h
@@ -48,7 +48,11 @@
 #define parent_node(node)	((void)(node),0)
 #endif
 #ifndef cpumask_of_node
-#define cpumask_of_node(node)	((void)node, cpu_online_mask)
+  #ifdef CONFIG_NEED_MULTIPLE_NODES
+    #define cpumask_of_node(node)	((node) == 0 ? cpu_online_mask : cpu_none_mask)
+  #else
+    #define cpumask_of_node(node)	((void)node, cpu_online_mask)
+  #endif
 #endif
 #ifndef pcibus_to_node
 #define pcibus_to_node(bus)	((void)(bus), -1)

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

* [PATCH 4.9 09/18] cpuset: Fix incorrect memory_pressure control file mapping
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
                   ` (7 preceding siblings ...)
  2017-09-05  7:11 ` [PATCH 4.9 08/18] cpumask: fix spurious cpumask_of_node() on non-NUMA multi-node configs Greg Kroah-Hartman
@ 2017-09-05  7:11 ` Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 10/18] alpha: uapi: Add support for __SANE_USERSPACE_TYPES__ Greg Kroah-Hartman
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05  7:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Waiman Long, Tejun Heo

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

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

From: Waiman Long <longman@redhat.com>

commit 1c08c22c874ac88799cab1f78c40f46110274915 upstream.

The memory_pressure control file was incorrectly set up without
a private value (0, by default). As a result, this control
file was treated like memory_migrate on read. By adding back the
FILE_MEMORY_PRESSURE private value, the correct memory pressure value
will be returned.

Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: 7dbdb199d3bf ("cgroup: replace cftype->mode with CFTYPE_WORLD_WRITABLE")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 kernel/cpuset.c |    1 +
 1 file changed, 1 insertion(+)

--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1905,6 +1905,7 @@ static struct cftype files[] = {
 	{
 		.name = "memory_pressure",
 		.read_u64 = cpuset_read_u64,
+		.private = FILE_MEMORY_PRESSURE,
 	},
 
 	{

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

* [PATCH 4.9 10/18] alpha: uapi: Add support for __SANE_USERSPACE_TYPES__
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
                   ` (8 preceding siblings ...)
  2017-09-05  7:11 ` [PATCH 4.9 09/18] cpuset: Fix incorrect memory_pressure control file mapping Greg Kroah-Hartman
@ 2017-09-05  7:11 ` Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 11/18] CIFS: Fix maximum SMB2 header size Greg Kroah-Hartman
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05  7:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ben Hutchings, Michael Cree, Matt Turner

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

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

From: Ben Hutchings <ben@decadent.org.uk>

commit cec80d82142ab25c71eee24b529cfeaf17c43062 upstream.

This fixes compiler errors in perf such as:

tests/attr.c: In function 'store_event':
tests/attr.c:66:27: error: format '%llu' expects argument of type 'long long unsigned int', but argument 6 has type '__u64 {aka long unsigned int}' [-Werror=format=]
  snprintf(path, PATH_MAX, "%s/event-%d-%llu-%d", dir,
                           ^

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Tested-by: Michael Cree <mcree@orcon.net.nz>
Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/alpha/include/asm/types.h      |    2 +-
 arch/alpha/include/uapi/asm/types.h |   12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

--- a/arch/alpha/include/asm/types.h
+++ b/arch/alpha/include/asm/types.h
@@ -1,6 +1,6 @@
 #ifndef _ALPHA_TYPES_H
 #define _ALPHA_TYPES_H
 
-#include <asm-generic/int-ll64.h>
+#include <uapi/asm/types.h>
 
 #endif /* _ALPHA_TYPES_H */
--- a/arch/alpha/include/uapi/asm/types.h
+++ b/arch/alpha/include/uapi/asm/types.h
@@ -9,8 +9,18 @@
  * need to be careful to avoid a name clashes.
  */
 
-#ifndef __KERNEL__
+/*
+ * This is here because we used to use l64 for alpha
+ * and we don't want to impact user mode with our change to ll64
+ * in the kernel.
+ *
+ * However, some user programs are fine with this.  They can
+ * flag __SANE_USERSPACE_TYPES__ to get int-ll64.h here.
+ */
+#if !defined(__SANE_USERSPACE_TYPES__) && !defined(__KERNEL__)
 #include <asm-generic/int-l64.h>
+#else
+#include <asm-generic/int-ll64.h>
 #endif
 
 #endif /* _UAPI_ALPHA_TYPES_H */

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

* [PATCH 4.9 11/18] CIFS: Fix maximum SMB2 header size
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
                   ` (9 preceding siblings ...)
  2017-09-05  7:11 ` [PATCH 4.9 10/18] alpha: uapi: Add support for __SANE_USERSPACE_TYPES__ Greg Kroah-Hartman
@ 2017-09-05  7:11 ` Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 12/18] CIFS: remove endian related sparse warning Greg Kroah-Hartman
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05  7:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pavel Shilovsky, Steve French, Sachin Prabhu

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

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

From: Pavel Shilovsky <pshilov@microsoft.com>

commit 9e37b1784f2be9397a903307574ee565bbadfd75 upstream.

Currently the maximum size of SMB2/3 header is set incorrectly which
leads to hanging of directory listing operations on encrypted SMB3
connections. Fix this by setting the maximum size to 170 bytes that
is calculated as RFC1002 length field size (4) + transform header
size (52) + SMB2 header size (64) + create response size (56).

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Acked-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/cifs/smb2pdu.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -84,8 +84,8 @@
 
 #define NUMBER_OF_SMB2_COMMANDS	0x0013
 
-/* BB FIXME - analyze following length BB */
-#define MAX_SMB2_HDR_SIZE 0x78 /* 4 len + 64 hdr + (2*24 wct) + 2 bct + 2 pad */
+/* 4 len + 52 transform hdr + 64 hdr + 56 create rsp */
+#define MAX_SMB2_HDR_SIZE 0x00b0
 
 #define SMB2_PROTO_NUMBER cpu_to_le32(0x424d53fe)
 #define SMB2_TRANSFORM_PROTO_NUM cpu_to_le32(0x424d53fd)

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

* [PATCH 4.9 12/18] CIFS: remove endian related sparse warning
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
                   ` (10 preceding siblings ...)
  2017-09-05  7:11 ` [PATCH 4.9 11/18] CIFS: Fix maximum SMB2 header size Greg Kroah-Hartman
@ 2017-09-05  7:11 ` Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 13/18] wl1251: add a missing spin_lock_init() Greg Kroah-Hartman
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05  7:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Steve French, Ronnie Sahlberg,
	Pavel Shilovsky

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

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

From: Steve French <smfrench@gmail.com>

commit 6e3c1529c39e92ed64ca41d53abadabbaa1d5393 upstream.

Recent patch had an endian warning ie
cifs: return ENAMETOOLONG for overlong names in cifs_open()/cifs_lookup()

Signed-off-by: Steve French <smfrench@gmail.com>
CC: Ronnie Sahlberg <lsahlber@redhat.com>
Acked-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/cifs/dir.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -194,7 +194,7 @@ check_name(struct dentry *direntry, stru
 	int i;
 
 	if (unlikely(direntry->d_name.len >
-		     tcon->fsAttrInfo.MaxPathNameComponentLength))
+		     le32_to_cpu(tcon->fsAttrInfo.MaxPathNameComponentLength)))
 		return -ENAMETOOLONG;
 
 	if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)) {

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

* [PATCH 4.9 13/18] wl1251: add a missing spin_lock_init()
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
                   ` (11 preceding siblings ...)
  2017-09-05  7:11 ` [PATCH 4.9 12/18] CIFS: remove endian related sparse warning Greg Kroah-Hartman
@ 2017-09-05  7:11 ` Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 14/18] lib/mpi: kunmap after finishing accessing buffer Greg Kroah-Hartman
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05  7:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Pavel Machek, Kalle Valo, Cong Wang,
	David S. Miller

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

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

From: Cong Wang <xiyou.wangcong@gmail.com>

commit f581a0dd744fe32b0a8805e279c59ec1ac676d60 upstream.

wl1251: add a missing spin_lock_init()

This fixes the following kernel warning:

 [ 5668.771453] BUG: spinlock bad magic on CPU#0, kworker/u2:3/9745
 [ 5668.771850]  lock: 0xce63ef20, .magic: 00000000, .owner: <none>/-1,
 .owner_cpu: 0
 [ 5668.772277] CPU: 0 PID: 9745 Comm: kworker/u2:3 Tainted: G        W
 4.12.0-03002-gec979a4-dirty #40
 [ 5668.772796] Hardware name: Nokia RX-51 board
 [ 5668.773071] Workqueue: phy1 wl1251_irq_work
 [ 5668.773345] [<c010c9e4>] (unwind_backtrace) from [<c010a274>]
 (show_stack+0x10/0x14)
 [ 5668.773803] [<c010a274>] (show_stack) from [<c01545a4>]
 (do_raw_spin_lock+0x6c/0xa0)
 [ 5668.774230] [<c01545a4>] (do_raw_spin_lock) from [<c06ca578>]
 (_raw_spin_lock_irqsave+0x10/0x18)
 [ 5668.774658] [<c06ca578>] (_raw_spin_lock_irqsave) from [<c048c010>]
 (wl1251_op_tx+0x38/0x5c)
 [ 5668.775115] [<c048c010>] (wl1251_op_tx) from [<c06a12e8>]
 (ieee80211_tx_frags+0x188/0x1c0)
 [ 5668.775543] [<c06a12e8>] (ieee80211_tx_frags) from [<c06a138c>]
 (__ieee80211_tx+0x6c/0x130)
 [ 5668.775970] [<c06a138c>] (__ieee80211_tx) from [<c06a3dbc>]
 (ieee80211_tx+0xdc/0x104)
 [ 5668.776367] [<c06a3dbc>] (ieee80211_tx) from [<c06a4af0>]
 (__ieee80211_subif_start_xmit+0x454/0x8c8)
 [ 5668.776824] [<c06a4af0>] (__ieee80211_subif_start_xmit) from
 [<c06a4f94>] (ieee80211_subif_start_xmit+0x30/0x2fc)
 [ 5668.777343] [<c06a4f94>] (ieee80211_subif_start_xmit) from
 [<c0578848>] (dev_hard_start_xmit+0x80/0x118)
...

    by adding the missing spin_lock_init().

Reported-by: Pavel Machek <pavel@ucw.cz>
Cc: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/net/wireless/ti/wl1251/main.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -1571,6 +1571,7 @@ struct ieee80211_hw *wl1251_alloc_hw(voi
 
 	wl->state = WL1251_STATE_OFF;
 	mutex_init(&wl->mutex);
+	spin_lock_init(&wl->wl_lock);
 
 	wl->tx_mgmt_frm_rate = DEFAULT_HW_GEN_TX_RATE;
 	wl->tx_mgmt_frm_mod = DEFAULT_HW_GEN_MODULATION_TYPE;

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

* [PATCH 4.9 14/18] lib/mpi: kunmap after finishing accessing buffer
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
                   ` (12 preceding siblings ...)
  2017-09-05  7:11 ` [PATCH 4.9 13/18] wl1251: add a missing spin_lock_init() Greg Kroah-Hartman
@ 2017-09-05  7:11 ` Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 15/18] xfrm: policy: check policy direction value Greg Kroah-Hartman
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05  7:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, stable, Stephan Mueller, Herbert Xu

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

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

From: Stephan Mueller <smueller@chronox.de>

commit dea3eb8b452e36cf2dd572b0a797915ccf452ae6 upstream.

Using sg_miter_start and sg_miter_next, the buffer of an SG is kmap'ed
to *buff. The current code calls sg_miter_stop (and thus kunmap) on the
SG entry before the last access of *buff.

The patch moves the sg_miter_stop call after the last access to *buff to
ensure that the memory pointed to by *buff is still mapped.

Fixes: 4816c9406430 ("lib/mpi: Fix SG miter leak")
Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 lib/mpi/mpicoder.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/lib/mpi/mpicoder.c
+++ b/lib/mpi/mpicoder.c
@@ -364,11 +364,11 @@ MPI mpi_read_raw_from_sgl(struct scatter
 	}
 
 	miter.consumed = lzeros;
-	sg_miter_stop(&miter);
 
 	nbytes -= lzeros;
 	nbits = nbytes * 8;
 	if (nbits > MAX_EXTERN_MPI_BITS) {
+		sg_miter_stop(&miter);
 		pr_info("MPI: mpi too large (%u bits)\n", nbits);
 		return NULL;
 	}
@@ -376,6 +376,8 @@ MPI mpi_read_raw_from_sgl(struct scatter
 	if (nbytes > 0)
 		nbits -= count_leading_zeros(*buff) - (BITS_PER_LONG - 8);
 
+	sg_miter_stop(&miter);
+
 	nlimbs = DIV_ROUND_UP(nbytes, BYTES_PER_MPI_LIMB);
 	val = mpi_alloc(nlimbs);
 	if (!val)

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

* [PATCH 4.9 15/18] xfrm: policy: check policy direction value
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
                   ` (13 preceding siblings ...)
  2017-09-05  7:11 ` [PATCH 4.9 14/18] lib/mpi: kunmap after finishing accessing buffer Greg Kroah-Hartman
@ 2017-09-05  7:11 ` Greg Kroah-Hartman
  2017-09-05  7:11 ` [PATCH 4.9 17/18] kvm: arm/arm64: Force reading uncached stage2 PGD Greg Kroah-Hartman
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05  7:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, bo Zhang, Vladis Dronov, Steffen Klassert

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

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

From: Vladis Dronov <vdronov@redhat.com>

commit 7bab09631c2a303f87a7eb7e3d69e888673b9b7e upstream.

The 'dir' parameter in xfrm_migrate() is a user-controlled byte which is used
as an array index. This can lead to an out-of-bound access, kernel lockup and
DoS. Add a check for the 'dir' value.

This fixes CVE-2017-11600.

References: https://bugzilla.redhat.com/show_bug.cgi?id=1474928
Fixes: 80c9abaabf42 ("[XFRM]: Extension for dynamic update of endpoint address(es)")
Reported-by: "bo Zhang" <zhangbo5891001@gmail.com>
Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 net/xfrm/xfrm_policy.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -3308,9 +3308,15 @@ int xfrm_migrate(const struct xfrm_selec
 	struct xfrm_state *x_new[XFRM_MAX_DEPTH];
 	struct xfrm_migrate *mp;
 
+	/* Stage 0 - sanity checks */
 	if ((err = xfrm_migrate_check(m, num_migrate)) < 0)
 		goto out;
 
+	if (dir >= XFRM_POLICY_MAX) {
+		err = -EINVAL;
+		goto out;
+	}
+
 	/* Stage 1 - find policy */
 	if ((pol = xfrm_migrate_policy_find(sel, dir, type, net)) == NULL) {
 		err = -ENOENT;

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

* [PATCH 4.9 17/18] kvm: arm/arm64: Force reading uncached stage2 PGD
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
                   ` (14 preceding siblings ...)
  2017-09-05  7:11 ` [PATCH 4.9 15/18] xfrm: policy: check policy direction value Greg Kroah-Hartman
@ 2017-09-05  7:11 ` Greg Kroah-Hartman
  2017-09-05  9:29 ` [PATCH 4.9 00/18] 4.9.48-stable review Sumit Semwal
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05  7:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Marc Zyngier, Suzuki K Poulose,
	Christoffer Dall

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

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

From: Suzuki K Poulose <suzuki.poulose@arm.com>

commit 2952a6070e07ebdd5896f1f5b861acad677caded upstream.

Make sure we don't use a cached value of the KVM stage2 PGD while
resetting the PGD.

Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Christoffer Dall <cdall@linaro.org>
Signed-off-by: Christoffer Dall <cdall@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


---
 arch/arm/kvm/mmu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -837,7 +837,7 @@ void kvm_free_stage2_pgd(struct kvm *kvm
 	spin_lock(&kvm->mmu_lock);
 	if (kvm->arch.pgd) {
 		unmap_stage2_range(kvm, 0, KVM_PHYS_SIZE);
-		pgd = kvm->arch.pgd;
+		pgd = READ_ONCE(kvm->arch.pgd);
 		kvm->arch.pgd = NULL;
 	}
 	spin_unlock(&kvm->mmu_lock);

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

* Re: [PATCH 4.9 00/18] 4.9.48-stable review
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
                   ` (15 preceding siblings ...)
  2017-09-05  7:11 ` [PATCH 4.9 17/18] kvm: arm/arm64: Force reading uncached stage2 PGD Greg Kroah-Hartman
@ 2017-09-05  9:29 ` Sumit Semwal
  2017-09-05 14:15   ` Greg Kroah-Hartman
  2017-09-05 16:48 ` Guenter Roeck
  2017-09-05 17:14 ` Shuah Khan
  18 siblings, 1 reply; 21+ messages in thread
From: Sumit Semwal @ 2017-09-05  9:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: LKML, Linus Torvalds, Andrew Morton, Guenter Roeck, Shuah Khan,
	patches, Ben Hutchings, # 3.4.x

Hi Greg,

On 5 September 2017 at 12:41, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> This is the start of the stable review cycle for the 4.9.48 release.
> There are 18 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 Thu Sep  7 07:09:06 UTC 2017.
> Anything received after that time might be too late.

For ARM64, built and boot-tested with defconfig on Hikey - no regressions noted.
>
> The whole patch series can be found in one patch at:
>         kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.48-rc1.gz
> or in the git tree and branch at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h
>
> -------------
> Pseudo-Shortlog of commits:
>
> Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>     Linux 4.9.48-rc1
>
> Oleg Nesterov <oleg@redhat.com>
>     epoll: fix race between ep_poll_callback(POLLFREE) and ep_free()/ep_remove()
>
> Suzuki K Poulose <suzuki.poulose@arm.com>
>     kvm: arm/arm64: Force reading uncached stage2 PGD
>
> Xiangliang.Yu <Xiangliang.Yu@amd.com>
>     drm/ttm: Fix accounting error when fail to get pages for pool
>
> Vladis Dronov <vdronov@redhat.com>
>     xfrm: policy: check policy direction value
>
> Stephan Mueller <smueller@chronox.de>
>     lib/mpi: kunmap after finishing accessing buffer
>
> Cong Wang <xiyou.wangcong@gmail.com>
>     wl1251: add a missing spin_lock_init()
>
> Steve French <smfrench@gmail.com>
>     CIFS: remove endian related sparse warning
>
> Pavel Shilovsky <pshilov@microsoft.com>
>     CIFS: Fix maximum SMB2 header size
>
> Ben Hutchings <ben@decadent.org.uk>
>     alpha: uapi: Add support for __SANE_USERSPACE_TYPES__
>
> Waiman Long <longman@redhat.com>
>     cpuset: Fix incorrect memory_pressure control file mapping
>
> Tejun Heo <tj@kernel.org>
>     cpumask: fix spurious cpumask_of_node() on non-NUMA multi-node configs
>
> Yan, Zheng <zyan@redhat.com>
>     ceph: fix readpage from fscache
>
> Mel Gorman <mgorman@techsingularity.net>
>     mm, madvise: ensure poisoned pages are removed from per-cpu lists
>
> Eric Biggers <ebiggers@google.com>
>     mm, uprobes: fix multiple free of ->uprobes_state.xol_area
>
> Stephan Mueller <smueller@chronox.de>
>     crypto: algif_skcipher - only call put_page on referenced and used pages
>
> Stephen Douthit <stephend@adiengineering.com>
>     i2c: ismt: Return EMSGSIZE for block reads with bogus length
>
> Stephen Douthit <stephend@adiengineering.com>
>     i2c: ismt: Don't duplicate the receive length for block reads
>
> James Hogan <james.hogan@imgtec.com>
>     irqchip: mips-gic: SYNC after enabling GIC region
>
>
> -------------
>
> Diffstat:
>
>  Makefile                              |  4 ++--
>  arch/alpha/include/asm/types.h        |  2 +-
>  arch/alpha/include/uapi/asm/types.h   | 12 +++++++++-
>  arch/arm/kvm/mmu.c                    |  2 +-
>  crypto/algif_skcipher.c               |  9 ++++++--
>  drivers/gpu/drm/ttm/ttm_page_alloc.c  |  2 +-
>  drivers/i2c/busses/i2c-ismt.c         |  6 +++--
>  drivers/irqchip/irq-mips-gic.c        |  5 ++++-
>  drivers/net/wireless/ti/wl1251/main.c |  1 +
>  fs/ceph/addr.c                        | 24 ++++++++++++--------
>  fs/ceph/cache.c                       | 12 +++-------
>  fs/cifs/dir.c                         |  2 +-
>  fs/cifs/smb2pdu.h                     |  4 ++--
>  fs/eventpoll.c                        | 42 ++++++++++++++++++++++-------------
>  include/asm-generic/topology.h        |  6 ++++-
>  kernel/cpuset.c                       |  1 +
>  kernel/events/uprobes.c               |  2 --
>  kernel/fork.c                         |  8 +++++++
>  lib/mpi/mpicoder.c                    |  4 +++-
>  mm/madvise.c                          |  7 ++++++
>  net/xfrm/xfrm_policy.c                |  6 +++++
>  21 files changed, 109 insertions(+), 52 deletions(-)
>
>



-- 
Thanks and regards,

Sumit Semwal
Linaro Mobile Group - Kernel Team Lead
Linaro.org │ Open source software for ARM SoCs

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

* Re: [PATCH 4.9 00/18] 4.9.48-stable review
  2017-09-05  9:29 ` [PATCH 4.9 00/18] 4.9.48-stable review Sumit Semwal
@ 2017-09-05 14:15   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2017-09-05 14:15 UTC (permalink / raw)
  To: Sumit Semwal
  Cc: LKML, Linus Torvalds, Andrew Morton, Guenter Roeck, Shuah Khan,
	patches, Ben Hutchings, # 3.4.x

On Tue, Sep 05, 2017 at 02:59:37PM +0530, Sumit Semwal wrote:
> Hi Greg,
> 
> On 5 September 2017 at 12:41, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> > This is the start of the stable review cycle for the 4.9.48 release.
> > There are 18 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 Thu Sep  7 07:09:06 UTC 2017.
> > Anything received after that time might be too late.
> 
> For ARM64, built and boot-tested with defconfig on Hikey - no regressions noted.

Thanks for testing and letting me know.

greg k-h

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

* Re: [PATCH 4.9 00/18] 4.9.48-stable review
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
                   ` (16 preceding siblings ...)
  2017-09-05  9:29 ` [PATCH 4.9 00/18] 4.9.48-stable review Sumit Semwal
@ 2017-09-05 16:48 ` Guenter Roeck
  2017-09-05 17:14 ` Shuah Khan
  18 siblings, 0 replies; 21+ messages in thread
From: Guenter Roeck @ 2017-09-05 16:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, torvalds, akpm, shuahkh, patches, ben.hutchings, stable

On Tue, Sep 05, 2017 at 09:11:08AM +0200, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.9.48 release.
> There are 18 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 Thu Sep  7 07:09:06 UTC 2017.
> Anything received after that time might be too late.
> 
Build results:
        total: 145 pass: 145 fail: 0
Qemu test results:
	total: 122 pass: 122 fail: 0

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

Guenter

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

* Re: [PATCH 4.9 00/18] 4.9.48-stable review
  2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
                   ` (17 preceding siblings ...)
  2017-09-05 16:48 ` Guenter Roeck
@ 2017-09-05 17:14 ` Shuah Khan
  18 siblings, 0 replies; 21+ messages in thread
From: Shuah Khan @ 2017-09-05 17:14 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: torvalds, akpm, linux, patches, ben.hutchings, stable, Shuah Khan

On 09/05/2017 01:11 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.9.48 release.
> There are 18 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 Thu Sep  7 07:09:06 UTC 2017.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.48-rc1.gz
> or in the git tree and branch at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.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] 21+ messages in thread

end of thread, other threads:[~2017-09-05 17:15 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-05  7:11 [PATCH 4.9 00/18] 4.9.48-stable review Greg Kroah-Hartman
2017-09-05  7:11 ` [PATCH 4.9 01/18] irqchip: mips-gic: SYNC after enabling GIC region Greg Kroah-Hartman
2017-09-05  7:11 ` [PATCH 4.9 02/18] i2c: ismt: Dont duplicate the receive length for block reads Greg Kroah-Hartman
2017-09-05  7:11 ` [PATCH 4.9 03/18] i2c: ismt: Return EMSGSIZE for block reads with bogus length Greg Kroah-Hartman
2017-09-05  7:11 ` [PATCH 4.9 04/18] crypto: algif_skcipher - only call put_page on referenced and used pages Greg Kroah-Hartman
2017-09-05  7:11 ` [PATCH 4.9 05/18] mm, uprobes: fix multiple free of ->uprobes_state.xol_area Greg Kroah-Hartman
2017-09-05  7:11 ` [PATCH 4.9 06/18] mm, madvise: ensure poisoned pages are removed from per-cpu lists Greg Kroah-Hartman
2017-09-05  7:11 ` [PATCH 4.9 07/18] ceph: fix readpage from fscache Greg Kroah-Hartman
2017-09-05  7:11 ` [PATCH 4.9 08/18] cpumask: fix spurious cpumask_of_node() on non-NUMA multi-node configs Greg Kroah-Hartman
2017-09-05  7:11 ` [PATCH 4.9 09/18] cpuset: Fix incorrect memory_pressure control file mapping Greg Kroah-Hartman
2017-09-05  7:11 ` [PATCH 4.9 10/18] alpha: uapi: Add support for __SANE_USERSPACE_TYPES__ Greg Kroah-Hartman
2017-09-05  7:11 ` [PATCH 4.9 11/18] CIFS: Fix maximum SMB2 header size Greg Kroah-Hartman
2017-09-05  7:11 ` [PATCH 4.9 12/18] CIFS: remove endian related sparse warning Greg Kroah-Hartman
2017-09-05  7:11 ` [PATCH 4.9 13/18] wl1251: add a missing spin_lock_init() Greg Kroah-Hartman
2017-09-05  7:11 ` [PATCH 4.9 14/18] lib/mpi: kunmap after finishing accessing buffer Greg Kroah-Hartman
2017-09-05  7:11 ` [PATCH 4.9 15/18] xfrm: policy: check policy direction value Greg Kroah-Hartman
2017-09-05  7:11 ` [PATCH 4.9 17/18] kvm: arm/arm64: Force reading uncached stage2 PGD Greg Kroah-Hartman
2017-09-05  9:29 ` [PATCH 4.9 00/18] 4.9.48-stable review Sumit Semwal
2017-09-05 14:15   ` Greg Kroah-Hartman
2017-09-05 16:48 ` Guenter Roeck
2017-09-05 17:14 ` Shuah Khan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.