1. 26 Aug, 2021 14 commits
    • Yonglong Liu's avatar
      net: hns3: fix speed unknown issue in bond 4 · b15c072a
      Yonglong Liu authored
      In bond 4, when the link goes down and up repeatedly, the bond may get an
      unknown speed, and then this port can not work.
      
      The driver notify netif_carrier_on() before update the link state, when the
      bond receive carrier on, will query the speed of the port, if the query
      operation happens before updating the link state, will get an unknown
      speed. So need to notify netif_carrier_on() after update the link state.
      
      Fixes: 46a3df9f ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support")
      Fixes: e2cb1dec ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support")
      Signed-off-by: default avatarYonglong Liu <liuyonglong@huawei.com>
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b15c072a
    • Yufeng Mo's avatar
      net: hns3: add waiting time before cmdq memory is released · a96d9330
      Yufeng Mo authored
      After the cmdq registers are cleared, the firmware may take time to
      clear out possible left over commands in the cmdq. Driver must release
      cmdq memory only after firmware has completed processing of left over
      commands.
      
      Fixes: 232d0d55 ("net: hns3: uninitialize command queue while unloading PF driver")
      Signed-off-by: default avatarYufeng Mo <moyufeng@huawei.com>
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a96d9330
    • Yufeng Mo's avatar
      net: hns3: clear hardware resource when loading driver · 1a6d2819
      Yufeng Mo authored
      If a PF is bonded to a virtual machine and the virtual machine exits
      unexpectedly, some hardware resource cannot be cleared. In this case,
      loading driver may cause exceptions. Therefore, the hardware resource
      needs to be cleared when the driver is loaded.
      
      Fixes: 46a3df9f ("net: hns3: Add HNS3 Acceleration Engine & Compatibility Layer Support")
      Signed-off-by: default avatarYufeng Mo <moyufeng@huawei.com>
      Signed-off-by: default avatarSalil Mehta <salil.mehta@huawei.com>
      Signed-off-by: default avatarGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1a6d2819
    • 王贇's avatar
      net: fix NULL pointer reference in cipso_v4_doi_free · 733c99ee
      王贇 authored
      In netlbl_cipsov4_add_std() when 'doi_def->map.std' alloc
      failed, we sometime observe panic:
      
        BUG: kernel NULL pointer dereference, address:
        ...
        RIP: 0010:cipso_v4_doi_free+0x3a/0x80
        ...
        Call Trace:
         netlbl_cipsov4_add_std+0xf4/0x8c0
         netlbl_cipsov4_add+0x13f/0x1b0
         genl_family_rcv_msg_doit.isra.15+0x132/0x170
         genl_rcv_msg+0x125/0x240
      
      This is because in cipso_v4_doi_free() there is no check
      on 'doi_def->map.std' when 'doi_def->type' equal 1, which
      is possibe, since netlbl_cipsov4_add_std() haven't initialize
      it before alloc 'doi_def->map.std'.
      
      This patch just add the check to prevent panic happen for similar
      cases.
      Reported-by: default avatarAbaci <abaci@linux.alibaba.com>
      Signed-off-by: default avatarMichael Wang <yun.wang@linux.alibaba.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      733c99ee
    • Andrey Ignatov's avatar
      rtnetlink: Return correct error on changing device netns · 96a6b93b
      Andrey Ignatov authored
      Currently when device is moved between network namespaces using
      RTM_NEWLINK message type and one of netns attributes (FLA_NET_NS_PID,
      IFLA_NET_NS_FD, IFLA_TARGET_NETNSID) but w/o specifying IFLA_IFNAME, and
      target namespace already has device with same name, userspace will get
      EINVAL what is confusing and makes debugging harder.
      
      Fix it so that userspace gets more appropriate EEXIST instead what makes
      debugging much easier.
      
      Before:
      
        # ./ifname.sh
        + ip netns add ns0
        + ip netns exec ns0 ip link add l0 type dummy
        + ip netns exec ns0 ip link show l0
        8: l0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
            link/ether 66:90:b5:d5:78:69 brd ff:ff:ff:ff:ff:ff
        + ip link add l0 type dummy
        + ip link show l0
        10: l0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
            link/ether 6e:c6:1f:15:20:8d brd ff:ff:ff:ff:ff:ff
        + ip link set l0 netns ns0
        RTNETLINK answers: Invalid argument
      
      After:
      
        # ./ifname.sh
        + ip netns add ns0
        + ip netns exec ns0 ip link add l0 type dummy
        + ip netns exec ns0 ip link show l0
        8: l0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
            link/ether 1e:4a:72:e3:e3:8f brd ff:ff:ff:ff:ff:ff
        + ip link add l0 type dummy
        + ip link show l0
        10: l0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
            link/ether f2:fc:fe:2b:7d:a6 brd ff:ff:ff:ff:ff:ff
        + ip link set l0 netns ns0
        RTNETLINK answers: File exists
      
      The problem is that do_setlink() passes its `char *ifname` argument,
      that it gets from a caller, to __dev_change_net_namespace() as is (as
      `const char *pat`), but semantics of ifname and pat can be different.
      
      For example, __rtnl_newlink() does this:
      
      net/core/rtnetlink.c
          3270	char ifname[IFNAMSIZ];
           ...
          3286	if (tb[IFLA_IFNAME])
          3287		nla_strscpy(ifname, tb[IFLA_IFNAME], IFNAMSIZ);
          3288	else
          3289		ifname[0] = '\0';
           ...
          3364	if (dev) {
           ...
          3394		return do_setlink(skb, dev, ifm, extack, tb, ifname, status);
          3395	}
      
      , i.e. do_setlink() gets ifname pointer that is always valid no matter
      if user specified IFLA_IFNAME or not and then do_setlink() passes this
      ifname pointer as is to __dev_change_net_namespace() as pat argument.
      
      But the pat (pattern) in __dev_change_net_namespace() is used as:
      
      net/core/dev.c
         11198	err = -EEXIST;
         11199	if (__dev_get_by_name(net, dev->name)) {
         11200		/* We get here if we can't use the current device name */
         11201		if (!pat)
         11202			goto out;
         11203		err = dev_get_valid_name(net, dev, pat);
         11204		if (err < 0)
         11205			goto out;
         11206	}
      
      As the result the `goto out` path on line 11202 is neven taken and
      instead of returning EEXIST defined on line 11198,
      __dev_change_net_namespace() returns an error from dev_get_valid_name()
      and this, in turn, will be EINVAL for ifname[0] = '\0' set earlier.
      
      Fixes: d8a5ec67 ("[NET]: netlink support for moving devices between network namespaces.")
      Signed-off-by: default avatarAndrey Ignatov <rdna@fb.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      96a6b93b
    • David S. Miller's avatar
      Merge branch 'dsa-hellcreek-fixes' · a423cbe0
      David S. Miller authored
      Kurt Kanzenbach says:
      
      ====================
      net: dsa: hellcreek: 802.1Qbv Fixes
      
      while using TAPRIO offloading on the Hirschmann hellcreek switch, I've noticed
      two issues in the current implementation:
      
      1. The gate control list is incorrectly programmed
      2. The admin base time is not set properly
      
      Fix it.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a423cbe0
    • Kurt Kanzenbach's avatar
      net: dsa: hellcreek: Adjust schedule look ahead window · b7658ed3
      Kurt Kanzenbach authored
      Traffic schedules can only be started up to eight seconds within the
      future. Therefore, the driver periodically checks every two seconds whether the
      admin base time provided by the user is inside that window. If so the schedule
      is started. Otherwise the check is deferred.
      
      However, according to the programming manual the look ahead window size should
      be four - not eight - seconds. By using the proposed value of four seconds
      starting a schedule at a specified admin base time actually works as expected.
      
      Fixes: 24dfc6eb ("net: dsa: hellcreek: Add TAPRIO offloading support")
      Signed-off-by: Kurt Kanzenbach's avatarKurt Kanzenbach <kurt@linutronix.de>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b7658ed3
    • Kurt Kanzenbach's avatar
      net: dsa: hellcreek: Fix incorrect setting of GCL · a7db5ed8
      Kurt Kanzenbach authored
      Currently the gate control list which is programmed into the hardware is
      incorrect resulting in wrong traffic schedules. The problem is the loop
      variables are incremented before they are referenced. Therefore, move the
      increment to the end of the loop.
      
      Fixes: 24dfc6eb ("net: dsa: hellcreek: Add TAPRIO offloading support")
      Signed-off-by: Kurt Kanzenbach's avatarKurt Kanzenbach <kurt@linutronix.de>
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a7db5ed8
    • Rahul Lakkireddy's avatar
      cxgb4: dont touch blocked freelist bitmap after free · 43fed4d4
      Rahul Lakkireddy authored
      When adapter init fails, the blocked freelist bitmap is already freed
      up and should not be touched. So, move the bitmap zeroing closer to
      where it was successfully allocated. Also handle adapter init failure
      unwind path immediately and avoid setting up RDMA memory windows.
      
      Fixes: 5b377d11 ("cxgb4: Add debugfs facility to inject FL starvation")
      Signed-off-by: default avatarRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      43fed4d4
    • David S. Miller's avatar
      Merge branch 'inet-siphash' · 38d57551
      David S. Miller authored
      Eric Dumazet says:
      
      ====================
      inet: use siphash in exception handling
      
      A group of security researchers brought to our attention
      the weakness of hash functions used in rt6_exception_hash()
      and fnhe_hashfun()
      
      I made two distinct patches to help backports, since IPv6
      part was added in 4.15
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      38d57551
    • Eric Dumazet's avatar
      ipv4: use siphash instead of Jenkins in fnhe_hashfun() · 6457378f
      Eric Dumazet authored
      A group of security researchers brought to our attention
      the weakness of hash function used in fnhe_hashfun().
      
      Lets use siphash instead of Jenkins Hash, to considerably
      reduce security risks.
      
      Also remove the inline keyword, this really is distracting.
      
      Fixes: d546c621 ("ipv4: harden fnhe_hashfun()")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarKeyu Man <kman001@ucr.edu>
      Cc: Willy Tarreau <w@1wt.eu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6457378f
    • Eric Dumazet's avatar
      ipv6: use siphash in rt6_exception_hash() · 4785305c
      Eric Dumazet authored
      A group of security researchers brought to our attention
      the weakness of hash function used in rt6_exception_hash()
      
      Lets use siphash instead of Jenkins Hash, to considerably
      reduce security risks.
      
      Following patch deals with IPv4.
      
      Fixes: 35732d01 ("ipv6: introduce a hash table to store dst cache")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarKeyu Man <kman001@ucr.edu>
      Cc: Wei Wang <weiwan@google.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Acked-by: default avatarWei Wang <weiwan@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4785305c
    • David S. Miller's avatar
      Merge tag 'linux-can-fixes-for-5.14-20210826' of... · 92ea47fe
      David S. Miller authored
      Merge tag 'linux-can-fixes-for-5.14-20210826' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can
      
      Marc Kleine says:
      
      ====================
      pull-request: can 2021-08-26
      
      this is a pull request of a single patch for net/master.
      
      Stefan Mätje's patch fixes the interchange of RX and TX error counters
      inthe esd_usb2 CAN driver.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      92ea47fe
    • Stefan Mätje's avatar
      can: usb: esd_usb2: esd_usb2_rx_event(): fix the interchange of the CAN RX and TX error counters · 044012b5
      Stefan Mätje authored
      This patch fixes the interchanged fetch of the CAN RX and TX error
      counters from the ESD_EV_CAN_ERROR_EXT message. The RX error counter
      is really in struct rx_msg::data[2] and the TX error counter is in
      struct rx_msg::data[3].
      
      Fixes: 96d8e903 ("can: Add driver for esd CAN-USB/2 device")
      Link: https://lore.kernel.org/r/20210825215227.4947-2-stefan.maetje@esd.eu
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarStefan Mätje <stefan.maetje@esd.eu>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      044012b5
  2. 25 Aug, 2021 7 commits
    • kernel test robot's avatar
      net: usb: asix: ax88772: fix boolconv.cocci warnings · ec92e524
      kernel test robot authored
      drivers/net/usb/asix_devices.c:757:60-65: WARNING: conversion to bool not needed here
      
       Remove unneeded conversion to bool
      
      Semantic patch information:
       Relational and logical operators evaluate to bool,
       explicit conversion is overly verbose and unneeded.
      
      Generated by: scripts/coccinelle/misc/boolconv.cocci
      
      Fixes: 7a141e64 ("net: usb: asix: ax88772: move embedded PHY detection as early as possible")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarkernel test robot <lkp@intel.com>
      Reviewed-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Link: https://lore.kernel.org/r/20210825183538.13070-1-o.rempel@pengutronix.deSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ec92e524
    • Davide Caratti's avatar
      net/sched: ets: fix crash when flipping from 'strict' to 'quantum' · cd9b50ad
      Davide Caratti authored
      While running kselftests, Hangbin observed that sch_ets.sh often crashes,
      and splats like the following one are seen in the output of 'dmesg':
      
       BUG: kernel NULL pointer dereference, address: 0000000000000000
       #PF: supervisor read access in kernel mode
       #PF: error_code(0x0000) - not-present page
       PGD 159f12067 P4D 159f12067 PUD 159f13067 PMD 0
       Oops: 0000 [#1] SMP NOPTI
       CPU: 2 PID: 921 Comm: tc Not tainted 5.14.0-rc6+ #458
       Hardware name: Red Hat KVM, BIOS 1.11.1-4.module+el8.1.0+4066+0f1aadab 04/01/2014
       RIP: 0010:__list_del_entry_valid+0x2d/0x50
       Code: 48 8b 57 08 48 b9 00 01 00 00 00 00 ad de 48 39 c8 0f 84 ac 6e 5b 00 48 b9 22 01 00 00 00 00 ad de 48 39 ca 0f 84 cf 6e 5b 00 <48> 8b 32 48 39 fe 0f 85 af 6e 5b 00 48 8b 50 08 48 39 f2 0f 85 94
       RSP: 0018:ffffb2da005c3890 EFLAGS: 00010217
       RAX: 0000000000000000 RBX: ffff9073ba23f800 RCX: dead000000000122
       RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff9073ba23fbc8
       RBP: ffff9073ba23f890 R08: 0000000000000001 R09: 0000000000000001
       R10: 0000000000000001 R11: 0000000000000001 R12: dead000000000100
       R13: ffff9073ba23fb00 R14: 0000000000000002 R15: 0000000000000002
       FS:  00007f93e5564e40(0000) GS:ffff9073bba00000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 0000000000000000 CR3: 000000014ad34000 CR4: 0000000000350ee0
       Call Trace:
        ets_qdisc_reset+0x6e/0x100 [sch_ets]
        qdisc_reset+0x49/0x1d0
        tbf_reset+0x15/0x60 [sch_tbf]
        qdisc_reset+0x49/0x1d0
        dev_reset_queue.constprop.42+0x2f/0x90
        dev_deactivate_many+0x1d3/0x3d0
        dev_deactivate+0x56/0x90
        qdisc_graft+0x47e/0x5a0
        tc_get_qdisc+0x1db/0x3e0
        rtnetlink_rcv_msg+0x164/0x4c0
        netlink_rcv_skb+0x50/0x100
        netlink_unicast+0x1a5/0x280
        netlink_sendmsg+0x242/0x480
        sock_sendmsg+0x5b/0x60
        ____sys_sendmsg+0x1f2/0x260
        ___sys_sendmsg+0x7c/0xc0
        __sys_sendmsg+0x57/0xa0
        do_syscall_64+0x3a/0x80
        entry_SYSCALL_64_after_hwframe+0x44/0xae
       RIP: 0033:0x7f93e44b8338
       Code: 89 02 48 c7 c0 ff ff ff ff eb b5 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8d 05 25 43 2c 00 8b 00 85 c0 75 17 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 41 89 d4 55
       RSP: 002b:00007ffc0db737a8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
       RAX: ffffffffffffffda RBX: 0000000061255c06 RCX: 00007f93e44b8338
       RDX: 0000000000000000 RSI: 00007ffc0db73810 RDI: 0000000000000003
       RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
       R10: 000000000000000b R11: 0000000000000246 R12: 0000000000000001
       R13: 0000000000687880 R14: 0000000000000000 R15: 0000000000000000
       Modules linked in: sch_ets sch_tbf dummy rfkill iTCO_wdt iTCO_vendor_support intel_rapl_msr intel_rapl_common joydev i2c_i801 pcspkr i2c_smbus lpc_ich virtio_balloon ip_tables xfs libcrc32c crct10dif_pclmul crc32_pclmul crc32c_intel ahci libahci ghash_clmulni_intel libata serio_raw virtio_blk virtio_console virtio_net net_failover failover sunrpc dm_mirror dm_region_hash dm_log dm_mod
       CR2: 0000000000000000
      
      When the change() function decreases the value of 'nstrict', we must take
      into account that packets might be already enqueued on a class that flips
      from 'strict' to 'quantum': otherwise that class will not be added to the
      bandwidth-sharing list. Then, a call to ets_qdisc_reset() will attempt to
      do list_del(&alist) with 'alist' filled with zero, hence the NULL pointer
      dereference.
      For classes flipping from 'strict' to 'quantum', initialize an empty list
      and eventually add it to the bandwidth-sharing list, if there are packets
      already enqueued. In this way, the kernel will:
       a) prevent crashing as described above.
       b) avoid retaining the backlog packets (for an arbitrarily long time) in
          case no packet is enqueued after a change from 'strict' to 'quantum'.
      Reported-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Fixes: dcc68b4d ("net: sch_ets: Add a new Qdisc")
      Signed-off-by: default avatarDavide Caratti <dcaratti@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cd9b50ad
    • Shai Malin's avatar
      qede: Fix memset corruption · e5434688
      Shai Malin authored
      Thanks to Kees Cook who detected the problem of memset that starting
      from not the first member, but sized for the whole struct.
      The better change will be to remove the redundant memset and to clear
      only the msix_cnt member.
      Signed-off-by: default avatarPrabhakar Kushwaha <pkushwaha@marvell.com>
      Signed-off-by: default avatarAriel Elior <aelior@marvell.com>
      Signed-off-by: default avatarShai Malin <smalin@marvell.com>
      Reported-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e5434688
    • Song Yoong Siang's avatar
      net: stmmac: fix kernel panic due to NULL pointer dereference of buf->xdp · 2b9fff64
      Song Yoong Siang authored
      Ensure a valid XSK buffer before proceed to free the xdp buffer.
      
      The following kernel panic is observed without this patch:
      
      RIP: 0010:xp_free+0x5/0x40
      Call Trace:
      stmmac_napi_poll_rxtx+0x332/0xb30 [stmmac]
      ? stmmac_tx_timer+0x3c/0xb0 [stmmac]
      net_rx_action+0x13d/0x3d0
      __do_softirq+0xfc/0x2fb
      ? smpboot_register_percpu_thread+0xe0/0xe0
      run_ksoftirqd+0x32/0x70
      smpboot_thread_fn+0x1d8/0x2c0
      kthread+0x169/0x1a0
      ? kthread_park+0x90/0x90
      ret_from_fork+0x1f/0x30
      ---[ end trace 0000000000000002 ]---
      
      Fixes: bba2556e ("net: stmmac: Enable RX via AF_XDP zero-copy")
      Cc: <stable@vger.kernel.org> # 5.13.x
      Suggested-by: default avatarOng Boon Leong <boon.leong.ong@intel.com>
      Signed-off-by: default avatarSong Yoong Siang <yoong.siang.song@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2b9fff64
    • Song Yoong Siang's avatar
      net: stmmac: fix kernel panic due to NULL pointer dereference of xsk_pool · a6451192
      Song Yoong Siang authored
      After free xsk_pool, there is possibility that napi polling is still
      running in the middle, thus causes a kernel crash due to kernel NULL
      pointer dereference of rx_q->xsk_pool and tx_q->xsk_pool.
      
      Fix this by changing the XDP pool setup sequence to:
       1. disable napi before free xsk_pool
       2. enable napi after init xsk_pool
      
      The following kernel panic is observed without this patch:
      
      RIP: 0010:xsk_uses_need_wakeup+0x5/0x10
      Call Trace:
      stmmac_napi_poll_rxtx+0x3a9/0xae0 [stmmac]
      __napi_poll+0x27/0x130
      net_rx_action+0x233/0x280
      __do_softirq+0xe2/0x2b6
      run_ksoftirqd+0x1a/0x20
      smpboot_thread_fn+0xac/0x140
      ? sort_range+0x20/0x20
      kthread+0x124/0x150
      ? set_kthread_struct+0x40/0x40
      ret_from_fork+0x1f/0x30
      ---[ end trace a77c8956b79ac107 ]---
      
      Fixes: bba2556e ("net: stmmac: Enable RX via AF_XDP zero-copy")
      Cc: <stable@vger.kernel.org> # 5.13.x
      Signed-off-by: default avatarSong Yoong Siang <yoong.siang.song@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a6451192
    • Harini Katakam's avatar
      net: macb: Add a NULL check on desc_ptp · 85520079
      Harini Katakam authored
      macb_ptp_desc will not return NULL under most circumstances with correct
      Kconfig and IP design config register. But for the sake of the extreme
      corner case, check for NULL when using the helper. In case of rx_tstamp,
      no action is necessary except to return (similar to timestamp disabled)
      and warn. In case of TX, return -EINVAL to let the skb be free. Perform
      this check before marking skb in progress.
      Fixes coverity warning:
      (4) Event dereference:
      Dereferencing a null pointer "desc_ptp"
      Signed-off-by: default avatarHarini Katakam <harini.katakam@xilinx.com>
      Reviewed-by: default avatarRadhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
      Signed-off-by: default avatarMichal Simek <michal.simek@xilinx.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      85520079
    • Michael Riesch's avatar
      net: stmmac: dwmac-rk: fix unbalanced pm_runtime_enable warnings · 2d26f6e3
      Michael Riesch authored
      This reverts commit 2c896fb0
      "net: stmmac: dwmac-rk: add pd_gmac support for rk3399" and fixes
      unbalanced pm_runtime_enable warnings.
      
      In the commit to be reverted, support for power management was
      introduced to the Rockchip glue code. Later, power management support
      was introduced to the stmmac core code, resulting in multiple
      invocations of pm_runtime_{enable,disable,get_sync,put_sync}.
      
      The multiple invocations happen in rk_gmac_powerup and
      stmmac_{dvr_probe, resume} as well as in rk_gmac_powerdown and
      stmmac_{dvr_remove, suspend}, respectively, which are always called
      in conjunction.
      
      Fixes: 5ec55823 ("net: stmmac: add clocks management for gmac driver")
      Signed-off-by: default avatarMichael Riesch <michael.riesch@wolfvision.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2d26f6e3
  3. 24 Aug, 2021 4 commits
  4. 23 Aug, 2021 7 commits
    • David S. Miller's avatar
      Merge branch 'asix-fixes' · 14315498
      David S. Miller authored
      Oleksij Rempel says:
      
      ====================
      asix fixes
      
      changes v2:
      - rebase against current net
      - add one more fix for the ax88178 variant
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      14315498
    • Oleksij Rempel's avatar
      net: usb: asix: do not call phy_disconnect() for ax88178 · 1406e8cb
      Oleksij Rempel authored
      Fix crash on reboot on a system with ASIX AX88178 USB adapter attached
      to it:
      | asix 1-1.4:1.0 eth0: unregister 'asix' usb-ci_hdrc.0-1.4, ASIX AX88178 USB 2.0 Ethernet
      | 8<--- cut here ---
      | Unable to handle kernel NULL pointer dereference at virtual address 0000028c
      | pgd = 5ec93aee
      | [0000028c] *pgd=00000000
      | Internal error: Oops: 5 [#1] PREEMPT SMP ARM
      | Modules linked in:
      | CPU: 1 PID: 1 Comm: systemd-shutdow Not tainted 5.14.0-rc1-20210811-1 #4
      | Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
      | PC is at phy_disconnect+0x8/0x48
      | LR is at ax88772_unbind+0x14/0x20
      | [<80650d04>] (phy_disconnect) from [<80741aa4>] (ax88772_unbind+0x14/0x20)
      | [<80741aa4>] (ax88772_unbind) from [<8074e250>] (usbnet_disconnect+0x48/0xd8)
      | [<8074e250>] (usbnet_disconnect) from [<807655e0>] (usb_unbind_interface+0x78/0x25c)
      | [<807655e0>] (usb_unbind_interface) from [<805b03a0>] (__device_release_driver+0x154/0x20c)
      | [<805b03a0>] (__device_release_driver) from [<805b0478>] (device_release_driver+0x20/0x2c)
      | [<805b0478>] (device_release_driver) from [<805af944>] (bus_remove_device+0xcc/0xf8)
      | [<805af944>] (bus_remove_device) from [<805ab26c>] (device_del+0x178/0x4b0)
      | [<805ab26c>] (device_del) from [<807634a4>] (usb_disable_device+0xcc/0x178)
      | [<807634a4>] (usb_disable_device) from [<8075a060>] (usb_disconnect+0xd8/0x238)
      | [<8075a060>] (usb_disconnect) from [<8075a02c>] (usb_disconnect+0xa4/0x238)
      | [<8075a02c>] (usb_disconnect) from [<8075a02c>] (usb_disconnect+0xa4/0x238)
      | [<8075a02c>] (usb_disconnect) from [<80af3520>] (usb_remove_hcd+0xa0/0x198)
      | [<80af3520>] (usb_remove_hcd) from [<807902e0>] (host_stop+0x38/0xa8)
      | [<807902e0>] (host_stop) from [<8078d9e4>] (ci_hdrc_remove+0x3c/0x118)
      | [<8078d9e4>] (ci_hdrc_remove) from [<805b27ec>] (platform_remove+0x20/0x50)
      | [<805b27ec>] (platform_remove) from [<805b03a0>] (__device_release_driver+0x154/0x20c)
      | [<805b03a0>] (__device_release_driver) from [<805b0478>] (device_release_driver+0x20/0x2c)
      | [<805b0478>] (device_release_driver) from [<805af944>] (bus_remove_device+0xcc/0xf8)
      | [<805af944>] (bus_remove_device) from [<805ab26c>] (device_del+0x178/0x4b0)
      
      For this adapter we call ax88178_bind() and ax88772_unbind(), which is
      related to different chip version and different counter part *bind()
      function.
      
      Since this chip is currently not ported to the PHYLIB, we do not need to
      call phy_disconnect() here. So, to fix this crash, we need to add
      ax88178_unbind().
      
      Fixes: e532a096 ("net: usb: asix: ax88772: add phylib support")
      Reported-by: default avatarRobin van der Gracht <robin@protonic.nl>
      Tested-by: default avatarRobin van der Gracht <robin@protonic.nl>
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1406e8cb
    • Oleksij Rempel's avatar
      net: usb: asix: ax88772: move embedded PHY detection as early as possible · 7a141e64
      Oleksij Rempel authored
      Some HW revisions need additional MAC configuration before the embedded PHY
      can be enabled. If this is not done, we won't be able to get response
      from the internal PHY.
      
      This issue was detected on chipcode == AX_AX88772_CHIPCODE variant,
      where ax88772_hw_reset() was executed with missing embd_phy flag.
      
      Fixes: e532a096 ("net: usb: asix: ax88772: add phylib support")
      Reported-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
      Tested-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
      Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7a141e64
    • Maxim Kiselev's avatar
      net: marvell: fix MVNETA_TX_IN_PRGRS bit number · 359f4cdd
      Maxim Kiselev authored
      According to Armada XP datasheet bit at 0 position is corresponding for
      TxInProg indication.
      
      Fixes: c5aff182 ("net: mvneta: driver for Marvell Armada 370/XP network unit")
      Signed-off-by: default avatarMaxim Kiselev <bigunclemax@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      359f4cdd
    • Wong Vee Khee's avatar
      net: stmmac: fix kernel panic due to NULL pointer dereference of plat->est · 82a44ae1
      Wong Vee Khee authored
      In the case of taprio offload is not enabled, the error handling path
      causes a kernel crash due to kernel NULL pointer deference.
      
      Fix this by adding check for NULL before attempt to access 'plat->est'
      on the mutex_lock() call.
      
      The following kernel panic is observed without this patch:
      
      RIP: 0010:mutex_lock+0x10/0x20
      Call Trace:
      tc_setup_taprio+0x482/0x560 [stmmac]
      kmem_cache_alloc_trace+0x13f/0x490
      taprio_disable_offload.isra.0+0x9d/0x180 [sch_taprio]
      taprio_destroy+0x6c/0x100 [sch_taprio]
      qdisc_create+0x2e5/0x4f0
      tc_modify_qdisc+0x126/0x740
      rtnetlink_rcv_msg+0x12b/0x380
      _raw_spin_lock_irqsave+0x19/0x40
      _raw_spin_unlock_irqrestore+0x18/0x30
      create_object+0x212/0x340
      rtnl_calcit.isra.0+0x110/0x110
      netlink_rcv_skb+0x50/0x100
      netlink_unicast+0x191/0x230
      netlink_sendmsg+0x243/0x470
      sock_sendmsg+0x5e/0x60
      ____sys_sendmsg+0x20b/0x280
      copy_msghdr_from_user+0x5c/0x90
      __mod_memcg_state+0x87/0xf0
       ___sys_sendmsg+0x7c/0xc0
      lru_cache_add+0x7f/0xa0
      _raw_spin_unlock+0x16/0x30
      wp_page_copy+0x449/0x890
      handle_mm_fault+0x921/0xfc0
      __sys_sendmsg+0x59/0xa0
      do_syscall_64+0x33/0x40
      entry_SYSCALL_64_after_hwframe+0x44/0xa9
      ---[ end trace b1f19b24368a96aa ]---
      
      Fixes: b60189e0 ("net: stmmac: Integrate EST with TAPRIO scheduler API")
      Cc: <stable@vger.kernel.org> # 5.10.x
      Signed-off-by: default avatarWong Vee Khee <vee.khee.wong@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      82a44ae1
    • David S. Miller's avatar
      Merge branch '1GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue · 46002bf3
      David S. Miller authored
      Tony Nguyen says:
      
      ====================
      Intel Wired LAN Driver Updates 2021-08-20
      
      This series contains updates to igc and e1000e drivers.
      
      Aaron Ma resolves a page fault which occurs when thunderbolt is
      unplugged for igc.
      
      Toshiki Nishioka fixes Tx queue looping to use actual number of queues
      instead of max value for igc.
      
      Sasha fixes an incorrect latency comparison by decoding the values before
      comparing and prevents attempted writes to read-only NVMs for e1000e.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      46002bf3
    • Christophe JAILLET's avatar
      xgene-v2: Fix a resource leak in the error handling path of 'xge_probe()' · 5ed74b03
      Christophe JAILLET authored
      A successful 'xge_mdio_config()' call should be balanced by a corresponding
      'xge_mdio_remove()' call in the error handling path of the probe, as
      already done in the remove function.
      
      Update the error handling path accordingly.
      
      Fixes: ea8ab16a ("drivers: net: xgene-v2: Add MDIO support")
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5ed74b03
  5. 22 Aug, 2021 2 commits
  6. 20 Aug, 2021 6 commits