From patchwork Tue Jun 9 17:44:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224689 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0097EC433E1 for ; Tue, 9 Jun 2020 17:52:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D45C02074B for ; Tue, 9 Jun 2020 17:52:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725139; bh=GVBRq8Kr5iEPg8jgisHpldDMUf6aatMoT78grIKmM94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Qv7kgZY5piQNrcCSkSY8K1PhoXQZCMNB0cnOuHkx83IA51Yzw0TO2uKL48juHoB8U aT5jjWtKikvWE0/X+J0ufu0W86poPTma2XsQA4O9ZocGBe7C2YvQbn5zbc6Zo/2o7C styO9bjvr8bXsO7iSPxJE+wGHCiSuSTgrMLHbJvA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731675AbgFIRwS (ORCPT ); Tue, 9 Jun 2020 13:52:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:42430 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730665AbgFIRwR (ORCPT ); Tue, 9 Jun 2020 13:52:17 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C6CE120734; Tue, 9 Jun 2020 17:52:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725136; bh=GVBRq8Kr5iEPg8jgisHpldDMUf6aatMoT78grIKmM94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G8t3GvfAmqtb1lIcyOD7fy9PCnbgBra/+A9VX6UvGSphROFXsJ/B79c4jUUwTUkhC u0jzZJ8b3jBRMNVluJFkyjCeG3m9XpgTvYCY2QQ1LkoAIJnc1Al1Q7jYMgIjn/koSi UDQA7mJuDNrdAzHX6vfn4PKLazQ5nqdYHPuovU5s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , James Chapman , Guillaume Nault , syzbot , "David S. Miller" Subject: [PATCH 5.4 02/34] l2tp: add sk_family checks to l2tp_validate_socket Date: Tue, 9 Jun 2020 19:44:58 +0200 Message-Id: <20200609174052.959453505@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Eric Dumazet [ Upstream commit d9a81a225277686eb629938986d97629ea102633 ] syzbot was able to trigger a crash after using an ISDN socket and fool l2tp. Fix this by making sure the UDP socket is of the proper family. BUG: KASAN: slab-out-of-bounds in setup_udp_tunnel_sock+0x465/0x540 net/ipv4/udp_tunnel.c:78 Write of size 1 at addr ffff88808ed0c590 by task syz-executor.5/3018 CPU: 0 PID: 3018 Comm: syz-executor.5 Not tainted 5.7.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x188/0x20d lib/dump_stack.c:118 print_address_description.constprop.0.cold+0xd3/0x413 mm/kasan/report.c:382 __kasan_report.cold+0x20/0x38 mm/kasan/report.c:511 kasan_report+0x33/0x50 mm/kasan/common.c:625 setup_udp_tunnel_sock+0x465/0x540 net/ipv4/udp_tunnel.c:78 l2tp_tunnel_register+0xb15/0xdd0 net/l2tp/l2tp_core.c:1523 l2tp_nl_cmd_tunnel_create+0x4b2/0xa60 net/l2tp/l2tp_netlink.c:249 genl_family_rcv_msg_doit net/netlink/genetlink.c:673 [inline] genl_family_rcv_msg net/netlink/genetlink.c:718 [inline] genl_rcv_msg+0x627/0xdf0 net/netlink/genetlink.c:735 netlink_rcv_skb+0x15a/0x410 net/netlink/af_netlink.c:2469 genl_rcv+0x24/0x40 net/netlink/genetlink.c:746 netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline] netlink_unicast+0x537/0x740 net/netlink/af_netlink.c:1329 netlink_sendmsg+0x882/0xe10 net/netlink/af_netlink.c:1918 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg+0xcf/0x120 net/socket.c:672 ____sys_sendmsg+0x6e6/0x810 net/socket.c:2352 ___sys_sendmsg+0x100/0x170 net/socket.c:2406 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2439 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295 entry_SYSCALL_64_after_hwframe+0x49/0xb3 RIP: 0033:0x45ca29 Code: 0d b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 db b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007effe76edc78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00000000004fe1c0 RCX: 000000000045ca29 RDX: 0000000000000000 RSI: 0000000020000240 RDI: 0000000000000005 RBP: 000000000078bf00 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 000000000000094e R14: 00000000004d5d00 R15: 00007effe76ee6d4 Allocated by task 3018: save_stack+0x1b/0x40 mm/kasan/common.c:49 set_track mm/kasan/common.c:57 [inline] __kasan_kmalloc mm/kasan/common.c:495 [inline] __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:468 __do_kmalloc mm/slab.c:3656 [inline] __kmalloc+0x161/0x7a0 mm/slab.c:3665 kmalloc include/linux/slab.h:560 [inline] sk_prot_alloc+0x223/0x2f0 net/core/sock.c:1612 sk_alloc+0x36/0x1100 net/core/sock.c:1666 data_sock_create drivers/isdn/mISDN/socket.c:600 [inline] mISDN_sock_create+0x272/0x400 drivers/isdn/mISDN/socket.c:796 __sock_create+0x3cb/0x730 net/socket.c:1428 sock_create net/socket.c:1479 [inline] __sys_socket+0xef/0x200 net/socket.c:1521 __do_sys_socket net/socket.c:1530 [inline] __se_sys_socket net/socket.c:1528 [inline] __x64_sys_socket+0x6f/0xb0 net/socket.c:1528 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295 entry_SYSCALL_64_after_hwframe+0x49/0xb3 Freed by task 2484: save_stack+0x1b/0x40 mm/kasan/common.c:49 set_track mm/kasan/common.c:57 [inline] kasan_set_free_info mm/kasan/common.c:317 [inline] __kasan_slab_free+0xf7/0x140 mm/kasan/common.c:456 __cache_free mm/slab.c:3426 [inline] kfree+0x109/0x2b0 mm/slab.c:3757 kvfree+0x42/0x50 mm/util.c:603 __free_fdtable+0x2d/0x70 fs/file.c:31 put_files_struct fs/file.c:420 [inline] put_files_struct+0x248/0x2e0 fs/file.c:413 exit_files+0x7e/0xa0 fs/file.c:445 do_exit+0xb04/0x2dd0 kernel/exit.c:791 do_group_exit+0x125/0x340 kernel/exit.c:894 get_signal+0x47b/0x24e0 kernel/signal.c:2739 do_signal+0x81/0x2240 arch/x86/kernel/signal.c:784 exit_to_usermode_loop+0x26c/0x360 arch/x86/entry/common.c:161 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline] syscall_return_slowpath arch/x86/entry/common.c:279 [inline] do_syscall_64+0x6b1/0x7d0 arch/x86/entry/common.c:305 entry_SYSCALL_64_after_hwframe+0x49/0xb3 The buggy address belongs to the object at ffff88808ed0c000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1424 bytes inside of 2048-byte region [ffff88808ed0c000, ffff88808ed0c800) The buggy address belongs to the page: page:ffffea00023b4300 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 flags: 0xfffe0000000200(slab) raw: 00fffe0000000200 ffffea0002838208 ffffea00015ba288 ffff8880aa000e00 raw: 0000000000000000 ffff88808ed0c000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88808ed0c480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88808ed0c500: 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88808ed0c580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff88808ed0c600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88808ed0c680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc Fixes: 6b9f34239b00 ("l2tp: fix races in tunnel creation") Fixes: fd558d186df2 ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts") Signed-off-by: Eric Dumazet Cc: James Chapman Cc: Guillaume Nault Reported-by: syzbot Acked-by: Guillaume Nault Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/l2tp/l2tp_core.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/l2tp/l2tp_core.c +++ b/net/l2tp/l2tp_core.c @@ -1460,6 +1460,9 @@ static int l2tp_validate_socket(const st if (sk->sk_type != SOCK_DGRAM) return -EPROTONOSUPPORT; + if (sk->sk_family != PF_INET && sk->sk_family != PF_INET6) + return -EPROTONOSUPPORT; + if ((encap == L2TP_ENCAPTYPE_UDP && sk->sk_protocol != IPPROTO_UDP) || (encap == L2TP_ENCAPTYPE_IP && sk->sk_protocol != IPPROTO_L2TP)) return -EPROTONOSUPPORT; From patchwork Tue Jun 9 17:44:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224642 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6615C433E0 for ; Tue, 9 Jun 2020 18:04:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BA7EF20734 for ; Tue, 9 Jun 2020 18:04:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725865; bh=iW4xh7bGZp/d8/suFv0SpWiX+a9CMAonku3f8lqcqMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=F59ttm5EOo8n3Av0j36CIFdeLBNpBu8HYHuIPLfgZsqeC9Nn946QcYkHEUgzOIOn0 B+oyyIgC4i7o9ZEL1cKENd5lbVD+6Nb1ExHs17hybj/g9nTU4oSpT11KmVraDNxBA1 cNu0NrbLRlGYSsylhieJd/HjUn8joKXxgFwRCY+c= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387786AbgFISEZ (ORCPT ); Tue, 9 Jun 2020 14:04:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:42500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731688AbgFIRwT (ORCPT ); Tue, 9 Jun 2020 13:52:19 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 07D19207F9; Tue, 9 Jun 2020 17:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725138; bh=iW4xh7bGZp/d8/suFv0SpWiX+a9CMAonku3f8lqcqMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bAUJ0NBn9lU4wiZNrHNN/VdfEByfsZyBFNqCzAU6gW5wxsk+nA5In9yT1PLNGYStP YmqTIwUNqfiOsk3tnmJAI78/+pqmgx/PBh+kNzv90j6RY6eZo+qk6+WTrBsVZ2nwgy ce26gxy5BiyBN9Lz5oxw5jIe++nLDGmAMkNo/tUg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , James Chapman , Andrii Nakryiko , syzbot+3610d489778b57cc8031@syzkaller.appspotmail.com Subject: [PATCH 5.4 03/34] l2tp: do not use inet_hash()/inet_unhash() Date: Tue, 9 Jun 2020 19:44:59 +0200 Message-Id: <20200609174053.077690575@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Eric Dumazet [ Upstream commit 02c71b144c811bcdd865e0a1226d0407d11357e8 ] syzbot recently found a way to crash the kernel [1] Issue here is that inet_hash() & inet_unhash() are currently only meant to be used by TCP & DCCP, since only these protocols provide the needed hashinfo pointer. L2TP uses a single list (instead of a hash table) This old bug became an issue after commit 610236587600 ("bpf: Add new cgroup attach type to enable sock modifications") since after this commit, sk_common_release() can be called while the L2TP socket is still considered 'hashed'. general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] CPU: 0 PID: 7063 Comm: syz-executor654 Not tainted 5.7.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:inet_unhash+0x11f/0x770 net/ipv4/inet_hashtables.c:600 Code: 03 0f b6 04 02 84 c0 74 08 3c 03 0f 8e dd 04 00 00 48 8d 7d 08 44 8b 73 08 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 55 05 00 00 48 8d 7d 14 4c 8b 6d 08 48 b8 00 00 RSP: 0018:ffffc90001777d30 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: ffff88809a6df940 RCX: ffffffff8697c242 RDX: 0000000000000001 RSI: ffffffff8697c251 RDI: 0000000000000008 RBP: 0000000000000000 R08: ffff88809f3ae1c0 R09: fffffbfff1514cc1 R10: ffffffff8a8a6607 R11: fffffbfff1514cc0 R12: ffff88809a6df9b0 R13: 0000000000000007 R14: 0000000000000000 R15: ffffffff873a4d00 FS: 0000000001d2b880(0000) GS:ffff8880ae600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000006cd090 CR3: 000000009403a000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: sk_common_release+0xba/0x370 net/core/sock.c:3210 inet_create net/ipv4/af_inet.c:390 [inline] inet_create+0x966/0xe00 net/ipv4/af_inet.c:248 __sock_create+0x3cb/0x730 net/socket.c:1428 sock_create net/socket.c:1479 [inline] __sys_socket+0xef/0x200 net/socket.c:1521 __do_sys_socket net/socket.c:1530 [inline] __se_sys_socket net/socket.c:1528 [inline] __x64_sys_socket+0x6f/0xb0 net/socket.c:1528 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295 entry_SYSCALL_64_after_hwframe+0x49/0xb3 RIP: 0033:0x441e29 Code: e8 fc b3 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 eb 08 fc ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007ffdce184148 EFLAGS: 00000246 ORIG_RAX: 0000000000000029 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000441e29 RDX: 0000000000000073 RSI: 0000000000000002 RDI: 0000000000000002 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000402c30 R14: 0000000000000000 R15: 0000000000000000 Modules linked in: ---[ end trace 23b6578228ce553e ]--- RIP: 0010:inet_unhash+0x11f/0x770 net/ipv4/inet_hashtables.c:600 Code: 03 0f b6 04 02 84 c0 74 08 3c 03 0f 8e dd 04 00 00 48 8d 7d 08 44 8b 73 08 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 55 05 00 00 48 8d 7d 14 4c 8b 6d 08 48 b8 00 00 RSP: 0018:ffffc90001777d30 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: ffff88809a6df940 RCX: ffffffff8697c242 RDX: 0000000000000001 RSI: ffffffff8697c251 RDI: 0000000000000008 RBP: 0000000000000000 R08: ffff88809f3ae1c0 R09: fffffbfff1514cc1 R10: ffffffff8a8a6607 R11: fffffbfff1514cc0 R12: ffff88809a6df9b0 R13: 0000000000000007 R14: 0000000000000000 R15: ffffffff873a4d00 FS: 0000000001d2b880(0000) GS:ffff8880ae600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000006cd090 CR3: 000000009403a000 CR4: 00000000001406f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Fixes: 0d76751fad77 ("l2tp: Add L2TPv3 IP encapsulation (no UDP) support") Signed-off-by: Eric Dumazet Cc: James Chapman Cc: Andrii Nakryiko Reported-by: syzbot+3610d489778b57cc8031@syzkaller.appspotmail.com Signed-off-by: Greg Kroah-Hartman --- net/l2tp/l2tp_ip.c | 29 ++++++++++++++++++++++------- net/l2tp/l2tp_ip6.c | 30 ++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 15 deletions(-) --- a/net/l2tp/l2tp_ip.c +++ b/net/l2tp/l2tp_ip.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -209,15 +208,31 @@ discard: return 0; } -static int l2tp_ip_open(struct sock *sk) +static int l2tp_ip_hash(struct sock *sk) { - /* Prevent autobind. We don't have ports. */ - inet_sk(sk)->inet_num = IPPROTO_L2TP; + if (sk_unhashed(sk)) { + write_lock_bh(&l2tp_ip_lock); + sk_add_node(sk, &l2tp_ip_table); + write_unlock_bh(&l2tp_ip_lock); + } + return 0; +} +static void l2tp_ip_unhash(struct sock *sk) +{ + if (sk_unhashed(sk)) + return; write_lock_bh(&l2tp_ip_lock); - sk_add_node(sk, &l2tp_ip_table); + sk_del_node_init(sk); write_unlock_bh(&l2tp_ip_lock); +} + +static int l2tp_ip_open(struct sock *sk) +{ + /* Prevent autobind. We don't have ports. */ + inet_sk(sk)->inet_num = IPPROTO_L2TP; + l2tp_ip_hash(sk); return 0; } @@ -594,8 +609,8 @@ static struct proto l2tp_ip_prot = { .sendmsg = l2tp_ip_sendmsg, .recvmsg = l2tp_ip_recvmsg, .backlog_rcv = l2tp_ip_backlog_recv, - .hash = inet_hash, - .unhash = inet_unhash, + .hash = l2tp_ip_hash, + .unhash = l2tp_ip_unhash, .obj_size = sizeof(struct l2tp_ip_sock), #ifdef CONFIG_COMPAT .compat_setsockopt = compat_ip_setsockopt, --- a/net/l2tp/l2tp_ip6.c +++ b/net/l2tp/l2tp_ip6.c @@ -20,8 +20,6 @@ #include #include #include -#include -#include #include #include #include @@ -222,15 +220,31 @@ discard: return 0; } -static int l2tp_ip6_open(struct sock *sk) +static int l2tp_ip6_hash(struct sock *sk) { - /* Prevent autobind. We don't have ports. */ - inet_sk(sk)->inet_num = IPPROTO_L2TP; + if (sk_unhashed(sk)) { + write_lock_bh(&l2tp_ip6_lock); + sk_add_node(sk, &l2tp_ip6_table); + write_unlock_bh(&l2tp_ip6_lock); + } + return 0; +} +static void l2tp_ip6_unhash(struct sock *sk) +{ + if (sk_unhashed(sk)) + return; write_lock_bh(&l2tp_ip6_lock); - sk_add_node(sk, &l2tp_ip6_table); + sk_del_node_init(sk); write_unlock_bh(&l2tp_ip6_lock); +} + +static int l2tp_ip6_open(struct sock *sk) +{ + /* Prevent autobind. We don't have ports. */ + inet_sk(sk)->inet_num = IPPROTO_L2TP; + l2tp_ip6_hash(sk); return 0; } @@ -728,8 +742,8 @@ static struct proto l2tp_ip6_prot = { .sendmsg = l2tp_ip6_sendmsg, .recvmsg = l2tp_ip6_recvmsg, .backlog_rcv = l2tp_ip6_backlog_recv, - .hash = inet6_hash, - .unhash = inet_unhash, + .hash = l2tp_ip6_hash, + .unhash = l2tp_ip6_unhash, .obj_size = sizeof(struct l2tp_ip6_sock), #ifdef CONFIG_COMPAT .compat_setsockopt = compat_ipv6_setsockopt, From patchwork Tue Jun 9 17:45:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224643 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80DE6C433E1 for ; Tue, 9 Jun 2020 18:04:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D560206D5 for ; Tue, 9 Jun 2020 18:04:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725851; bh=ViZa30ypR7/xokQKb3odmSsdv+h/Zb0AyqQm1aaQY/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=BhcDdMV4RHYrok6oRf3I7S3w2m80Ld66R59G/p7nPl4OIupdauNA+bAuONfSF/Y2o eaVldsDMCKxi1d9HOheTqrWQmjKFQTtRD/xQoUDOF+h3vb/t8N14EREVxHOhjmds67 WVEGmeqOaKSDUtTm2QvcJBlH+QUM+sZF3i9WlRZQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733267AbgFISEI (ORCPT ); Tue, 9 Jun 2020 14:04:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:42628 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732806AbgFIRwX (ORCPT ); Tue, 9 Jun 2020 13:52:23 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 795B720734; Tue, 9 Jun 2020 17:52:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725142; bh=ViZa30ypR7/xokQKb3odmSsdv+h/Zb0AyqQm1aaQY/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CfFdMtha45sqsXjdbwbRYNq8oaMSZNi9nwhZsTRX6x5/95sCRdHayghvqUlMAzBL3 sst/o2X2MqlBLbj2xX2kxxJeioJuwYeJsgqou6O8LA8pBWWAhvGTkBWzCbbEvg7NAP YwjwsqADLsVuzO1e8Ub73qKeYnh/V3LI4gqYul2Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fugang Duan , "David S. Miller" Subject: [PATCH 5.4 05/34] net: stmmac: enable timestamp snapshot for required PTP packets in dwmac v5.10a Date: Tue, 9 Jun 2020 19:45:01 +0200 Message-Id: <20200609174053.303180274@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Fugang Duan [ Upstream commit f2fb6b6275eba9d312957ca44c487bd780da6169 ] For rx filter 'HWTSTAMP_FILTER_PTP_V2_EVENT', it should be PTP v2/802.AS1, any layer, any kind of event packet, but HW only take timestamp snapshot for below PTP message: sync, Pdelay_req, Pdelay_resp. Then it causes below issue when test E2E case: ptp4l[2479.534]: port 1: received DELAY_REQ without timestamp ptp4l[2481.423]: port 1: received DELAY_REQ without timestamp ptp4l[2481.758]: port 1: received DELAY_REQ without timestamp ptp4l[2483.524]: port 1: received DELAY_REQ without timestamp ptp4l[2484.233]: port 1: received DELAY_REQ without timestamp ptp4l[2485.750]: port 1: received DELAY_REQ without timestamp ptp4l[2486.888]: port 1: received DELAY_REQ without timestamp ptp4l[2487.265]: port 1: received DELAY_REQ without timestamp ptp4l[2487.316]: port 1: received DELAY_REQ without timestamp Timestamp snapshot dependency on register bits in received path: SNAPTYPSEL TSMSTRENA TSEVNTENA PTP_Messages 01 x 0 SYNC, Follow_Up, Delay_Req, Delay_Resp, Pdelay_Req, Pdelay_Resp, Pdelay_Resp_Follow_Up 01 0 1 SYNC, Pdelay_Req, Pdelay_Resp For dwmac v5.10a, enabling all events by setting register DWC_EQOS_TIME_STAMPING[SNAPTYPSEL] to 2’b01, clearing bit [TSEVNTENA] to 0’b0, which can support all required events. Signed-off-by: Fugang Duan Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -630,7 +630,8 @@ static int stmmac_hwtstamp_set(struct ne config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT; ptp_v2 = PTP_TCR_TSVER2ENA; snap_type_sel = PTP_TCR_SNAPTYPSEL_1; - ts_event_en = PTP_TCR_TSEVNTENA; + if (priv->synopsys_id != DWMAC_CORE_5_10) + ts_event_en = PTP_TCR_TSEVNTENA; ptp_over_ipv4_udp = PTP_TCR_TSIPV4ENA; ptp_over_ipv6_udp = PTP_TCR_TSIPV6ENA; ptp_over_ethernet = PTP_TCR_TSIPENA; From patchwork Tue Jun 9 17:45:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224688 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2E06C433E0 for ; Tue, 9 Jun 2020 17:52:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 790FF207F9 for ; Tue, 9 Jun 2020 17:52:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725151; bh=tlrqTCvHAD7zvP2mZ+lUjBeNaDmgSx14Us+yObbsOvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=2kE+PCbT1CT3tQUNHj1eZYEfJ2B2hWnsgjtBpTg4BRCUMGFVVcsAqNHh9q9l6GUF3 2c4U8AAfC/N/mjOwo8Hf1MkOwra1/6C4N3cFZ2MaVEm8p/PoYa3At8CKxFv3LPoNHq 83k8XKfxgbwdd3yZNyfrHDWwTiZMXtk+dnLKKa3M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729402AbgFIRwa (ORCPT ); Tue, 9 Jun 2020 13:52:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:42698 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732892AbgFIRwZ (ORCPT ); Tue, 9 Jun 2020 13:52:25 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B0FA02074B; Tue, 9 Jun 2020 17:52:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725145; bh=tlrqTCvHAD7zvP2mZ+lUjBeNaDmgSx14Us+yObbsOvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C8SNNAdU+hl6Z+K0zW7Owb8cQYrnwCw4YLcqTZ6+NmLz0EtGCH63WRv8D8K4Ne0ZQ QJiPS60t7rVR+ZACJIO0ujHayk6Drq4dtXMzHLGEA2YdHnPIwPfz5aehRMJjo/gHZZ /c9vbU+avxkMklfNT9VRQYP5rx1p4+mJtaXHR9D4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniele Palmas , =?utf-8?q?Bj=C3=B8rn_Mork?= , "David S. Miller" Subject: [PATCH 5.4 06/34] net: usb: qmi_wwan: add Telit LE910C1-EUX composition Date: Tue, 9 Jun 2020 19:45:02 +0200 Message-Id: <20200609174053.406992811@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Daniele Palmas [ Upstream commit 591612aa578cd7148b7b9d74869ef40118978389 ] Add support for Telit LE910C1-EUX composition 0x1031: tty, tty, tty, rmnet Signed-off-by: Daniele Palmas Acked-by: Bjørn Mork Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -1324,6 +1324,7 @@ static const struct usb_device_id produc {QMI_FIXED_INTF(0x1bbb, 0x0203, 2)}, /* Alcatel L800MA */ {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */ {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */ + {QMI_QUIRK_SET_DTR(0x1bc7, 0x1031, 3)}, /* Telit LE910C1-EUX */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */ {QMI_QUIRK_SET_DTR(0x1bc7, 0x1050, 2)}, /* Telit FN980 */ {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */ From patchwork Tue Jun 9 17:45:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224687 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E21B6C433DF for ; Tue, 9 Jun 2020 17:52:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C2AC3207F9 for ; Tue, 9 Jun 2020 17:52:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725156; bh=5hEyJv+i8lgPkzKGzA2JKa81T8owg04PWOjhCN+qqAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wLfeGqCYMST61YeLN6URUejBqztqFZ7uiBtLDRQ9yMQESIQZEAAbDMyZrbS2Xy1mB 5dBX3Di/5ltf2Hj7VFE3AtleREielsl95dAuwcyjhsT5q6+Uqzz3jmEBa2owbn4/8n Z61e9PMwfC9xVEU8XLpTxGP1jkgMiOIPHQ/d9xys= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732914AbgFIRwf (ORCPT ); Tue, 9 Jun 2020 13:52:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:42882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732904AbgFIRwc (ORCPT ); Tue, 9 Jun 2020 13:52:32 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7241A20734; Tue, 9 Jun 2020 17:52:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725151; bh=5hEyJv+i8lgPkzKGzA2JKa81T8owg04PWOjhCN+qqAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AowsPmHtZqw6mQ+q6hsOb9kQ/RdfJEzCrqpiMVtwxdzuCl3UBoFd4t5dbiXdRtWJf xNLe7z67cO5wuEnthYvvNGQ4cMzqDX/7LvBVU8BeGjczIaGfm8V/g0WKnUt8CMtrh+ Dl1QzBdneV2Oxk6xiJN3Mq14VSp5I562jXfPk21k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefano Garzarella , Jorgen Hansen , "David S. Miller" Subject: [PATCH 5.4 09/34] vsock: fix timeout in vsock_accept() Date: Tue, 9 Jun 2020 19:45:05 +0200 Message-Id: <20200609174053.793966089@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Stefano Garzarella [ Upstream commit 7e0afbdfd13d1e708fe96e31c46c4897101a6a43 ] The accept(2) is an "input" socket interface, so we should use SO_RCVTIMEO instead of SO_SNDTIMEO to set the timeout. So this patch replace sock_sndtimeo() with sock_rcvtimeo() to use the right timeout in the vsock_accept(). Fixes: d021c344051a ("VSOCK: Introduce VM Sockets") Signed-off-by: Stefano Garzarella Reviewed-by: Jorgen Hansen Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/vmw_vsock/af_vsock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -1275,7 +1275,7 @@ static int vsock_accept(struct socket *s /* Wait for children sockets to appear; these are the new sockets * created upon connection establishment. */ - timeout = sock_sndtimeo(listener, flags & O_NONBLOCK); + timeout = sock_rcvtimeo(listener, flags & O_NONBLOCK); prepare_to_wait(sk_sleep(listener), &wait, TASK_INTERRUPTIBLE); while ((connected = vsock_dequeue_accept(listener)) == NULL && From patchwork Tue Jun 9 17:45:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224641 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6795FC433DF for ; Tue, 9 Jun 2020 18:04:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 49CC8206D5 for ; Tue, 9 Jun 2020 18:04:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725880; bh=2wq8q15ub0uB0vMe8hgGxS46CrFW/myQrAZmv2wOkoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gkYgr7qegXZic9NrDJ5K++qSKVcwano8sOwWiddiDLJcHT/dPUVwlkJaRGLMxWH0/ 6nJ+txorW2f3D8l9x6bArMi6OnDZlcL+KzQPfUeZX1aEeO1vApJzUlszBZLSAGMpWG DuEL89GrfCT42uzPXy2uP2/pFkMepHtOEeULYE+g= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388007AbgFISEi (ORCPT ); Tue, 9 Jun 2020 14:04:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:42080 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732886AbgFIRwG (ORCPT ); Tue, 9 Jun 2020 13:52:06 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8548B207ED; Tue, 9 Jun 2020 17:52:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725125; bh=2wq8q15ub0uB0vMe8hgGxS46CrFW/myQrAZmv2wOkoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w15kzALPgz4orT//WSlqLlZF8+4vruop8ldERJnTYb+WvJmN33v/f4OsNZcFEZvBh V4HTd39InV5C5huleM+o7X4U6G+M/+oZtD3LmKL1ON7YTrwX+lYG31y4pH+gPr0+8R FeLzWslSVB1CBM1ObnUZ2uyclNdZBgISp8tBl4l4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Willem de Bruijn , "David S. Miller" Subject: [PATCH 5.4 10/34] net: check untrusted gso_size at kernel entry Date: Tue, 9 Jun 2020 19:45:06 +0200 Message-Id: <20200609174053.918759824@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Willem de Bruijn [ Upstream commit 6dd912f82680761d8fb6b1bb274a69d4c7010988 ] Syzkaller again found a path to a kernel crash through bad gso input: a packet with gso size exceeding len. These packets are dropped in tcp_gso_segment and udp[46]_ufo_fragment. But they may affect gso size calculations earlier in the path. Now that we have thlen as of commit 9274124f023b ("net: stricter validation of untrusted gso packets"), check gso_size at entry too. Fixes: bfd5f4a3d605 ("packet: Add GSO/csum offload support.") Reported-by: syzbot Signed-off-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/linux/virtio_net.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h @@ -31,6 +31,7 @@ static inline int virtio_net_hdr_to_skb( { unsigned int gso_type = 0; unsigned int thlen = 0; + unsigned int p_off = 0; unsigned int ip_proto; if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { @@ -68,7 +69,8 @@ static inline int virtio_net_hdr_to_skb( if (!skb_partial_csum_set(skb, start, off)) return -EINVAL; - if (skb_transport_offset(skb) + thlen > skb_headlen(skb)) + p_off = skb_transport_offset(skb) + thlen; + if (p_off > skb_headlen(skb)) return -EINVAL; } else { /* gso packets without NEEDS_CSUM do not set transport_offset. @@ -92,17 +94,25 @@ retry: return -EINVAL; } - if (keys.control.thoff + thlen > skb_headlen(skb) || + p_off = keys.control.thoff + thlen; + if (p_off > skb_headlen(skb) || keys.basic.ip_proto != ip_proto) return -EINVAL; skb_set_transport_header(skb, keys.control.thoff); + } else if (gso_type) { + p_off = thlen; + if (p_off > skb_headlen(skb)) + return -EINVAL; } } if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { u16 gso_size = __virtio16_to_cpu(little_endian, hdr->gso_size); + if (skb->len - p_off <= gso_size) + return -EINVAL; + skb_shinfo(skb)->gso_size = gso_size; skb_shinfo(skb)->gso_type = gso_type; From patchwork Tue Jun 9 17:45:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224640 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C221C433DF for ; Tue, 9 Jun 2020 18:04:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1434820801 for ; Tue, 9 Jun 2020 18:04:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725898; bh=R/2+iH0ntOAXXcyfdHjyJIeGtR8m6nlM7VYdO+xk6Gs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sfAVh/gDS/d0V6NRNAnRwmztyNQ1ZZwfUUfqHfsg8drNJw8BZNAegH2dqIjheqrPP USjZS9s1VRht6BNoxcTkuoqpXrjtGZ9Kvxz5k45/lmWhP9pqiJiXnnhmK7Y/goi0ez XD22Qv9OTvgTMzNZqcJN5JPy8qaN6y28nG5yRJoY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388002AbgFISEi (ORCPT ); Tue, 9 Jun 2020 14:04:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:42154 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728537AbgFIRwH (ORCPT ); Tue, 9 Jun 2020 13:52:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BFC2F20774; Tue, 9 Jun 2020 17:52:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725127; bh=R/2+iH0ntOAXXcyfdHjyJIeGtR8m6nlM7VYdO+xk6Gs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PGiGlpsv78ZxLpPpISRRRINaRgbklQyt0rsqe95S2IP7okbQM8MxyUL1R3CjOwz2e lRhTNvoXdgy8jPct9v1OyDjNvgPm9mK0au1OZ8wJ7ViMA5D6p0aJSqASnfweWcZiNP TcxUFZlzTWAdjvJoMkDtcPxhOeKzBFiGCECDu4PI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Willem de Bruijn , "David S. Miller" Subject: [PATCH 5.4 11/34] net: be more gentle about silly gso requests coming from user Date: Tue, 9 Jun 2020 19:45:07 +0200 Message-Id: <20200609174054.051190910@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Eric Dumazet [ Upstream commit 7c6d2ecbda83150b2036a2b36b21381ad4667762 ] Recent change in virtio_net_hdr_to_skb() broke some packetdrill tests. When --mss=XXX option is set, packetdrill always provide gso_type & gso_size for its inbound packets, regardless of packet size. if (packet->tcp && packet->mss) { if (packet->ipv4) gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; else gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; gso.gso_size = packet->mss; } Since many other programs could do the same, relax virtio_net_hdr_to_skb() to no longer return an error, but instead ignore gso settings. This keeps Willem intent to make sure no malicious packet could reach gso stack. Note that TCP stack has a special logic in tcp_set_skb_tso_segs() to clear gso_size for small packets. Fixes: 6dd912f82680 ("net: check untrusted gso_size at kernel entry") Signed-off-by: Eric Dumazet Cc: Willem de Bruijn Acked-by: Willem de Bruijn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- include/linux/virtio_net.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h @@ -109,16 +109,17 @@ retry: if (hdr->gso_type != VIRTIO_NET_HDR_GSO_NONE) { u16 gso_size = __virtio16_to_cpu(little_endian, hdr->gso_size); + struct skb_shared_info *shinfo = skb_shinfo(skb); - if (skb->len - p_off <= gso_size) - return -EINVAL; + /* Too small packets are not really GSO ones. */ + if (skb->len - p_off > gso_size) { + shinfo->gso_size = gso_size; + shinfo->gso_type = gso_type; - skb_shinfo(skb)->gso_size = gso_size; - skb_shinfo(skb)->gso_type = gso_type; - - /* Header must be checked, and gso_segs computed. */ - skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY; - skb_shinfo(skb)->gso_segs = 0; + /* Header must be checked, and gso_segs computed. */ + shinfo->gso_type |= SKB_GSO_DODGY; + shinfo->gso_segs = 0; + } } return 0; From patchwork Tue Jun 9 17:45:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 187695 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp770175ilo; Tue, 9 Jun 2020 11:04:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTLMRh0Ci4JByR16yIqcFgYTDAgvyqKAOCQ73K+ahmm987eYZYT12xCnIwnZ0m9EyLZ0Q0 X-Received: by 2002:a50:c359:: with SMTP id q25mr28997146edb.123.1591725843721; Tue, 09 Jun 2020 11:04:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591725843; cv=none; d=google.com; s=arc-20160816; b=om6IQwimoQGySDIFP/mrBEYI8UKmtacmwcl/pcCN20Vx3IpNH2BKh8eJRdE8j/eEx/ 9kuniZi+Bs0ZVLhtc37PULwiti2FNF8EsFOurvnYKxcz4jMAtnplTnp1qIltL5Q7VHE7 n0qNHIUmDTzyTgFGePMaWxf7+12c3Mqyodwys6Unl01mI669dP2ADwZUwcSlJqR3P+Xg aEQL7CmxdFTOl5Vr1IoqQv98ekEb76IuampfA9E6NAEOivjO6GcVBcM5UOUR5p2W6ijO FVYN4YcP4vQEHRL7UqLnf2wc8nXDNxhVYlzG+FuyoZxV+g/XvKVxN2pwPU7AZUrVb69N zkWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bY+5RgWAuj4+Fukc/KBqnT65+4+MKFT1kIjxWaD0A6Q=; b=Aq9bPd10BGzJ3Dc4kOMXO95/esFEq/ZJlVPZ+HSlGqzfjViagNbCl6hz3yc21KLYFK MvFEXG2qjkaFZXOL9hnn4GmN2puHv+EZ6ycWpQ92lUSWQNM9oG0byJWjkYBJaFpM9vn0 z2YDmgZkzIvRRDK5w2l96WAt5OjidAVuQgGDElOJaWJxbOgVHkk8dY7oK6ed5rgAYzqN bf9GdPRd4AMipEXP9RzBEnjCItfY4EDpvwSaActqTNu2IsR3xkhvanlccG3wgvEkmNaf fKz2y03hjqsXTbzyxkRQNmzB2q+nTA3/ul/oCC0FqlsBJM3KxauvA/cqoGNWZ4QOz1i/ /9Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="RN/rp31x"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n25si11282764ejs.551.2020.06.09.11.04.02; Tue, 09 Jun 2020 11:04:03 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="RN/rp31x"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387940AbgFISDk (ORCPT + 15 others); Tue, 9 Jun 2020 14:03:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:42986 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732916AbgFIRwg (ORCPT ); Tue, 9 Jun 2020 13:52:36 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E6AAE20774; Tue, 9 Jun 2020 17:52:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725156; bh=9QiSaFPCF+LjbweQTWvY4JtLf48Yd8AZc7D1koPx13M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RN/rp31xaKPWGocFgq6R+seM943Ke/wJhAX2XEsnjJSKLP+oLWrEZuXFFu5o3+MLh JDMQt3PeX4TPrvcbfQ6HMV7AmxxC8ENtEF+GUoWJ2H9kfrragxBmkqXJpo9lbMo4CM e+Brn6Zpi1p6qMAuLuvbrZjsZv0QTOO/eUS/YNHw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lars-Peter Clausen , Jonathan Cameron , Stable@vger.kernel.org, Tomasz Duszynski Subject: [PATCH 5.4 16/34] iio:chemical:sps30: Fix timestamp alignment Date: Tue, 9 Jun 2020 19:45:12 +0200 Message-Id: <20200609174054.670448439@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jonathan Cameron commit a5bf6fdd19c327bcfd9073a8740fa19ca4525fd4 upstream. One of a class of bugs pointed out by Lars in a recent review. iio_push_to_buffers_with_timestamp assumes the buffer used is aligned to the size of the timestamp (8 bytes). This is not guaranteed in this driver which uses an array of smaller elements on the stack. Fixes: 232e0f6ddeae ("iio: chemical: add support for Sensirion SPS30 sensor") Reported-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron Cc: Acked-by: Tomasz Duszynski Signed-off-by: Greg Kroah-Hartman --- drivers/iio/chemical/sps30.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/iio/chemical/sps30.c +++ b/drivers/iio/chemical/sps30.c @@ -230,15 +230,18 @@ static irqreturn_t sps30_trigger_handler struct iio_dev *indio_dev = pf->indio_dev; struct sps30_state *state = iio_priv(indio_dev); int ret; - s32 data[4 + 2]; /* PM1, PM2P5, PM4, PM10, timestamp */ + struct { + s32 data[4]; /* PM1, PM2P5, PM4, PM10 */ + s64 ts; + } scan; mutex_lock(&state->lock); - ret = sps30_do_meas(state, data, 4); + ret = sps30_do_meas(state, scan.data, ARRAY_SIZE(scan.data)); mutex_unlock(&state->lock); if (ret) goto err; - iio_push_to_buffers_with_timestamp(indio_dev, data, + iio_push_to_buffers_with_timestamp(indio_dev, &scan, iio_get_time_ns(indio_dev)); err: iio_trigger_notify_done(indio_dev->trig); From patchwork Tue Jun 9 17:45:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224685 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49B8BC433E0 for ; Tue, 9 Jun 2020 17:53:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1F8A1207ED for ; Tue, 9 Jun 2020 17:53:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725183; bh=ZMv3ezj23sl3iB5uhJe069xw5SiAAJNn15tfc3mWTyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=K0s4v9KNxP7xEJIFxRV3WRseR3n/NWL/QJrlg4hE5dXOQ+sp6qF7yFEjXo9w56ieq WT/RTxTFkGRbsbzhKqBdULVeElXvpcE+cavZIlSUJUBl83XOyOy+WG3QXOKIY74Aw7 wFewoCK41s/L1uJfJMLk5e01XQoXdHvRn7MwZ2Rc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732973AbgFIRxC (ORCPT ); Tue, 9 Jun 2020 13:53:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:43672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732970AbgFIRxB (ORCPT ); Tue, 9 Jun 2020 13:53:01 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 93B8B20801; Tue, 9 Jun 2020 17:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725181; bh=ZMv3ezj23sl3iB5uhJe069xw5SiAAJNn15tfc3mWTyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X8fMTX9iOGLr3N/lSqQjwySemfLTGXGV89CO2h7gtwNeevFDakUqWmHBhP6RorDOV p5CMUNBZGJPvOMXUJAog8B5RKzDecnq4aF13Jgmr4s8WRrzfVwbaHxX6efzjgpqgR1 94FHBiW8MtL9eklzWugcgB6Un2H+cTe1z6VSat3o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathieu Othacehe , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.4 17/34] iio: vcnl4000: Fix i2c swapped word reading. Date: Tue, 9 Jun 2020 19:45:13 +0200 Message-Id: <20200609174054.797121315@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mathieu Othacehe commit 18dfb5326370991c81a6d1ed6d1aeee055cb8c05 upstream. The bytes returned by the i2c reading need to be swapped unconditionally. Otherwise, on be16 platforms, an incorrect value will be returned. Taking the slow path via next merge window as its been around a while and we have a patch set dependent on this which would be held up. Fixes: 62a1efb9f868 ("iio: add vcnl4000 combined ALS and proximity sensor") Signed-off-by: Mathieu Othacehe Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/light/vcnl4000.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/drivers/iio/light/vcnl4000.c +++ b/drivers/iio/light/vcnl4000.c @@ -193,7 +193,6 @@ static int vcnl4000_measure(struct vcnl4 u8 rdy_mask, u8 data_reg, int *val) { int tries = 20; - __be16 buf; int ret; mutex_lock(&data->vcnl4000_lock); @@ -220,13 +219,12 @@ static int vcnl4000_measure(struct vcnl4 goto fail; } - ret = i2c_smbus_read_i2c_block_data(data->client, - data_reg, sizeof(buf), (u8 *) &buf); + ret = i2c_smbus_read_word_swapped(data->client, data_reg); if (ret < 0) goto fail; mutex_unlock(&data->vcnl4000_lock); - *val = be16_to_cpu(buf); + *val = ret; return 0; From patchwork Tue Jun 9 17:45:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 187694 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp769209ilo; Tue, 9 Jun 2020 11:03:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0guZRUW3ob5FgcghDVTJ6WQVHmOiF0y8uxd9YUURboFYd+zI7Phe3v1MwqXzsdBmQi4XO X-Received: by 2002:aa7:dad6:: with SMTP id x22mr28387640eds.265.1591725783313; Tue, 09 Jun 2020 11:03:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591725783; cv=none; d=google.com; s=arc-20160816; b=XFgOHdUIc5+Filfcui8TPzI56OdfgmeJXGO3OxMGr8TjsMrLUSeGkU6et3G/OhwwJy ImY4hUUSJiSipZg/Rq1FPRA6PNdGf8c7m96sCDuOEvHZ6ZRSo0YtsfrwQA1y1CMSTnX2 P0dMrJD+NPEmFpkOl1/8SsfihxRfN8T8yZ/dnQ+Ae/4qmiUnOXTd6nP4PZr0Rztd6atg asOZ9gfgNiLU+8TxwDxu2s9ClNSqtsc5iY72TyUboshu0ymHU3yEs1JEBjZG/OcrGbhM hHj14FPS2hcunwoBTWmnIoj8dgPVXwex3gnepUAPYFSpyV3+0EKZMZOZ/Zn9qD0Pg5l+ vQmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dgBt0LQaYjXgUNjPmsg9FIck0ZlAxf/ZvWgM8/nd01g=; b=s+gZvhJBgXTYxGzLyMGI7had1g5ss3jjTelZSOZO9UzRSYbgmyajgASwwfczA0ajyl NMVJnn49dIrtLJNNy/oweJGvG3L+FZFtbzK4/8w+55m2Kg7SXvGOPiZjnju4voZZaqP1 YUFofbZXSW/5ivPnehdSLK0nUcn93qpZA4gGuXulqdlCUgoYM3JDPJdkhSRyhTywCSo0 sVMRdSLTZi1wf49XWlHfIlvGwHDkDqZxAVy4QH2C3NSNg6CNitjn1o7NY/BQXuxif+kK h/iQpGLkQuEdiHLJXhk3hJXFaibpO/6DaDQUYeFjpPOsJtcKxg8t9iDGksozAyycZUwv f7/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mvI099iC; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gv4si11016951ejb.565.2020.06.09.11.03.03; Tue, 09 Jun 2020 11:03:03 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mvI099iC; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733002AbgFISDA (ORCPT + 15 others); Tue, 9 Jun 2020 14:03:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:43744 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732985AbgFIRxD (ORCPT ); Tue, 9 Jun 2020 13:53:03 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C61B0207C3; Tue, 9 Jun 2020 17:53:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725183; bh=tJ7i3gI0/ijEe7QVglU/MZNhpV1Jc+al4aF2FGTCKJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mvI099iCC1Xomkd3DHQmrDXKnJaHLRREPrTNFQLCXpyWSo9KRwMUuhthmMDWygIhw pYuUAUvTungBGmQ1wCinnwgrZlycNuRMixnNvWAgSwsg2Ih6wN4t0rpoqh29jtmh3j aJYL6Md/eWrSb/Te/vrZ11/YFQLaQxkY81kEhXbo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lars-Peter Clausen , Jonathan Cameron , Stable@vger.kernel.org, Tomasz Duszynski Subject: [PATCH 5.4 18/34] iio:chemical:pms7003: Fix timestamp alignment and prevent data leak. Date: Tue, 9 Jun 2020 19:45:14 +0200 Message-Id: <20200609174054.904245534@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Jonathan Cameron commit 13e945631c2ffb946c0af342812a3cd39227de6e upstream. One of a class of bugs pointed out by Lars in a recent review. iio_push_to_buffers_with_timestamp assumes the buffer used is aligned to the size of the timestamp (8 bytes). This is not guaranteed in this driver which uses an array of smaller elements on the stack. As Lars also noted this anti pattern can involve a leak of data to userspace and that indeed can happen here. We close both issues by moving to a suitable structure in the iio_priv() data with alignment explicitly requested. This data is allocated with kzalloc so no data can leak appart from previous readings. Fixes: a1d642266c14 ("iio: chemical: add support for Plantower PMS7003 sensor") Reported-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron Cc: Acked-by: Tomasz Duszynski Signed-off-by: Greg Kroah-Hartman --- drivers/iio/chemical/pms7003.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) --- a/drivers/iio/chemical/pms7003.c +++ b/drivers/iio/chemical/pms7003.c @@ -73,6 +73,11 @@ struct pms7003_state { struct pms7003_frame frame; struct completion frame_ready; struct mutex lock; /* must be held whenever state gets touched */ + /* Used to construct scan to push to the IIO buffer */ + struct { + u16 data[3]; /* PM1, PM2P5, PM10 */ + s64 ts; + } scan; }; static int pms7003_do_cmd(struct pms7003_state *state, enum pms7003_cmd cmd) @@ -104,7 +109,6 @@ static irqreturn_t pms7003_trigger_handl struct iio_dev *indio_dev = pf->indio_dev; struct pms7003_state *state = iio_priv(indio_dev); struct pms7003_frame *frame = &state->frame; - u16 data[3 + 1 + 4]; /* PM1, PM2P5, PM10, padding, timestamp */ int ret; mutex_lock(&state->lock); @@ -114,12 +118,15 @@ static irqreturn_t pms7003_trigger_handl goto err; } - data[PM1] = pms7003_get_pm(frame->data + PMS7003_PM1_OFFSET); - data[PM2P5] = pms7003_get_pm(frame->data + PMS7003_PM2P5_OFFSET); - data[PM10] = pms7003_get_pm(frame->data + PMS7003_PM10_OFFSET); + state->scan.data[PM1] = + pms7003_get_pm(frame->data + PMS7003_PM1_OFFSET); + state->scan.data[PM2P5] = + pms7003_get_pm(frame->data + PMS7003_PM2P5_OFFSET); + state->scan.data[PM10] = + pms7003_get_pm(frame->data + PMS7003_PM10_OFFSET); mutex_unlock(&state->lock); - iio_push_to_buffers_with_timestamp(indio_dev, data, + iio_push_to_buffers_with_timestamp(indio_dev, &state->scan, iio_get_time_ns(indio_dev)); err: iio_trigger_notify_done(indio_dev->trig); From patchwork Tue Jun 9 17:45:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224649 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5782AC433E1 for ; Tue, 9 Jun 2020 18:03:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 27578206D5 for ; Tue, 9 Jun 2020 18:03:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725780; bh=RflnbD7gqZ1jl7ABeffmia6Gt/M0jQeppRlS42Z53+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=gW7mjmZ5EChkyYKLbmEweZwOEVTWxpBlPY8etXTDUVWZz8Iap0zQh64ZcBrXX18J1 O05c/CyHBWNS1T+CnPXOhHP3dTJo7eCYlUzS6zFWx4qGo7cC8e0NezCaOPencpvkO7 9YSrPMjvth7R17tFh4ibCoSOIk6RbOfwLAtRRKN0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731479AbgFISCy (ORCPT ); Tue, 9 Jun 2020 14:02:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:43934 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733002AbgFIRxI (ORCPT ); Tue, 9 Jun 2020 13:53:08 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 46A9E207ED; Tue, 9 Jun 2020 17:53:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725187; bh=RflnbD7gqZ1jl7ABeffmia6Gt/M0jQeppRlS42Z53+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oHSAxmK6qEpUxhGs+46314DrKmZDm9neS33D3Q57HvgBZQFrTDn+nD3gyy+BsNM5D bFnqrLwlj7n7OyRIKkQgVR5NdfFGFU13dF3q5xqERqItFyF80yQywyE5EGrDvs61yp a9HPTrAAFiG1VmWR0Ad341RxA/v3cshZvLCG84m0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bin Liu Subject: [PATCH 5.4 20/34] usb: musb: start session in resume for host port Date: Tue, 9 Jun 2020 19:45:16 +0200 Message-Id: <20200609174055.141154547@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Bin Liu commit 7f88a5ac393f39319f69b8b20cc8d5759878d1a1 upstream. Commit 17539f2f4f0b ("usb: musb: fix enumeration after resume") replaced musb_start() in musb_resume() to not override softconnect bit, but it doesn't restart the session for host port which was done in musb_start(). The session could be disabled in musb_suspend(), which leads the host port doesn't stay in host mode. So let's start the session specifically for host port in musb_resume(). Fixes: 17539f2f4f0b ("usb: musb: fix enumeration after resume") Cc: stable@vger.kernel.org Signed-off-by: Bin Liu Link: https://lore.kernel.org/r/20200525025049.3400-3-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/musb/musb_core.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2721,6 +2721,13 @@ static int musb_resume(struct device *de musb_enable_interrupts(musb); musb_platform_enable(musb); + /* session might be disabled in suspend */ + if (musb->port_mode == MUSB_HOST && + !(musb->ops->quirks & MUSB_PRESERVE_SESSION)) { + devctl |= MUSB_DEVCTL_SESSION; + musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); + } + spin_lock_irqsave(&musb->lock, flags); error = musb_run_resume_work(musb); if (error) From patchwork Tue Jun 9 17:45:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224650 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35623C433E1 for ; Tue, 9 Jun 2020 18:02:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 09C50206D5 for ; Tue, 9 Jun 2020 18:02:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725774; bh=6YPxQIpnHA4tJL9vOwIld7dOcuszsw2Lm6F7R0UTo0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=oLwKnkgWqKvkn/uUnquD7C762uVcnCCaIKoXStzF+FEIT4LH5HAuDaMutvA6pSzpN csj3OrLFnYLA+zwU31y5i7166RQmuRue4RguR+YY0Ye7UHsbxV3/WkC67JBO/pQT4D oVtX8tWj5q7GLu9Q6JBD4i0ZHovk3mmAOh2aP1e0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733003AbgFIRxN (ORCPT ); Tue, 9 Jun 2020 13:53:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:43972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731732AbgFIRxK (ORCPT ); Tue, 9 Jun 2020 13:53:10 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7BC492074B; Tue, 9 Jun 2020 17:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725189; bh=6YPxQIpnHA4tJL9vOwIld7dOcuszsw2Lm6F7R0UTo0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0RDv4TuJp0SOuvmx4anxA0kTj72aoIVfFKf73sRo/P1/7tHEpnl27ja+RMSpa+NJA p7/I7dRWmn5YrXwJYa/l0Mc2tbnY7ty0xu2p+mSOkaJm28gGwnZHhk+gCNVTUcDlx4 PaUgaexSH5NSMKmSs/rgO1JeZ43w0q0eyQrHISVc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Bin Liu Subject: [PATCH 5.4 21/34] usb: musb: Fix runtime PM imbalance on error Date: Tue, 9 Jun 2020 19:45:17 +0200 Message-Id: <20200609174055.288728754@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dinghao Liu commit e4befc121df03dc8ed2ac1031c98f9538e244bae upstream. When copy_from_user() returns an error code, there is a runtime PM usage counter imbalance. Fix this by moving copy_from_user() to the beginning of this function. Fixes: 7b6c1b4c0e1e ("usb: musb: fix runtime PM in debugfs") Signed-off-by: Dinghao Liu Cc: stable@vger.kernel.org Signed-off-by: Bin Liu Link: https://lore.kernel.org/r/20200525025049.3400-7-b-liu@ti.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/usb/musb/musb_debugfs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -168,6 +168,11 @@ static ssize_t musb_test_mode_write(stru u8 test; char buf[24]; + memset(buf, 0x00, sizeof(buf)); + + if (copy_from_user(buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) + return -EFAULT; + pm_runtime_get_sync(musb->controller); test = musb_readb(musb->mregs, MUSB_TESTMODE); if (test) { @@ -176,11 +181,6 @@ static ssize_t musb_test_mode_write(stru goto ret; } - memset(buf, 0x00, sizeof(buf)); - - if (copy_from_user(buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) - return -EFAULT; - if (strstarts(buf, "force host full-speed")) test = MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS; From patchwork Tue Jun 9 17:45:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FFFCC433E0 for ; Tue, 9 Jun 2020 18:02:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3DDE420734 for ; Tue, 9 Jun 2020 18:02:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725765; bh=miLTQdPwzuk9lQFiqP5cxP8nhx922KpR3g6Sz11QT1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=VOCvbrmIv7lkoBvbYwkkl4cJDz5bm1KQyNHC/1EIZ5lMWe3BqavTjXrFjY7mnOfku PgD76+18FbHDxQExJD7SKBNqO5QYsYQVDZTRWUhRMHclgzkTaGQBadVOr6Ku8iAiOk 9UgJ5sNVoob6g1nB0exWdQuTgK2PlHFocOuHalc8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731572AbgFIRxV (ORCPT ); Tue, 9 Jun 2020 13:53:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:44112 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733014AbgFIRxR (ORCPT ); Tue, 9 Jun 2020 13:53:17 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 32B172074B; Tue, 9 Jun 2020 17:53:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725196; bh=miLTQdPwzuk9lQFiqP5cxP8nhx922KpR3g6Sz11QT1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wfHaRxKfACHuJKy6i7epq16MqyLHTeIuApNuuXuAJIJAvxvEEisEG3Lq3TOtqTyKb o3JpqIJS+unhA7YldkMkWRQBn0m21tiTuIBa7bJOfyq01lcWK/t43Xrs8Y+p7L6vSx XF/Tn83LxMJFUIFIZ1pLU8GwwSgmTJfDlde/O268= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pascal Terjan Subject: [PATCH 5.4 24/34] staging: rtl8712: Fix IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK Date: Tue, 9 Jun 2020 19:45:20 +0200 Message-Id: <20200609174056.116658615@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Pascal Terjan commit 15ea976a1f12b5fd76b1bd6ff3eb5132fd28047f upstream. The value in shared headers was fixed 9 years ago in commit 8d661f1e462d ("ieee80211: correct IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK macro") and while looking at using shared headers for other duplicated constants I noticed this driver uses the old value. The macros are also defined twice in this file so I am deleting the second definition. Signed-off-by: Pascal Terjan Cc: stable Link: https://lore.kernel.org/r/20200523211247.23262-1-pterjan@google.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/wifi.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) --- a/drivers/staging/rtl8712/wifi.h +++ b/drivers/staging/rtl8712/wifi.h @@ -440,7 +440,7 @@ static inline unsigned char *get_hdr_bss /* block-ack parameters */ #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C -#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0 +#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFC0 #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000 #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 @@ -532,13 +532,6 @@ struct ieee80211_ht_addt_info { #define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 #define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 -/* block-ack parameters */ -#define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002 -#define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C -#define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFA0 -#define IEEE80211_DELBA_PARAM_TID_MASK 0xF000 -#define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800 - /* * A-PMDU buffer sizes * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2) From patchwork Tue Jun 9 17:45:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 187696 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp770201ilo; Tue, 9 Jun 2020 11:04:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztinPLkStjS8pw7EVax3gc4Mz1QzuGSiQrvZiciG2rO1FWuZrz5kJsQVAvY0tJPb0hpzFy X-Received: by 2002:a17:906:3158:: with SMTP id e24mr7947702eje.543.1591725844755; Tue, 09 Jun 2020 11:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591725844; cv=none; d=google.com; s=arc-20160816; b=DlahKdxUfS5DxOkcYBfBuM1Q6KvEONYo9rHLeBW2nT/QrzQmb/UMoWPx3DvwBkWv/F 3GkisAL9lWz8pSKiTMe4LpfDk3PC/WVsg+vJhOIEYvnHXjxW8FQipqbKASb68pzMp/m3 0hY2m4uniA8C2MNrarnYO1f2IgAc1cXnpuklBB3EMJa5Hb5jkKs+uBoJJTMJXGyBNK1p 072nWMXCxEoGn78mljEAKYynq11EncrMsdXvn7fbsK6DhpGNWIxj7oWY+En/R8LvfYYJ Kd+K15QQpJ5PdFYQ8BcCf+pM4MgLCYfccBIktf4U0M6RGCFGESj/pW81TfiOMMyo0hv9 kXrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/rtbpW0aQEeZ4NFcx2rYrdvLKJmdYcGqqwuOKRuwTdk=; b=myKWF+AT2sB4EMeQE4HNwPzkPhOgnPIjf3MJ1vyaZG5RV7meZU8JGbmh6LZ2RO2mhe v61cDSbbfOBNQl//bAYe3gSqKvWw0BilPI+M6IAbKXY0jVl4WV+kfIOc8hVfzB+72Wub M41ISP9YjJwWigfy3xdCiFESZyi0MRmi3JOcJjeV4iADDmtDUKmT4hmqtKLdGMFSdIPP jjUhkIOtC4nhbE8o0h03UtgUSBkZmX2QEOmp3s3BLaV9BtqfEHqAYhFhLuJsrZDpCoiz 60XGlXgvbklhAkF2+0v1ftHqFzZfy0qb9tU/YfYD3suEGDnVKccucmaTn8GbXpChVmPC MQIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="GavMI/mR"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n25si11282764ejs.551.2020.06.09.11.04.04; Tue, 09 Jun 2020 11:04:04 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="GavMI/mR"; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733051AbgFISDk (ORCPT + 15 others); Tue, 9 Jun 2020 14:03:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:43126 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732922AbgFIRwl (ORCPT ); Tue, 9 Jun 2020 13:52:41 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 72603207F9; Tue, 9 Jun 2020 17:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725160; bh=mlChgyTv5SQLeyzNVZm89cxyxj49nT+0TF3uaH4MMaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GavMI/mRc+WajWXLqaPhQxH5t7oLAx/qRwoQ5nOfH3LKYBOZJBhf0AZNkaRQchwZ6 AKlgmvnQyqlKmBAqMUYv+37YQ9jNqV3LyppgtFKBtDVIUBE1iGHO82GYQLPRv8Knbp hcwPWiRBIiEz0dakRjdL1ut921HqfEzUBJ2ZBs8Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Douglas Anderson Subject: [PATCH 5.4 26/34] nvmem: qfprom: remove incorrect write support Date: Tue, 9 Jun 2020 19:45:22 +0200 Message-Id: <20200609174056.359919958@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Srinivas Kandagatla commit 8d9eb0d6d59a5d7028c80a30831143d3e75515a7 upstream. qfprom has different address spaces for read and write. Reads are always done from corrected address space, where as writes are done on raw address space. Writing to corrected address space is invalid and ignored, so it does not make sense to have this support in the driver which only supports corrected address space regions at the moment. Fixes: 4ab11996b489 ("nvmem: qfprom: Add Qualcomm QFPROM support.") Signed-off-by: Srinivas Kandagatla Reviewed-by: Douglas Anderson Cc: stable Link: https://lore.kernel.org/r/20200522113341.7728-1-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman --- drivers/nvmem/qfprom.c | 14 -------------- 1 file changed, 14 deletions(-) --- a/drivers/nvmem/qfprom.c +++ b/drivers/nvmem/qfprom.c @@ -27,25 +27,11 @@ static int qfprom_reg_read(void *context return 0; } -static int qfprom_reg_write(void *context, - unsigned int reg, void *_val, size_t bytes) -{ - struct qfprom_priv *priv = context; - u8 *val = _val; - int i = 0, words = bytes; - - while (words--) - writeb(*val++, priv->base + reg + i++); - - return 0; -} - static struct nvmem_config econfig = { .name = "qfprom", .stride = 1, .word_size = 1, .reg_read = qfprom_reg_read, - .reg_write = qfprom_reg_write, }; static int qfprom_probe(struct platform_device *pdev) From patchwork Tue Jun 9 17:45:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224646 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BB05C433E0 for ; Tue, 9 Jun 2020 18:03:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 02AD920734 for ; Tue, 9 Jun 2020 18:03:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725809; bh=hOmNoff9bwoQAs+mY1OICGkI+7xRGt2c2lk5BdXv4rc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=PGkm1tMh2AF/i784W1XnHqxeQ81pofaxC+VgGoQV9/loGKkwAekhe2NjiEGpwXcuG +58sBHPvZ/3lmUdPghO8oAHrkGrvQg1+ffDf+rZf7FzAn1cKBW8EJcvjB9gGNmijey eLDgl4lCEyXGm6NnQhPPQ9tt0QbmjAa5KmyaLk1w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729348AbgFIRwr (ORCPT ); Tue, 9 Jun 2020 13:52:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:43186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731611AbgFIRwn (ORCPT ); Tue, 9 Jun 2020 13:52:43 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A7FCF20801; Tue, 9 Jun 2020 17:52:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725163; bh=hOmNoff9bwoQAs+mY1OICGkI+7xRGt2c2lk5BdXv4rc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LUyKuR3vOL4olONq1+4a7k3Bw/FXRuDntlYlXNCNbLwnaLVsVp9jesbEsd/PKqRn3 8ei9h3XiKEryZZGjz0qh15Hx9vk+XNrA5/lz5kOmlNA++B74+9iNJq/nc+96GOAuVA WlWvGMqmu+eB4KUh4tfm9Qt2cCuxjjhKul55LkLM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tony W Wang-oc , Thomas Gleixner Subject: [PATCH 5.4 27/34] x86/speculation/spectre_v2: Exclude Zhaoxin CPUs from SPECTRE_V2 Date: Tue, 9 Jun 2020 19:45:23 +0200 Message-Id: <20200609174056.885099252@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Tony W Wang-oc commit 1e41a766c98b481400ab8c5a7aa8ea63a1bb03de upstream. New Zhaoxin family 7 CPUs are not affected by SPECTRE_V2. So define a separate cpu_vuln_whitelist bit NO_SPECTRE_V2 and add these CPUs to the cpu vulnerability whitelist. Signed-off-by: Tony W Wang-oc Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/1579227872-26972-2-git-send-email-TonyWWang-oc@zhaoxin.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/common.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1024,6 +1024,7 @@ static void identify_cpu_without_cpuid(s #define MSBDS_ONLY BIT(5) #define NO_SWAPGS BIT(6) #define NO_ITLB_MULTIHIT BIT(7) +#define NO_SPECTRE_V2 BIT(8) #define VULNWL(_vendor, _family, _model, _whitelist) \ { X86_VENDOR_##_vendor, _family, _model, X86_FEATURE_ANY, _whitelist } @@ -1085,6 +1086,10 @@ static const __initconst struct x86_cpu_ /* FAMILY_ANY must be last, otherwise 0x0f - 0x12 matches won't work */ VULNWL_AMD(X86_FAMILY_ANY, NO_MELTDOWN | NO_L1TF | NO_MDS | NO_SWAPGS | NO_ITLB_MULTIHIT), VULNWL_HYGON(X86_FAMILY_ANY, NO_MELTDOWN | NO_L1TF | NO_MDS | NO_SWAPGS | NO_ITLB_MULTIHIT), + + /* Zhaoxin Family 7 */ + VULNWL(CENTAUR, 7, X86_MODEL_ANY, NO_SPECTRE_V2), + VULNWL(ZHAOXIN, 7, X86_MODEL_ANY, NO_SPECTRE_V2), {} }; @@ -1117,7 +1122,9 @@ static void __init cpu_set_bug_bits(stru return; setup_force_cpu_bug(X86_BUG_SPECTRE_V1); - setup_force_cpu_bug(X86_BUG_SPECTRE_V2); + + if (!cpu_matches(NO_SPECTRE_V2)) + setup_force_cpu_bug(X86_BUG_SPECTRE_V2); if (!cpu_matches(NO_SSB) && !(ia32_cap & ARCH_CAP_SSB_NO) && !cpu_has(c, X86_FEATURE_AMD_SSB_NO)) From patchwork Tue Jun 9 17:45:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224686 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD8FBC433DF for ; Tue, 9 Jun 2020 17:52:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A6CAA207F9 for ; Tue, 9 Jun 2020 17:52:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725171; bh=6EQsCHB1db4wnTT7zvI7y54pE21bsBWoDpl9oZzvWnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=NucZhfCGJ5A2oOFP2b4iKko7xgWw2I+x1WmrprHfEWK28KfWDai61J2X7C5vfGoL/ 59WHxK3U7BzBxf4Y+RXRLzH44t0KkNvV2gq0o/vcDTRjinIa6Ki4UBnZNisQ4eaGDr 1kByClS/vkp3wIvYgyWCet5Jj9rFeg/58lFuFw/E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732939AbgFIRwt (ORCPT ); Tue, 9 Jun 2020 13:52:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:43350 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732864AbgFIRws (ORCPT ); Tue, 9 Jun 2020 13:52:48 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2E3D320734; Tue, 9 Jun 2020 17:52:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725167; bh=6EQsCHB1db4wnTT7zvI7y54pE21bsBWoDpl9oZzvWnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RQKeBQpcNiVNM29vO9lnkFgc5sgtK5M3whz1H2MfYHdklxjTG6aKjB8N+40xWFIg8 qn5Accn+0dVBaa6zZjiD9D1KqKM3ShrFV9dhz/wHfDx0Ebs23+EAoqjru/TIHlTsn+ 8l/+u/fJ30tDOkFt1P2LLg4JJbhl45iYpYkY2MCg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Gross , Borislav Petkov , Thomas Gleixner , Josh Poimboeuf Subject: [PATCH 5.4 29/34] x86/cpu: Add table argument to cpu_matches() Date: Tue, 9 Jun 2020 19:45:25 +0200 Message-Id: <20200609174057.355696135@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Mark Gross commit 93920f61c2ad7edb01e63323832585796af75fc9 upstream To make cpu_matches() reusable for other matching tables, have it take a pointer to a x86_cpu_id table as an argument. [ bp: Flip arguments order. ] Signed-off-by: Mark Gross Signed-off-by: Borislav Petkov Signed-off-by: Thomas Gleixner Reviewed-by: Josh Poimboeuf Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/common.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1093,9 +1093,9 @@ static const __initconst struct x86_cpu_ {} }; -static bool __init cpu_matches(unsigned long which) +static bool __init cpu_matches(const struct x86_cpu_id *table, unsigned long which) { - const struct x86_cpu_id *m = x86_match_cpu(cpu_vuln_whitelist); + const struct x86_cpu_id *m = x86_match_cpu(table); return m && !!(m->driver_data & which); } @@ -1115,31 +1115,34 @@ static void __init cpu_set_bug_bits(stru u64 ia32_cap = x86_read_arch_cap_msr(); /* Set ITLB_MULTIHIT bug if cpu is not in the whitelist and not mitigated */ - if (!cpu_matches(NO_ITLB_MULTIHIT) && !(ia32_cap & ARCH_CAP_PSCHANGE_MC_NO)) + if (!cpu_matches(cpu_vuln_whitelist, NO_ITLB_MULTIHIT) && + !(ia32_cap & ARCH_CAP_PSCHANGE_MC_NO)) setup_force_cpu_bug(X86_BUG_ITLB_MULTIHIT); - if (cpu_matches(NO_SPECULATION)) + if (cpu_matches(cpu_vuln_whitelist, NO_SPECULATION)) return; setup_force_cpu_bug(X86_BUG_SPECTRE_V1); - if (!cpu_matches(NO_SPECTRE_V2)) + if (!cpu_matches(cpu_vuln_whitelist, NO_SPECTRE_V2)) setup_force_cpu_bug(X86_BUG_SPECTRE_V2); - if (!cpu_matches(NO_SSB) && !(ia32_cap & ARCH_CAP_SSB_NO) && + if (!cpu_matches(cpu_vuln_whitelist, NO_SSB) && + !(ia32_cap & ARCH_CAP_SSB_NO) && !cpu_has(c, X86_FEATURE_AMD_SSB_NO)) setup_force_cpu_bug(X86_BUG_SPEC_STORE_BYPASS); if (ia32_cap & ARCH_CAP_IBRS_ALL) setup_force_cpu_cap(X86_FEATURE_IBRS_ENHANCED); - if (!cpu_matches(NO_MDS) && !(ia32_cap & ARCH_CAP_MDS_NO)) { + if (!cpu_matches(cpu_vuln_whitelist, NO_MDS) && + !(ia32_cap & ARCH_CAP_MDS_NO)) { setup_force_cpu_bug(X86_BUG_MDS); - if (cpu_matches(MSBDS_ONLY)) + if (cpu_matches(cpu_vuln_whitelist, MSBDS_ONLY)) setup_force_cpu_bug(X86_BUG_MSBDS_ONLY); } - if (!cpu_matches(NO_SWAPGS)) + if (!cpu_matches(cpu_vuln_whitelist, NO_SWAPGS)) setup_force_cpu_bug(X86_BUG_SWAPGS); /* @@ -1157,7 +1160,7 @@ static void __init cpu_set_bug_bits(stru (ia32_cap & ARCH_CAP_TSX_CTRL_MSR))) setup_force_cpu_bug(X86_BUG_TAA); - if (cpu_matches(NO_MELTDOWN)) + if (cpu_matches(cpu_vuln_whitelist, NO_MELTDOWN)) return; /* Rogue Data Cache Load? No! */ @@ -1166,7 +1169,7 @@ static void __init cpu_set_bug_bits(stru setup_force_cpu_bug(X86_BUG_CPU_MELTDOWN); - if (cpu_matches(NO_L1TF)) + if (cpu_matches(cpu_vuln_whitelist, NO_L1TF)) return; setup_force_cpu_bug(X86_BUG_L1TF); From patchwork Tue Jun 9 17:45:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224647 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A974AC433E1 for ; Tue, 9 Jun 2020 18:03:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8240520734 for ; Tue, 9 Jun 2020 18:03:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725807; bh=KBJDsnC/ruZzhFkAosuSNvcMKVC5aIEuK5TDQj8MtJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wfS3bN1jmU7oPIDDIDnx6NBSfGHe8/FAiivjxt9+h6VPN6rucqnCTydyBj+xDdbYZ D5x1IlWzwqXuBM38cf+PqTn2G8xPCvXVL8jEwkpW4aQBPPcmq38znwSFNpvsDzrqw5 g5GTO8S1Bn8xUWiPNpmprV+G0gOmzq4IuwF124uE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732904AbgFISDS (ORCPT ); Tue, 9 Jun 2020 14:03:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:43540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729149AbgFIRwy (ORCPT ); Tue, 9 Jun 2020 13:52:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D45E52074B; Tue, 9 Jun 2020 17:52:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725174; bh=KBJDsnC/ruZzhFkAosuSNvcMKVC5aIEuK5TDQj8MtJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YxgbHg6bEcvkOMrvMFv5dNw9KsXciWO7AMJpLzQpvMxOw6RiYw1viJDQ5NQV35PVw 8Om2V3cdcSrSyoYtbCV/u26bDB36BcHKmFLFw1jX0w4nj/QvYhfQGhw+EER9pYUf2+ 1hZnAF+XWsq9nnJH8l1tzHRv2SK5pvkbMegG5wVg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josh Poimboeuf , Thomas Gleixner Subject: [PATCH 5.4 32/34] x86/speculation: Add Ivy Bridge to affected list Date: Tue, 9 Jun 2020 19:45:28 +0200 Message-Id: <20200609174058.092286604@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Josh Poimboeuf commit 3798cc4d106e91382bfe016caa2edada27c2bb3f upstream Make the docs match the code. Signed-off-by: Josh Poimboeuf Signed-off-by: Thomas Gleixner Signed-off-by: Greg Kroah-Hartman --- Documentation/admin-guide/hw-vuln/special-register-buffer-data-sampling.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/Documentation/admin-guide/hw-vuln/special-register-buffer-data-sampling.rst +++ b/Documentation/admin-guide/hw-vuln/special-register-buffer-data-sampling.rst @@ -27,6 +27,8 @@ by software using TSX_CTRL_MSR otherwise ============= ============ ======== common name Family_Model Stepping ============= ============ ======== + IvyBridge 06_3AH All + Haswell 06_3CH All Haswell_L 06_45H All Haswell_G 06_46H All @@ -37,9 +39,8 @@ by software using TSX_CTRL_MSR otherwise Skylake_L 06_4EH All Skylake 06_5EH All - Kabylake_L 06_8EH <=0xC - - Kabylake 06_9EH <=0xD + Kabylake_L 06_8EH <= 0xC + Kabylake 06_9EH <= 0xD ============= ============ ======== Related CVEs From patchwork Tue Jun 9 17:45:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224648 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C16E3C433DF for ; Tue, 9 Jun 2020 18:03:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F5B6206D5 for ; Tue, 9 Jun 2020 18:03:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725792; bh=Nm6Enj1yAA/to0vIuhmN9PTYANqMr4oTBzNdJPmi7wI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sKUzHkEpUDhyJSyGaEpGCx3zncMoB4EppP1kOVEOUfLebUASTdOW44z3UCVTtIckn SkWO48sQyShRzBHxmrDKhkG4riLmqExhP89MgSbhkkydQdqRVr6TXd+d1k4brCMUtl 50gtBt/29795CYKQqPFimgb8jx/69oA+lljVf9pI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732964AbgFIRxA (ORCPT ); Tue, 9 Jun 2020 13:53:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:43614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732957AbgFIRw7 (ORCPT ); Tue, 9 Jun 2020 13:52:59 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 54D33207C3; Tue, 9 Jun 2020 17:52:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591725178; bh=Nm6Enj1yAA/to0vIuhmN9PTYANqMr4oTBzNdJPmi7wI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CWOJ7bREQH891tgca68yKghTqbUBg3R3OK2eU00Fzm7jGU1Ztnw+t9zZWIYaZ7sbh y/65KW4LwHbc8zK2jSduYzZ3bf+v7/CfUOSplq7Yz23wv2iaeF0aGhI1HSbLuVlrZ/ igRQLAcNjL4/9J2QxC8JkOc88Dycgf5a4Sem9CAQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Gortmaker , Roi Dayan , Mark Bloch , Saeed Mahameed Subject: [PATCH 5.4 34/34] Revert "net/mlx5: Annotate mutex destroy for root ns" Date: Tue, 9 Jun 2020 19:45:30 +0200 Message-Id: <20200609174058.653317561@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200609174052.628006868@linuxfoundation.org> References: <20200609174052.628006868@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Greg Kroah-Hartman This reverts commit 3f4f034a8676e366857861e76c3ad11ae059b2fb which is commit 9ca415399dae133b00273a4283ef31d003a6818d upstream. It was backported incorrectly, Paul writes at: https://lore.kernel.org/r/20200607203425.GD23662@windriver.com I happened to notice this commit: 9ca415399dae - "net/mlx5: Annotate mutex destroy for root ns" ...was backported to 4.19 and 5.4 and v5.6 in linux-stable. It patches del_sw_root_ns() - which only exists after v5.7-rc7 from: 6eb7a268a99b - "net/mlx5: Don't maintain a case of del_sw_func being null" which creates the one line del_sw_root_ns stub function around kfree(node) by breaking it out of tree_put_node(). In the absense of del_sw_root_ns - the backport finds an identical one line kfree stub fcn - named del_sw_prio from this earlier commit: 139ed6c6c46a - "net/mlx5: Fix steering memory leak" [in v4.15-rc5] and then puts the mutex_destroy() into that (wrong) function, instead of putting it into tree_put_node where the root ns case used to be hand Reported-by: Paul Gortmaker Cc: Roi Dayan Cc: Mark Bloch Cc: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 6 ------ 1 file changed, 6 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -417,12 +417,6 @@ static void del_sw_ns(struct fs_node *no static void del_sw_prio(struct fs_node *node) { - struct mlx5_flow_root_namespace *root_ns; - struct mlx5_flow_namespace *ns; - - fs_get_obj(ns, node); - root_ns = container_of(ns, struct mlx5_flow_root_namespace, ns); - mutex_destroy(&root_ns->chain_lock); kfree(node); }