Skip to content
Snippets Groups Projects
  1. Jun 01, 2021
  2. May 31, 2021
  3. May 29, 2021
  4. May 27, 2021
  5. May 26, 2021
    • Miklos Szeredi's avatar
      fuse: update attr_version counter on fuse_notify_inval_inode() · 8d70af17
      Miklos Szeredi authored
      
      mainline inclusion
      from mainline-v5.8-rc1
      commit 5ddd9ced
      category: bugfix
      bugzilla: 37636
      CVE: NA
      
      -------------------------------------------------
      
      A GETATTR request can race with FUSE_NOTIFY_INVAL_INODE, resulting in the
      attribute cache being updated with stale information after the
      invalidation.
      
      Fix this by bumping the attribute version in fuse_reverse_inval_inode().
      
      Reported-by: default avatarKrzysztof Rusek <rusek@9livesdata.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      
      Conflict: fs/fuse/inode.c
      a. commit f15ecfef ("fuse: Introduce fi->lock to protect write related fields")
      is not backported, 'fi->lock' do not exist.
      b. commit 4510d86f ("fuse: Convert fc->attr_version into atomic64_t") is not
      backported, 'fc->lock' is needed to read 'fc->attr_version'.
      Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
      Reviewed-by: default avatarZhang Yi <yi.zhang@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      8d70af17
    • Xingjun Liu's avatar
      alinux: random: speed up the initialization of module · 99161116
      Xingjun Liu authored
      
      anolis inclusion
      from anolis_master
      commit 7afda44c8a9e043f8f16dcc57dd8ef615522e2c8
      category: performance
      bugzilla: NA
      CVE: NA
      ---------------------------
      
      alinux: random: speed up the initialization of module
      
      During the module initialization phase, entropy will be added
      to entropy pool for every interrupt, the change should speed up
      initialization of the random module.
      
      Before optimization:
      [   22.180236] random: crng init done
      
      After optimization:
      [    1.474832] random: crng init done
      
      Signed-off-by: default avatarXingjun Liu <xingjun.lxj@alibaba-inc.com>
      Reviewed-by: default avatarLiu Jiang <gerry@linux.alibaba.com>
      Reviewed-by: default avatarCaspar Zhang <caspar@linux.alibaba.com>
      Reviewed-by: default avatarJia Zhang <zhang.jia@linux.alibaba.com>
      Reviewed-by: default avatarYang Shi <yang.shi@linux.alibaba.com>
      Reviewed-by: default avatarLiu Bo <bo.liu@linux.alibaba.com>
      Signed-off-by: default avatarChen Jialong <chenjialong@huawei.com>
      Reviewed-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
      Reviewed-by: default avatarZiyuan Hu <huziyuan@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      99161116
    • Pavel Skripkin's avatar
      net: mac802154: Fix general protection fault · 54dc6b64
      Pavel Skripkin authored
      
      stable inclusion
      from linux-4.19.187
      commit c166c0f5311dc9de687b8985574a5ee5166d367e
      CVE: CVE-2021-33033
      
      --------------------------------
      
      commit 1165affd484889d4986cf3b724318935a0b120d8 upstream.
      
      syzbot found general protection fault in crypto_destroy_tfm()[1].
      It was caused by wrong clean up loop in llsec_key_alloc().
      If one of the tfm array members is in IS_ERR() range it will
      cause general protection fault in clean up function [1].
      
      Call Trace:
       crypto_free_aead include/crypto/aead.h:191 [inline] [1]
       llsec_key_alloc net/mac802154/llsec.c:156 [inline]
       mac802154_llsec_key_add+0x9e0/0xcc0 net/mac802154/llsec.c:249
       ieee802154_add_llsec_key+0x56/0x80 net/mac802154/cfg.c:338
       rdev_add_llsec_key net/ieee802154/rdev-ops.h:260 [inline]
       nl802154_add_llsec_key+0x3d3/0x560 net/ieee802154/nl802154.c:1584
       genl_family_rcv_msg_doit+0x228/0x320 net/netlink/genetlink.c:739
       genl_family_rcv_msg net/netlink/genetlink.c:783 [inline]
       genl_rcv_msg+0x328/0x580 net/netlink/genetlink.c:800
       netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2502
       genl_rcv+0x24/0x40 net/netlink/genetlink.c:811
       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
      
      Signed-off-by: default avatarPavel Skripkin <paskripkin@gmail.com>
      Reported-by: default avatar <syzbot+9ec037722d2603a9f52e@syzkaller.appspotmail.com>
      Acked-by: default avatarAlexander Aring <aahringo@redhat.com>
      Link: https://lore.kernel.org/r/20210304152125.1052825-1-paskripkin@gmail.com
      
      
      Signed-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Reviewed-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
      Reviewed-by: default avatarYue Haibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      54dc6b64
    • Paul Moore's avatar
      cipso,calipso: resolve a number of problems with the DOI refcounts · a409c9a6
      Paul Moore authored
      
      stable inclusion
      from linux-4.19.181
      commit a44af1c69737f9e64d5134c34eb9d5c4c2e04da1
      CVE: CVE-2021-33033
      
      --------------------------------
      
      commit ad5d07f4a9cd671233ae20983848874731102c08 upstream.
      
      The current CIPSO and CALIPSO refcounting scheme for the DOI
      definitions is a bit flawed in that we:
      
      1. Don't correctly match gets/puts in netlbl_cipsov4_list().
      2. Decrement the refcount on each attempt to remove the DOI from the
         DOI list, only removing it from the list once the refcount drops
         to zero.
      
      This patch fixes these problems by adding the missing "puts" to
      netlbl_cipsov4_list() and introduces a more conventional, i.e.
      not-buggy, refcounting mechanism to the DOI definitions.  Upon the
      addition of a DOI to the DOI list, it is initialized with a refcount
      of one, removing a DOI from the list removes it from the list and
      drops the refcount by one; "gets" and "puts" behave as expected with
      respect to refcounts, increasing and decreasing the DOI's refcount by
      one.
      
      Fixes: b1edeb10 ("netlabel: Replace protocol/NetLabel linking with refrerence counts")
      Fixes: d7cce015 ("netlabel: Add support for removing a CALIPSO DOI.")
      Reported-by: default avatar <syzbot+9ec037722d2603a9f52e@syzkaller.appspotmail.com>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Reviewed-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
      Reviewed-by: default avatarYue Haibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      a409c9a6
    • Archie Pusaka's avatar
      Bluetooth: verify AMP hci_chan before amp_destroy · 929b7e76
      Archie Pusaka authored
      
      stable inclusion
      from linux-4.19.191
      commit 75e26178e26f910f7f26c79c2824b726eecf0dfb
      CVE: CVE-2021-33034
      
      --------------------------------
      
      commit 5c4c8c9544099bb9043a10a5318130a943e32fc3 upstream.
      
      hci_chan can be created in 2 places: hci_loglink_complete_evt() if
      it is an AMP hci_chan, or l2cap_conn_add() otherwise. In theory,
      Only AMP hci_chan should be removed by a call to
      hci_disconn_loglink_complete_evt(). However, the controller might mess
      up, call that function, and destroy an hci_chan which is not initiated
      by hci_loglink_complete_evt().
      
      This patch adds a verification that the destroyed hci_chan must have
      been init'd by hci_loglink_complete_evt().
      
      Example crash call trace:
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0xe3/0x144 lib/dump_stack.c:118
       print_address_description+0x67/0x22a mm/kasan/report.c:256
       kasan_report_error mm/kasan/report.c:354 [inline]
       kasan_report mm/kasan/report.c:412 [inline]
       kasan_report+0x251/0x28f mm/kasan/report.c:396
       hci_send_acl+0x3b/0x56e net/bluetooth/hci_core.c:4072
       l2cap_send_cmd+0x5af/0x5c2 net/bluetooth/l2cap_core.c:877
       l2cap_send_move_chan_cfm_icid+0x8e/0xb1 net/bluetooth/l2cap_core.c:4661
       l2cap_move_fail net/bluetooth/l2cap_core.c:5146 [inline]
       l2cap_move_channel_rsp net/bluetooth/l2cap_core.c:5185 [inline]
       l2cap_bredr_sig_cmd net/bluetooth/l2cap_core.c:5464 [inline]
       l2cap_sig_channel net/bluetooth/l2cap_core.c:5799 [inline]
       l2cap_recv_frame+0x1d12/0x51aa net/bluetooth/l2cap_core.c:7023
       l2cap_recv_acldata+0x2ea/0x693 net/bluetooth/l2cap_core.c:7596
       hci_acldata_packet net/bluetooth/hci_core.c:4606 [inline]
       hci_rx_work+0x2bd/0x45e net/bluetooth/hci_core.c:4796
       process_one_work+0x6f8/0xb50 kernel/workqueue.c:2175
       worker_thread+0x4fc/0x670 kernel/workqueue.c:2321
       kthread+0x2f0/0x304 kernel/kthread.c:253
       ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:415
      
      Allocated by task 38:
       set_track mm/kasan/kasan.c:460 [inline]
       kasan_kmalloc+0x8d/0x9a mm/kasan/kasan.c:553
       kmem_cache_alloc_trace+0x102/0x129 mm/slub.c:2787
       kmalloc include/linux/slab.h:515 [inline]
       kzalloc include/linux/slab.h:709 [inline]
       hci_chan_create+0x86/0x26d net/bluetooth/hci_conn.c:1674
       l2cap_conn_add.part.0+0x1c/0x814 net/bluetooth/l2cap_core.c:7062
       l2cap_conn_add net/bluetooth/l2cap_core.c:7059 [inline]
       l2cap_connect_cfm+0x134/0x852 net/bluetooth/l2cap_core.c:7381
       hci_connect_cfm+0x9d/0x122 include/net/bluetooth/hci_core.h:1404
       hci_remote_ext_features_evt net/bluetooth/hci_event.c:4161 [inline]
       hci_event_packet+0x463f/0x72fa net/bluetooth/hci_event.c:5981
       hci_rx_work+0x197/0x45e net/bluetooth/hci_core.c:4791
       process_one_work+0x6f8/0xb50 kernel/workqueue.c:2175
       worker_thread+0x4fc/0x670 kernel/workqueue.c:2321
       kthread+0x2f0/0x304 kernel/kthread.c:253
       ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:415
      
      Freed by task 1732:
       set_track mm/kasan/kasan.c:460 [inline]
       __kasan_slab_free mm/kasan/kasan.c:521 [inline]
       __kasan_slab_free+0x106/0x128 mm/kasan/kasan.c:493
       slab_free_hook mm/slub.c:1409 [inline]
       slab_free_freelist_hook+0xaa/0xf6 mm/slub.c:1436
       slab_free mm/slub.c:3009 [inline]
       kfree+0x182/0x21e mm/slub.c:3972
       hci_disconn_loglink_complete_evt net/bluetooth/hci_event.c:4891 [inline]
       hci_event_packet+0x6a1c/0x72fa net/bluetooth/hci_event.c:6050
       hci_rx_work+0x197/0x45e net/bluetooth/hci_core.c:4791
       process_one_work+0x6f8/0xb50 kernel/workqueue.c:2175
       worker_thread+0x4fc/0x670 kernel/workqueue.c:2321
       kthread+0x2f0/0x304 kernel/kthread.c:253
       ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:415
      
      The buggy address belongs to the object at ffff8881d7af9180
       which belongs to the cache kmalloc-128 of size 128
      The buggy address is located 24 bytes inside of
       128-byte region [ffff8881d7af9180, ffff8881d7af9200)
      The buggy address belongs to the page:
      page:ffffea00075ebe40 count:1 mapcount:0 mapping:ffff8881da403200 index:0x0
      flags: 0x8000000000000200(slab)
      raw: 8000000000000200 dead000000000100 dead000000000200 ffff8881da403200
      raw: 0000000000000000 0000000080150015 00000001ffffffff 0000000000000000
      page dumped because: kasan: bad access detected
      
      Memory state around the buggy address:
       ffff8881d7af9080: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
       ffff8881d7af9100: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
      >ffff8881d7af9180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                  ^
       ffff8881d7af9200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
       ffff8881d7af9280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      
      Signed-off-by: default avatarArchie Pusaka <apusaka@chromium.org>
      Reported-by: default avatar <syzbot+98228e7407314d2d4ba2@syzkaller.appspotmail.com>
      Reviewed-by: default avatarAlain Michaud <alainm@chromium.org>
      Reviewed-by: default avatarAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Cc: George Kennedy <george.kennedy@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Reviewed-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      929b7e76
    • Or Cohen's avatar
      net/nfc: fix use-after-free llcp_sock_bind/connect · e7354fd8
      Or Cohen authored
      
      stable inclusion
      from linux-4.19.191
      commit 48fba458fe54cc2a980a05c13e6c19b8b2cfb610
      CVE: CVE-2021-23134
      
      --------------------------------
      
      commit c61760e6940dd4039a7f5e84a6afc9cdbf4d82b6 upstream.
      
      Commits 8a4cd82d ("nfc: fix refcount leak in llcp_sock_connect()")
      and c33b1cc62 ("nfc: fix refcount leak in llcp_sock_bind()")
      fixed a refcount leak bug in bind/connect but introduced a
      use-after-free if the same local is assigned to 2 different sockets.
      
      This can be triggered by the following simple program:
          int sock1 = socket( AF_NFC, SOCK_STREAM, NFC_SOCKPROTO_LLCP );
          int sock2 = socket( AF_NFC, SOCK_STREAM, NFC_SOCKPROTO_LLCP );
          memset( &addr, 0, sizeof(struct sockaddr_nfc_llcp) );
          addr.sa_family = AF_NFC;
          addr.nfc_protocol = NFC_PROTO_NFC_DEP;
          bind( sock1, (struct sockaddr*) &addr, sizeof(struct sockaddr_nfc_llcp) )
          bind( sock2, (struct sockaddr*) &addr, sizeof(struct sockaddr_nfc_llcp) )
          close(sock1);
          close(sock2);
      
      Fix this by assigning NULL to llcp_sock->local after calling
      nfc_llcp_local_put.
      
      This addresses CVE-2021-23134.
      
      Reported-by: default avatarOr Cohen <orcohen@paloaltonetworks.com>
      Reported-by: default avatarNadav Markus <nmarkus@paloaltonetworks.com>
      Fixes: c33b1cc62 ("nfc: fix refcount leak in llcp_sock_bind()")
      Signed-off-by: default avatarOr Cohen <orcohen@paloaltonetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Reviewed-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
      Reviewed-by: default avatarYue Haibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      e7354fd8