Skip to content
  1. Jan 17, 2020
    • Eric Dumazet's avatar
      net: usb: lan78xx: limit size of local TSO packets · a3278851
      Eric Dumazet authored
      commit f8d7408a upstream.
      
      lan78xx_tx_bh() makes sure to not exceed MAX_SINGLE_PACKET_SIZE
      bytes in the aggregated packets it builds, but does
      nothing to prevent large GSO packets being submitted.
      
      Pierre-Francois reported various hangs when/if TSO is enabled.
      
      For localy generated packets, we can use netif_set_gso_max_size()
      to limit the size of TSO packets.
      
      Note that forwarded packets could still hit the issue,
      so a complete fix might require implementing .ndo_features_check
      for this driver, forcing a software segmentation if the size
      of the TSO packet exceeds MAX_SINGLE_PACKET_SIZE.
      
      Fixes: 55d7de9d
      
       ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarRENARD Pierre-Francois <pfrenard@gmail.com>
      Tested-by: default avatarRENARD Pierre-Francois <pfrenard@gmail.com>
      Cc: Stefan Wahren <stefan.wahren@i2se.com>
      Cc: Woojung Huh <woojung.huh@microchip.com>
      Cc: Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a3278851
  2. Jan 15, 2020
    • Jonathan Bell's avatar
      dwc_otg: fiq_fsm: add a barrier on entry into FIQ handler(s) · ac6064a0
      Jonathan Bell authored
      
      
      On BCM2835, there is no hardware guarantee that multiple outstanding
      reads to different peripherals will complete in-order. The FIQ code
      uses peripheral reads without barriers for performance, so in the case
      where a read to a slow peripheral was issued immediately prior to FIQ
      entry, the first peripheral read that the FIQ did could end up with
      wrong read data returned.
      
      Add dsb(sy) on entry so that all outstanding reads are retired.
      
      The FIQ only issues reads to the dwc_otg core, so per-read barriers
      in the handler itself are not required.
      
      On BCM2836 and BCM2837 the barrier is not strictly required due to
      differences in how the peripheral bus is implemented, but having
      arch-specific handlers that introduce different latencies is risky.
      
      Signed-off-by: default avatarJonathan Bell <jonathan@raspberrypi.org>
      ac6064a0
  3. Jan 14, 2020
  4. Jan 12, 2020
    • Greg Kroah-Hartman's avatar
      Linux 4.19.95 · dcd88898
      Greg Kroah-Hartman authored
      dcd88898
    • Qi Zhou's avatar
      usb: missing parentheses in USE_NEW_SCHEME · aad8003a
      Qi Zhou authored
      commit 1530f6f5 upstream.
      
      According to bd0e6c96
      
       ("usb: hub: try old enumeration scheme first
      for high speed devices") the kernel will try the old enumeration scheme
      first for high speed devices.  This can happen when a high speed device
      is plugged in.
      
      But due to missing parentheses in the USE_NEW_SCHEME define, this logic
      can get messed up and the incorrect result happens.
      
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarQi Zhou <atmgnd@outlook.com>
      Link: https://lore.kernel.org/r/ht4mtag8ZP-HKEhD0KkJhcFnVlOFV8N8eNjJVRD9pDkkLUNhmEo8_cL_sl7xy9mdajdH-T8J3TFQsjvoYQT61NFjQXy469Ed_BbBw_x4S1E=@protonmail.com
      [ fixup changelog text - gregkh]
      Cc: stable <stable@vger.kernel.org>
      Fixes: bd0e6c96
      
       ("usb: hub: try old enumeration scheme first for high speed devices")
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aad8003a
    • Daniele Palmas's avatar
      USB: serial: option: add Telit ME910G1 0x110a composition · a16ae613
      Daniele Palmas authored
      commit 0d3010fa
      
       upstream.
      
      This patch adds the following Telit ME910G1 composition:
      
      0x110a: tty, tty, tty, rmnet
      
      Signed-off-by: default avatarDaniele Palmas <dnlplm@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a16ae613
    • Johan Hovold's avatar
      USB: core: fix check for duplicate endpoints · f85541a5
      Johan Hovold authored
      commit 3e4f8e21 upstream.
      
      Amend the endpoint-descriptor sanity checks to detect all duplicate
      endpoint addresses in a configuration.
      
      Commit 0a8fd134
      
       ("USB: fix problems with duplicate endpoint
      addresses") added a check for duplicate endpoint addresses within a
      single alternate setting, but did not look for duplicate addresses in
      other interfaces.
      
      The current check would also not detect all duplicate addresses when one
      endpoint is as a (bi-directional) control endpoint.
      
      This specifically avoids overwriting the endpoint entries in struct
      usb_device when enabling a duplicate endpoint, something which could
      potentially lead to crashes or leaks, for example, when endpoints are
      later disabled.
      
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Link: https://lore.kernel.org/r/20191219161016.6695-1-johan@kernel.org
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f85541a5
    • Thinh Nguyen's avatar
      usb: dwc3: gadget: Fix request complete check · ceaeb21b
      Thinh Nguyen authored
      commit ea0d7627 upstream.
      
      We can only check for IN direction if the request had completed. For OUT
      direction, it's perfectly fine that the host can send less than the
      setup length. Let's return true fall all cases of OUT direction.
      
      Fixes: e0c42ce5
      
       ("usb: dwc3: gadget: simplify IOC handling")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarThinh Nguyen <thinhn@synopsys.com>
      Link: https://lore.kernel.org/r/ac5a3593a94fdaa3d92e6352356b5f7a01ccdc7c.1576291140.git.thinhn@synopsys.com
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ceaeb21b
    • Petr Machata's avatar
      net: sch_prio: When ungrafting, replace with FIFO · 672d3ca2
      Petr Machata authored
      [ Upstream commit 240ce7f6 ]
      
      When a child Qdisc is removed from one of the PRIO Qdisc's bands, it is
      replaced unconditionally by a NOOP qdisc. As a result, any traffic hitting
      that band gets dropped. That is incorrect--no Qdisc was explicitly added
      when PRIO was created, and after removal, none should have to be added
      either.
      
      Fix PRIO by first attempting to create a default Qdisc and only falling
      back to noop when that fails. This pattern of attempting to create an
      invisible FIFO, using NOOP only as a fallback, is also seen in other
      Qdiscs.
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      672d3ca2
    • Petr Machata's avatar
      mlxsw: spectrum_qdisc: Ignore grafting of invisible FIFO · 741cf884
      Petr Machata authored
      [ Upstream commit 3971a535 ]
      
      The following patch will change PRIO to replace a removed Qdisc with an
      invisible FIFO, instead of NOOP. mlxsw will see this replacement due to the
      graft message that is generated. But because FIFO does not issue its own
      REPLACE message, when the graft operation takes place, the Qdisc that mlxsw
      tracks under the indicated band is still the old one. The child
      handle (0:0) therefore does not match, and mlxsw rejects the graft
      operation, which leads to an extack message:
      
          Warning: Offloading graft operation failed.
      
      Fix by ignoring the invisible children in the PRIO graft handler. The
      DESTROY message of the removed Qdisc is going to follow shortly and handle
      the removal.
      
      Fixes: 32dc5efc
      
       ("mlxsw: spectrum: qdiscs: prio: Handle graft command")
      Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      741cf884
    • Eric Dumazet's avatar
      vlan: vlan_changelink() should propagate errors · a98672dd
      Eric Dumazet authored
      [ Upstream commit eb8ef2a3 ]
      
      Both vlan_dev_change_flags() and vlan_dev_set_egress_priority()
      can return an error. vlan_changelink() should not ignore them.
      
      Fixes: 07b5b17e
      
       ("[VLAN]: Use rtnl_link API")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a98672dd
    • Eric Dumazet's avatar
      vlan: fix memory leak in vlan_dev_set_egress_priority · 4e71a156
      Eric Dumazet authored
      [ Upstream commit 9bbd917e ]
      
      There are few cases where the ndo_uninit() handler might be not
      called if an error happens while device is initialized.
      
      Since vlan_newlink() calls vlan_changelink() before
      trying to register the netdevice, we need to make sure
      vlan_dev_uninit() has been called at least once,
      or we might leak allocated memory.
      
      BUG: memory leak
      unreferenced object 0xffff888122a206c0 (size 32):
        comm "syz-executor511", pid 7124, jiffies 4294950399 (age 32.240s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 61 73 00 00 00 00 00 00 00 00  ......as........
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<000000000eb3bb85>] kmemleak_alloc_recursive include/linux/kmemleak.h:43 [inline]
          [<000000000eb3bb85>] slab_post_alloc_hook mm/slab.h:586 [inline]
          [<000000000eb3bb85>] slab_alloc mm/slab.c:3320 [inline]
          [<000000000eb3bb85>] kmem_cache_alloc_trace+0x145/0x2c0 mm/slab.c:3549
          [<000000007b99f620>] kmalloc include/linux/slab.h:556 [inline]
          [<000000007b99f620>] vlan_dev_set_egress_priority+0xcc/0x150 net/8021q/vlan_dev.c:194
          [<000000007b0cb745>] vlan_changelink+0xd6/0x140 net/8021q/vlan_netlink.c:126
          [<0000000065aba83a>] vlan_newlink+0x135/0x200 net/8021q/vlan_netlink.c:181
          [<00000000fb5dd7a2>] __rtnl_newlink+0x89a/0xb80 net/core/rtnetlink.c:3305
          [<00000000ae4273a1>] rtnl_newlink+0x4e/0x80 net/core/rtnetlink.c:3363
          [<00000000decab39f>] rtnetlink_rcv_msg+0x178/0x4b0 net/core/rtnetlink.c:5424
          [<00000000accba4ee>] netlink_rcv_skb+0x61/0x170 net/netlink/af_netlink.c:2477
          [<00000000319fe20f>] rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:5442
          [<00000000d51938dc>] netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline]
          [<00000000d51938dc>] netlink_unicast+0x223/0x310 net/netlink/af_netlink.c:1328
          [<00000000e539ac79>] netlink_sendmsg+0x2c0/0x570 net/netlink/af_netlink.c:1917
          [<000000006250c27e>] sock_sendmsg_nosec net/socket.c:639 [inline]
          [<000000006250c27e>] sock_sendmsg+0x54/0x70 net/socket.c:659
          [<00000000e2a156d1>] ____sys_sendmsg+0x2d0/0x300 net/socket.c:2330
          [<000000008c87466e>] ___sys_sendmsg+0x8a/0xd0 net/socket.c:2384
          [<00000000110e3054>] __sys_sendmsg+0x80/0xf0 net/socket.c:2417
          [<00000000d71077c8>] __do_sys_sendmsg net/socket.c:2426 [inline]
          [<00000000d71077c8>] __se_sys_sendmsg net/socket.c:2424 [inline]
          [<00000000d71077c8>] __x64_sys_sendmsg+0x23/0x30 net/socket.c:2424
      
      Fixe: 07b5b17e
      
       ("[VLAN]: Use rtnl_link API")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4e71a156
    • Hangbin Liu's avatar
      vxlan: fix tos value before xmit · b5fdf59c
      Hangbin Liu authored
      [ Upstream commit 71130f29 ]
      
      Before ip_tunnel_ecn_encap() and udp_tunnel_xmit_skb() we should filter
      tos value by RT_TOS() instead of using config tos directly.
      
      vxlan_get_route() would filter the tos to fl4.flowi4_tos but we didn't
      return it back, as geneve_get_v4_rt() did. So we have to use RT_TOS()
      directly in function ip_tunnel_ecn_encap().
      
      Fixes: 206aaafc ("VXLAN: Use IP Tunnels tunnel ENC encap API")
      Fixes: 1400615d
      
       ("vxlan: allow setting ipv6 traffic class")
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b5fdf59c
    • Pengcheng Yang's avatar
      tcp: fix "old stuff" D-SACK causing SACK to be treated as D-SACK · 5ea5b6e3
      Pengcheng Yang authored
      [ Upstream commit c9655008 ]
      
      When we receive a D-SACK, where the sequence number satisfies:
      	undo_marker <= start_seq < end_seq <= prior_snd_una
      we consider this is a valid D-SACK and tcp_is_sackblock_valid()
      returns true, then this D-SACK is discarded as "old stuff",
      but the variable first_sack_index is not marked as negative
      in tcp_sacktag_write_queue().
      
      If this D-SACK also carries a SACK that needs to be processed
      (for example, the previous SACK segment was lost), this SACK
      will be treated as a D-SACK in the following processing of
      tcp_sacktag_write_queue(), which will eventually lead to
      incorrect updates of undo_retrans and reordering.
      
      Fixes: fd6dad61
      
       ("[TCP]: Earlier SACK block verification & simplify access to them")
      Signed-off-by: default avatarPengcheng Yang <yangpc@wangsu.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5ea5b6e3
    • Xin Long's avatar
      sctp: free cmd->obj.chunk for the unprocessed SCTP_CMD_REPLY · 5f52b9eb
      Xin Long authored
      [ Upstream commit be7a7729
      
       ]
      
      This patch is to fix a memleak caused by no place to free cmd->obj.chunk
      for the unprocessed SCTP_CMD_REPLY. This issue occurs when failing to
      process a cmd while there're still SCTP_CMD_REPLY cmds on the cmd seq
      with an allocated chunk in cmd->obj.chunk.
      
      So fix it by freeing cmd->obj.chunk for each SCTP_CMD_REPLY cmd left on
      the cmd seq when any cmd returns error. While at it, also remove 'nomem'
      label.
      
      Reported-by: default avatar <syzbot+107c4aff5f392bf1517f@syzkaller.appspotmail.com>
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5f52b9eb
    • Wen Yang's avatar
      sch_cake: avoid possible divide by zero in cake_enqueue() · f5c8c211
      Wen Yang authored
      [ Upstream commit 68aab823 ]
      
      The variables 'window_interval' is u64 and do_div()
      truncates it to 32 bits, which means it can test
      non-zero and be truncated to zero for division.
      The unit of window_interval is nanoseconds,
      so its lower 32-bit is relatively easy to exceed.
      Fix this issue by using div64_u64() instead.
      
      Fixes: 7298de9c
      
       ("sch_cake: Add ingress mode")
      Signed-off-by: default avatarWen Yang <wenyang@linux.alibaba.com>
      Cc: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
      Cc: Toke Høiland-Jørgensen <toke@redhat.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Cong Wang <xiyou.wangcong@gmail.com>
      Cc: cake@lists.bufferbloat.net
      Cc: netdev@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Acked-by: default avatarToke Høiland-Jørgensen <toke@toke.dk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f5c8c211
    • Eric Dumazet's avatar
      pkt_sched: fq: do not accept silly TCA_FQ_QUANTUM · 94ac4a4d
      Eric Dumazet authored
      [ Upstream commit d9e15a27 ]
      
      As diagnosed by Florian :
      
      If TCA_FQ_QUANTUM is set to 0x80000000, fq_deueue()
      can loop forever in :
      
      if (f->credit <= 0) {
        f->credit += q->quantum;
        goto begin;
      }
      
      ... because f->credit is either 0 or -2147483648.
      
      Let's limit TCA_FQ_QUANTUM to no more than 1 << 20 :
      This max value should limit risks of breaking user setups
      while fixing this bug.
      
      Fixes: afe4fd06
      
       ("pkt_sched: fq: Fair Queue packet scheduler")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Diagnosed-by: default avatarFlorian Westphal <fw@strlen.de>
      Reported-by: default avatar <syzbot+dc9071cc5a85950bdfce@syzkaller.appspotmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      94ac4a4d
    • Eric Dumazet's avatar
      net: usb: lan78xx: fix possible skb leak · 77b07bbf
      Eric Dumazet authored
      [ Upstream commit 47240ba0 ]
      
      If skb_linearize() fails, we need to free the skb.
      
      TSO makes skb bigger, and this bug might be the reason
      Raspberry Pi 3B+ users had to disable TSO.
      
      Fixes: 55d7de9d
      
       ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarRENARD Pierre-Francois <pfrenard@gmail.com>
      Cc: Stefan Wahren <stefan.wahren@i2se.com>
      Cc: Woojung Huh <woojung.huh@microchip.com>
      Cc: Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      77b07bbf
    • Chen-Yu Tsai's avatar
      net: stmmac: dwmac-sunxi: Allow all RGMII modes · 5994f91d
      Chen-Yu Tsai authored
      [ Upstream commit 52cc73e5 ]
      
      Allow all the RGMII modes to be used. This would allow us to represent
      the hardware better in the device tree with RGMII_ID where in most
      cases the PHY's internal delay for both RX and TX are used.
      
      Fixes: af0bd4e9
      
       ("net: stmmac: sunxi platform extensions for GMAC in Allwinner A20 SoC's")
      Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5994f91d
    • Chen-Yu Tsai's avatar
      net: stmmac: dwmac-sun8i: Allow all RGMII modes · 527d7463
      Chen-Yu Tsai authored
      [ Upstream commit f1239d8a ]
      
      Allow all the RGMII modes to be used. This would allow us to represent
      the hardware better in the device tree with RGMII_ID where in most
      cases the PHY's internal delay for both RX and TX are used.
      
      Fixes: 9f93ac8d
      
       ("net-next: stmmac: Add dwmac-sun8i")
      Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      527d7463
    • Andrew Lunn's avatar
      net: dsa: mv88e6xxx: Preserve priority when setting CPU port. · d36857e0
      Andrew Lunn authored
      [ Upstream commit d8dc2c96 ]
      
      The 6390 family uses an extended register to set the port connected to
      the CPU. The lower 5 bits indicate the port, the upper three bits are
      the priority of the frames as they pass through the switch, what
      egress queue they should use, etc. Since frames being set to the CPU
      are typically management frames, BPDU, IGMP, ARP, etc set the priority
      to 7, the reset default, and the highest.
      
      Fixes: 33641994
      
       ("net: dsa: mv88e6xxx: Monitor and Management tables")
      Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Tested-by: default avatarChris Healy <cphealy@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d36857e0
    • Eric Dumazet's avatar
      macvlan: do not assume mac_header is set in macvlan_broadcast() · 5f3274c5
      Eric Dumazet authored
      [ Upstream commit 96cc4b69 ]
      
      Use of eth_hdr() in tx path is error prone.
      
      Many drivers call skb_reset_mac_header() before using it,
      but others do not.
      
      Commit 6d1ccff6 ("net: reset mac header in dev_start_xmit()")
      attempted to fix this generically, but commit d346a3fa
      ("packet: introduce PACKET_QDISC_BYPASS socket option") brought
      back the macvlan bug.
      
      Lets add a new helper, so that tx paths no longer have
      to call skb_reset_mac_header() only to get a pointer
      to skb->data.
      
      Hopefully we will be able to revert 6d1ccff6
      ("net: reset mac header in dev_start_xmit()") and save few cycles
      in transmit fast path.
      
      BUG: KASAN: use-after-free in __get_unaligned_cpu32 include/linux/unaligned/packed_struct.h:19 [inline]
      BUG: KASAN: use-after-free in mc_hash drivers/net/macvlan.c:251 [inline]
      BUG: KASAN: use-after-free in macvlan_broadcast+0x547/0x620 drivers/net/macvlan.c:277
      Read of size 4 at addr ffff8880a4932401 by task syz-executor947/9579
      
      CPU: 0 PID: 9579 Comm: syz-executor947 Not tainted 5.5.0-rc4-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+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:639
       __asan_report_load_n_noabort+0xf/0x20 mm/kasan/generic_report.c:145
       __get_unaligned_cpu32 include/linux/unaligned/packed_struct.h:19 [inline]
       mc_hash drivers/net/macvlan.c:251 [inline]
       macvlan_broadcast+0x547/0x620 drivers/net/macvlan.c:277
       macvlan_queue_xmit drivers/net/macvlan.c:520 [inline]
       macvlan_start_xmit+0x402/0x77f drivers/net/macvlan.c:559
       __netdev_start_xmit include/linux/netdevice.h:4447 [inline]
       netdev_start_xmit include/linux/netdevice.h:4461 [inline]
       dev_direct_xmit+0x419/0x630 net/core/dev.c:4079
       packet_direct_xmit+0x1a9/0x250 net/packet/af_packet.c:240
       packet_snd net/packet/af_packet.c:2966 [inline]
       packet_sendmsg+0x260d/0x6220 net/packet/af_packet.c:2991
       sock_sendmsg_nosec net/socket.c:639 [inline]
       sock_sendmsg+0xd7/0x130 net/socket.c:659
       __sys_sendto+0x262/0x380 net/socket.c:1985
       __do_sys_sendto net/socket.c:1997 [inline]
       __se_sys_sendto net/socket.c:1993 [inline]
       __x64_sys_sendto+0xe1/0x1a0 net/socket.c:1993
       do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      RIP: 0033:0x442639
      Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 5b 10 fc ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007ffc13549e08 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
      RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000442639
      RDX: 000000000000000e RSI: 0000000020000080 RDI: 0000000000000003
      RBP: 0000000000000004 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
      R13: 0000000000403bb0 R14: 0000000000000000 R15: 0000000000000000
      
      Allocated by task 9389:
       save_stack+0x23/0x90 mm/kasan/common.c:72
       set_track mm/kasan/common.c:80 [inline]
       __kasan_kmalloc mm/kasan/common.c:513 [inline]
       __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:486
       kasan_kmalloc+0x9/0x10 mm/kasan/common.c:527
       __do_kmalloc mm/slab.c:3656 [inline]
       __kmalloc+0x163/0x770 mm/slab.c:3665
       kmalloc include/linux/slab.h:561 [inline]
       tomoyo_realpath_from_path+0xc5/0x660 security/tomoyo/realpath.c:252
       tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
       tomoyo_path_perm+0x230/0x430 security/tomoyo/file.c:822
       tomoyo_inode_getattr+0x1d/0x30 security/tomoyo/tomoyo.c:129
       security_inode_getattr+0xf2/0x150 security/security.c:1222
       vfs_getattr+0x25/0x70 fs/stat.c:115
       vfs_statx_fd+0x71/0xc0 fs/stat.c:145
       vfs_fstat include/linux/fs.h:3265 [inline]
       __do_sys_newfstat+0x9b/0x120 fs/stat.c:378
       __se_sys_newfstat fs/stat.c:375 [inline]
       __x64_sys_newfstat+0x54/0x80 fs/stat.c:375
       do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      Freed by task 9389:
       save_stack+0x23/0x90 mm/kasan/common.c:72
       set_track mm/kasan/common.c:80 [inline]
       kasan_set_free_info mm/kasan/common.c:335 [inline]
       __kasan_slab_free+0x102/0x150 mm/kasan/common.c:474
       kasan_slab_free+0xe/0x10 mm/kasan/common.c:483
       __cache_free mm/slab.c:3426 [inline]
       kfree+0x10a/0x2c0 mm/slab.c:3757
       tomoyo_realpath_from_path+0x1a7/0x660 security/tomoyo/realpath.c:289
       tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
       tomoyo_path_perm+0x230/0x430 security/tomoyo/file.c:822
       tomoyo_inode_getattr+0x1d/0x30 security/tomoyo/tomoyo.c:129
       security_inode_getattr+0xf2/0x150 security/security.c:1222
       vfs_getattr+0x25/0x70 fs/stat.c:115
       vfs_statx_fd+0x71/0xc0 fs/stat.c:145
       vfs_fstat include/linux/fs.h:3265 [inline]
       __do_sys_newfstat+0x9b/0x120 fs/stat.c:378
       __se_sys_newfstat fs/stat.c:375 [inline]
       __x64_sys_newfstat+0x54/0x80 fs/stat.c:375
       do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      The buggy address belongs to the object at ffff8880a4932000
       which belongs to the cache kmalloc-4k of size 4096
      The buggy address is located 1025 bytes inside of
       4096-byte region [ffff8880a4932000, ffff8880a4933000)
      The buggy address belongs to the page:
      page:ffffea0002924c80 refcount:1 mapcount:0 mapping:ffff8880aa402000 index:0x0 compound_mapcount: 0
      raw: 00fffe0000010200 ffffea0002846208 ffffea00028f3888 ffff8880aa402000
      raw: 0000000000000000 ffff8880a4932000 0000000100000001 0000000000000000
      page dumped because: kasan: bad access detected
      
      Memory state around the buggy address:
       ffff8880a4932300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
       ffff8880a4932380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      >ffff8880a4932400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
       ffff8880a4932480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
       ffff8880a4932500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      
      Fixes: b863ceb7
      
       ("[NET]: Add macvlan driver")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5f3274c5
    • Eric Dumazet's avatar
      gtp: fix bad unlock balance in gtp_encap_enable_socket · 776a81a0
      Eric Dumazet authored
      [ Upstream commit 90d72256 ]
      
      WARNING: bad unlock balance detected!
      5.5.0-rc5-syzkaller #0 Not tainted
      -------------------------------------
      syz-executor921/9688 is trying to release lock (sk_lock-AF_INET6) at:
      [<ffffffff84bf8506>] gtp_encap_enable_socket+0x146/0x400 drivers/net/gtp.c:830
      but there are no more locks to release!
      
      other info that might help us debug this:
      2 locks held by syz-executor921/9688:
       #0: ffffffff8a4d8840 (rtnl_mutex){+.+.}, at: rtnl_lock net/core/rtnetlink.c:72 [inline]
       #0: ffffffff8a4d8840 (rtnl_mutex){+.+.}, at: rtnetlink_rcv_msg+0x405/0xaf0 net/core/rtnetlink.c:5421
       #1: ffff88809304b560 (slock-AF_INET6){+...}, at: spin_lock_bh include/linux/spinlock.h:343 [inline]
       #1: ffff88809304b560 (slock-AF_INET6){+...}, at: release_sock+0x20/0x1c0 net/core/sock.c:2951
      
      stack backtrace:
      CPU: 0 PID: 9688 Comm: syz-executor921 Not tainted 5.5.0-rc5-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0x197/0x210 lib/dump_stack.c:118
       print_unlock_imbalance_bug kernel/locking/lockdep.c:4008 [inline]
       print_unlock_imbalance_bug.cold+0x114/0x123 kernel/locking/lockdep.c:3984
       __lock_release kernel/locking/lockdep.c:4242 [inline]
       lock_release+0x5f2/0x960 kernel/locking/lockdep.c:4503
       sock_release_ownership include/net/sock.h:1496 [inline]
       release_sock+0x17c/0x1c0 net/core/sock.c:2961
       gtp_encap_enable_socket+0x146/0x400 drivers/net/gtp.c:830
       gtp_encap_enable drivers/net/gtp.c:852 [inline]
       gtp_newlink+0x9fc/0xc60 drivers/net/gtp.c:666
       __rtnl_newlink+0x109e/0x1790 net/core/rtnetlink.c:3305
       rtnl_newlink+0x69/0xa0 net/core/rtnetlink.c:3363
       rtnetlink_rcv_msg+0x45e/0xaf0 net/core/rtnetlink.c:5424
       netlink_rcv_skb+0x177/0x450 net/netlink/af_netlink.c:2477
       rtnetlink_rcv+0x1d/0x30 net/core/rtnetlink.c:5442
       netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline]
       netlink_unicast+0x58c/0x7d0 net/netlink/af_netlink.c:1328
       netlink_sendmsg+0x91c/0xea0 net/netlink/af_netlink.c:1917
       sock_sendmsg_nosec net/socket.c:639 [inline]
       sock_sendmsg+0xd7/0x130 net/socket.c:659
       ____sys_sendmsg+0x753/0x880 net/socket.c:2330
       ___sys_sendmsg+0x100/0x170 net/socket.c:2384
       __sys_sendmsg+0x105/0x1d0 net/socket.c:2417
       __do_sys_sendmsg net/socket.c:2426 [inline]
       __se_sys_sendmsg net/socket.c:2424 [inline]
       __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2424
       do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
       entry_SYSCALL_64_after_hwframe+0x49/0xbe
      RIP: 0033:0x445d49
      Code: e8 bc b7 02 00 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 2b 12 fc ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007f8019074db8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
      RAX: ffffffffffffffda RBX: 00000000006dac38 RCX: 0000000000445d49
      RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000000000003
      RBP: 00000000006dac30 R08: 0000000000000004 R09: 0000000000000000
      R10: 0000000000000008 R11: 0000000000000246 R12: 00000000006dac3c
      R13: 00007ffea687f6bf R14: 00007f80190759c0 R15: 20c49ba5e353f7cf
      
      Fixes: e198987e
      
       ("gtp: fix suspicious RCU usage")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Cc: Taehee Yoo <ap420073@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      776a81a0
    • Logan Gunthorpe's avatar
      PCI/switchtec: Read all 64 bits of part_event_bitmap · 13d9f98e
      Logan Gunthorpe authored
      commit 6acdf7e1 upstream.
      
      The part_event_bitmap register is 64 bits wide, so read it with ioread64()
      instead of the 32-bit ioread32().
      
      Fixes: 52eabba5 ("switchtec: Add IOCTLs to the Switchtec driver")
      Link: https://lore.kernel.org/r/20190910195833.3891-1-logang@deltatee.com
      
      
      Reported-by: default avatarDoug Meyer <dmeyer@gigaio.com>
      Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Cc: stable@vger.kernel.org	# v4.12+
      Cc: Kelvin Cao <Kelvin.Cao@microchip.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      13d9f98e
    • Anson Huang's avatar
      ARM: dts: imx6ul: use nvmem-cells for cpu speed grading · 40b049d0
      Anson Huang authored
      commit 92f0eb08
      
       upstream.
      
      On i.MX6UL, accessing OCOTP directly is wrong because the ocotp clock
      needs to be enabled first, so use the nvmem-cells binding instead.
      
      Signed-off-by: default avatarAnson Huang <Anson.Huang@nxp.com>
      Signed-off-by: default avatarShawn Guo <shawnguo@kernel.org>
      Cc: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      40b049d0
    • Anson Huang's avatar
      cpufreq: imx6q: read OCOTP through nvmem for imx6ul/imx6ull · 4ef576e9
      Anson Huang authored
      commit 2733fb0d
      
       upstream.
      
      On i.MX6UL/i.MX6ULL, accessing OCOTP directly is wrong because
      the ocotp clock needs to be enabled first. Add support for reading
      OCOTP through the nvmem API, and keep the old method there to
      support old dtb.
      
      Signed-off-by: default avatarAnson Huang <Anson.Huang@nxp.com>
      Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4ef576e9
    • Jason A. Donenfeld's avatar
      powerpc/spinlocks: Include correct header for static key · 0b9700de
      Jason A. Donenfeld authored
      commit 6da3eced upstream.
      
      Recently, the spinlock implementation grew a static key optimization,
      but the jump_label.h header include was left out, leading to build
      errors:
      
        linux/arch/powerpc/include/asm/spinlock.h:44:7: error: implicit declaration of function ‘static_branch_unlikely’
         44 |  if (!static_branch_unlikely(&shared_processor))
      
      This commit adds the missing header.
      
      mpe: The build break is only seen with CONFIG_JUMP_LABEL=n.
      
      Fixes: 656c21d6
      
       ("powerpc/shared: Use static key to detect shared processor")
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Reviewed-by: default avatarSrikar Dronamraju <srikar@linux.ibm.com>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20191223133147.129983-1-Jason@zx2c4.com
      
      
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0b9700de
    • Srikar Dronamraju's avatar
      powerpc/vcpu: Assume dedicated processors as non-preempt · 04a2096c
      Srikar Dronamraju authored
      commit 14c73bd3 upstream.
      
      With commit 247f2f6f ("sched/core: Don't schedule threads on
      pre-empted vCPUs"), the scheduler avoids preempted vCPUs to schedule
      tasks on wakeup. This leads to wrong choice of CPU, which in-turn
      leads to larger wakeup latencies. Eventually, it leads to performance
      regression in latency sensitive benchmarks like soltp, schbench etc.
      
      On Powerpc, vcpu_is_preempted() only looks at yield_count. If the
      yield_count is odd, the vCPU is assumed to be preempted. However
      yield_count is increased whenever the LPAR enters CEDE state (idle).
      So any CPU that has entered CEDE state is assumed to be preempted.
      
      Even if vCPU of dedicated LPAR is preempted/donated, it should have
      right of first-use since they are supposed to own the vCPU.
      
      On a Power9 System with 32 cores:
        # lscpu
        Architecture:        ppc64le
        Byte Order:          Little Endian
        CPU(s):              128
        On-line CPU(s) list: 0-127
        Thread(s) per core:  8
        Core(s) per socket:  1
        Socket(s):           16
        NUMA node(s):        2
        Model:               2.2 (pvr 004e 0202)
        Model name:          POWER9 (architected), altivec supported
        Hypervisor vendor:   pHyp
        Virtualization type: para
        L1d cache:           32K
        L1i cache:           32K
        L2 cache:            512K
        L3 cache:            10240K
        NUMA node0 CPU(s):   0-63
        NUMA node1 CPU(s):   64-127
      
        # perf stat -a -r 5 ./schbench
        v5.4                               v5.4 + patch
        Latency percentiles (usec)         Latency percentiles (usec)
              50.0000th: 45                      50.0th: 45
              75.0000th: 62                      75.0th: 63
              90.0000th: 71                      90.0th: 74
              95.0000th: 77                      95.0th: 78
              *99.0000th: 91                     *99.0th: 82
              99.5000th: 707                     99.5th: 83
              99.9000th: 6920                    99.9th: 86
              min=0, max=10048                   min=0, max=96
        Latency percentiles (usec)         Latency percentiles (usec)
              50.0000th: 45                      50.0th: 46
              75.0000th: 61                      75.0th: 64
              90.0000th: 72                      90.0th: 75
              95.0000th: 79                      95.0th: 79
              *99.0000th: 691                    *99.0th: 83
              99.5000th: 3972                    99.5th: 85
              99.9000th: 8368                    99.9th: 91
              min=0, max=16606                   min=0, max=117
        Latency percentiles (usec)         Latency percentiles (usec)
              50.0000th: 45                      50.0th: 46
              75.0000th: 61                      75.0th: 64
              90.0000th: 71                      90.0th: 75
              95.0000th: 77                      95.0th: 79
              *99.0000th: 106                    *99.0th: 83
              99.5000th: 2364                    99.5th: 84
              99.9000th: 7480                    99.9th: 90
              min=0, max=10001                   min=0, max=95
        Latency percentiles (usec)         Latency percentiles (usec)
              50.0000th: 45                      50.0th: 47
              75.0000th: 62                      75.0th: 65
              90.0000th: 72                      90.0th: 75
              95.0000th: 78                      95.0th: 79
              *99.0000th: 93                     *99.0th: 84
              99.5000th: 108                     99.5th: 85
              99.9000th: 6792                    99.9th: 90
              min=0, max=17681                   min=0, max=117
        Latency percentiles (usec)         Latency percentiles (usec)
              50.0000th: 46                      50.0th: 45
              75.0000th: 62                      75.0th: 64
              90.0000th: 73                      90.0th: 75
              95.0000th: 79                      95.0th: 79
              *99.0000th: 113                    *99.0th: 82
              99.5000th: 2724                    99.5th: 83
              99.9000th: 6184                    99.9th: 93
              min=0, max=9887                    min=0, max=111
      
         Performance counter stats for 'system wide' (5 runs):
      
        context-switches    43,373  ( +-  0.40% )   44,597 ( +-  0.55% )
        cpu-migrations       1,211  ( +-  5.04% )      220 ( +-  6.23% )
        page-faults         15,983  ( +-  5.21% )   15,360 ( +-  3.38% )
      
      Waiman Long suggested using static_keys.
      
      Fixes: 247f2f6f
      
       ("sched/core: Don't schedule threads on pre-empted vCPUs")
      Cc: stable@vger.kernel.org # v4.18+
      Reported-by: default avatarParth Shah <parth@linux.ibm.com>
      Reported-by: default avatarIhor Pasichnyk <Ihor.Pasichnyk@ibm.com>
      Tested-by: default avatarJuri Lelli <juri.lelli@redhat.com>
      Acked-by: default avatarWaiman Long <longman@redhat.com>
      Reviewed-by: default avatarGautham R. Shenoy <ego@linux.vnet.ibm.com>
      Signed-off-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
      Acked-by: default avatarPhil Auld <pauld@redhat.com>
      Reviewed-by: default avatarVaidyanathan Srinivasan <svaidy@linux.ibm.com>
      Tested-by: default avatarParth Shah <parth@linux.ibm.com>
      [mpe: Move the key and setting of the key to pseries/setup.c]
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20191213035036.6913-1-mpe@ellerman.id.au
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      04a2096c
    • Haiyang Zhang's avatar
      hv_netvsc: Fix unwanted rx_table reset · 24fc85b5
      Haiyang Zhang authored
      [ Upstream commit b0689faa ]
      
      In existing code, the receive indirection table, rx_table, is in
      struct rndis_device, which will be reset when changing MTU, ringparam,
      etc. User configured receive indirection table values will be lost.
      
      To fix this, move rx_table to struct net_device_context, and check
      netif_is_rxfh_configured(), so rx_table will be set to default only
      if no user configured value.
      
      Fixes: ff4a4419
      
       ("netvsc: allow get/set of RSS indirection table")
      Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      24fc85b5
    • Chan Shu Tak, Alex's avatar
      llc2: Fix return statement of llc_stat_ev_rx_null_dsap_xid_c (and _test_c) · fc95d2b0
      Chan Shu Tak, Alex authored
      [ Upstream commit af1c0e4e
      
       ]
      
      When a frame with NULL DSAP is received, llc_station_rcv is called.
      In turn, llc_stat_ev_rx_null_dsap_xid_c is called to check if it is a NULL
      XID frame. The return statement of llc_stat_ev_rx_null_dsap_xid_c returns 1
      when the incoming frame is not a NULL XID frame and 0 otherwise. Hence, a
      NULL XID response is returned unexpectedly, e.g. when the incoming frame is
      a NULL TEST command.
      
      To fix the error, simply remove the conditional operator.
      
      A similar error in llc_stat_ev_rx_null_dsap_test_c is also fixed.
      
      Signed-off-by: default avatarChan Shu Tak, Alex <alexchan@task.com.hk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fc95d2b0
    • Helge Deller's avatar
      parisc: Fix compiler warnings in debug_core.c · 4b9f0187
      Helge Deller authored
      [ Upstream commit 75cf9797
      
       ]
      
      Fix this compiler warning:
      kernel/debug/debug_core.c: In function ‘kgdb_cpu_enter’:
      arch/parisc/include/asm/cmpxchg.h:48:3: warning: value computed is not used [-Wunused-value]
         48 |  ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
      arch/parisc/include/asm/atomic.h:78:30: note: in expansion of macro ‘xchg’
         78 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new))
            |                              ^~~~
      kernel/debug/debug_core.c:596:4: note: in expansion of macro ‘atomic_xchg’
        596 |    atomic_xchg(&kgdb_active, cpu);
            |    ^~~~~~~~~~~
      
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4b9f0187
    • Yang Yingliang's avatar
      block: fix memleak when __blk_rq_map_user_iov() is failed · e80e36de
      Yang Yingliang authored
      [ Upstream commit 3b7995a9
      
       ]
      
      When I doing fuzzy test, get the memleak report:
      
      BUG: memory leak
      unreferenced object 0xffff88837af80000 (size 4096):
        comm "memleak", pid 3557, jiffies 4294817681 (age 112.499s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          20 00 00 00 10 01 00 00 00 00 00 00 01 00 00 00   ...............
        backtrace:
          [<000000001c894df8>] bio_alloc_bioset+0x393/0x590
          [<000000008b139a3c>] bio_copy_user_iov+0x300/0xcd0
          [<00000000a998bd8c>] blk_rq_map_user_iov+0x2f1/0x5f0
          [<000000005ceb7f05>] blk_rq_map_user+0xf2/0x160
          [<000000006454da92>] sg_common_write.isra.21+0x1094/0x1870
          [<00000000064bb208>] sg_write.part.25+0x5d9/0x950
          [<000000004fc670f6>] sg_write+0x5f/0x8c
          [<00000000b0d05c7b>] __vfs_write+0x7c/0x100
          [<000000008e177714>] vfs_write+0x1c3/0x500
          [<0000000087d23f34>] ksys_write+0xf9/0x200
          [<000000002c8dbc9d>] do_syscall_64+0x9f/0x4f0
          [<00000000678d8e9a>] entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      If __blk_rq_map_user_iov() is failed in blk_rq_map_user_iov(),
      the bio(s) which is allocated before this failing will leak. The
      refcount of the bio(s) is init to 1 and increased to 2 by calling
      bio_get(), but __blk_rq_unmap_user() only decrease it to 1, so
      the bio cannot be freed. Fix it by calling blk_rq_unmap_user().
      
      Reviewed-by: default avatarBob Liu <bob.liu@oracle.com>
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e80e36de
    • Stefan Haberland's avatar
      s390/dasd: fix memleak in path handling error case · 729a7f5e
      Stefan Haberland authored
      [ Upstream commit 00b39f69
      
       ]
      
      If for whatever reason the dasd_eckd_check_characteristics() function
      exits after at least some paths have their configuration data
      allocated those data is never freed again. In the error case the
      device->private pointer is set to NULL and dasd_eckd_uncheck_device()
      will exit without freeing the path data because of this NULL pointer.
      
      Fix by calling dasd_eckd_clear_conf_data() for error cases.
      
      Also use dasd_eckd_clear_conf_data() in dasd_eckd_uncheck_device()
      to avoid code duplication.
      
      Reported-by: default avatarQian Cai <cai@lca.pw>
      Reviewed-by: default avatarJan Hoeppner <hoeppner@linux.ibm.com>
      Signed-off-by: default avatarStefan Haberland <sth@linux.ibm.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      729a7f5e
    • Jan Höppner's avatar
      s390/dasd/cio: Interpret ccw_device_get_mdc return value correctly · 000d4f2f
      Jan Höppner authored
      [ Upstream commit dd4b3c83
      
       ]
      
      The max data count (mdc) is an unsigned 16-bit integer value as per AR
      documentation and is received via ccw_device_get_mdc() for a specific
      path mask from the CIO layer. The function itself also always returns a
      positive mdc value or 0 in case mdc isn't supported or couldn't be
      determined.
      
      Though, the comment for this function describes a negative return value
      to indicate failures.
      
      As a result, the DASD device driver interprets the return value of
      ccw_device_get_mdc() incorrectly. The error case is essentially a dead
      code path.
      
      To fix this behaviour, check explicitly for a return value of 0 and
      change the comment for ccw_device_get_mdc() accordingly.
      
      This fix merely enables the error code path in the DASD functions
      get_fcx_max_data() and verify_fcx_max_data(). The actual functionality
      stays the same and is still correct.
      
      Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
      Signed-off-by: default avatarJan Höppner <hoeppner@linux.ibm.com>
      Acked-by: default avatarPeter Oberparleiter <oberpar@linux.ibm.com>
      Reviewed-by: default avatarStefan Haberland <sth@linux.ibm.com>
      Signed-off-by: default avatarStefan Haberland <sth@linux.ibm.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      000d4f2f
    • Chuhong Yuan's avatar
      drm/exynos: gsc: add missed component_del · f2bcbc59
      Chuhong Yuan authored
      [ Upstream commit 84c92365
      
       ]
      
      The driver forgets to call component_del in remove to match component_add
      in probe.
      Add the missed call to fix it.
      
      Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
      Signed-off-by: default avatarInki Dae <inki.dae@samsung.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f2bcbc59
    • Christian Borntraeger's avatar
      s390/purgatory: do not build purgatory with kcov, kasan and friends · 152eaa86
      Christian Borntraeger authored
      [ Upstream commit c23587c9
      
       ]
      
      the purgatory must not rely on functions from the "old" kernel,
      so we must disable kasan and friends. We also need to have a
      separate copy of string.c as the default does not build memcmp
      with KASAN.
      
      Reported-by: default avatarkbuild test robot <lkp@intel.com>
      Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
      Reviewed-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      152eaa86
    • Jose Abreu's avatar
      net: stmmac: Always arm TX Timer at end of transmission start · 5ee6f0da
      Jose Abreu authored
      [ Upstream commit 4772f26d ]
      
      If TX Coalesce timer is enabled we should always arm it, otherwise we
      may hit the case where an interrupt is missed and the TX Queue will
      timeout.
      
      Arming the timer does not necessarly mean it will run the tx_clean()
      because this function is wrapped around NAPI launcher.
      
      Fixes: 9125cdd1
      
       ("stmmac: add the initial tx coalesce schema")
      Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5ee6f0da
    • Jose Abreu's avatar
      net: stmmac: RX buffer size must be 16 byte aligned · c8fa1cb1
      Jose Abreu authored
      [ Upstream commit 8d558f02 ]
      
      We need to align the RX buffer size to at least 16 byte so that IP
      doesn't mis-behave. This is required by HW.
      
      Changes from v2:
      - Align UP and not DOWN (David)
      
      Fixes: 7ac6653a
      
       ("stmmac: Move the STMicroelectronics driver")
      Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c8fa1cb1