1. 15 5月, 2021 1 次提交
  2. 14 5月, 2021 14 次提交
    • G
      net: mana: Use struct_size() in kzalloc() · ea89c862
      Gustavo A. R. Silva 提交于
      Make use of the struct_size() helper instead of an open-coded version,
      in order to avoid any potential type mistakes or integer overflows
      that, in the worst scenario, could lead to heap overflows.
      
      This code was detected with the help of Coccinelle and, audited and
      fixed manually.
      Signed-off-by: NGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ea89c862
    • C
      net: qed: remove redundant initialization of variable rc · 5efe2575
      Colin Ian King 提交于
      The variable rc is being initialized with a value that is never read,
      it is being updated later on.  The assignment is redundant and can be
      removed.
      
      Addresses-Coverity: ("Unused value")
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5efe2575
    • X
      virtio-net: get build_skb() buf by data ptr · 7bf64460
      Xuan Zhuo 提交于
      In the case of merge, the page passed into page_to_skb() may be a head
      page, not the page where the current data is located. So when trying to
      get the buf where the data is located, you should directly use the
      pointer(p) to get the address corresponding to the page.
      
      At the same time, the offset of the data in the page should also be
      obtained using offset_in_page().
      
      This patch solves this problem. But if you don’t use this patch, the
      original code can also run, because if the page is not the page of the
      current data, the calculated tailroom will be less than 0, and will not
      enter the logic of build_skb() . The significance of this patch is to
      modify this logical problem, allowing more situations to use
      build_skb().
      Signed-off-by: NXuan Zhuo <xuanzhuo@linux.alibaba.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7bf64460
    • X
      virtio-net: fix for unable to handle page fault for address · 6c66c147
      Xuan Zhuo 提交于
      In merge mode, when xdp is enabled, if the headroom of buf is smaller
      than virtnet_get_headroom(), xdp_linearize_page() will be called but the
      variable of "headroom" is still 0, which leads to wrong logic after
      entering page_to_skb().
      
      [   16.600944] BUG: unable to handle page fault for address: ffffecbfff7b43c8[   16.602175] #PF: supervisor read access in kernel mode
      [   16.603350] #PF: error_code(0x0000) - not-present page
      [   16.604200] PGD 0 P4D 0
      [   16.604686] Oops: 0000 [#1] SMP PTI
      [   16.605306] CPU: 4 PID: 715 Comm: sh Tainted: G    B             5.12.0+ #312
      [   16.606429] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/04
      [   16.608217] RIP: 0010:unmap_page_range+0x947/0xde0
      [   16.609014] Code: 00 00 08 00 48 83 f8 01 45 19 e4 41 f7 d4 41 83 e4 03 e9 a4 fd ff ff e8 b7 63 ed ff 4c 89 e0 48 c1 e0 065
      [   16.611863] RSP: 0018:ffffc90002503c58 EFLAGS: 00010286
      [   16.612720] RAX: ffffecbfff7b43c0 RBX: 00007f19f7203000 RCX: ffffffff812ff359
      [   16.613853] RDX: ffff888107778000 RSI: 0000000000000000 RDI: 0000000000000005
      [   16.614976] RBP: ffffea000425e000 R08: 0000000000000000 R09: 3030303030303030
      [   16.616124] R10: ffffffff82ed7d94 R11: 6637303030302052 R12: 7c00000afffded0f
      [   16.617276] R13: 0000000000000001 R14: ffff888119ee7010 R15: 00007f19f7202000
      [   16.618423] FS:  0000000000000000(0000) GS:ffff88842fd00000(0000) knlGS:0000000000000000
      [   16.619738] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   16.620670] CR2: ffffecbfff7b43c8 CR3: 0000000103220005 CR4: 0000000000370ee0
      [   16.621792] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [   16.622920] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [   16.624047] Call Trace:
      [   16.624525]  ? release_pages+0x24d/0x730
      [   16.625209]  unmap_single_vma+0xa9/0x130
      [   16.625885]  unmap_vmas+0x76/0xf0
      [   16.626480]  exit_mmap+0xa0/0x210
      [   16.627129]  mmput+0x67/0x180
      [   16.627673]  do_exit+0x3d1/0xf10
      [   16.628259]  ? do_user_addr_fault+0x231/0x840
      [   16.629000]  do_group_exit+0x53/0xd0
      [   16.629631]  __x64_sys_exit_group+0x1d/0x20
      [   16.630354]  do_syscall_64+0x3c/0x80
      [   16.630988]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      [   16.631828] RIP: 0033:0x7f1a043d0191
      [   16.632464] Code: Unable to access opcode bytes at RIP 0x7f1a043d0167.
      [   16.633502] RSP: 002b:00007ffe3d993308 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
      [   16.634737] RAX: ffffffffffffffda RBX: 00007f1a044c9490 RCX: 00007f1a043d0191
      [   16.635857] RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
      [   16.636986] RBP: 0000000000000000 R08: ffffffffffffff88 R09: 0000000000000001
      [   16.638120] R10: 0000000000000008 R11: 0000000000000246 R12: 00007f1a044c9490
      [   16.639245] R13: 0000000000000001 R14: 00007f1a044c9968 R15: 0000000000000000
      [   16.640408] Modules linked in:
      [   16.640958] CR2: ffffecbfff7b43c8
      [   16.641557] ---[ end trace bc4891c6ce46354c ]---
      [   16.642335] RIP: 0010:unmap_page_range+0x947/0xde0
      [   16.643135] Code: 00 00 08 00 48 83 f8 01 45 19 e4 41 f7 d4 41 83 e4 03 e9 a4 fd ff ff e8 b7 63 ed ff 4c 89 e0 48 c1 e0 065
      [   16.645983] RSP: 0018:ffffc90002503c58 EFLAGS: 00010286
      [   16.646845] RAX: ffffecbfff7b43c0 RBX: 00007f19f7203000 RCX: ffffffff812ff359
      [   16.647970] RDX: ffff888107778000 RSI: 0000000000000000 RDI: 0000000000000005
      [   16.649091] RBP: ffffea000425e000 R08: 0000000000000000 R09: 3030303030303030
      [   16.650250] R10: ffffffff82ed7d94 R11: 6637303030302052 R12: 7c00000afffded0f
      [   16.651394] R13: 0000000000000001 R14: ffff888119ee7010 R15: 00007f19f7202000
      [   16.652529] FS:  0000000000000000(0000) GS:ffff88842fd00000(0000) knlGS:0000000000000000
      [   16.653887] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   16.654841] CR2: ffffecbfff7b43c8 CR3: 0000000103220005 CR4: 0000000000370ee0
      [   16.655992] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [   16.657150] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [   16.658290] Kernel panic - not syncing: Fatal exception
      [   16.659613] Kernel Offset: disabled
      [   16.660234] ---[ end Kernel panic - not syncing: Fatal exception ]---
      
      Fixes: fb32856b ("virtio-net: page_to_skb() use build_skb when there's sufficient tailroom")
      Signed-off-by: NXuan Zhuo <xuanzhuo@linux.alibaba.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6c66c147
    • G
      atl1c: improve link detection reliability on Mikrotik 10/25G NIC · ea0fbd05
      Gatis Peisenieks 提交于
      Mikrotik 10/25G NIC emulates the MDIO accesses, but the emulation is
      not 100% reliable - the MDIO ops occasionally can timeout.
      
      This adds a reliable way of detecting link on Mikrotik 10/25G NIC.
      Signed-off-by: NGatis Peisenieks <gatis@mikrotik.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ea0fbd05
    • G
      atl1c: enable rx csum offload on Mikrotik 10/25G NIC · b0390009
      Gatis Peisenieks 提交于
      Mikrotik 10/25G NIC supports hw checksum verification on rx for
      IP/IPv6 + TCP/UDP packets. HW checksum offload helps reduce host
      cpu load.
      
      This enables the csum offload specifically for Mikrotik 10/25G NIC
      as other HW supported by the driver is known to have problems with it.
      
      TCP iperf3 to Threadripper 3960X with NIC improved 16.5 -> 20.0 Gbps
      with mtu=1500.
      Signed-off-by: NGatis Peisenieks <gatis@mikrotik.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b0390009
    • G
      atl1c: adjust max mtu according to Mikrotik 10/25G NIC ability · 545fa3fb
      Gatis Peisenieks 提交于
      The new Mikrotik 10/25G NIC supports jumbo frames. Jumbo frames are
      supported for TSO as well.
      
      This enables the support for mtu up to 9500 bytes.
      Signed-off-by: NGatis Peisenieks <gatis@mikrotik.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      545fa3fb
    • G
      atl1c: improve performance by avoiding unnecessary pcie writes on xmit · d7ab6419
      Gatis Peisenieks 提交于
      The kernel has xmit_more facility that hints the networking driver xmit
      path about whether more packets are coming soon. This information can be
      used to avoid unnecessary expensive PCIe transaction per tx packet.
      
      Max TX pps on Mikrotik 10/25G NIC in a Threadripper 3960X system
      improved from 1150Kpps to 1700Kpps.
      
      Testing L2 forwarding on AR8151 hardware did not reveal a measurable
      increase in latency.
      Signed-off-by: NGatis Peisenieks <gatis@mikrotik.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d7ab6419
    • G
      atl1c: show correct link speed on Mikrotik 10/25G NIC · f19d4997
      Gatis Peisenieks 提交于
      The new Mikrotik 10/25G NIC maintains compatibility with existing atl1c
      driver. However it does have new features.
      
      This defines some new register offsets, code for identifying the new type
      of NIC and correct speed detection for the NIC.
      Signed-off-by: NGatis Peisenieks <gatis@mikrotik.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f19d4997
    • G
      net: hinic: fix misspelled "acessing" · 5db8c86e
      Guangbin Huang 提交于
      The word "acessing" is misspelled, so fix it.
      Signed-off-by: NGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5db8c86e
    • G
      net: hinic: remove unnecessary parentheses · c8ad5df6
      Guangbin Huang 提交于
      There are some unnecessary parentheses, this patch deletes them.
      Signed-off-by: NGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c8ad5df6
    • G
      net: hinic: add blank line after function declaration · 3402ab54
      Guangbin Huang 提交于
      There should be a blank line after function declaration, so add two
      missed blank lines.
      Signed-off-by: NGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3402ab54
    • G
      net: hinic: remove unnecessary blank line · 9afcb595
      Guangbin Huang 提交于
      There are two blank lines are unnecessary, this patch removes them.
      Signed-off-by: NGuangbin Huang <huangguangbin2@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9afcb595
    • J
      alx: use fine-grained locking instead of RTNL · 4a5fe57e
      Johannes Berg 提交于
      In the alx driver, all locking depended on the RTNL, but
      that causes issues with ipconfig ("ip=..." command line)
      because that waits for the netdev to have a carrier while
      holding the RTNL, but the alx workers etc. require RTNL,
      so the carrier won't be set until the RTNL is dropped and
      can be acquired by alx workers. This causes long delays
      at boot, as reported by Nikolai Zhubr.
      
      Really the only sensible thing to do here is to not use
      the RTNL for everything, but instead have fine-grained
      locking for just the driver. Do that, it's not that hard.
      Reported-by: NNikolai Zhubr <zhubr.2@gmail.com>
      Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4a5fe57e
  3. 13 5月, 2021 1 次提交
  4. 12 5月, 2021 3 次提交
    • L
      usb: class: cdc-wdm: WWAN framework integration · cac6fb01
      Loic Poulain 提交于
      The WWAN framework provides a unified way to handle WWAN/modems and its
      control port(s). It has initially been introduced to support MHI/PCI
      modems, offering the same control protocols as the USB variants such as
      MBIM, QMI, AT... The WWAN framework exposes these control protocols as
      character devices, similarly to cdc-wdm, but in a bus agnostic fashion.
      
      This change adds registration of the USB modem cdc-wdm control endpoints
      to the WWAN framework as standard control ports (wwanXpY...).
      
      Exposing cdc-wdm through WWAN framework normally maintains backward
      compatibility, e.g:
          $ qmicli --device-open-qmi -d /dev/wwan0p1QMI --dms-get-ids
      instead of
          $ qmicli --device-open-qmi -d /dev/cdc-wdm0 --dms-get-ids
      
      However, some tools may rely on cdc-wdm driver/device name for device
      detection. It is then safer to keep the 'legacy' cdc-wdm character
      device to prevent any breakage. This is handled in this change by
      API mutual exclusion, only one access method can be used at a time,
      either cdc-wdm chardev or WWAN API.
      
      Note that unknown channel types (other than MBIM, AT or MBIM) are not
      registered to the WWAN framework.
      Signed-off-by: NLoic Poulain <loic.poulain@linaro.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cac6fb01
    • Z
      mISDN: fix possible use-after-free in HFC_cleanup() · 009fc857
      Zou Wei 提交于
      This module's remove path calls del_timer(). However, that function
      does not wait until the timer handler finishes. This means that the
      timer handler may still be running after the driver's remove function
      has finished, which would result in a use-after-free.
      
      Fix by calling del_timer_sync(), which makes sure the timer handler
      has finished, and unable to re-schedule itself.
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Signed-off-by: NZou Wei <zou_wei@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      009fc857
    • Z
      atm: iphase: fix possible use-after-free in ia_module_exit() · 1c72e6ab
      Zou Wei 提交于
      This module's remove path calls del_timer(). However, that function
      does not wait until the timer handler finishes. This means that the
      timer handler may still be running after the driver's remove function
      has finished, which would result in a use-after-free.
      
      Fix by calling del_timer_sync(), which makes sure the timer handler
      has finished, and unable to re-schedule itself.
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Signed-off-by: NZou Wei <zou_wei@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1c72e6ab
  5. 11 5月, 2021 18 次提交
  6. 09 5月, 2021 1 次提交
    • L
      drm/i915/display: fix compiler warning about array overrun · fec4d427
      Linus Torvalds 提交于
      intel_dp_check_mst_status() uses a 14-byte array to read the DPRX Event
      Status Indicator data, but then passes that buffer at offset 10 off as
      an argument to drm_dp_channel_eq_ok().
      
      End result: there are only 4 bytes remaining of the buffer, yet
      drm_dp_channel_eq_ok() wants a 6-byte buffer.  gcc-11 correctly warns
      about this case:
      
        drivers/gpu/drm/i915/display/intel_dp.c: In function ‘intel_dp_check_mst_status’:
        drivers/gpu/drm/i915/display/intel_dp.c:3491:22: warning: ‘drm_dp_channel_eq_ok’ reading 6 bytes from a region of size 4 [-Wstringop-overread]
         3491 |                     !drm_dp_channel_eq_ok(&esi[10], intel_dp->lane_count)) {
              |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        drivers/gpu/drm/i915/display/intel_dp.c:3491:22: note: referencing argument 1 of type ‘const u8 *’ {aka ‘const unsigned char *’}
        In file included from drivers/gpu/drm/i915/display/intel_dp.c:38:
        include/drm/drm_dp_helper.h:1466:6: note: in a call to function ‘drm_dp_channel_eq_ok’
         1466 | bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
              |      ^~~~~~~~~~~~~~~~~~~~
             6:14 elapsed
      
      This commit just extends the original array by 2 zero-initialized bytes,
      avoiding the warning.
      
      There may be some underlying bug in here that caused this confusion, but
      this is at least no worse than the existing situation that could use
      random data off the stack.
      
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Dave Airlie <airlied@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fec4d427
  7. 08 5月, 2021 2 次提交