]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 11 Mar 2018 16:22:46 +0000 (17:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 11 Mar 2018 16:22:46 +0000 (17:22 +0100)
added patches:
bpf-cpumap-use-gfp_kernel-instead-of-gfp_atomic-in-__cpu_map_entry_alloc.patch
ib-uverbs-improve-lockdep_check.patch
mac80211_hwsim-don-t-use-wq_mem_reclaim.patch
net-smc-fix-null-pointer-dereference-on-sock_create_kern-error-path.patch

queue-4.15/bpf-cpumap-use-gfp_kernel-instead-of-gfp_atomic-in-__cpu_map_entry_alloc.patch [new file with mode: 0644]
queue-4.15/ib-uverbs-improve-lockdep_check.patch [new file with mode: 0644]
queue-4.15/mac80211_hwsim-don-t-use-wq_mem_reclaim.patch [new file with mode: 0644]
queue-4.15/net-smc-fix-null-pointer-dereference-on-sock_create_kern-error-path.patch [new file with mode: 0644]
queue-4.15/series

diff --git a/queue-4.15/bpf-cpumap-use-gfp_kernel-instead-of-gfp_atomic-in-__cpu_map_entry_alloc.patch b/queue-4.15/bpf-cpumap-use-gfp_kernel-instead-of-gfp_atomic-in-__cpu_map_entry_alloc.patch
new file mode 100644 (file)
index 0000000..e746e77
--- /dev/null
@@ -0,0 +1,46 @@
+From 7fc17e909edfb9bf421ee04e981d3d474175c7c7 Mon Sep 17 00:00:00 2001
+From: Jason Wang <jasowang@redhat.com>
+Date: Wed, 14 Feb 2018 22:17:34 +0800
+Subject: bpf: cpumap: use GFP_KERNEL instead of GFP_ATOMIC in __cpu_map_entry_alloc()
+
+From: Jason Wang <jasowang@redhat.com>
+
+commit 7fc17e909edfb9bf421ee04e981d3d474175c7c7 upstream.
+
+There're several implications after commit 0bf7800f1799 ("ptr_ring:
+try vmalloc() when kmalloc() fails") with the using of vmalloc() since
+can't allow GFP_ATOMIC but mandate GFP_KERNEL. This will lead a WARN
+since cpumap try to call with GFP_ATOMIC. Fortunately, entry
+allocation of cpumap can only be done through syscall path which means
+GFP_ATOMIC is not necessary, so fixing this by replacing GFP_ATOMIC
+with GFP_KERNEL.
+
+Reported-by: syzbot+1a240cdb1f4cc88819df@syzkaller.appspotmail.com
+Fixes: 0bf7800f1799 ("ptr_ring: try vmalloc() when kmalloc() fails")
+Cc: Michal Hocko <mhocko@kernel.org>
+Cc: Daniel Borkmann <daniel@iogearbox.net>
+Cc: Matthew Wilcox <willy@infradead.org>
+Cc: Jesper Dangaard Brouer <brouer@redhat.com>
+Cc: akpm@linux-foundation.org
+Cc: dhowells@redhat.com
+Cc: hannes@cmpxchg.org
+Signed-off-by: Jason Wang <jasowang@redhat.com>
+Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
+Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/bpf/cpumap.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/kernel/bpf/cpumap.c
++++ b/kernel/bpf/cpumap.c
+@@ -339,7 +339,7 @@ static int cpu_map_kthread_run(void *dat
+ struct bpf_cpu_map_entry *__cpu_map_entry_alloc(u32 qsize, u32 cpu, int map_id)
+ {
+-      gfp_t gfp = GFP_ATOMIC|__GFP_NOWARN;
++      gfp_t gfp = GFP_KERNEL | __GFP_NOWARN;
+       struct bpf_cpu_map_entry *rcpu;
+       int numa, err;
diff --git a/queue-4.15/ib-uverbs-improve-lockdep_check.patch b/queue-4.15/ib-uverbs-improve-lockdep_check.patch
new file mode 100644 (file)
index 0000000..838f7ad
--- /dev/null
@@ -0,0 +1,72 @@
+From 104f268d439b3c21c83708e52946a4d8d37f3d0f Mon Sep 17 00:00:00 2001
+From: Jason Gunthorpe <jgg@mellanox.com>
+Date: Tue, 13 Feb 2018 12:18:38 +0200
+Subject: IB/uverbs: Improve lockdep_check
+
+From: Jason Gunthorpe <jgg@mellanox.com>
+
+commit 104f268d439b3c21c83708e52946a4d8d37f3d0f upstream.
+
+This is really being used as an assert that the expected usecnt
+is being held and implicitly that the usecnt is valid. Rename it to
+assert_uverbs_usecnt and tighten the checks to only accept valid
+values of usecnt (eg 0 and < -1 are invalid).
+
+The tigher checkes make the assertion cover more cases and is more
+likely to find bugs via syzkaller/etc.
+
+Fixes: 3832125624b7 ("IB/core: Add support for idr types")
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/infiniband/core/rdma_core.c |   12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+--- a/drivers/infiniband/core/rdma_core.c
++++ b/drivers/infiniband/core/rdma_core.c
+@@ -407,13 +407,13 @@ static int __must_check remove_commit_fd
+       return ret;
+ }
+-static void lockdep_check(struct ib_uobject *uobj, bool exclusive)
++static void assert_uverbs_usecnt(struct ib_uobject *uobj, bool exclusive)
+ {
+ #ifdef CONFIG_LOCKDEP
+       if (exclusive)
+-              WARN_ON(atomic_read(&uobj->usecnt) > 0);
++              WARN_ON(atomic_read(&uobj->usecnt) != -1);
+       else
+-              WARN_ON(atomic_read(&uobj->usecnt) == -1);
++              WARN_ON(atomic_read(&uobj->usecnt) <= 0);
+ #endif
+ }
+@@ -452,7 +452,7 @@ int __must_check rdma_remove_commit_uobj
+               WARN(true, "ib_uverbs: Cleanup is running while removing an uobject\n");
+               return 0;
+       }
+-      lockdep_check(uobj, true);
++      assert_uverbs_usecnt(uobj, true);
+       ret = _rdma_remove_commit_uobject(uobj, RDMA_REMOVE_DESTROY);
+       up_read(&ucontext->cleanup_rwsem);
+@@ -482,7 +482,7 @@ int rdma_explicit_destroy(struct ib_uobj
+               WARN(true, "ib_uverbs: Cleanup is running while removing an uobject\n");
+               return 0;
+       }
+-      lockdep_check(uobject, true);
++      assert_uverbs_usecnt(uobject, true);
+       ret = uobject->type->type_class->remove_commit(uobject,
+                                                      RDMA_REMOVE_DESTROY);
+       if (ret)
+@@ -569,7 +569,7 @@ static void lookup_put_fd_uobject(struct
+ void rdma_lookup_put_uobject(struct ib_uobject *uobj, bool exclusive)
+ {
+-      lockdep_check(uobj, exclusive);
++      assert_uverbs_usecnt(uobj, exclusive);
+       uobj->type->type_class->lookup_put(uobj, exclusive);
+       /*
+        * In order to unlock an object, either decrease its usecnt for
diff --git a/queue-4.15/mac80211_hwsim-don-t-use-wq_mem_reclaim.patch b/queue-4.15/mac80211_hwsim-don-t-use-wq_mem_reclaim.patch
new file mode 100644 (file)
index 0000000..19f6a52
--- /dev/null
@@ -0,0 +1,34 @@
+From ce162bfbc0b601841886965baba14877127c7c7c Mon Sep 17 00:00:00 2001
+From: Johannes Berg <johannes.berg@intel.com>
+Date: Wed, 24 Jan 2018 08:40:51 +0100
+Subject: mac80211_hwsim: don't use WQ_MEM_RECLAIM
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+commit ce162bfbc0b601841886965baba14877127c7c7c upstream.
+
+We're obviously not part of a memory reclaim path, so don't set the flag.
+
+This also causes a warning in check_flush_dependency() since we end up
+in a code path that flushes a non-reclaim workqueue, and we shouldn't do
+that if we were really part of reclaim.
+
+Reported-by: syzbot+41cdaf4232c50e658934@syzkaller.appspotmail.com
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/wireless/mac80211_hwsim.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/wireless/mac80211_hwsim.c
++++ b/drivers/net/wireless/mac80211_hwsim.c
+@@ -3455,7 +3455,7 @@ static int __init init_mac80211_hwsim(vo
+       spin_lock_init(&hwsim_radio_lock);
+-      hwsim_wq = alloc_workqueue("hwsim_wq",WQ_MEM_RECLAIM,0);
++      hwsim_wq = alloc_workqueue("hwsim_wq", 0, 0);
+       if (!hwsim_wq)
+               return -ENOMEM;
diff --git a/queue-4.15/net-smc-fix-null-pointer-dereference-on-sock_create_kern-error-path.patch b/queue-4.15/net-smc-fix-null-pointer-dereference-on-sock_create_kern-error-path.patch
new file mode 100644 (file)
index 0000000..cd82144
--- /dev/null
@@ -0,0 +1,79 @@
+From a5dcb73b96a9d21431048bdaac02d9e96f386da3 Mon Sep 17 00:00:00 2001
+From: Davide Caratti <dcaratti@redhat.com>
+Date: Wed, 28 Feb 2018 12:44:09 +0100
+Subject: net/smc: fix NULL pointer dereference on sock_create_kern() error path
+
+From: Davide Caratti <dcaratti@redhat.com>
+
+commit a5dcb73b96a9d21431048bdaac02d9e96f386da3 upstream.
+
+when sock_create_kern(..., a) returns an error, 'a' might not be a valid
+pointer, so it shouldn't be dereferenced to read a->sk->sk_sndbuf and
+and a->sk->sk_rcvbuf; not doing that caused the following crash:
+
+general protection fault: 0000 [#1] SMP KASAN
+Dumping ftrace buffer:
+    (ftrace buffer empty)
+Modules linked in:
+CPU: 0 PID: 4254 Comm: syzkaller919713 Not tainted 4.16.0-rc1+ #18
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
+Google 01/01/2011
+RIP: 0010:smc_create+0x14e/0x300 net/smc/af_smc.c:1410
+RSP: 0018:ffff8801b06afbc8 EFLAGS: 00010202
+RAX: dffffc0000000000 RBX: ffff8801b63457c0 RCX: ffffffff85a3e746
+RDX: 0000000000000004 RSI: 00000000ffffffff RDI: 0000000000000020
+RBP: ffff8801b06afbf0 R08: 00000000000007c0 R09: 0000000000000000
+R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
+R13: ffff8801b6345c08 R14: 00000000ffffffe9 R15: ffffffff8695ced0
+FS:  0000000001afb880(0000) GS:ffff8801db200000(0000)
+knlGS:0000000000000000
+CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+CR2: 0000000020000040 CR3: 00000001b0721004 CR4: 00000000001606f0
+DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
+Call Trace:
+  __sock_create+0x4d4/0x850 net/socket.c:1285
+  sock_create net/socket.c:1325 [inline]
+  SYSC_socketpair net/socket.c:1409 [inline]
+  SyS_socketpair+0x1c0/0x6f0 net/socket.c:1366
+  do_syscall_64+0x282/0x940 arch/x86/entry/common.c:287
+  entry_SYSCALL_64_after_hwframe+0x26/0x9b
+RIP: 0033:0x4404b9
+RSP: 002b:00007fff44ab6908 EFLAGS: 00000246 ORIG_RAX: 0000000000000035
+RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00000000004404b9
+RDX: 0000000000000000 RSI: 0000000000000001 RDI: 000000000000002b
+RBP: 00007fff44ab6910 R08: 0000000000000002 R09: 00007fff44003031
+R10: 0000000020000040 R11: 0000000000000246 R12: ffffffffffffffff
+R13: 0000000000000006 R14: 0000000000000000 R15: 0000000000000000
+Code: 48 c1 ea 03 80 3c 02 00 0f 85 b3 01 00 00 4c 8b a3 48 04 00 00 48
+b8
+00 00 00 00 00 fc ff df 49 8d 7c 24 20 48 89 fa 48 c1 ea 03 <80> 3c 02
+00
+0f 85 82 01 00 00 4d 8b 7c 24 20 48 b8 00 00 00 00
+RIP: smc_create+0x14e/0x300 net/smc/af_smc.c:1410 RSP: ffff8801b06afbc8
+
+Fixes: cd6851f30386 smc: remote memory buffers (RMBs)
+Reported-and-tested-by: syzbot+aa0227369be2dcc26ebe@syzkaller.appspotmail.com
+Signed-off-by: Davide Caratti <dcaratti@redhat.com>
+Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/smc/af_smc.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/net/smc/af_smc.c
++++ b/net/smc/af_smc.c
+@@ -1369,8 +1369,10 @@ static int smc_create(struct net *net, s
+       smc->use_fallback = false; /* assume rdma capability first */
+       rc = sock_create_kern(net, PF_INET, SOCK_STREAM,
+                             IPPROTO_TCP, &smc->clcsock);
+-      if (rc)
++      if (rc) {
+               sk_common_release(sk);
++              goto out;
++      }
+       smc->sk.sk_sndbuf = max(smc->clcsock->sk->sk_sndbuf, SMC_BUF_MIN_SIZE);
+       smc->sk.sk_rcvbuf = max(smc->clcsock->sk->sk_rcvbuf, SMC_BUF_MIN_SIZE);
index 9c342c6b61229aea279ba220d3ce18fc51e86af2..4e3562869c4e7dfc974f84d86b559cdf725e62fc 100644 (file)
@@ -1,3 +1,7 @@
 rdma-ucma-limit-possible-option-size.patch
 rdma-ucma-check-that-user-doesn-t-overflow-qp-state.patch
 rdma-mlx5-fix-integer-overflow-while-resizing-cq.patch
+bpf-cpumap-use-gfp_kernel-instead-of-gfp_atomic-in-__cpu_map_entry_alloc.patch
+ib-uverbs-improve-lockdep_check.patch
+mac80211_hwsim-don-t-use-wq_mem_reclaim.patch
+net-smc-fix-null-pointer-dereference-on-sock_create_kern-error-path.patch