1. 06 Aug, 2019 23 commits
  2. 04 Aug, 2019 17 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.9.187 · 97d7530b
      Greg Kroah-Hartman authored
      97d7530b
    • Yan, Zheng's avatar
      ceph: hold i_ceph_lock when removing caps for freeing inode · 370bb858
      Yan, Zheng authored
      commit d6e47819 upstream.
      
      ceph_d_revalidate(, LOOKUP_RCU) may call __ceph_caps_issued_mask()
      on a freeing inode.
      Signed-off-by: default avatar"Yan, Zheng" <zyan@redhat.com>
      Reviewed-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      370bb858
    • Miroslav Lichvar's avatar
      drivers/pps/pps.c: clear offset flags in PPS_SETPARAMS ioctl · 91c5daaa
      Miroslav Lichvar authored
      commit 5515e9a6 upstream.
      
      The PPS assert/clear offset corrections are set by the PPS_SETPARAMS
      ioctl in the pps_ktime structs, which also contain flags.  The flags are
      not initialized by applications (using the timepps.h header) and they
      are not used by the kernel for anything except returning them back in
      the PPS_GETPARAMS ioctl.
      
      Set the flags to zero to make it clear they are unused and avoid leaking
      uninitialized data of the PPS_SETPARAMS caller to other applications
      that have a read access to the PPS device.
      
      Link: http://lkml.kernel.org/r/20190702092251.24303-1-mlichvar@redhat.comSigned-off-by: default avatarMiroslav Lichvar <mlichvar@redhat.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Acked-by: default avatarRodolfo Giometti <giometti@enneenne.com>
      Cc: Greg KH <greg@kroah.com>
      Cc: Dan Carpenter <dan.carpenter@oracle.com>
      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>
      91c5daaa
    • Jann Horn's avatar
      sched/fair: Don't free p->numa_faults with concurrent readers · 837ffc97
      Jann Horn authored
      commit 16d51a59 upstream.
      
      When going through execve(), zero out the NUMA fault statistics instead of
      freeing them.
      
      During execve, the task is reachable through procfs and the scheduler. A
      concurrent /proc/*/sched reader can read data from a freed ->numa_faults
      allocation (confirmed by KASAN) and write it back to userspace.
      I believe that it would also be possible for a use-after-free read to occur
      through a race between a NUMA fault and execve(): task_numa_fault() can
      lead to task_numa_compare(), which invokes task_weight() on the currently
      running task of a different CPU.
      
      Another way to fix this would be to make ->numa_faults RCU-managed or add
      extra locking, but it seems easier to wipe the NUMA fault statistics on
      execve.
      Signed-off-by: default avatarJann Horn <jannh@google.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will@kernel.org>
      Fixes: 82727018 ("sched/numa: Call task_numa_free() from do_execve()")
      Link: https://lkml.kernel.org/r/20190716152047.14424-1-jannh@google.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      837ffc97
    • Vladis Dronov's avatar
      Bluetooth: hci_uart: check for missing tty operations · 58a01b0b
      Vladis Dronov authored
      commit b36a1552 upstream.
      
      Certain ttys operations (pty_unix98_ops) lack tiocmget() and tiocmset()
      functions which are called by the certain HCI UART protocols (hci_ath,
      hci_bcm, hci_intel, hci_mrvl, hci_qca) via hci_uart_set_flow_control()
      or directly. This leads to an execution at NULL and can be triggered by
      an unprivileged user. Fix this by adding a helper function and a check
      for the missing tty operations in the protocols code.
      
      This fixes CVE-2019-10207. The Fixes: lines list commits where calls to
      tiocm[gs]et() or hci_uart_set_flow_control() were added to the HCI UART
      protocols.
      
      Link: https://syzkaller.appspot.com/bug?id=1b42faa2848963564a5b1b7f8c837ea7b55ffa50
      Reported-by: syzbot+79337b501d6aa974d0f6@syzkaller.appspotmail.com
      Cc: stable@vger.kernel.org # v2.6.36+
      Fixes: b3190df6 ("Bluetooth: Support for Atheros AR300x serial chip")
      Fixes: 118612fb ("Bluetooth: hci_bcm: Add suspend/resume PM functions")
      Fixes: ff289559 ("Bluetooth: hci_intel: Add Intel baudrate configuration support")
      Fixes: 162f812f ("Bluetooth: hci_uart: Add Marvell support")
      Fixes: fa9ad876 ("Bluetooth: hci_qca: Add support for Qualcomm Bluetooth chip wcn3990")
      Signed-off-by: default avatarVladis Dronov <vdronov@redhat.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Reviewed-by: default avatarYu-Chen, Cho <acho@suse.com>
      Tested-by: default avatarYu-Chen, Cho <acho@suse.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      58a01b0b
    • Luke Nowakowski-Krijger's avatar
      media: radio-raremono: change devm_k*alloc to k*alloc · 4c0a7ec4
      Luke Nowakowski-Krijger authored
      commit c666355e upstream.
      
      Change devm_k*alloc to k*alloc to manually allocate memory
      
      The manual allocation and freeing of memory is necessary because when
      the USB radio is disconnected, the memory associated with devm_k*alloc
      is freed. Meaning if we still have unresolved references to the radio
      device, then we get use-after-free errors.
      
      This patch fixes this by manually allocating memory, and freeing it in
      the v4l2.release callback that gets called when the last radio device
      exits.
      
      Reported-and-tested-by: syzbot+a4387f5b6b799f6becbf@syzkaller.appspotmail.com
      Signed-off-by: default avatarLuke Nowakowski-Krijger <lnowakow@eng.ucsd.edu>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      [hverkuil-cisco@xs4all.nl: cleaned up two small checkpatch.pl warnings]
      [hverkuil-cisco@xs4all.nl: prefix subject with driver name]
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4c0a7ec4
    • Oliver Neukum's avatar
      media: cpia2_usb: first wake up, then free in disconnect · 0b8a71a8
      Oliver Neukum authored
      commit eff73de2 upstream.
      
      Kasan reported a use after free in cpia2_usb_disconnect()
      It first freed everything and then woke up those waiting.
      The reverse order is correct.
      
      Fixes: 6c493f8b ("[media] cpia2: major overhaul to get it in a working state again")
      Signed-off-by: default avatarOliver Neukum <oneukum@suse.com>
      Reported-by: syzbot+0c90fc937c84f97d0aa6@syzkaller.appspotmail.com
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0b8a71a8
    • Sean Young's avatar
      media: au0828: fix null dereference in error path · f7d3edb0
      Sean Young authored
      commit 6d0d1ff9 upstream.
      
      au0828_usb_disconnect() gets the au0828_dev struct via usb_get_intfdata,
      so it needs to set up for the error paths.
      
      Reported-by: syzbot+357d86bcb4cca1a2f572@syzkaller.appspotmail.com
      Signed-off-by: default avatarSean Young <sean@mess.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f7d3edb0
    • Phong Tran's avatar
      ISDN: hfcsusb: checking idx of ep configuration · af34434a
      Phong Tran authored
      commit f384e62a upstream.
      
      The syzbot test with random endpoint address which made the idx is
      overflow in the table of endpoint configuations.
      
      this adds the checking for fixing the error report from
      syzbot
      
      KASAN: stack-out-of-bounds Read in hfcsusb_probe [1]
      The patch tested by syzbot [2]
      
      Reported-by: syzbot+8750abbc3a46ef47d509@syzkaller.appspotmail.com
      
      [1]:
      https://syzkaller.appspot.com/bug?id=30a04378dac680c5d521304a00a86156bb913522
      [2]:
      https://groups.google.com/d/msg/syzkaller-bugs/_6HBdge8F3E/OJn7wVNpBAAJSigned-off-by: default avatarPhong Tran <tranmanphong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      af34434a
    • Will Deacon's avatar
      arm64: compat: Provide definition for COMPAT_SIGMINSTKSZ · 8902d3a8
      Will Deacon authored
      commit 24951465 upstream.
      
      arch/arm/ defines a SIGMINSTKSZ of 2k, so we should use the same value
      for compat tasks.
      
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Reviewed-by: default avatarDave Martin <Dave.Martin@arm.com>
      Reported-by: default avatarSteve McIntyre <steve.mcintyre@arm.com>
      Tested-by: default avatarSteve McIntyre <93sam@debian.org>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8902d3a8
    • Abhishek Sahu's avatar
      i2c: qup: fixed releasing dma without flush operation completion · 51e26d23
      Abhishek Sahu authored
      commit 7239872f upstream.
      
      The QUP BSLP BAM generates the following error sometimes if the
      current I2C DMA transfer fails and the flush operation has been
      scheduled
      
          “bam-dma-engine 7884000.dma: Cannot free busy channel”
      
      If any I2C error comes during BAM DMA transfer, then the QUP I2C
      interrupt will be generated and the flush operation will be
      carried out to make I2C consume all scheduled DMA transfer.
      Currently, the same completion structure is being used for BAM
      transfer which has already completed without reinit. It will make
      flush operation wait_for_completion_timeout completed immediately
      and will proceed for freeing the DMA resources where the
      descriptors are still in process.
      Signed-off-by: default avatarAbhishek Sahu <absahu@codeaurora.org>
      Acked-by: default avatarSricharan R <sricharan@codeaurora.org>
      Reviewed-by: default avatarAustin Christ <austinwc@codeaurora.org>
      Reviewed-by: default avatarAndy Gross <andy.gross@linaro.org>
      Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
      Signed-off-by: default avatarAmit Pundir <amit.pundir@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      51e26d23
    • allen yan's avatar
      arm64: dts: marvell: Fix A37xx UART0 register size · e522a090
      allen yan authored
      commit c737abc1 upstream.
      
      Armada-37xx UART0 registers are 0x200 bytes wide. Right next to them are
      the UART1 registers that should not be declared in this node.
      
      Update the example in DT bindings document accordingly.
      Signed-off-by: default avatarallen yan <yanwei@marvell.com>
      Signed-off-by: default avatarMiquel Raynal <miquel.raynal@free-electrons.com>
      Signed-off-by: default avatarGregory CLEMENT <gregory.clement@free-electrons.com>
      Signed-off-by: default avatarAmit Pundir <amit.pundir@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e522a090
    • Soheil Hassas Yeganeh's avatar
      tcp: reset sk_send_head in tcp_write_queue_purge · 70453339
      Soheil Hassas Yeganeh authored
      [ Upstream commit dbbf2d1e ]
      
      tcp_write_queue_purge clears all the SKBs in the write queue
      but does not reset the sk_send_head. As a result, we can have
      a NULL pointer dereference anywhere that we use tcp_send_head
      instead of the tcp_write_queue_tail.
      
      For example, after a27fd7a8 (tcp: purge write queue upon RST),
      we can purge the write queue on RST. Prior to
      75c119af (tcp: implement rb-tree based retransmit queue),
      tcp_push will only check tcp_send_head and then accesses
      tcp_write_queue_tail to send the actual SKB. As a result, it will
      dereference a NULL pointer.
      
      This has been reported twice for 4.14 where we don't have
      75c119af:
      
      By Timofey Titovets:
      
      [  422.081094] BUG: unable to handle kernel NULL pointer dereference
      at 0000000000000038
      [  422.081254] IP: tcp_push+0x42/0x110
      [  422.081314] PGD 0 P4D 0
      [  422.081364] Oops: 0002 [#1] SMP PTI
      
      By Yongjian Xu:
      
      BUG: unable to handle kernel NULL pointer dereference at 0000000000000038
      IP: tcp_push+0x48/0x120
      PGD 80000007ff77b067 P4D 80000007ff77b067 PUD 7fd989067 PMD 0
      Oops: 0002 [#18] SMP PTI
      Modules linked in: tcp_diag inet_diag tcp_bbr sch_fq iTCO_wdt
      iTCO_vendor_support pcspkr ixgbe mdio i2c_i801 lpc_ich joydev input_leds shpchp
      e1000e igb dca ptp pps_core hwmon mei_me mei ipmi_si ipmi_msghandler sg ses
      scsi_transport_sas enclosure ext4 jbd2 mbcache sd_mod ahci libahci megaraid_sas
      wmi ast ttm dm_mirror dm_region_hash dm_log dm_mod dax
      CPU: 6 PID: 14156 Comm: [ET_NET 6] Tainted: G D 4.14.26-1.el6.x86_64 #1
      Hardware name: LENOVO ThinkServer RD440 /ThinkServer RD440, BIOS A0TS80A
      09/22/2014
      task: ffff8807d78d8140 task.stack: ffffc9000e944000
      RIP: 0010:tcp_push+0x48/0x120
      RSP: 0018:ffffc9000e947a88 EFLAGS: 00010246
      RAX: 00000000000005b4 RBX: ffff880f7cce9c00 RCX: 0000000000000000
      RDX: 0000000000000000 RSI: 0000000000000040 RDI: ffff8807d00f5000
      RBP: ffffc9000e947aa8 R08: 0000000000001c84 R09: 0000000000000000
      R10: ffff8807d00f5158 R11: 0000000000000000 R12: ffff8807d00f5000
      R13: 0000000000000020 R14: 00000000000256d4 R15: 0000000000000000
      FS: 00007f5916de9700(0000) GS:ffff88107fd00000(0000) knlGS:0000000000000000
      CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000038 CR3: 00000007f8226004 CR4: 00000000001606e0
      Call Trace:
      tcp_sendmsg_locked+0x33d/0xe50
      tcp_sendmsg+0x37/0x60
      inet_sendmsg+0x39/0xc0
      sock_sendmsg+0x49/0x60
      sock_write_iter+0xb6/0x100
      do_iter_readv_writev+0xec/0x130
      ? rw_verify_area+0x49/0xb0
      do_iter_write+0x97/0xd0
      vfs_writev+0x7e/0xe0
      ? __wake_up_common_lock+0x80/0xa0
      ? __fget_light+0x2c/0x70
      ? __do_page_fault+0x1e7/0x530
      do_writev+0x60/0xf0
      ? inet_shutdown+0xac/0x110
      SyS_writev+0x10/0x20
      do_syscall_64+0x6f/0x140
      ? prepare_exit_to_usermode+0x8b/0xa0
      entry_SYSCALL_64_after_hwframe+0x3d/0xa2
      RIP: 0033:0x3135ce0c57
      RSP: 002b:00007f5916de4b00 EFLAGS: 00000293 ORIG_RAX: 0000000000000014
      RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000003135ce0c57
      RDX: 0000000000000002 RSI: 00007f5916de4b90 RDI: 000000000000606f
      RBP: 0000000000000000 R08: 0000000000000000 R09: 00007f5916de8c38
      R10: 0000000000000000 R11: 0000000000000293 R12: 00000000000464cc
      R13: 00007f5916de8c30 R14: 00007f58d8bef080 R15: 0000000000000002
      Code: 48 8b 97 60 01 00 00 4c 8d 97 58 01 00 00 41 b9 00 00 00 00 41 89 f3 4c 39
      d2 49 0f 44 d1 41 81 e3 00 80 00 00 0f 85 b0 00 00 00 <80> 4a 38 08 44 8b 8f 74
      06 00 00 44 89 8f 7c 06 00 00 83 e6 01
      RIP: tcp_push+0x48/0x120 RSP: ffffc9000e947a88
      CR2: 0000000000000038
      ---[ end trace 8d545c2e93515549 ]---
      
      There is other scenario which found in stable 4.4:
      Allocated:
       [<ffffffff82f380a6>] __alloc_skb+0xe6/0x600 net/core/skbuff.c:218
       [<ffffffff832466c3>] alloc_skb_fclone include/linux/skbuff.h:856 [inline]
       [<ffffffff832466c3>] sk_stream_alloc_skb+0xa3/0x5d0 net/ipv4/tcp.c:833
       [<ffffffff83249164>] tcp_sendmsg+0xd34/0x2b00 net/ipv4/tcp.c:1178
       [<ffffffff83300ef3>] inet_sendmsg+0x203/0x4d0 net/ipv4/af_inet.c:755
      Freed:
       [<ffffffff82f372fd>] __kfree_skb+0x1d/0x20 net/core/skbuff.c:676
       [<ffffffff83288834>] sk_wmem_free_skb include/net/sock.h:1447 [inline]
       [<ffffffff83288834>] tcp_write_queue_purge include/net/tcp.h:1460 [inline]
       [<ffffffff83288834>] tcp_connect_init net/ipv4/tcp_output.c:3122 [inline]
       [<ffffffff83288834>] tcp_connect+0xb24/0x30c0 net/ipv4/tcp_output.c:3261
       [<ffffffff8329b991>] tcp_v4_connect+0xf31/0x1890 net/ipv4/tcp_ipv4.c:246
      
      BUG: KASAN: use-after-free in tcp_skb_pcount include/net/tcp.h:796 [inline]
      BUG: KASAN: use-after-free in tcp_init_tso_segs net/ipv4/tcp_output.c:1619 [inline]
      BUG: KASAN: use-after-free in tcp_write_xmit+0x3fc2/0x4cb0 net/ipv4/tcp_output.c:2056
       [<ffffffff81515cd5>] kasan_report.cold.7+0x175/0x2f7 mm/kasan/report.c:408
       [<ffffffff814f9784>] __asan_report_load2_noabort+0x14/0x20 mm/kasan/report.c:427
       [<ffffffff83286582>] tcp_skb_pcount include/net/tcp.h:796 [inline]
       [<ffffffff83286582>] tcp_init_tso_segs net/ipv4/tcp_output.c:1619 [inline]
       [<ffffffff83286582>] tcp_write_xmit+0x3fc2/0x4cb0 net/ipv4/tcp_output.c:2056
       [<ffffffff83287a40>] __tcp_push_pending_frames+0xa0/0x290 net/ipv4/tcp_output.c:2307
      
      stable 4.4 and stable 4.9 don't have the commit abb4a8b8 ("tcp: purge write queue upon RST")
      which is referred in dbbf2d1e,
      in tcp_connect_init, it calls tcp_write_queue_purge, and does not reset sk_send_head, then UAF.
      
      stable 4.14 have the commit abb4a8b8 ("tcp: purge write queue upon RST"),
      in tcp_reset, it calls tcp_write_queue_purge(sk), and does not reset sk_send_head, then UAF.
      
      So this patch can be used to fix stable 4.4 and 4.9.
      
      Fixes: a27fd7a8 (tcp: purge write queue upon RST)
      Reported-by: default avatarTimofey Titovets <nefelim4ag@gmail.com>
      Reported-by: default avatarYongjian Xu <yongjianchn@gmail.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
      Tested-by: default avatarYongjian Xu <yongjianchn@gmail.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 avatarMao Wenan <maowenan@huawei.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      70453339
    • Xin Long's avatar
      ipv6: check sk sk_type and protocol early in ip_mroute_set/getsockopt · 1e531ad4
      Xin Long authored
      [ Upstream commit 99253eb7 ]
      
      Commit 5e1859fb ("ipv4: ipmr: various fixes and cleanups") fixed
      the issue for ipv4 ipmr:
      
        ip_mroute_setsockopt() & ip_mroute_getsockopt() should not
        access/set raw_sk(sk)->ipmr_table before making sure the socket
        is a raw socket, and protocol is IGMP
      
      The same fix should be done for ipv6 ipmr as well.
      
      This patch can fix the panic caused by overwriting the same offset
      as ipmr_table as in raw_sk(sk) when accessing other type's socket
      by ip_mroute_setsockopt().
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1e531ad4
    • Linus Torvalds's avatar
      access: avoid the RCU grace period for the temporary subjective credentials · 50810015
      Linus Torvalds authored
      commit d7852fbd upstream.
      
      It turns out that 'access()' (and 'faccessat()') can cause a lot of RCU
      work because it installs a temporary credential that gets allocated and
      freed for each system call.
      
      The allocation and freeing overhead is mostly benign, but because
      credentials can be accessed under the RCU read lock, the freeing
      involves a RCU grace period.
      
      Which is not a huge deal normally, but if you have a lot of access()
      calls, this causes a fair amount of seconday damage: instead of having a
      nice alloc/free patterns that hits in hot per-CPU slab caches, you have
      all those delayed free's, and on big machines with hundreds of cores,
      the RCU overhead can end up being enormous.
      
      But it turns out that all of this is entirely unnecessary.  Exactly
      because access() only installs the credential as the thread-local
      subjective credential, the temporary cred pointer doesn't actually need
      to be RCU free'd at all.  Once we're done using it, we can just free it
      synchronously and avoid all the RCU overhead.
      
      So add a 'non_rcu' flag to 'struct cred', which can be set by users that
      know they only use it in non-RCU context (there are other potential
      users for this).  We can make it a union with the rcu freeing list head
      that we need for the RCU case, so this doesn't need any extra storage.
      
      Note that this also makes 'get_current_cred()' clear the new non_rcu
      flag, in case we have filesystems that take a long-term reference to the
      cred and then expect the RCU delayed freeing afterwards.  It's not
      entirely clear that this is required, but it makes for clear semantics:
      the subjective cred remains non-RCU as long as you only access it
      synchronously using the thread-local accessors, but you _can_ use it as
      a generic cred if you want to.
      
      It is possible that we should just remove the whole RCU markings for
      ->cred entirely.  Only ->real_cred is really supposed to be accessed
      through RCU, and the long-term cred copies that nfs uses might want to
      explicitly re-enable RCU freeing if required, rather than have
      get_current_cred() do it implicitly.
      
      But this is a "minimal semantic changes" change for the immediate
      problem.
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Jan Glauber <jglauber@marvell.com>
      Cc: Jiri Kosina <jikos@kernel.org>
      Cc: Jayachandran Chandrasekharan Nair <jnair@marvell.com>
      Cc: Greg KH <greg@kroah.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Miklos Szeredi <miklos@szeredi.hu>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      50810015
    • Michael Neuling's avatar
      powerpc/tm: Fix oops on sigreturn on systems without TM · 08ee34d8
      Michael Neuling authored
      commit f16d80b7 upstream.
      
      On systems like P9 powernv where we have no TM (or P8 booted with
      ppc_tm=off), userspace can construct a signal context which still has
      the MSR TS bits set. The kernel tries to restore this context which
      results in the following crash:
      
        Unexpected TM Bad Thing exception at c0000000000022fc (msr 0x8000000102a03031) tm_scratch=800000020280f033
        Oops: Unrecoverable exception, sig: 6 [#1]
        LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
        Modules linked in:
        CPU: 0 PID: 1636 Comm: sigfuz Not tainted 5.2.0-11043-g0a8ad0ff #69
        NIP:  c0000000000022fc LR: 00007fffb2d67e48 CTR: 0000000000000000
        REGS: c00000003fffbd70 TRAP: 0700   Not tainted  (5.2.0-11045-g7142b497d8)
        MSR:  8000000102a03031 <SF,VEC,VSX,FP,ME,IR,DR,LE,TM[E]>  CR: 42004242  XER: 00000000
        CFAR: c0000000000022e0 IRQMASK: 0
        GPR00: 0000000000000072 00007fffb2b6e560 00007fffb2d87f00 0000000000000669
        GPR04: 00007fffb2b6e728 0000000000000000 0000000000000000 00007fffb2b6f2a8
        GPR08: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
        GPR12: 0000000000000000 00007fffb2b76900 0000000000000000 0000000000000000
        GPR16: 00007fffb2370000 00007fffb2d84390 00007fffea3a15ac 000001000a250420
        GPR20: 00007fffb2b6f260 0000000010001770 0000000000000000 0000000000000000
        GPR24: 00007fffb2d843a0 00007fffea3a14a0 0000000000010000 0000000000800000
        GPR28: 00007fffea3a14d8 00000000003d0f00 0000000000000000 00007fffb2b6e728
        NIP [c0000000000022fc] rfi_flush_fallback+0x7c/0x80
        LR [00007fffb2d67e48] 0x7fffb2d67e48
        Call Trace:
        Instruction dump:
        e96a0220 e96a02a8 e96a0330 e96a03b8 394a0400 4200ffdc 7d2903a6 e92d0c00
        e94d0c08 e96d0c10 e82d0c18 7db242a6 <4c000024> 7db243a6 7db142a6 f82d0c18
      
      The problem is the signal code assumes TM is enabled when
      CONFIG_PPC_TRANSACTIONAL_MEM is enabled. This may not be the case as
      with P9 powernv or if `ppc_tm=off` is used on P8.
      
      This means any local user can crash the system.
      
      Fix the problem by returning a bad stack frame to the user if they try
      to set the MSR TS bits with sigreturn() on systems where TM is not
      supported.
      
      Found with sigfuz kernel selftest on P9.
      
      This fixes CVE-2019-13648.
      
      Fixes: 2b0a576d ("powerpc: Add new transactional memory state to the signal context")
      Cc: stable@vger.kernel.org # v3.9
      Reported-by: default avatarPraveen Pandey <Praveen.Pandey@in.ibm.com>
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20190719050502.405-1-mikey@neuling.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      08ee34d8
    • Hui Wang's avatar
      ALSA: hda - Add a conexant codec entry to let mute led work · 2f4b7fbb
      Hui Wang authored
      commit 3f880949 upstream.
      
      This conexant codec isn't in the supported codec list yet, the hda
      generic driver can drive this codec well, but on a Lenovo machine
      with mute/mic-mute leds, we need to apply CXT_FIXUP_THINKPAD_ACPI
      to make the leds work. After adding this codec to the list, the
      driver patch_conexant.c will apply THINKPAD_ACPI to this machine.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2f4b7fbb