Skip to content
  1. Apr 16, 2021
    • Potnuri Bharat Teja's avatar
      RDMA/cxgb4: check for ipv6 address properly while destroying listener · 0db5a93b
      Potnuri Bharat Teja authored
      [ Upstream commit 603c4690 ]
      
      ipv6 bit is wrongly set by the below which causes fatal adapter lookup
      engine errors for ipv4 connections while destroying a listener.  Fix it to
      properly check the local address for ipv6.
      
      Fixes: 3408be14
      
       ("RDMA/cxgb4: Fix adapter LE hash errors while destroying ipv6 listening server")
      Link: https://lore.kernel.org/r/20210331135715.30072-1-bharat@chelsio.com
      Signed-off-by: default avatarPotnuri Bharat Teja <bharat@chelsio.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0db5a93b
    • Alexander Gordeev's avatar
      s390/cpcmd: fix inline assembly register clobbering · bf886e59
      Alexander Gordeev authored
      [ Upstream commit 7a2f9144 ]
      
      Register variables initialized using arithmetic. That leads to
      kasan instrumentaton code corrupting the registers contents.
      Follow GCC guidlines and use temporary variables for assigning
      init values to register variables.
      
      Fixes: 94c12cc7
      
       ("[S390] Inline assembly cleanup.")
      Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      Acked-by: default avatarIlya Leoshkevich <iii@linux.ibm.com>
      Link: https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Local-Register-Variables.html
      Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      bf886e59
    • Zqiang's avatar
      workqueue: Move the position of debug_work_activate() in __queue_work() · b737254f
      Zqiang authored
      [ Upstream commit 0687c66b ]
      
      The debug_work_activate() is called on the premise that
      the work can be inserted, because if wq be in WQ_DRAINING
      status, insert work may be failed.
      
      Fixes: e41e704b
      
       ("workqueue: improve destroy_workqueue() debuggability")
      Signed-off-by: default avatarZqiang <qiang.zhang@windriver.com>
      Reviewed-by: default avatarLai Jiangshan <jiangshanlai@gmail.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b737254f
    • Lukasz Bartosik's avatar
      clk: fix invalid usage of list cursor in unregister · ea96fc0c
      Lukasz Bartosik authored
      [ Upstream commit 70454655 ]
      
      Fix invalid usage of a list_for_each_entry cursor in
      clk_notifier_unregister(). When list is empty or if the list
      is completely traversed (without breaking from the loop on one
      of the entries) then the list cursor does not point to a valid
      entry and therefore should not be used. The patch fixes a logical
      bug that hasn't been seen in pratice however it is analogus
      to the bug fixed in clk_notifier_register().
      
      The issue was dicovered when running 5.12-rc1 kernel on x86_64
      with KASAN enabled:
      BUG: KASAN: global-out-of-bounds in clk_notifier_register+0xab/0x230
      Read of size 8 at addr ffffffffa0d10588 by task swapper/0/1
      
      CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.12.0-rc1 #1
      Hardware name: Google Caroline/Caroline,
      BIOS Google_Caroline.7820.430.0 07/20/2018
      Call Trace:
       dump_stack+0xee/0x15c
       print_address_description+0x1e/0x2dc
       kasan_report+0x188/0x1ce
       ? clk_notifier_register+0xab/0x230
       ? clk_prepare_lock+0x15/0x7b
       ? clk_notifier_register+0xab/0x230
       clk_notifier_register+0xab/0x230
       dw8250_probe+0xc01/0x10d4
       ...
       Memory state around the buggy address:
        ffffffffa0d10480: 00 00 00 00 00 03 f9 f9 f9 f9 f9 f9 00 00 00 00
        ffffffffa0d10500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f9 f9
       >ffffffffa0d10580: f9 f9 f9 f9 00 00 00 00 00 00 00 00 00 00 00 00
                                ^
        ffffffffa0d10600: 00 00 00 00 00 00 f9 f9 f9 f9 f9 f9 00 00 00 00
        ffffffffa0d10680: 00 00 00 00 00 00 00 00 f9 f9 f9 f9 00 00 00 00
        ==================================================================
      
      Fixes: b2476490
      
       ("clk: introduce the common clock framework")
      Reported-by: default avatarLukasz Majczak <lma@semihalf.com>
      Signed-off-by: default avatarLukasz Bartosik <lb@semihalf.com>
      Link: https://lore.kernel.org/r/20210401225149.18826-2-lb@semihalf.com
      Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ea96fc0c
    • Arnd Bergmann's avatar
      soc/fsl: qbman: fix conflicting alignment attributes · d20e26f5
      Arnd Bergmann authored
      [ Upstream commit 040f3119 ]
      
      When building with W=1, gcc points out that the __packed attribute
      on struct qm_eqcr_entry conflicts with the 8-byte alignment
      attribute on struct qm_fd inside it:
      
      drivers/soc/fsl/qbman/qman.c:189:1: error: alignment 1 of 'struct qm_eqcr_entry' is less than 8 [-Werror=packed-not-aligned]
      
      I assume that the alignment attribute is the correct one, and
      that qm_eqcr_entry cannot actually be unaligned in memory,
      so add the same alignment on the outer struct.
      
      Fixes: c535e923
      
       ("soc/fsl: Introduce DPAA 1.x QMan device driver")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20210323131530.2619900-1-arnd@kernel.org'
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d20e26f5
    • Lv Yunlong's avatar
      net:tipc: Fix a double free in tipc_sk_mcast_rcv · d0d49f2c
      Lv Yunlong authored
      [ Upstream commit 6bf24dc0 ]
      
      In the if(skb_peek(arrvq) == skb) branch, it calls __skb_dequeue(arrvq) to get
      the skb by skb = skb_peek(arrvq). Then __skb_dequeue() unlinks the skb from arrvq
      and returns the skb which equals to skb_peek(arrvq). After __skb_dequeue(arrvq)
      finished, the skb is freed by kfree_skb(__skb_dequeue(arrvq)) in the first time.
      
      Unfortunately, the same skb is freed in the second time by kfree_skb(skb) after
      the branch completed.
      
      My patch removes kfree_skb() in the if(skb_peek(arrvq) == skb) branch, because
      this skb will be freed by kfree_skb(skb) finally.
      
      Fixes: cb1b7280
      
       ("tipc: eliminate race condition at multicast reception")
      Signed-off-by: default avatarLv Yunlong <lyl2019@mail.ustc.edu.cn>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d0d49f2c
    • Claudiu Manoil's avatar
      gianfar: Handle error code at MAC address change · 6157a79c
      Claudiu Manoil authored
      [ Upstream commit bff5b625 ]
      
      Handle return error code of eth_mac_addr();
      
      Fixes: 3d23a05c
      
       ("gianfar: Enable changing mac addr when if up")
      Signed-off-by: default avatarClaudiu Manoil <claudiu.manoil@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6157a79c
    • Eric Dumazet's avatar
      sch_red: fix off-by-one checks in red_check_params() · a3210f91
      Eric Dumazet authored
      [ Upstream commit 3a87571f ]
      
      This fixes following syzbot report:
      
      UBSAN: shift-out-of-bounds in ./include/net/red.h:237:23
      shift exponent 32 is too large for 32-bit type 'unsigned int'
      CPU: 1 PID: 8418 Comm: syz-executor170 Not tainted 5.12.0-rc4-next-20210324-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:79 [inline]
       dump_stack+0x141/0x1d7 lib/dump_stack.c:120
       ubsan_epilogue+0xb/0x5a lib/ubsan.c:148
       __ubsan_handle_shift_out_of_bounds.cold+0xb1/0x181 lib/ubsan.c:327
       red_set_parms include/net/red.h:237 [inline]
       choke_change.cold+0x3c/0xc8 net/sched/sch_choke.c:414
       qdisc_create+0x475/0x12f0 net/sched/sch_api.c:1247
       tc_modify_qdisc+0x4c8/0x1a50 net/sched/sch_api.c:1663
       rtnetlink_rcv_msg+0x44e/0xad0 net/core/rtnetlink.c:5553
       netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2502
       netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline]
       netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1338
       netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1927
       sock_sendmsg_nosec net/socket.c:654 [inline]
       sock_sendmsg+0xcf/0x120 net/socket.c:674
       ____sys_sendmsg+0x6e8/0x810 net/socket.c:2350
       ___sys_sendmsg+0xf3/0x170 net/socket.c:2404
       __sys_sendmsg+0xe5/0x1b0 net/socket.c:2433
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      RIP: 0033:0x43f039
      Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 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 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
      RSP: 002b:00007ffdfa725168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 0000000000400488 RCX: 000000000043f039
      RDX: 0000000000000000 RSI: 0000000020000040 RDI: 0000000000000004
      RBP: 0000000000403020 R08: 0000000000400488 R09: 0000000000400488
      R10: 0000000000400488 R11: 0000000000000246 R12: 00000000004030b0
      R13: 0000000000000000 R14: 00000000004ac018 R15: 0000000000400488
      
      Fixes: 8afa10cb
      
       ("net_sched: red: Avoid illegal values")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a3210f91
    • Pavel Tikhomirov's avatar
      net: sched: sch_teql: fix null-pointer dereference · 7e356ee3
      Pavel Tikhomirov authored
      commit 1ffbc7ea upstream.
      
      Reproduce:
      
        modprobe sch_teql
        tc qdisc add dev teql0 root teql0
      
      This leads to (for instance in Centos 7 VM) OOPS:
      
      [  532.366633] BUG: unable to handle kernel NULL pointer dereference at 00000000000000a8
      [  532.366733] IP: [<ffffffffc06124a8>] teql_destroy+0x18/0x100 [sch_teql]
      [  532.366825] PGD 80000001376d5067 PUD 137e37067 PMD 0
      [  532.366906] Oops: 0000 [#1] SMP
      [  532.366987] Modules linked in: sch_teql ...
      [  532.367945] CPU: 1 PID: 3026 Comm: tc Kdump: loaded Tainted: G               ------------ T 3.10.0-1062.7.1.el7.x86_64 #1
      [  532.368041] Hardware name: Virtuozzo KVM, BIOS 1.11.0-2.vz7.2 04/01/2014
      [  532.368125] task: ffff8b7d37d31070 ti: ffff8b7c9fdbc000 task.ti: ffff8b7c9fdbc000
      [  532.368224] RIP: 0010:[<ffffffffc06124a8>]  [<ffffffffc06124a8>] teql_destroy+0x18/0x100 [sch_teql]
      [  532.368320] RSP: 0018:ffff8b7c9fdbf8e0  EFLAGS: 00010286
      [  532.368394] RAX: ffffffffc0612490 RBX: ffff8b7cb1565e00 RCX: ffff8b7d35ba2000
      [  532.368476] RDX: ffff8b7d35ba2000 RSI: 0000000000000000 RDI: ffff8b7cb1565e00
      [  532.368557] RBP: ffff8b7c9fdbf8f8 R08: ffff8b7d3fd1f140 R09: ffff8b7d3b001600
      [  532.368638] R10: ffff8b7d3b001600 R11: ffffffff84c7d65b R12: 00000000ffffffd8
      [  532.368719] R13: 0000000000008000 R14: ffff8b7d35ba2000 R15: ffff8b7c9fdbf9a8
      [  532.368800] FS:  00007f6a4e872740(0000) GS:ffff8b7d3fd00000(0000) knlGS:0000000000000000
      [  532.368885] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  532.368961] CR2: 00000000000000a8 CR3: 00000001396ee000 CR4: 00000000000206e0
      [  532.369046] Call Trace:
      [  532.369159]  [<ffffffff84c8192e>] qdisc_create+0x36e/0x450
      [  532.369268]  [<ffffffff846a9b49>] ? ns_capable+0x29/0x50
      [  532.369366]  [<ffffffff849afde2>] ? nla_parse+0x32/0x120
      [  532.369442]  [<ffffffff84c81b4c>] tc_modify_qdisc+0x13c/0x610
      [  532.371508]  [<ffffffff84c693e7>] rtnetlink_rcv_msg+0xa7/0x260
      [  532.372668]  [<ffffffff84907b65>] ? sock_has_perm+0x75/0x90
      [  532.373790]  [<ffffffff84c69340>] ? rtnl_newlink+0x890/0x890
      [  532.374914]  [<ffffffff84c8da7b>] netlink_rcv_skb+0xab/0xc0
      [  532.376055]  [<ffffffff84c63708>] rtnetlink_rcv+0x28/0x30
      [  532.377204]  [<ffffffff84c8d400>] netlink_unicast+0x170/0x210
      [  532.378333]  [<ffffffff84c8d7a8>] netlink_sendmsg+0x308/0x420
      [  532.379465]  [<ffffffff84c2f3a6>] sock_sendmsg+0xb6/0xf0
      [  532.380710]  [<ffffffffc034a56e>] ? __xfs_filemap_fault+0x8e/0x1d0 [xfs]
      [  532.381868]  [<ffffffffc034a75c>] ? xfs_filemap_fault+0x2c/0x30 [xfs]
      [  532.383037]  [<ffffffff847ec23a>] ? __do_fault.isra.61+0x8a/0x100
      [  532.384144]  [<ffffffff84c30269>] ___sys_sendmsg+0x3e9/0x400
      [  532.385268]  [<ffffffff847f3fad>] ? handle_mm_fault+0x39d/0x9b0
      [  532.386387]  [<ffffffff84d88678>] ? __do_page_fault+0x238/0x500
      [  532.387472]  [<ffffffff84c31921>] __sys_sendmsg+0x51/0x90
      [  532.388560]  [<ffffffff84c31972>] SyS_sendmsg+0x12/0x20
      [  532.389636]  [<ffffffff84d8dede>] system_call_fastpath+0x25/0x2a
      [  532.390704]  [<ffffffff84d8de21>] ? system_call_after_swapgs+0xae/0x146
      [  532.391753] Code: 00 00 00 00 00 00 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 66 66 66 66 90 55 48 89 e5 41 55 41 54 53 48 8b b7 48 01 00 00 48 89 fb <48> 8b 8e a8 00 00 00 48 85 c9 74 43 48 89 ca eb 0f 0f 1f 80 00
      [  532.394036] RIP  [<ffffffffc06124a8>] teql_destroy+0x18/0x100 [sch_teql]
      [  532.395127]  RSP <ffff8b7c9fdbf8e0>
      [  532.396179] CR2: 00000000000000a8
      
      Null pointer dereference happens on master->slaves dereference in
      teql_destroy() as master is null-pointer.
      
      When qdisc_create() calls teql_qdisc_init() it imediately fails after
      check "if (m->dev == dev)" because both devices are teql0, and it does
      not set qdisc_priv(sch)->m leaving it zero on error path, then
      qdisc_create() imediately calls teql_destroy() which does not expect
      zero master pointer and we get OOPS.
      
      Fixes: 87b60cfa
      
       ("net_sched: fix error recovery at qdisc creation")
      Signed-off-by: default avatarPavel Tikhomirov <ptikhomirov@virtuozzo.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7e356ee3
    • Tetsuo Handa's avatar
      batman-adv: initialize "struct batadv_tvlv_tt_vlan_data"->reserved field · d1168e0d
      Tetsuo Handa authored
      commit 08c27f33 upstream.
      
      KMSAN found uninitialized value at batadv_tt_prepare_tvlv_local_data()
      [1], for commit ced72933 ("batman-adv: use CRC32C instead of CRC16
      in TT code") inserted 'reserved' field into "struct batadv_tvlv_tt_data"
      and commit 7ea7b4a1
      
       ("batman-adv: make the TT CRC logic VLAN
      specific") moved that field to "struct batadv_tvlv_tt_vlan_data" but left
      that field uninitialized.
      
      [1] https://syzkaller.appspot.com/bug?id=07f3e6dba96f0eb3cabab986adcd8a58b9bdbe9d
      
      Reported-by: default avatarsyzbot <syzbot+50ee810676e6a089487b@syzkaller.appspotmail.com>
      Tested-by: default avatarsyzbot <syzbot+50ee810676e6a089487b@syzkaller.appspotmail.com>
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Fixes: ced72933 ("batman-adv: use CRC32C instead of CRC16 in TT code")
      Fixes: 7ea7b4a1
      
       ("batman-adv: make the TT CRC logic VLAN specific")
      Acked-by: default avatarSven Eckelmann <sven@narfation.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d1168e0d
    • Gao Xiang's avatar
      parisc: avoid a warning on u8 cast for cmpxchg on u8 pointers · f0612443
      Gao Xiang authored
      commit 4d752e5a upstream.
      
      commit b344d6a8
      
       ("parisc: add support for cmpxchg on u8 pointers")
      can generate a sparse warning ("cast truncates bits from constant
      value"), which has been reported several times [1] [2] [3].
      
      The original code worked as expected, but anyway, let silence such
      sparse warning as what others did [4].
      
      [1] https://lore.kernel.org/r/202104061220.nRMBwCXw-lkp@intel.com
      [2] https://lore.kernel.org/r/202012291914.T5Agcn99-lkp@intel.com
      [3] https://lore.kernel.org/r/202008210829.KVwn7Xeh%25lkp@intel.com
      [4] https://lore.kernel.org/r/20210315131512.133720-2-jacopo+renesas@jmondi.org
      Cc: Liam Beguin <liambeguin@gmail.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: stable@vger.kernel.org # v5.8+
      Signed-off-by: default avatarGao Xiang <hsiangkao@redhat.com>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f0612443
    • Helge Deller's avatar
      parisc: parisc-agp requires SBA IOMMU driver · a7e4b113
      Helge Deller authored
      commit 9054284e
      
       upstream.
      
      Add a dependency to the SBA IOMMU driver to avoid:
      ERROR: modpost: "sba_list" [drivers/char/agp/parisc-agp.ko] undefined!
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a7e4b113
    • Jack Qiu's avatar
      fs: direct-io: fix missing sdio->boundary · 16c15e14
      Jack Qiu authored
      commit df41872b upstream.
      
      I encountered a hung task issue, but not a performance one.  I run DIO
      on a device (need lba continuous, for example open channel ssd), maybe
      hungtask in below case:
      
        DIO:						Checkpoint:
        get addr A(at boundary), merge into BIO,
        no submit because boundary missing
      						flush dirty data(get addr A+1), wait IO(A+1)
      						writeback timeout, because DIO(A) didn't submit
        get addr A+2 fail, because checkpoint is doing
      
      dio_send_cur_page() may clear sdio->boundary, so prevent it from missing
      a boundary.
      
      Link: https://lkml.kernel.org/r/20210322042253.38312-1-jack.qiu@huawei.com
      Fixes: b1058b98
      
       ("direct-io: submit bio after boundary buffer is added to it")
      Signed-off-by: default avatarJack Qiu <jack.qiu@huawei.com>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      16c15e14
    • Wengang Wang's avatar
      ocfs2: fix deadlock between setattr and dio_end_io_write · 466d0421
      Wengang Wang authored
      commit 90bd070a upstream.
      
      The following deadlock is detected:
      
        truncate -> setattr path is waiting for pending direct IO to be done (inode->i_dio_count become zero) with inode->i_rwsem held (down_write).
      
        PID: 14827  TASK: ffff881686a9af80  CPU: 20  COMMAND: "ora_p005_hrltd9"
         #0  __schedule at ffffffff818667cc
         #1  schedule at ffffffff81866de6
         #2  inode_dio_wait at ffffffff812a2d04
         #3  ocfs2_setattr at ffffffffc05f322e [ocfs2]
         #4  notify_change at ffffffff812a5a09
         #5  do_truncate at ffffffff812808f5
         #6  do_sys_ftruncate.constprop.18 at ffffffff81280cf2
         #7  sys_ftruncate at ffffffff81280d8e
         #8  do_syscall_64 at ffffffff81003949
         #9  entry_SYSCALL_64_after_hwframe at ffffffff81a001ad
      
      dio completion path is going to complete one direct IO (decrement
      inode->i_dio_count), but before that it hung at locking inode->i_rwsem:
      
         #0  __schedule+700 at ffffffff818667cc
         #1  schedule+54 at ffffffff81866de6
         #2  rwsem_down_write_failed+536 at ffffffff8186aa28
         #3  call_rwsem_down_write_failed+23 at ffffffff8185a1b7
         #4  down_write+45 at ffffffff81869c9d
         #5  ocfs2_dio_end_io_write+180 at ffffffffc05d5444 [ocfs2]
         #6  ocfs2_dio_end_io+85 at ffffffffc05d5a85 [ocfs2]
         #7  dio_complete+140 at ffffffff812c873c
         #8  dio_aio_complete_work+25 at ffffffff812c89f9
         #9  process_one_work+361 at ffffffff810b1889
        #10  worker_thread+77 at ffffffff810b233d
        #11  kthread+261 at ffffffff810b7fd5
        #12  ret_from_fork+62 at ffffffff81a0035e
      
      Thus above forms ABBA deadlock.  The same deadlock was mentioned in
      upstream commit 28f5a8a7
      
       ("ocfs2: should wait dio before inode lock
      in ocfs2_setattr()").  It seems that that commit only removed the
      cluster lock (the victim of above dead lock) from the ABBA deadlock
      party.
      
      End-user visible effects: Process hang in truncate -> ocfs2_setattr path
      and other processes hang at ocfs2_dio_end_io_write path.
      
      This is to fix the deadlock itself.  It removes inode_lock() call from
      dio completion path to remove the deadlock and add ip_alloc_sem lock in
      setattr path to synchronize the inode modifications.
      
      [wen.gang.wang@oracle.com: remove the "had_alloc_lock" as suggested]
        Link: https://lkml.kernel.org/r/20210402171344.1605-1-wen.gang.wang@oracle.com
      
      Link: https://lkml.kernel.org/r/20210331203654.3911-1-wen.gang.wang@oracle.com
      Signed-off-by: default avatarWengang Wang <wen.gang.wang@oracle.com>
      Reviewed-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Cc: Changwei Ge <gechangwei@live.cn>
      Cc: Gang He <ghe@suse.com>
      Cc: Jun Piao <piaojun@huawei.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      466d0421
    • Sergei Trofimovich's avatar
      ia64: fix user_stack_pointer() for ptrace() · 84427f06
      Sergei Trofimovich authored
      commit 7ad1e366
      
       upstream.
      
      ia64 has two stacks:
      
       - memory stack (or stack), pointed at by by r12
      
       - register backing store (register stack), pointed at by
         ar.bsp/ar.bspstore with complications around dirty
         register frame on CPU.
      
      In [1] Dmitry noticed that PTRACE_GET_SYSCALL_INFO returns the register
      stack instead memory stack.
      
      The bug comes from the fact that user_stack_pointer() and
      current_user_stack_pointer() don't return the same register:
      
        ulong user_stack_pointer(struct pt_regs *regs) { return regs->ar_bspstore; }
        #define current_user_stack_pointer() (current_pt_regs()->r12)
      
      The change gets both back in sync.
      
      I think ptrace(PTRACE_GET_SYSCALL_INFO) is the only affected user by
      this bug on ia64.
      
      The change fixes 'rt_sigreturn.gen.test' strace test where it was
      observed initially.
      
      Link: https://bugs.gentoo.org/769614 [1]
      Link: https://lkml.kernel.org/r/20210331084447.2561532-1-slyfox@gentoo.org
      Signed-off-by: default avatarSergei Trofimovich <slyfox@gentoo.org>
      Reported-by: default avatarDmitry V. Levin <ldv@altlinux.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      84427f06
    • Muhammad Usama Anjum's avatar
      net: ipv6: check for validity before dereferencing cfg->fc_nlinfo.nlh · ff5eb74b
      Muhammad Usama Anjum authored
      commit 864db232
      
       upstream.
      
      nlh is being checked for validtity two times when it is dereferenced in
      this function. Check for validity again when updating the flags through
      nlh pointer to make the dereferencing safe.
      
      CC: <stable@vger.kernel.org>
      Addresses-Coverity: ("NULL pointer dereference")
      Signed-off-by: default avatarMuhammad Usama Anjum <musamaanjum@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ff5eb74b
    • Luca Fancellu's avatar
      xen/evtchn: Change irq_info lock to raw_spinlock_t · af48f185
      Luca Fancellu authored
      commit d120198b upstream.
      
      Unmask operation must be called with interrupt disabled,
      on preempt_rt spin_lock_irqsave/spin_unlock_irqrestore
      don't disable/enable interrupts, so use raw_* implementation
      and change lock variable in struct irq_info from spinlock_t
      to raw_spinlock_t
      
      Cc: stable@vger.kernel.org
      Fixes: 25da4618
      
       ("xen/events: don't unmask an event channel when an eoi is pending")
      Signed-off-by: default avatarLuca Fancellu <luca.fancellu@arm.com>
      Reviewed-by: default avatarJulien Grall <jgrall@amazon.com>
      Reviewed-by: default avatarWei Liu <wei.liu@kernel.org>
      Link: https://lore.kernel.org/r/20210406105105.10141-1-luca.fancellu@arm.com
      Signed-off-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      af48f185
    • Xiaoming Ni's avatar
      nfc: Avoid endless loops caused by repeated llcp_sock_connect() · 79fc2e47
      Xiaoming Ni authored
      commit 4b5db93e upstream.
      
      When sock_wait_state() returns -EINPROGRESS, "sk->sk_state" is
       LLCP_CONNECTING. In this case, llcp_sock_connect() is repeatedly invoked,
       nfc_llcp_sock_link() will add sk to local->connecting_sockets twice.
       sk->sk_node->next will point to itself, that will make an endless loop
       and hang-up the system.
      To fix it, check whether sk->sk_state is LLCP_CONNECTING in
       llcp_sock_connect() to avoid repeated invoking.
      
      Fixes: b4011239
      
       ("NFC: llcp: Fix non blocking sockets connections")
      Reported-by: default avatar"kiyin(尹亮)" <kiyin@tencent.com>
      Link: https://www.openwall.com/lists/oss-security/2020/11/01/1
      Cc: <stable@vger.kernel.org> #v3.11
      Signed-off-by: default avatarXiaoming Ni <nixiaoming@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      79fc2e47
    • Xiaoming Ni's avatar
      nfc: fix memory leak in llcp_sock_connect() · 83a09c10
      Xiaoming Ni authored
      commit 7574fcdb upstream.
      
      In llcp_sock_connect(), use kmemdup to allocate memory for
       "llcp_sock->service_name". The memory is not released in the sock_unlink
      label of the subsequent failure branch.
      As a result, memory leakage occurs.
      
      fix CVE-2020-25672
      
      Fixes: d646960f
      
       ("NFC: Initial LLCP support")
      Reported-by: default avatar"kiyin(尹亮)" <kiyin@tencent.com>
      Link: https://www.openwall.com/lists/oss-security/2020/11/01/1
      Cc: <stable@vger.kernel.org> #v3.3
      Signed-off-by: default avatarXiaoming Ni <nixiaoming@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      83a09c10
    • Xiaoming Ni's avatar
      nfc: fix refcount leak in llcp_sock_connect() · 013b8099
      Xiaoming Ni authored
      commit 8a4cd82d upstream.
      
      nfc_llcp_local_get() is invoked in llcp_sock_connect(),
      but nfc_llcp_local_put() is not invoked in subsequent failure branches.
      As a result, refcount leakage occurs.
      To fix it, add calling nfc_llcp_local_put().
      
      fix CVE-2020-25671
      Fixes: c7aa1225
      
       ("NFC: Take a reference on the LLCP local pointer when creating a socket")
      Reported-by: default avatar"kiyin(尹亮)" <kiyin@tencent.com>
      Link: https://www.openwall.com/lists/oss-security/2020/11/01/1
      Cc: <stable@vger.kernel.org> #v3.6
      Signed-off-by: default avatarXiaoming Ni <nixiaoming@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      013b8099
    • Xiaoming Ni's avatar
      nfc: fix refcount leak in llcp_sock_bind() · 18013007
      Xiaoming Ni authored
      commit c33b1cc6 upstream.
      
      nfc_llcp_local_get() is invoked in llcp_sock_bind(),
      but nfc_llcp_local_put() is not invoked in subsequent failure branches.
      As a result, refcount leakage occurs.
      To fix it, add calling nfc_llcp_local_put().
      
      fix CVE-2020-25670
      Fixes: c7aa1225
      
       ("NFC: Take a reference on the LLCP local pointer when creating a socket")
      Reported-by: default avatar"kiyin(尹亮)" <kiyin@tencent.com>
      Link: https://www.openwall.com/lists/oss-security/2020/11/01/1
      Cc: <stable@vger.kernel.org> #v3.6
      Signed-off-by: default avatarXiaoming Ni <nixiaoming@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      18013007
    • Hans de Goede's avatar
      ASoC: intel: atom: Stop advertising non working S24LE support · e4a69c09
      Hans de Goede authored
      commit aa65bacd upstream.
      
      The SST firmware's media and deep-buffer inputs are hardcoded to
      S16LE, the corresponding DAIs don't have a hw_params callback and
      their prepare callback also does not take the format into account.
      
      So far the advertising of non working S24LE support has not caused
      issues because pulseaudio defaults to S16LE, but changing pulse-audio's
      config to use S24LE will result in broken sound.
      
      Pipewire is replacing pulse now and pipewire prefers S24LE over S16LE
      when available, causing the problem of the broken S24LE support to
      come to the surface now.
      
      Cc: stable@vger.kernel.org
      BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/866
      Fixes: 098c2cd2
      
       ("ASoC: Intel: Atom: add 24-bit support for media playback and capture")
      Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://lore.kernel.org/r/20210324132711.216152-2-hdegoede@redhat.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e4a69c09
    • Jonas Holmberg's avatar
      ALSA: aloop: Fix initialization of controls · 1f5e3544
      Jonas Holmberg authored
      commit 168632a4
      
       upstream.
      
      Add a control to the card before copying the id so that the numid field
      is initialized in the copy. Otherwise the numid field of active_id,
      format_id, rate_id and channels_id will be the same (0) and
      snd_ctl_notify() will not queue the events properly.
      
      Signed-off-by: default avatarJonas Holmberg <jonashg@axis.com>
      Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20210407075428.2666787-1-jonashg@axis.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1f5e3544
    • Ye Xiang's avatar
      iio: hid-sensor-prox: Fix scale not correct issue · 75a4fdb1
      Ye Xiang authored
      commit d68c592e upstream
      
      Currently, the proxy sensor scale is zero because it just return the
      exponent directly. To fix this issue, this patch use
      hid_sensor_format_scale to process the scale first then return the
      output.
      
      Fixes: 39a3a013
      
       ("iio: hid-sensors: Added Proximity Sensor Driver")
      Signed-off-by: default avatarYe Xiang <xiang.ye@intel.com>
      Link: https://lore.kernel.org/r/20210130102530.31064-1-xiang.ye@intel.com
      Cc: <Stable@vger.kernel.org>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      [sudip: adjust context]
      Signed-off-by: default avatarSudip Mukherjee <sudipm.mukherjee@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      75a4fdb1
    • Nicolas Pitre's avatar
      ARM: 8723/2: always assume the "unified" syntax for assembly code · aa0ef53e
      Nicolas Pitre authored
      commit 75fea300
      
       upstream.
      
      The GNU assembler has implemented the "unified syntax" parsing since
      2005. This "unified" syntax is required when the kernel is built in
      Thumb2 mode. However the "unified" syntax is a mixed bag of features,
      including not requiring a `#' prefix with immediate operands. This leads
      to situations where some code builds just fine in Thumb2 mode and fails
      to build in ARM mode if that prefix is missing. This behavior
      discrepancy makes build tests less valuable, forcing both ARM and Thumb2
      builds for proper coverage.
      
      Let's "fix" this issue by always using the "unified" syntax for both ARM
      and Thumb2 mode. Given that the documented minimum binutils version that
      properly builds the kernel is version 2.20 released in 2010, we can
      assume that any toolchain capable of building the latest kernel is also
      "unified syntax" capable.
      
      Whith this, a bunch of macros used to mask some differences between both
      syntaxes can be removed, with the side effect of making LTO easier.
      
      Suggested-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: default avatarNicolas Pitre <nico@linaro.org>
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      [nathan: Resolve small conflict on 4.9 due to a lack of 49460970
      
      ]
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa0ef53e
  2. Apr 10, 2021