1. 21 Dec, 2019 28 commits
    • Steffen Maier's avatar
      scsi: zfcp: drop default switch case which might paper over missing case · e2020c19
      Steffen Maier authored
      [ Upstream commit 0c902936 ]
      
      This was introduced with v4.18 commit 8c3d20aa ("scsi: zfcp: fix
      missing REC trigger trace for all objects in ERP_FAILED") but would now
      suppress helpful -Wswitch compiler warnings when building with W=1 such as
      the following forced example:
      
      drivers/s390/scsi/zfcp_erp.c: In function 'zfcp_erp_handle_failed':
      drivers/s390/scsi/zfcp_erp.c:126:2: warning: enumeration value 'ZFCP_ERP_ACTION_REOPEN_PORT_FORCED' not handled in switch [-Wswitch]
        switch (want) {
        ^~~~~~
      
      But then again, only with W=1 we would notice unhandled enum cases.
      Without the default cases and a missed unhandled enum case, the code might
      perform unforeseen things we might not want...
      
      As of today, we never run through the removed default case, so removing it
      is no functional change.  In the future, we never should run through a
      default case but introduce the necessary specific case(s) to handle new
      functionality.
      Signed-off-by: default avatarSteffen Maier <maier@linux.ibm.com>
      Reviewed-by: default avatarBenjamin Block <bblock@linux.ibm.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e2020c19
    • Maciej W. Rozycki's avatar
      MIPS: SiByte: Enable ZONE_DMA32 for LittleSur · 0f276685
      Maciej W. Rozycki authored
      [ Upstream commit 756d6d83 ]
      
      The LittleSur board is marked for high memory support and therefore
      clearly must provide a way to have enough memory installed for some to
      be present outside the low 4GiB physical address range.  With the memory
      map of the BCM1250 SOC it has been built around it means over 1GiB of
      actual DRAM, as only the first 1GiB is mapped in the low 4GiB physical
      address range[1].
      
      Complement commit cce335ae ("[MIPS] 64-bit Sibyte kernels need
      DMA32.") then and also enable ZONE_DMA32 for LittleSur.
      
      References:
      
      [1] "BCM1250/BCM1125/BCM1125H User Manual", Revision 1250_1125-UM100-R,
          Broadcom Corporation, 21 Oct 2002, Section 3: "System Overview",
          "Memory Map", pp. 34-38
      Signed-off-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
      Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Patchwork: https://patchwork.linux-mips.org/patch/21107/
      Fixes: cce335ae ("[MIPS] 64-bit Sibyte kernels need DMA32.")
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0f276685
    • David Teigland's avatar
      dlm: fix missing idr_destroy for recover_idr · 72c9c04b
      David Teigland authored
      [ Upstream commit 8fc6ed9a ]
      
      Which would leak memory for the idr internals.
      Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      72c9c04b
    • John Keeping's avatar
      ARM: dts: rockchip: Fix rk3288-rock2 vcc_flash name · 8d9ca529
      John Keeping authored
      [ Upstream commit 03d9f8fa ]
      
      There is no functional change from this, but it is confusing to find two
      copies of vcc_sys and no vcc_flash when looking in
      /sys/class/regulator/*/name.
      Signed-off-by: default avatarJohn Keeping <john@metanate.com>
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8d9ca529
    • Heiko Stuebner's avatar
      clk: rockchip: fix rk3188 sclk_mac_lbtest parameter ordering · 3d9fa488
      Heiko Stuebner authored
      [ Upstream commit ac8cb538 ]
      
      Similar to commit a9f0c0e5 ("clk: rockchip: fix rk3188 sclk_smc
      gate data") there is one other gate clock in the rk3188 clock driver
      with a similar wrong ordering, the sclk_mac_lbtest. So fix it as well.
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3d9fa488
    • Finley Xiao's avatar
      clk: rockchip: fix rk3188 sclk_smc gate data · fbfe4a8e
      Finley Xiao authored
      [ Upstream commit a9f0c0e5 ]
      
      Fix sclk_smc gate data.
      Change variable order, flags come before the register address.
      Signed-off-by: default avatarFinley Xiao <finley.xiao@rock-chips.com>
      Signed-off-by: default avatarJohan Jonker <jbx9999@hotmail.com>
      Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fbfe4a8e
    • Marek Szyprowski's avatar
      extcon: max8997: Fix lack of path setting in USB device mode · ef750045
      Marek Szyprowski authored
      [ Upstream commit a2dc5091 ]
      
      MAX8997 driver disables automatic path selection from MicroUSB connector
      and manually sets path to either UART or USB lines. However the code for
      setting USB path worked only for USB host mode (when ID pin is set
      to ground). When standard USB cable (USB device mode) is connected, path
      registers are not touched. This means that once the non-USB accessory is
      connected to MAX8997-operated micro USB port, the path is no longer set
      to USB and USB device mode doesn't work. This patch fixes it by setting
      USB path both for USB and USB host modes.
      Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ef750045
    • Moni Shoua's avatar
      net/mlx5: Release resource on error flow · cfdcc8d6
      Moni Shoua authored
      [ Upstream commit 69811496 ]
      
      Fix reference counting leakage when the event handler aborts due to an
      unsupported event for the resource type.
      
      Fixes: a14c2d4b ("net/mlx5_core: Warn on unsupported events of QP/RQ/SQ")
      Signed-off-by: default avatarMoni Shoua <monis@mellanox.com>
      Reviewed-by: default avatarMajd Dibbiny <majd@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cfdcc8d6
    • Vincent Whitchurch's avatar
      ARM: 8813/1: Make aligned 2-byte getuser()/putuser() atomic on ARMv6+ · fd9beff0
      Vincent Whitchurch authored
      [ Upstream commit 344eb553 ]
      
      getuser() and putuser() (and there underscored variants) use two
      strb[t]/ldrb[t] instructions when they are asked to get/put 16-bits.
      This means that the read/write is not atomic even when performed to a
      16-bit-aligned address.
      
      This leads to problems with vhost: vhost uses __getuser() to read the
      vring's 16-bit avail.index field, and if it happens to observe a partial
      update of the index, wrong descriptors will be used which will lead to a
      breakdown of the virtio communication.  A similar problem exists for
      __putuser() which is used to write to the vring's used.index field.
      
      The reason these functions use strb[t]/ldrb[t] is because strht/ldrht
      instructions did not exist until ARMv6T2/ARMv7.  So we should be easily
      able to fix this on ARMv7.  Also, since all ARMv6 processors also don't
      actually use the unprivileged instructions anymore for uaccess (since
      CONFIG_CPU_USE_DOMAINS is not used) we can easily fix them too.
      Signed-off-by: default avatarVincent Whitchurch <vincent.whitchurch@axis.com>
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fd9beff0
    • Andrei Otcheretianski's avatar
      iwlwifi: mvm: Send non offchannel traffic via AP sta · f443ac61
      Andrei Otcheretianski authored
      [ Upstream commit dc1aca22 ]
      
      TDLS discovery response frame is a unicast direct frame to the peer.
      Since we don't have a STA for this peer, this frame goes through
      iwl_tx_skb_non_sta(). As the result aux_sta and some completely
      arbitrary queue would be selected for this frame, resulting in a queue
      hang.  Fix that by sending such frames through AP sta instead.
      Signed-off-by: default avatarAndrei Otcheretianski <andrei.otcheretianski@intel.com>
      Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f443ac61
    • Arjun Vynipadath's avatar
      cxgb4vf: fix memleak in mac_hlist initialization · 473d22b0
      Arjun Vynipadath authored
      [ Upstream commit 24357e06 ]
      
      mac_hlist was initialized during adapter_up, which will be called
      every time a vf device is first brought up, or every time when device
      is brought up again after bringing all devices down. This means our
      state of previous list is lost, causing a memleak if entries are
      present in the list. To fix that, move list init to the condition
      that performs initial one time adapter setup.
      Signed-off-by: default avatarArjun Vynipadath <arjun@chelsio.com>
      Signed-off-by: default avatarGanesh Goudar <ganeshgr@chelsio.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      473d22b0
    • Douglas Anderson's avatar
      serial: core: Allow processing sysrq at port unlock time · 8bddce88
      Douglas Anderson authored
      [ Upstream commit d6e19358 ]
      
      Right now serial drivers process sysrq keys deep in their character
      receiving code.  This means that they've already grabbed their
      port->lock spinlock.  This can end up getting in the way if we've go
      to do serial stuff (especially kgdb) in response to the sysrq.
      
      Serial drivers have various hacks in them to handle this.  Looking at
      '8250_port.c' you can see that the console_write() skips locking if
      we're in the sysrq handler.  Looking at 'msm_serial.c' you can see
      that the port lock is dropped around uart_handle_sysrq_char().
      
      It turns out that these hacks aren't exactly perfect.  If you have
      lockdep turned on and use something like the 8250_port hack you'll get
      a splat that looks like:
      
        WARNING: possible circular locking dependency detected
        [...] is trying to acquire lock:
        ... (console_owner){-.-.}, at: console_unlock+0x2e0/0x5e4
      
        but task is already holding lock:
        ... (&port_lock_key){-.-.}, at: serial8250_handle_irq+0x30/0xe4
      
        which lock already depends on the new lock.
      
        the existing dependency chain (in reverse order) is:
      
        -> #1 (&port_lock_key){-.-.}:
               _raw_spin_lock_irqsave+0x58/0x70
               serial8250_console_write+0xa8/0x250
               univ8250_console_write+0x40/0x4c
               console_unlock+0x528/0x5e4
               register_console+0x2c4/0x3b0
               uart_add_one_port+0x350/0x478
               serial8250_register_8250_port+0x350/0x3a8
               dw8250_probe+0x67c/0x754
               platform_drv_probe+0x58/0xa4
               really_probe+0x150/0x294
               driver_probe_device+0xac/0xe8
               __driver_attach+0x98/0xd0
               bus_for_each_dev+0x84/0xc8
               driver_attach+0x2c/0x34
               bus_add_driver+0xf0/0x1ec
               driver_register+0xb4/0x100
               __platform_driver_register+0x60/0x6c
               dw8250_platform_driver_init+0x20/0x28
      	 ...
      
        -> #0 (console_owner){-.-.}:
               lock_acquire+0x1e8/0x214
               console_unlock+0x35c/0x5e4
               vprintk_emit+0x230/0x274
               vprintk_default+0x7c/0x84
               vprintk_func+0x190/0x1bc
               printk+0x80/0xa0
               __handle_sysrq+0x104/0x21c
               handle_sysrq+0x30/0x3c
               serial8250_read_char+0x15c/0x18c
               serial8250_rx_chars+0x34/0x74
               serial8250_handle_irq+0x9c/0xe4
               dw8250_handle_irq+0x98/0xcc
               serial8250_interrupt+0x50/0xe8
               ...
      
        other info that might help us debug this:
      
         Possible unsafe locking scenario:
      
               CPU0                    CPU1
               ----                    ----
          lock(&port_lock_key);
                                       lock(console_owner);
                                       lock(&port_lock_key);
          lock(console_owner);
      
         *** DEADLOCK ***
      
      The hack used in 'msm_serial.c' doesn't cause the above splats but it
      seems a bit ugly to unlock / lock our spinlock deep in our irq
      handler.
      
      It seems like we could defer processing the sysrq until the end of the
      interrupt handler right after we've unlocked the port.  With this
      scheme if a whole batch of sysrq characters comes in one irq then we
      won't handle them all, but that seems like it should be a fine
      compromise.
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8bddce88
    • Chuhong Yuan's avatar
      net: ep93xx_eth: fix mismatch of request_mem_region in remove · 697ac1ba
      Chuhong Yuan authored
      [ Upstream commit 3df70afe ]
      
      The driver calls release_resource in remove to match request_mem_region
      in probe, which is incorrect.
      Fix it by using the right one, release_mem_region.
      Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      697ac1ba
    • Chuhong Yuan's avatar
      rsxx: add missed destroy_workqueue calls in remove · da0b8029
      Chuhong Yuan authored
      [ Upstream commit dcb77e4b ]
      
      The driver misses calling destroy_workqueue in remove like what is done
      when probe fails.
      Add the missed calls to fix it.
      Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      da0b8029
    • paulhsia's avatar
      ALSA: pcm: Fix stream lock usage in snd_pcm_period_elapsed() · 4bec1e75
      paulhsia authored
      [ Upstream commit f5cdc9d4 ]
      
      If the nullity check for `substream->runtime` is outside of the lock
      region, it is possible to have a null runtime in the critical section
      if snd_pcm_detach_substream is called right before the lock.
      Signed-off-by: default avatarpaulhsia <paulhsia@chromium.org>
      Link: https://lore.kernel.org/r/20191112171715.128727-2-paulhsia@chromium.orgSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4bec1e75
    • Pan Bian's avatar
      Input: cyttsp4_core - fix use after free bug · ad4784e6
      Pan Bian authored
      [ Upstream commit 79aae6ac ]
      
      The device md->input is used after it is released. Setting the device
      data to NULL is unnecessary as the device is never used again. Instead,
      md->input should be assigned NULL to avoid accessing the freed memory
      accidently. Besides, checking md->si against NULL is superfluous as it
      points to a variable address, which cannot be NULL.
      Signed-off-by: default avatarPan Bian <bianpan2016@163.com>
      Link: https://lore.kernel.org/r/1572936379-6423-1-git-send-email-bianpan2016@163.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ad4784e6
    • Stephan Gerhold's avatar
      NFC: nxp-nci: Fix NULL pointer dereference after I2C communication error · b597aa92
      Stephan Gerhold authored
      [ Upstream commit a71a29f5 ]
      
      I2C communication errors (-EREMOTEIO) during the IRQ handler of nxp-nci
      result in a NULL pointer dereference at the moment:
      
          BUG: kernel NULL pointer dereference, address: 0000000000000000
          Oops: 0002 [#1] PREEMPT SMP NOPTI
          CPU: 1 PID: 355 Comm: irq/137-nxp-nci Not tainted 5.4.0-rc6 #1
          RIP: 0010:skb_queue_tail+0x25/0x50
          Call Trace:
           nci_recv_frame+0x36/0x90 [nci]
           nxp_nci_i2c_irq_thread_fn+0xd1/0x285 [nxp_nci_i2c]
           ? preempt_count_add+0x68/0xa0
           ? irq_forced_thread_fn+0x80/0x80
           irq_thread_fn+0x20/0x60
           irq_thread+0xee/0x180
           ? wake_threads_waitq+0x30/0x30
           kthread+0xfb/0x130
           ? irq_thread_check_affinity+0xd0/0xd0
           ? kthread_park+0x90/0x90
           ret_from_fork+0x1f/0x40
      
      Afterward the kernel must be rebooted to work properly again.
      
      This happens because it attempts to call nci_recv_frame() with skb == NULL.
      However, unlike nxp_nci_fw_recv_frame(), nci_recv_frame() does not have any
      NULL checks for skb, causing the NULL pointer dereference.
      
      Change the code to call only nxp_nci_fw_recv_frame() in case of an error.
      Make sure to log it so it is obvious that a communication error occurred.
      The error above then becomes:
      
          nxp-nci_i2c i2c-NXP1001:00: NFC: Read failed with error -121
          nci: __nci_request: wait_for_completion_interruptible_timeout failed 0
          nxp-nci_i2c i2c-NXP1001:00: NFC: Read failed with error -121
      
      Fixes: 6be88670 ("NFC: nxp-nci_i2c: Add I2C support to NXP NCI driver")
      Signed-off-by: default avatarStephan Gerhold <stephan@gerhold.net>
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b597aa92
    • Al Viro's avatar
      audit_get_nd(): don't unlock parent too early · 2b30b823
      Al Viro authored
      [ Upstream commit 69924b89 ]
      
      if the child has been negative and just went positive
      under us, we want coherent d_is_positive() and ->d_inode.
      Don't unlock the parent until we'd done that work...
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2b30b823
    • Al Viro's avatar
      b7436698
    • Sirong Wang's avatar
      RDMA/hns: Correct the value of HNS_ROCE_HEM_CHUNK_LEN · a4623faa
      Sirong Wang authored
      [ Upstream commit 531eb45b ]
      
      Size of pointer to buf field of struct hns_roce_hem_chunk should be
      considered when calculating HNS_ROCE_HEM_CHUNK_LEN, or sg table size will
      be larger than expected when allocating hem.
      
      Fixes: 9a443537 ("IB/hns: Add driver files for hns RoCE driver")
      Link: https://lore.kernel.org/r/1572575610-52530-2-git-send-email-liweihang@hisilicon.comSigned-off-by: default avatarSirong Wang <wangsirong@huawei.com>
      Signed-off-by: default avatarWeihang Li <liweihang@hisilicon.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a4623faa
    • Al Viro's avatar
      autofs: fix a leak in autofs_expire_indirect() · d29e4ee5
      Al Viro authored
      [ Upstream commit 03ad0d70 ]
      
      if the second call of should_expire() in there ends up
      grabbing and returning a new reference to dentry, we need
      to drop it before continuing.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d29e4ee5
    • Chuhong Yuan's avatar
      serial: ifx6x60: add missed pm_runtime_disable · a45d1053
      Chuhong Yuan authored
      commit 50b2b571 upstream.
      
      The driver forgets to call pm_runtime_disable in remove.
      Add the missed calls to fix it.
      Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20191118024833.21587-1-hslester96@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a45d1053
    • Jiangfeng Xiao's avatar
      serial: serial_core: Perform NULL checks for break_ctl ops · 8b054e0b
      Jiangfeng Xiao authored
      commit 7d73170e upstream.
      
      Doing fuzz test on sbsa uart device, causes a kernel crash
      due to NULL pointer dereference:
      
      ------------[ cut here ]------------
      Unable to handle kernel paging request at virtual address fffffffffffffffc
      pgd = ffffffe331723000
      [fffffffffffffffc] *pgd=0000002333595003, *pud=0000002333595003, *pmd=00000
      Internal error: Oops: 96000005 [#1] PREEMPT SMP
      Modules linked in: ping(O) jffs2 rtos_snapshot(O) pramdisk(O) hisi_sfc(O)
      Drv_Nandc_K(O) Drv_SysCtl_K(O) Drv_SysClk_K(O) bsp_reg(O) hns3(O)
      hns3_uio_enet(O) hclgevf(O) hclge(O) hnae3(O) mdio_factory(O)
      mdio_registry(O) mdio_dev(O) mdio(O) hns3_info(O) rtos_kbox_panic(O)
      uart_suspend(O) rsm(O) stp llc tunnel4 xt_tcpudp ipt_REJECT nf_reject_ipv4
      iptable_filter ip_tables x_tables sd_mod xhci_plat_hcd xhci_pci xhci_hcd
      usbmon usbhid usb_storage ohci_platform ohci_pci ohci_hcd hid_generic hid
      ehci_platform ehci_pci ehci_hcd vfat fat usbcore usb_common scsi_mod
      yaffs2multi(O) ext4 jbd2 ext2 mbcache ofpart i2c_dev i2c_core uio ubi nand
      nand_ecc nand_ids cfi_cmdset_0002 cfi_cmdset_0001 cfi_probe gen_probe
      cmdlinepart chipreg mtdblock mtd_blkdevs mtd nfsd auth_rpcgss oid_registry
      nfsv3 nfs nfs_acl lockd sunrpc grace autofs4
      CPU: 2 PID: 2385 Comm: tty_fuzz_test Tainted: G           O    4.4.193 #1
      task: ffffffe32b23f110 task.stack: ffffffe32bda4000
      PC is at uart_break_ctl+0x44/0x84
      LR is at uart_break_ctl+0x34/0x84
      pc : [<ffffff8393196098>] lr : [<ffffff8393196088>] pstate: 80000005
      sp : ffffffe32bda7cc0
      x29: ffffffe32bda7cc0 x28: ffffffe32b23f110
      x27: ffffff8393402000 x26: 0000000000000000
      x25: ffffffe32b233f40 x24: ffffffc07a8ec680
      x23: 0000000000005425 x22: 00000000ffffffff
      x21: ffffffe33ed73c98 x20: 0000000000000000
      x19: ffffffe33ed94168 x18: 0000000000000004
      x17: 0000007f92ae9d30 x16: ffffff8392fa6064
      x15: 0000000000000010 x14: 0000000000000000
      x13: 0000000000000000 x12: 0000000000000000
      x11: 0000000000000020 x10: 0000007ffdac1708
      x9 : 0000000000000078 x8 : 000000000000001d
      x7 : 0000000052a64887 x6 : ffffffe32bda7e08
      x5 : ffffffe32b23c000 x4 : 0000005fbc5b0000
      x3 : ffffff83938d5018 x2 : 0000000000000080
      x1 : ffffffe32b23c040 x0 : ffffff83934428f8
      virtual start addr offset is 38ac00000
      module base offset is 2cd4cf1000
      linear region base offset is : 0
      Process tty_fuzz_test (pid: 2385, stack limit = 0xffffffe32bda4000)
      Stack: (0xffffffe32bda7cc0 to 0xffffffe32bda8000)
      7cc0: ffffffe32bda7cf0 ffffff8393177718 ffffffc07a8ec680 ffffff8393196054
      7ce0: 000000001739f2e0 0000007ffdac1978 ffffffe32bda7d20 ffffff8393179a1c
      7d00: 0000000000000000 ffffff8393c0a000 ffffffc07a8ec680 cb88537fdc8ba600
      7d20: ffffffe32bda7df0 ffffff8392fa5a40 ffffff8393c0a000 0000000000005425
      7d40: 0000007ffdac1978 ffffffe32b233f40 ffffff8393178dcc 0000000000000003
      7d60: 000000000000011d 000000000000001d ffffffe32b23f110 000000000000029e
      7d80: ffffffe34fe8d5d0 0000000000000000 ffffffe32bda7e14 cb88537fdc8ba600
      7da0: ffffffe32bda7e30 ffffff8393042cfc ffffff8393c41720 ffffff8393c46410
      7dc0: ffffff839304fa68 ffffffe32b233f40 0000000000005425 0000007ffdac1978
      7de0: 000000000000011d cb88537fdc8ba600 ffffffe32bda7e70 ffffff8392fa60cc
      7e00: 0000000000000000 ffffffe32b233f40 ffffffe32b233f40 0000000000000003
      7e20: 0000000000005425 0000007ffdac1978 ffffffe32bda7e70 ffffff8392fa60b0
      7e40: 0000000000000280 ffffffe32b233f40 ffffffe32b233f40 0000000000000003
      7e60: 0000000000005425 cb88537fdc8ba600 0000000000000000 ffffff8392e02e78
      7e80: 0000000000000280 0000005fbc5b0000 ffffffffffffffff 0000007f92ae9d3c
      7ea0: 0000000060000000 0000000000000015 0000000000000003 0000000000005425
      7ec0: 0000007ffdac1978 0000000000000000 00000000a54c910e 0000007f92b95014
      7ee0: 0000007f92b95090 0000000052a64887 000000000000001d 0000000000000078
      7f00: 0000007ffdac1708 0000000000000020 0000000000000000 0000000000000000
      7f20: 0000000000000000 0000000000000010 000000556acf0090 0000007f92ae9d30
      7f40: 0000000000000004 000000556acdef10 0000000000000000 000000556acdebd0
      7f60: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
      7f80: 0000000000000000 0000000000000000 0000000000000000 0000007ffdac1840
      7fa0: 000000556acdedcc 0000007ffdac1840 0000007f92ae9d3c 0000000060000000
      7fc0: 0000000000000000 0000000000000000 0000000000000003 000000000000001d
      7fe0: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
      Call trace:
      Exception stack(0xffffffe32bda7ab0 to 0xffffffe32bda7bf0)
      7aa0:                                   0000000000001000 0000007fffffffff
      7ac0: ffffffe32bda7cc0 ffffff8393196098 0000000080000005 0000000000000025
      7ae0: ffffffe32b233f40 ffffff83930d777c ffffffe32bda7b30 ffffff83930d777c
      7b00: ffffffe32bda7be0 ffffff83938d5000 ffffffe32bda7be0 ffffffe32bda7c20
      7b20: ffffffe32bda7b60 ffffff83930d777c ffffffe32bda7c10 ffffff83938d5000
      7b40: ffffffe32bda7c10 ffffffe32bda7c50 ffffff8393c0a000 ffffffe32b23f110
      7b60: ffffffe32bda7b70 ffffff8392e09df4 ffffffe32bda7bb0 cb88537fdc8ba600
      7b80: ffffff83934428f8 ffffffe32b23c040 0000000000000080 ffffff83938d5018
      7ba0: 0000005fbc5b0000 ffffffe32b23c000 ffffffe32bda7e08 0000000052a64887
      7bc0: 000000000000001d 0000000000000078 0000007ffdac1708 0000000000000020
      7be0: 0000000000000000 0000000000000000
      [<ffffff8393196098>] uart_break_ctl+0x44/0x84
      [<ffffff8393177718>] send_break+0xa0/0x114
      [<ffffff8393179a1c>] tty_ioctl+0xc50/0xe84
      [<ffffff8392fa5a40>] do_vfs_ioctl+0xc4/0x6e8
      [<ffffff8392fa60cc>] SyS_ioctl+0x68/0x9c
      [<ffffff8392e02e78>] __sys_trace_return+0x0/0x4
      Code: b9410ea0 34000160 f9408aa0 f9402814 (b85fc280)
      ---[ end trace 8606094f1960c5e0 ]---
      Kernel panic - not syncing: Fatal exception
      
      Fix this problem by adding NULL checks prior to calling break_ctl ops.
      Signed-off-by: default avatarJiangfeng Xiao <xiaojiangfeng@huawei.com>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/1574263133-28259-1-git-send-email-xiaojiangfeng@huawei.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8b054e0b
    • Vincent Whitchurch's avatar
      serial: pl011: Fix DMA ->flush_buffer() · 36f8b7a0
      Vincent Whitchurch authored
      commit f6a19647 upstream.
      
      PL011's ->flush_buffer() implementation releases and reacquires the port
      lock.  Due to a race condition here, data can end up being added to the
      circular buffer but neither being discarded nor being sent out.  This
      leads to, for example, tcdrain(2) waiting indefinitely.
      
      Process A                       Process B
      
      uart_flush_buffer()
       - acquire lock
       - circ_clear
       - pl011_flush_buffer()
       -- release lock
       -- dmaengine_terminate_all()
      
                                      uart_write()
                                      - acquire lock
                                      - add chars to circ buffer
                                      - start_tx()
                                      -- start DMA
                                      - release lock
      
       -- acquire lock
       -- turn off DMA
       -- release lock
      
                                      // Data in circ buffer but DMA is off
      
      According to the comment in the code, the releasing of the lock around
      dmaengine_terminate_all() is to avoid a deadlock with the DMA engine
      callback.  However, since the time this code was written, the DMA engine
      API documentation seems to have been clarified to say that
      dmaengine_terminate_all() (in the identically implemented but
      differently named dmaengine_terminate_async() variant) does not wait for
      any running complete callback to be completed and can even be called
      from a complete callback.  So there is no possibility of deadlock if the
      DMA engine driver implements this API correctly.
      
      So we should be able to just remove this release and reacquire of the
      lock to prevent the aforementioned race condition.
      Signed-off-by: default avatarVincent Whitchurch <vincent.whitchurch@axis.com>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20191118092547.32135-1-vincent.whitchurch@axis.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      36f8b7a0
    • Jeffrey Hugo's avatar
      tty: serial: msm_serial: Fix flow control · 47c07f65
      Jeffrey Hugo authored
      commit b027ce25 upstream.
      
      hci_qca interfaces to the wcn3990 via a uart_dm on the msm8998 mtp and
      Lenovo Miix 630 laptop.  As part of initializing the wcn3990, hci_qca
      disables flow, configures the uart baudrate, and then reenables flow - at
      which point an event is expected to be received over the uart from the
      wcn3990.  It is observed that this event comes after the baudrate change
      but before hci_qca re-enables flow. This is unexpected, and is a result of
      msm_reset() being broken.
      
      According to the uart_dm hardware documentation, it is recommended that
      automatic hardware flow control be enabled by setting RX_RDY_CTL.  Auto
      hw flow control will manage RFR based on the configured watermark.  When
      there is space to receive data, the hw will assert RFR.  When the watermark
      is hit, the hw will de-assert RFR.
      
      The hardware documentation indicates that RFR can me manually managed via
      CR when RX_RDY_CTL is not set.  SET_RFR asserts RFR, and RESET_RFR
      de-asserts RFR.
      
      msm_reset() is broken because after resetting the hardware, it
      unconditionally asserts RFR via SET_RFR.  This enables flow regardless of
      the current configuration, and would undo a previous flow disable
      operation.  It should instead de-assert RFR via RESET_RFR to block flow
      until the hardware is reconfigured.  msm_serial should rely on the client
      to specify that flow should be enabled, either via mctrl() or the termios
      structure, and only assert RFR in response to those triggers.
      
      Fixes: 04896a77 ("msm_serial: serial driver for MSM7K onboard serial peripheral.")
      Signed-off-by: default avatarJeffrey Hugo <jeffrey.l.hugo@gmail.com>
      Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
      Cc: stable <stable@vger.kernel.org>
      Reviewed-by: default avatarAndy Gross <agross@kernel.org>
      Link: https://lore.kernel.org/r/20191021154616.25457-1-jeffrey.l.hugo@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      47c07f65
    • Peng Fan's avatar
      tty: serial: fsl_lpuart: use the sg count from dma_map_sg · 22cf3b33
      Peng Fan authored
      commit 487ee861 upstream.
      
      The dmaengine_prep_slave_sg needs to use sg count returned
      by dma_map_sg, not use sport->dma_tx_nents, because the return
      value of dma_map_sg is not always same with "nents".
      
      When enabling iommu for lpuart + edma, iommu framework may concatenate
      two sgs into one.
      
      Fixes: 6250cc30 ("tty: serial: fsl_lpuart: Use scatter/gather DMA for Tx")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarPeng Fan <peng.fan@nxp.com>
      Link: https://lore.kernel.org/r/1572932977-17866-1-git-send-email-peng.fan@nxp.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      22cf3b33
    • Michał Mirosław's avatar
      usb: gadget: u_serial: add missing port entry locking · 72f996aa
      Michał Mirosław authored
      commit daf82bd2 upstream.
      
      gserial_alloc_line() misses locking (for a release barrier) while
      resetting port entry on TTY allocation failure. Fix this.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMichał Mirosław <mirq-linux@rere.qmqm.pl>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Tested-by: default avatarLadislav Michl <ladis@linux-mips.org>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      72f996aa
    • Jon Hunter's avatar
      arm64: tegra: Fix 'active-low' warning for Jetson TX1 regulator · 3d41a0a7
      Jon Hunter authored
      commit 1e5e929c upstream.
      
      Commit 34993594 ("arm64: tegra: Enable HDMI on Jetson TX1")
      added a regulator for HDMI on the Jetson TX1 platform. This regulator
      has an active high enable, but the GPIO specifier for enabling the
      regulator incorrectly defines it as active-low. This causes the
      following warning to occur on boot ...
      
       WARNING KERN regulator@10 GPIO handle specifies active low - ignored
      
      The fixed-regulator binding does not use the active-low flag from the
      gpio specifier and purely relies of the presence of the
      'enable-active-high' property to determine if it is active high or low
      (if this property is omitted). Fix this warning by setting the GPIO
      to active-high in the GPIO specifier which aligns with the presense of
      the 'enable-active-high' property.
      
      Fixes: 34993594 ("arm64: tegra: Enable HDMI on Jetson TX1")
      Signed-off-by: default avatarJon Hunter <jonathanh@nvidia.com>
      Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3d41a0a7
  2. 05 Dec, 2019 12 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.9.206 · de84c554
      Greg Kroah-Hartman authored
      de84c554
    • Chuhong Yuan's avatar
      net: fec: fix clock count mis-match · d961a58d
      Chuhong Yuan authored
      commit a31eda65 upstream.
      
      pm_runtime_put_autosuspend in probe will call runtime suspend to
      disable clks automatically if CONFIG_PM is defined. (If CONFIG_PM
      is not defined, its implementation will be empty, then runtime
      suspend will not be called.)
      
      Therefore, we can call pm_runtime_get_sync to runtime resume it
      first to enable clks, which matches the runtime suspend. (Only when
      CONFIG_PM is defined, otherwise pm_runtime_get_sync will also be
      empty, then runtime resume will not be called.)
      
      Then it is fine to disable clks without causing clock count mis-match.
      
      Fixes: c43eab3e ("net: fec: add missed clk_disable_unprepare in remove")
      Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
      Acked-by: default avatarFugang Duan <fugang.duan@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Cc: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d961a58d
    • Hans de Goede's avatar
      platform/x86: hp-wmi: Fix ACPI errors caused by too small buffer · 15d6d766
      Hans de Goede authored
      commit 16245db1 upstream.
      
      The HP WMI calls may take up to 128 bytes of data as input, and
      the AML methods implementing the WMI calls, declare a couple of fields for
      accessing input in different sizes, specifycally the HWMC method contains:
      
              CreateField (Arg1, 0x80, 0x0400, D128)
      
      Even though we do not use any of the WMI command-types which need a buffer
      of this size, the APCI interpreter still tries to create it as it is
      declared in generoc code at the top of the HWMC method which runs before
      the code looks at which command-type is requested.
      
      This results in many of these errors on many different HP laptop models:
      
      [   14.459261] ACPI Error: Field [D128] at 1152 exceeds Buffer [NULL] size 160 (bits) (20170303/dsopcode-236)
      [   14.459268] ACPI Error: Method parse/execution failed [\HWMC] (Node ffff8edcc61507f8), AE_AML_BUFFER_LIMIT (20170303/psparse-543)
      [   14.459279] ACPI Error: Method parse/execution failed [\_SB.WMID.WMAA] (Node ffff8edcc61523c0), AE_AML_BUFFER_LIMIT (20170303/psparse-543)
      
      This commit increases the size of the data element of the bios_args struct
      to 128 bytes fixing these errors.
      
      Cc: stable@vger.kernel.org
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=197007
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=201981
      BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1520703Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      15d6d766
    • Lionel Debieve's avatar
      hwrng: stm32 - fix unbalanced pm_runtime_enable · 665eb2db
      Lionel Debieve authored
      commit af0d4442 upstream.
      
      No remove function implemented yet in the driver.
      Without remove function, the pm_runtime implementation
      complains when removing and probing again the driver.
      Signed-off-by: default avatarLionel Debieve <lionel.debieve@st.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      665eb2db
    • Candle Sun's avatar
      HID: core: check whether Usage Page item is after Usage ID items · 08d5c69a
      Candle Sun authored
      commit 1cb0d2ae upstream.
      
      Upstream commit 58e75155 ("HID: core: move Usage Page concatenation
      to Main item") adds support for Usage Page item after Usage ID items
      (such as keyboards manufactured by Primax).
      
      Usage Page concatenation in Main item works well for following report
      descriptor patterns:
      
          USAGE_PAGE (Keyboard)                   05 07
          USAGE_MINIMUM (Keyboard LeftControl)    19 E0
          USAGE_MAXIMUM (Keyboard Right GUI)      29 E7
          LOGICAL_MINIMUM (0)                     15 00
          LOGICAL_MAXIMUM (1)                     25 01
          REPORT_SIZE (1)                         75 01
          REPORT_COUNT (8)                        95 08
          INPUT (Data,Var,Abs)                    81 02
      
      -------------
      
          USAGE_MINIMUM (Keyboard LeftControl)    19 E0
          USAGE_MAXIMUM (Keyboard Right GUI)      29 E7
          LOGICAL_MINIMUM (0)                     15 00
          LOGICAL_MAXIMUM (1)                     25 01
          REPORT_SIZE (1)                         75 01
          REPORT_COUNT (8)                        95 08
          USAGE_PAGE (Keyboard)                   05 07
          INPUT (Data,Var,Abs)                    81 02
      
      But it makes the parser act wrong for the following report
      descriptor pattern(such as some Gamepads):
      
          USAGE_PAGE (Button)                     05 09
          USAGE (Button 1)                        09 01
          USAGE (Button 2)                        09 02
          USAGE (Button 4)                        09 04
          USAGE (Button 5)                        09 05
          USAGE (Button 7)                        09 07
          USAGE (Button 8)                        09 08
          USAGE (Button 14)                       09 0E
          USAGE (Button 15)                       09 0F
          USAGE (Button 13)                       09 0D
          USAGE_PAGE (Consumer Devices)           05 0C
          USAGE (Back)                            0a 24 02
          USAGE (HomePage)                        0a 23 02
          LOGICAL_MINIMUM (0)                     15 00
          LOGICAL_MAXIMUM (1)                     25 01
          REPORT_SIZE (1)                         75 01
          REPORT_COUNT (11)                       95 0B
          INPUT (Data,Var,Abs)                    81 02
      
      With Usage Page concatenation in Main item, parser recognizes all the
      11 Usages as consumer keys, it is not the HID device's real intention.
      
      This patch checks whether Usage Page is really defined after Usage ID
      items by comparing usage page using status.
      
      Usage Page concatenation on currently defined Usage Page will always
      do in local parsing when Usage ID items encountered.
      
      When Main item is parsing, concatenation will do again with last
      defined Usage Page if this page has not been used in the previous
      usages concatenation.
      Signed-off-by: default avatarCandle Sun <candle.sun@unisoc.com>
      Signed-off-by: default avatarNianfu Bai <nianfu.bai@unisoc.com>
      Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Cc: Siarhei Vishniakou <svv@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      08d5c69a
    • Dust Li's avatar
      net: sched: fix `tc -s class show` no bstats on class with nolock subqueues · 885187e3
      Dust Li authored
      [ Upstream commit 14e54ab9 ]
      
      When a classful qdisc's child qdisc has set the flag
      TCQ_F_CPUSTATS (pfifo_fast for example), the child qdisc's
      cpu_bstats should be passed to gnet_stats_copy_basic(),
      but many classful qdisc didn't do that. As a result,
      `tc -s class show dev DEV` always return 0 for bytes and
      packets in this case.
      
      Pass the child qdisc's cpu_bstats to gnet_stats_copy_basic()
      to fix this issue.
      
      The qstats also has this problem, but it has been fixed
      in 5dd431b6 ("net: sched: introduce and use qstats read...")
      and bstats still remains buggy.
      
      Fixes: 22e0f8b9 ("net: sched: make bstats per cpu and estimator RCU safe")
      Signed-off-by: default avatarDust Li <dust.li@linux.alibaba.com>
      Signed-off-by: default avatarTony Lu <tonylu@linux.alibaba.com>
      Acked-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      885187e3
    • Xin Long's avatar
      sctp: cache netns in sctp_ep_common · 4d921090
      Xin Long authored
      [ Upstream commit 31243461 ]
      
      This patch is to fix a data-race reported by syzbot:
      
        BUG: KCSAN: data-race in sctp_assoc_migrate / sctp_hash_obj
      
        write to 0xffff8880b67c0020 of 8 bytes by task 18908 on cpu 1:
          sctp_assoc_migrate+0x1a6/0x290 net/sctp/associola.c:1091
          sctp_sock_migrate+0x8aa/0x9b0 net/sctp/socket.c:9465
          sctp_accept+0x3c8/0x470 net/sctp/socket.c:4916
          inet_accept+0x7f/0x360 net/ipv4/af_inet.c:734
          __sys_accept4+0x224/0x430 net/socket.c:1754
          __do_sys_accept net/socket.c:1795 [inline]
          __se_sys_accept net/socket.c:1792 [inline]
          __x64_sys_accept+0x4e/0x60 net/socket.c:1792
          do_syscall_64+0xcc/0x370 arch/x86/entry/common.c:290
          entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
        read to 0xffff8880b67c0020 of 8 bytes by task 12003 on cpu 0:
          sctp_hash_obj+0x4f/0x2d0 net/sctp/input.c:894
          rht_key_get_hash include/linux/rhashtable.h:133 [inline]
          rht_key_hashfn include/linux/rhashtable.h:159 [inline]
          rht_head_hashfn include/linux/rhashtable.h:174 [inline]
          head_hashfn lib/rhashtable.c:41 [inline]
          rhashtable_rehash_one lib/rhashtable.c:245 [inline]
          rhashtable_rehash_chain lib/rhashtable.c:276 [inline]
          rhashtable_rehash_table lib/rhashtable.c:316 [inline]
          rht_deferred_worker+0x468/0xab0 lib/rhashtable.c:420
          process_one_work+0x3d4/0x890 kernel/workqueue.c:2269
          worker_thread+0xa0/0x800 kernel/workqueue.c:2415
          kthread+0x1d4/0x200 drivers/block/aoe/aoecmd.c:1253
          ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352
      
      It was caused by rhashtable access asoc->base.sk when sctp_assoc_migrate
      is changing its value. However, what rhashtable wants is netns from asoc
      base.sk, and for an asoc, its netns won't change once set. So we can
      simply fix it by caching netns since created.
      
      Fixes: d6c0256a ("sctp: add the rhashtable apis for sctp global transport hashtable")
      Reported-by: syzbot+e3b35fe7918ff0ee474e@syzkaller.appspotmail.com
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4d921090
    • John Rutherford's avatar
      tipc: fix link name length check · 38e88175
      John Rutherford authored
      [ Upstream commit fd567ac2 ]
      
      In commit 4f07b80c ("tipc: check msg->req data len in
      tipc_nl_compat_bearer_disable") the same patch code was copied into
      routines: tipc_nl_compat_bearer_disable(),
      tipc_nl_compat_link_stat_dump() and tipc_nl_compat_link_reset_stats().
      The two link routine occurrences should have been modified to check
      the maximum link name length and not bearer name length.
      
      Fixes: 4f07b80c ("tipc: check msg->reg data len in tipc_nl_compat_bearer_disable")
      Signed-off-by: default avatarJohn Rutherford <john.rutherford@dektech.com.au>
      Acked-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      38e88175
    • Paolo Abeni's avatar
      openvswitch: remove another BUG_ON() · 3c65c561
      Paolo Abeni authored
      [ Upstream commit 8a574f86 ]
      
      If we can't build the flow del notification, we can simply delete
      the flow, no need to crash the kernel. Still keep a WARN_ON to
      preserve debuggability.
      
      Note: the BUG_ON() predates the Fixes tag, but this change
      can be applied only after the mentioned commit.
      
      v1 -> v2:
       - do not leak an skb on error
      
      Fixes: aed06778 ("openvswitch: Minimize ovs_flow_cmd_del critical section.")
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3c65c561
    • Paolo Abeni's avatar
      openvswitch: drop unneeded BUG_ON() in ovs_flow_cmd_build_info() · 1996d4a6
      Paolo Abeni authored
      [ Upstream commit 8ffeb03f ]
      
      All the callers of ovs_flow_cmd_build_info() already deal with
      error return code correctly, so we can handle the error condition
      in a more gracefull way. Still dump a warning to preserve
      debuggability.
      
      v1 -> v2:
       - clarify the commit message
       - clean the skb and report the error (DaveM)
      
      Fixes: ccb1352e ("net: Add Open vSwitch kernel components.")
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1996d4a6
    • Jouni Hogander's avatar
      slip: Fix use-after-free Read in slip_open · 8d448b5d
      Jouni Hogander authored
      [ Upstream commit e58c1912 ]
      
      Slip_open doesn't clean-up device which registration failed from the
      slip_devs device list. On next open after failure this list is iterated
      and freed device is accessed. Fix this by calling sl_free_netdev in error
      path.
      
      Here is the trace from the Syzbot:
      
      __dump_stack lib/dump_stack.c:77 [inline]
      dump_stack+0x197/0x210 lib/dump_stack.c:118
      print_address_description.constprop.0.cold+0xd4/0x30b mm/kasan/report.c:374
      __kasan_report.cold+0x1b/0x41 mm/kasan/report.c:506
      kasan_report+0x12/0x20 mm/kasan/common.c:634
      __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132
      sl_sync drivers/net/slip/slip.c:725 [inline]
      slip_open+0xecd/0x11b7 drivers/net/slip/slip.c:801
      tty_ldisc_open.isra.0+0xa3/0x110 drivers/tty/tty_ldisc.c:469
      tty_set_ldisc+0x30e/0x6b0 drivers/tty/tty_ldisc.c:596
      tiocsetd drivers/tty/tty_io.c:2334 [inline]
      tty_ioctl+0xe8d/0x14f0 drivers/tty/tty_io.c:2594
      vfs_ioctl fs/ioctl.c:46 [inline]
      file_ioctl fs/ioctl.c:509 [inline]
      do_vfs_ioctl+0xdb6/0x13e0 fs/ioctl.c:696
      ksys_ioctl+0xab/0xd0 fs/ioctl.c:713
      __do_sys_ioctl fs/ioctl.c:720 [inline]
      __se_sys_ioctl fs/ioctl.c:718 [inline]
      __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:718
      do_syscall_64+0xfa/0x760 arch/x86/entry/common.c:290
      entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Fixes: 3b5a3997 ("slip: Fix memory leak in slip_open error path")
      Reported-by: syzbot+4d5170758f3762109542@syzkaller.appspotmail.com
      Cc: David Miller <davem@davemloft.net>
      Cc: Oliver Hartkopp <socketcan@hartkopp.net>
      Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
      Signed-off-by: default avatarJouni Hogander <jouni.hogander@unikie.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8d448b5d
    • Paolo Abeni's avatar
      openvswitch: fix flow command message size · b07c0629
      Paolo Abeni authored
      [ Upstream commit 4e81c0b3 ]
      
      When user-space sets the OVS_UFID_F_OMIT_* flags, and the relevant
      flow has no UFID, we can exceed the computed size, as
      ovs_nla_put_identifier() will always dump an OVS_FLOW_ATTR_KEY
      attribute.
      Take the above in account when computing the flow command message
      size.
      
      Fixes: 74ed7ab9 ("openvswitch: Add support for unique flow IDs.")
      Reported-by: default avatarQi Jun Ding <qding@redhat.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b07c0629