1. 18 1月, 2021 6 次提交
  2. 12 1月, 2021 1 次提交
  3. 10 1月, 2021 5 次提交
    • C
      bcache: set bcache device into read-only mode for BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET · 5342fd42
      Coly Li 提交于
      If BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET is set in incompat feature
      set, it means the cache device is created with obsoleted layout with
      obso_bucket_site_hi. Now bcache does not support this feature bit, a new
      BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE incompat feature bit is added
      for a better layout to support large bucket size.
      
      For the legacy compatibility purpose, if a cache device created with
      obsoleted BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET feature bit, all bcache
      devices attached to this cache set should be set to read-only. Then the
      dirty data can be written back to backing device before re-create the
      cache device with BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE feature bit
      by the latest bcache-tools.
      
      This patch checks BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET feature bit
      when running a cache set and attach a bcache device to the cache set. If
      this bit is set,
      - When run a cache set, print an error kernel message to indicate all
        following attached bcache device will be read-only.
      - When attach a bcache device, print an error kernel message to indicate
        the attached bcache device will be read-only, and ask users to update
        to latest bcache-tools.
      
      Such change is only for cache device whose bucket size >= 32MB, this is
      for the zoned SSD and almost nobody uses such large bucket size at this
      moment. If you don't explicit set a large bucket size for a zoned SSD,
      such change is totally transparent to your bcache device.
      
      Fixes: ffa47032 ("bcache: add bucket_size_hi into struct cache_sb_disk for large bucket")
      Signed-off-by: NColy Li <colyli@suse.de>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      5342fd42
    • C
      bcache: introduce BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE for large bucket · b16671e8
      Coly Li 提交于
      When large bucket feature was added, BCH_FEATURE_INCOMPAT_LARGE_BUCKET
      was introduced into the incompat feature set. It used bucket_size_hi
      (which was added at the tail of struct cache_sb_disk) to extend current
      16bit bucket size to 32bit with existing bucket_size in struct
      cache_sb_disk.
      
      This is not a good idea, there are two obvious problems,
      - Bucket size is always value power of 2, if store log2(bucket size) in
        existing bucket_size of struct cache_sb_disk, it is unnecessary to add
        bucket_size_hi.
      - Macro csum_set() assumes d[SB_JOURNAL_BUCKETS] is the last member in
        struct cache_sb_disk, bucket_size_hi was added after d[] which makes
        csum_set calculate an unexpected super block checksum.
      
      To fix the above problems, this patch introduces a new incompat feature
      bit BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE, when this bit is set, it
      means bucket_size in struct cache_sb_disk stores the order of power-of-2
      bucket size value. When user specifies a bucket size larger than 32768
      sectors, BCH_FEATURE_INCOMPAT_LOG_LARGE_BUCKET_SIZE will be set to
      incompat feature set, and bucket_size stores log2(bucket size) more
      than store the real bucket size value.
      
      The obsoleted BCH_FEATURE_INCOMPAT_LARGE_BUCKET won't be used anymore,
      it is renamed to BCH_FEATURE_INCOMPAT_OBSO_LARGE_BUCKET and still only
      recognized by kernel driver for legacy compatible purpose. The previous
      bucket_size_hi is renmaed to obso_bucket_size_hi in struct cache_sb_disk
      and not used in bcache-tools anymore.
      
      For cache device created with BCH_FEATURE_INCOMPAT_LARGE_BUCKET feature,
      bcache-tools and kernel driver still recognize the feature string and
      display it as "obso_large_bucket".
      
      With this change, the unnecessary extra space extend of bcache on-disk
      super block can be avoided, and csum_set() may generate expected check
      sum as well.
      
      Fixes: ffa47032 ("bcache: add bucket_size_hi into struct cache_sb_disk for large bucket")
      Signed-off-by: NColy Li <colyli@suse.de>
      Cc: stable@vger.kernel.org # 5.9+
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      b16671e8
    • C
      bcache: check unsupported feature sets for bcache register · 1dfc0686
      Coly Li 提交于
      This patch adds the check for features which is incompatible for
      current supported feature sets.
      
      Now if the bcache device created by bcache-tools has features that
      current kernel doesn't support, read_super() will fail with error
      messoage. E.g. if an unsupported incompatible feature detected,
      bcache register will fail with dmesg "bcache: register_bcache() error :
      Unsupported incompatible feature found".
      
      Fixes: d721a43f ("bcache: increase super block version for cache device and backing device")
      Fixes: ffa47032 ("bcache: add bucket_size_hi into struct cache_sb_disk for large bucket")
      Signed-off-by: NColy Li <colyli@suse.de>
      Cc: stable@vger.kernel.org # 5.9+
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      1dfc0686
    • C
      bcache: fix typo from SUUP to SUPP in features.h · f7b4943d
      Coly Li 提交于
      This patch fixes the following typos,
      from BCH_FEATURE_COMPAT_SUUP to BCH_FEATURE_COMPAT_SUPP
      from BCH_FEATURE_INCOMPAT_SUUP to BCH_FEATURE_INCOMPAT_SUPP
      from BCH_FEATURE_INCOMPAT_SUUP to BCH_FEATURE_RO_COMPAT_SUPP
      
      Fixes: d721a43f ("bcache: increase super block version for cache device and backing device")
      Fixes: ffa47032 ("bcache: add bucket_size_hi into struct cache_sb_disk for large bucket")
      Signed-off-by: NColy Li <colyli@suse.de>
      Cc: stable@vger.kernel.org # 5.9+
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      f7b4943d
    • Y
      bcache: set pdev_set_uuid before scond loop iteration · e8092707
      Yi Li 提交于
      There is no need to reassign pdev_set_uuid in the second loop iteration,
      so move it to the place before second loop.
      Signed-off-by: NYi Li <yili@winhong.com>
      Signed-off-by: NColy Li <colyli@suse.de>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      e8092707
  4. 09 1月, 2021 1 次提交
  5. 08 1月, 2021 27 次提交
    • D
      hwmon: (amd_energy) fix allocation of hwmon_channel_info config · 84e26155
      David Arcari 提交于
      hwmon, specifically hwmon_num_channel_attrs, expects the config
      array in the hwmon_channel_info structure to be terminated by
      a zero entry.  amd_energy does not honor this convention.  As
      result, a KASAN warning is possible.  Fix this by adding an
      additional entry and setting it to zero.
      
      Fixes: 8abee956 ("hwmon: Add amd_energy driver to report energy counters")
      Signed-off-by: NDavid Arcari <darcari@redhat.com>
      Cc: Naveen Krishna Chatradhi <nchatrad@amd.com>
      Cc: Jean Delvare <jdelvare@suse.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org
      Signed-off-by: NDavid Arcari <darcari@redhat.com>
      Acked-by: NNaveen Krishna Chatradhi <nchatrad@amd.com>
      Link: https://lore.kernel.org/r/20210107144707.6927-1-darcari@redhat.comSigned-off-by: NGuenter Roeck <linux@roeck-us.net>
      84e26155
    • J
      block/rnbd-clt: avoid module unload race with close confirmation · 3a21777c
      Jack Wang 提交于
      We had kernel panic, it is caused by unload module and last
      close confirmation.
      
      call trace:
      [1196029.743127]  free_sess+0x15/0x50 [rtrs_client]
      [1196029.743128]  rtrs_clt_close+0x4c/0x70 [rtrs_client]
      [1196029.743129]  ? rnbd_clt_unmap_device+0x1b0/0x1b0 [rnbd_client]
      [1196029.743130]  close_rtrs+0x25/0x50 [rnbd_client]
      [1196029.743131]  rnbd_client_exit+0x93/0xb99 [rnbd_client]
      [1196029.743132]  __x64_sys_delete_module+0x190/0x260
      
      And in the crashdump confirmation kworker is also running.
      PID: 6943   TASK: ffff9e2ac8098000  CPU: 4   COMMAND: "kworker/4:2"
       #0 [ffffb206cf337c30] __schedule at ffffffff9f93f891
       #1 [ffffb206cf337cc8] schedule at ffffffff9f93fe98
       #2 [ffffb206cf337cd0] schedule_timeout at ffffffff9f943938
       #3 [ffffb206cf337d50] wait_for_completion at ffffffff9f9410a7
       #4 [ffffb206cf337da0] __flush_work at ffffffff9f08ce0e
       #5 [ffffb206cf337e20] rtrs_clt_close_conns at ffffffffc0d5f668 [rtrs_client]
       #6 [ffffb206cf337e48] rtrs_clt_close at ffffffffc0d5f801 [rtrs_client]
       #7 [ffffb206cf337e68] close_rtrs at ffffffffc0d26255 [rnbd_client]
       #8 [ffffb206cf337e78] free_sess at ffffffffc0d262ad [rnbd_client]
       #9 [ffffb206cf337e88] rnbd_clt_put_dev at ffffffffc0d266a7 [rnbd_client]
      
      The problem is both code path try to close same session, which lead to
      panic.
      
      To fix it, just skip the sess if the refcount already drop to 0.
      
      Fixes: f7a7a5c2 ("block/rnbd: client: main functionality")
      Signed-off-by: NJack Wang <jinpu.wang@cloud.ionos.com>
      Reviewed-by: NGioh Kim <gi-oh.kim@cloud.ionos.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      3a21777c
    • S
      block/rnbd: Adding name to the Contributors List · ef8048dd
      Swapnil Ingle 提交于
      Adding name to the Contributors List
      Signed-off-by: NSwapnil Ingle <ingleswapnil@gmail.com>
      Acked-by: NJack Wang <jinpu.wang@cloud.ionos.com>
      Acked-by: NDanil Kipnis <danil.kipnis@cloud.ionos.com>
      Signed-off-by: NJack Wang <jinpu.wang@cloud.ionos.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      ef8048dd
    • G
      block/rnbd-clt: Fix sg table use after free · 80f99093
      Guoqing Jiang 提交于
      Since dynamically allocate sglist is used for rnbd_iu, we can't free sg
      table after send_usr_msg since the callback function (cqe.done) could
      still access the sglist.
      
      Otherwise KASAN reports UAF issue:
      
      [ 4856.600257] BUG: KASAN: use-after-free in dma_direct_unmap_sg+0x53/0x290
      [ 4856.600772] Read of size 4 at addr ffff888206af3a98 by task swapper/1/0
      
      [ 4856.601729] CPU: 1 PID: 0 Comm: swapper/1 Kdump: loaded Tainted: G        W         5.10.0-pserver #5.10.0-1+feature+linux+next+20201214.1025+0910d71
      [ 4856.601748] Hardware name: Supermicro Super Server/X11DDW-L, BIOS 3.3 02/21/2020
      [ 4856.601766] Call Trace:
      [ 4856.601785]  <IRQ>
      [ 4856.601822]  dump_stack+0x99/0xcb
      [ 4856.601856]  ? dma_direct_unmap_sg+0x53/0x290
      [ 4856.601888]  print_address_description.constprop.7+0x1e/0x230
      [ 4856.601913]  ? freeze_kernel_threads+0x73/0x73
      [ 4856.601965]  ? mark_held_locks+0x29/0xa0
      [ 4856.602019]  ? dma_direct_unmap_sg+0x53/0x290
      [ 4856.602039]  ? dma_direct_unmap_sg+0x53/0x290
      [ 4856.602079]  kasan_report.cold.9+0x37/0x7c
      [ 4856.602188]  ? mlx5_ib_post_recv+0x430/0x520 [mlx5_ib]
      [ 4856.602209]  ? dma_direct_unmap_sg+0x53/0x290
      [ 4856.602256]  dma_direct_unmap_sg+0x53/0x290
      [ 4856.602366]  complete_rdma_req+0x188/0x4b0 [rtrs_client]
      [ 4856.602451]  ? rtrs_clt_close+0x80/0x80 [rtrs_client]
      [ 4856.602535]  ? mlx5_ib_poll_cq+0x48b/0x16e0 [mlx5_ib]
      [ 4856.602589]  ? radix_tree_insert+0x3a0/0x3a0
      [ 4856.602610]  ? do_raw_spin_lock+0x119/0x1d0
      [ 4856.602647]  ? rwlock_bug.part.1+0x60/0x60
      [ 4856.602740]  rtrs_clt_rdma_done+0x3f7/0x670 [rtrs_client]
      [ 4856.602804]  ? rtrs_clt_rdma_cm_handler+0xda0/0xda0 [rtrs_client]
      [ 4856.602857]  ? check_flags.part.31+0x6c/0x1f0
      [ 4856.602927]  ? rcu_read_lock_sched_held+0xaf/0xe0
      [ 4856.602963]  ? rcu_read_lock_bh_held+0xc0/0xc0
      [ 4856.603137]  __ib_process_cq+0x10a/0x350 [ib_core]
      [ 4856.603309]  ib_poll_handler+0x41/0x1c0 [ib_core]
      [ 4856.603358]  irq_poll_softirq+0xe6/0x280
      [ 4856.603392]  ? lockdep_hardirqs_on_prepare+0x111/0x210
      [ 4856.603446]  __do_softirq+0x10d/0x646
      [ 4856.603540]  asm_call_irq_on_stack+0x12/0x20
      [ 4856.603563]  </IRQ>
      
      [ 4856.605096] Allocated by task 8914:
      [ 4856.605510]  kasan_save_stack+0x19/0x40
      [ 4856.605532]  __kasan_kmalloc.constprop.7+0xc1/0xd0
      [ 4856.605552]  __kmalloc+0x155/0x320
      [ 4856.605574]  __sg_alloc_table+0x155/0x1c0
      [ 4856.605594]  sg_alloc_table+0x1f/0x50
      [ 4856.605620]  send_msg_sess_info+0x119/0x2e0 [rnbd_client]
      [ 4856.605646]  remap_devs+0x71/0x210 [rnbd_client]
      [ 4856.605676]  init_sess+0xad8/0xe10 [rtrs_client]
      [ 4856.605706]  rtrs_clt_reconnect_work+0xd6/0x170 [rtrs_client]
      [ 4856.605728]  process_one_work+0x521/0xa90
      [ 4856.605748]  worker_thread+0x65/0x5b0
      [ 4856.605769]  kthread+0x1f2/0x210
      [ 4856.605789]  ret_from_fork+0x22/0x30
      
      [ 4856.606159] Freed by task 8914:
      [ 4856.606559]  kasan_save_stack+0x19/0x40
      [ 4856.606580]  kasan_set_track+0x1c/0x30
      [ 4856.606601]  kasan_set_free_info+0x1b/0x30
      [ 4856.606622]  __kasan_slab_free+0x108/0x150
      [ 4856.606642]  slab_free_freelist_hook+0x64/0x190
      [ 4856.606661]  kfree+0xe2/0x650
      [ 4856.606681]  __sg_free_table+0xa4/0x100
      [ 4856.606707]  send_msg_sess_info+0x1d6/0x2e0 [rnbd_client]
      [ 4856.606733]  remap_devs+0x71/0x210 [rnbd_client]
      [ 4856.606763]  init_sess+0xad8/0xe10 [rtrs_client]
      [ 4856.606792]  rtrs_clt_reconnect_work+0xd6/0x170 [rtrs_client]
      [ 4856.606813]  process_one_work+0x521/0xa90
      [ 4856.606833]  worker_thread+0x65/0x5b0
      [ 4856.606853]  kthread+0x1f2/0x210
      [ 4856.606872]  ret_from_fork+0x22/0x30
      
      The solution is to free iu's sgtable after the iu is not used anymore.
      And also move sg_alloc_table into rnbd_get_iu accordingly.
      
      Fixes: 5a1328d0 ("block/rnbd-clt: Dynamically allocate sglist for rnbd_iu")
      Signed-off-by: NGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
      Signed-off-by: NJack Wang <jinpu.wang@cloud.ionos.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      80f99093
    • J
      block/rnbd-srv: Fix use after free in rnbd_srv_sess_dev_force_close · 1a84e7c6
      Jack Wang 提交于
      KASAN detect following BUG:
      [  778.215311] ==================================================================
      [  778.216696] BUG: KASAN: use-after-free in rnbd_srv_sess_dev_force_close+0x38/0x60 [rnbd_server]
      [  778.219037] Read of size 8 at addr ffff88b1d6516c28 by task tee/8842
      
      [  778.220500] CPU: 37 PID: 8842 Comm: tee Kdump: loaded Not tainted 5.10.0-pserver #5.10.0-1+feature+linux+next+20201214.1025+0910d71
      [  778.220529] Hardware name: Supermicro Super Server/X11DDW-L, BIOS 3.3 02/21/2020
      [  778.220555] Call Trace:
      [  778.220609]  dump_stack+0x99/0xcb
      [  778.220667]  ? rnbd_srv_sess_dev_force_close+0x38/0x60 [rnbd_server]
      [  778.220715]  print_address_description.constprop.7+0x1e/0x230
      [  778.220750]  ? freeze_kernel_threads+0x73/0x73
      [  778.220896]  ? rnbd_srv_sess_dev_force_close+0x38/0x60 [rnbd_server]
      [  778.220932]  ? rnbd_srv_sess_dev_force_close+0x38/0x60 [rnbd_server]
      [  778.220994]  kasan_report.cold.9+0x37/0x7c
      [  778.221066]  ? kobject_put+0x80/0x270
      [  778.221102]  ? rnbd_srv_sess_dev_force_close+0x38/0x60 [rnbd_server]
      [  778.221184]  rnbd_srv_sess_dev_force_close+0x38/0x60 [rnbd_server]
      [  778.221240]  rnbd_srv_dev_session_force_close_store+0x6a/0xc0 [rnbd_server]
      [  778.221304]  ? sysfs_file_ops+0x90/0x90
      [  778.221353]  kernfs_fop_write+0x141/0x240
      [  778.221451]  vfs_write+0x142/0x4d0
      [  778.221553]  ksys_write+0xc0/0x160
      [  778.221602]  ? __ia32_sys_read+0x50/0x50
      [  778.221684]  ? lockdep_hardirqs_on_prepare+0x13d/0x210
      [  778.221718]  ? syscall_enter_from_user_mode+0x1c/0x50
      [  778.221821]  do_syscall_64+0x33/0x40
      [  778.221862]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [  778.221896] RIP: 0033:0x7f4affdd9504
      [  778.221928] Code: 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00 00 48 8d 05 f9 61 0d 00 8b 00 85 c0 75 13 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 54 c3 0f 1f 00 41 54 49 89 d4 55 48 89 f5 53
      [  778.221956] RSP: 002b:00007fffebb36b28 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
      [  778.222011] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f4affdd9504
      [  778.222038] RDX: 0000000000000002 RSI: 00007fffebb36c50 RDI: 0000000000000003
      [  778.222066] RBP: 00007fffebb36c50 R08: 0000556a151aa600 R09: 00007f4affeb1540
      [  778.222094] R10: fffffffffffffc19 R11: 0000000000000246 R12: 0000556a151aa520
      [  778.222121] R13: 0000000000000002 R14: 00007f4affea6760 R15: 0000000000000002
      
      [  778.222764] Allocated by task 3212:
      [  778.223285]  kasan_save_stack+0x19/0x40
      [  778.223316]  __kasan_kmalloc.constprop.7+0xc1/0xd0
      [  778.223347]  kmem_cache_alloc_trace+0x186/0x350
      [  778.223382]  rnbd_srv_rdma_ev+0xf16/0x1690 [rnbd_server]
      [  778.223422]  process_io_req+0x4d1/0x670 [rtrs_server]
      [  778.223573]  __ib_process_cq+0x10a/0x350 [ib_core]
      [  778.223709]  ib_cq_poll_work+0x31/0xb0 [ib_core]
      [  778.223743]  process_one_work+0x521/0xa90
      [  778.223773]  worker_thread+0x65/0x5b0
      [  778.223802]  kthread+0x1f2/0x210
      [  778.223833]  ret_from_fork+0x22/0x30
      
      [  778.224296] Freed by task 8842:
      [  778.224800]  kasan_save_stack+0x19/0x40
      [  778.224829]  kasan_set_track+0x1c/0x30
      [  778.224860]  kasan_set_free_info+0x1b/0x30
      [  778.224889]  __kasan_slab_free+0x108/0x150
      [  778.224919]  slab_free_freelist_hook+0x64/0x190
      [  778.224947]  kfree+0xe2/0x650
      [  778.224982]  rnbd_destroy_sess_dev+0x2fa/0x3b0 [rnbd_server]
      [  778.225011]  kobject_put+0xda/0x270
      [  778.225046]  rnbd_srv_sess_dev_force_close+0x30/0x60 [rnbd_server]
      [  778.225081]  rnbd_srv_dev_session_force_close_store+0x6a/0xc0 [rnbd_server]
      [  778.225111]  kernfs_fop_write+0x141/0x240
      [  778.225140]  vfs_write+0x142/0x4d0
      [  778.225169]  ksys_write+0xc0/0x160
      [  778.225198]  do_syscall_64+0x33/0x40
      [  778.225227]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      [  778.226506] The buggy address belongs to the object at ffff88b1d6516c00
                      which belongs to the cache kmalloc-512 of size 512
      [  778.227464] The buggy address is located 40 bytes inside of
                      512-byte region [ffff88b1d6516c00, ffff88b1d6516e00)
      
      The problem is in the sess_dev release function we call
      rnbd_destroy_sess_dev, and could free the sess_dev already, but we still
      set the keep_id in rnbd_srv_sess_dev_force_close, which lead to use
      after free.
      
      To fix it, move the keep_id before the sysfs removal, and cache the
      rnbd_srv_session for lock accessing,
      
      Fixes: 78699805 ("block/rnbd-srv: close a mapped device from server side.")
      Signed-off-by: NJack Wang <jinpu.wang@cloud.ionos.com>
      Reviewed-by: NGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      1a84e7c6
    • J
      block/rnbd: Select SG_POOL for RNBD_CLIENT · 74acfa99
      Jack Wang 提交于
      lkp reboot following build error:
       drivers/block/rnbd/rnbd-clt.c: In function 'rnbd_softirq_done_fn':
      >> drivers/block/rnbd/rnbd-clt.c:387:2: error: implicit declaration of function 'sg_free_table_chained' [-Werror=implicit-function-declaration]
           387 |  sg_free_table_chained(&iu->sgt, RNBD_INLINE_SG_CNT);
               |  ^~~~~~~~~~~~~~~~~~~~~
      
      The reason is CONFIG_SG_POOL is not enabled in the config, to
      avoid such failure, select SG_POOL in Kconfig for RNBD_CLIENT.
      
      Fixes: 5a1328d0 ("block/rnbd-clt: Dynamically allocate sglist for rnbd_iu")
      Reported-by: Nkernel test robot <lkp@intel.com>
      Signed-off-by: NJack Wang <jinpu.wang@cloud.ionos.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      74acfa99
    • A
      net: dsa: lantiq_gswip: Exclude RMII from modes that report 1 GbE · 3545454c
      Aleksander Jan Bajkowski 提交于
      Exclude RMII from modes that report 1 GbE support. Reduced MII supports
      up to 100 MbE.
      
      Fixes: 14fceff4 ("net: dsa: Add Lantiq / Intel DSA driver for vrx200")
      Signed-off-by: NAleksander Jan Bajkowski <olek2@wp.pl>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20210107195818.3878-1-olek2@wp.plSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      3545454c
    • J
      s390/qeth: fix L2 header access in qeth_l3_osa_features_check() · f9c48453
      Julian Wiedmann 提交于
      ip_finish_output_gso() may call .ndo_features_check() even before the
      skb has a L2 header. This conflicts with qeth_get_ip_version()'s attempt
      to inspect the L2 header via vlan_eth_hdr().
      
      Switch to vlan_get_protocol(), as already used further down in the
      common qeth_features_check() path.
      
      Fixes: f13ade19 ("s390/qeth: run non-offload L3 traffic over common xmit path")
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      f9c48453
    • J
      s390/qeth: fix locking for discipline setup / removal · b41b554c
      Julian Wiedmann 提交于
      Due to insufficient locking, qeth_core_set_online() and
      qeth_dev_layer2_store() can run in parallel, both attempting to load &
      setup the discipline (and stepping on each other toes along the way).
      A similar race can also occur between qeth_core_remove_device() and
      qeth_dev_layer2_store().
      
      Access to .discipline is meant to be protected by the discipline_mutex,
      so add/expand the locking in qeth_core_remove_device() and
      qeth_core_set_online().
      Adjust the locking in qeth_l*_remove_device() accordingly, as it's now
      handled by the callers in a consistent manner.
      
      Based on an initial patch by Ursula Braun.
      
      Fixes: 9dc48ccc ("qeth: serialize sysfs-triggered device configurations")
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Reviewed-by: NAlexandra Winter <wintera@linux.ibm.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      b41b554c
    • J
      s390/qeth: fix deadlock during recovery · 0b9902c1
      Julian Wiedmann 提交于
      When qeth_dev_layer2_store() - holding the discipline_mutex - waits
      inside qeth_l*_remove_device() for a qeth_do_reset() thread to complete,
      we can hit a deadlock if qeth_do_reset() concurrently calls
      qeth_set_online() and thus tries to aquire the discipline_mutex.
      
      Move the discipline_mutex locking outside of qeth_set_online() and
      qeth_set_offline(), and turn the discipline into a parameter so that
      callers understand the dependency.
      
      To fix the deadlock, we can now relax the locking:
      As already established, qeth_l*_remove_device() waits for
      qeth_do_reset() to complete. So qeth_do_reset() itself is under no risk
      of having card->discipline ripped out while it's running, and thus
      doesn't need to take the discipline_mutex.
      
      Fixes: 9dc48ccc ("qeth: serialize sysfs-triggered device configurations")
      Signed-off-by: NJulian Wiedmann <jwi@linux.ibm.com>
      Reviewed-by: NAlexandra Winter <wintera@linux.ibm.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      0b9902c1
    • C
      octeontx2-af: fix memory leak of lmac and lmac->name · ac7996d6
      Colin Ian King 提交于
      Currently the error return paths don't kfree lmac and lmac->name
      leading to some memory leaks.  Fix this by adding two error return
      paths that kfree these objects
      
      Addresses-Coverity: ("Resource leak")
      Fixes: 1463f382 ("octeontx2-af: Add support for CGX link management")
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Link: https://lore.kernel.org/r/20210107123916.189748-1-colin.king@canonical.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      ac7996d6
    • A
      chtls: Fix chtls resources release sequence · 15ef6b0e
      Ayush Sawal 提交于
      CPL_ABORT_RPL is sent after releasing the resources by calling
      chtls_release_resources(sk); and chtls_conn_done(sk);
      eventually causing kernel panic. Fixing it by calling release
      in appropriate order.
      
      Fixes: cc35c88a ("crypto : chtls - CPL handler definition")
      Signed-off-by: NVinay Kumar Yadav <vinay.yadav@chelsio.com>
      Signed-off-by: NAyush Sawal <ayush.sawal@chelsio.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      15ef6b0e
    • A
      chtls: Added a check to avoid NULL pointer dereference · eade1e0a
      Ayush Sawal 提交于
      In case of server removal lookup_stid() may return NULL pointer, which
      is used as listen_ctx. So added a check before accessing this pointer.
      
      Fixes: cc35c88a ("crypto : chtls - CPL handler definition")
      Signed-off-by: NVinay Kumar Yadav <vinay.yadav@chelsio.com>
      Signed-off-by: NAyush Sawal <ayush.sawal@chelsio.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      eade1e0a
    • A
      chtls: Replace skb_dequeue with skb_peek · a84b2c0d
      Ayush Sawal 提交于
      The skb is unlinked twice, one in __skb_dequeue in function
      chtls_reset_synq() and another in cleanup_syn_rcv_conn().
      So in this patch using skb_peek() instead of __skb_dequeue(),
      so that unlink will be handled only in cleanup_syn_rcv_conn().
      
      Fixes: cc35c88a ("crypto : chtls - CPL handler definition")
      Signed-off-by: NVinay Kumar Yadav <vinay.yadav@chelsio.com>
      Signed-off-by: NAyush Sawal <ayush.sawal@chelsio.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      a84b2c0d
    • A
      chtls: Avoid unnecessary freeing of oreq pointer · f8d15d29
      Ayush Sawal 提交于
      In chtls_pass_accept_request(), removing the chtls_reqsk_free()
      call to avoid oreq freeing twice. Here oreq is the pointer to
      struct request_sock.
      
      Fixes: cc35c88a ("crypto : chtls - CPL handler definition")
      Signed-off-by: NRohit Maheshwari <rohitm@chelsio.com>
      Signed-off-by: NAyush Sawal <ayush.sawal@chelsio.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      f8d15d29
    • A
      chtls: Fix panic when route to peer not configured · 5a5fac99
      Ayush Sawal 提交于
      If route to peer is not configured, we might get non tls
      devices from dst_neigh_lookup() which is invalid, adding a
      check to avoid it.
      
      Fixes: cc35c88a ("crypto : chtls - CPL handler definition")
      Signed-off-by: NRohit Maheshwari <rohitm@chelsio.com>
      Signed-off-by: NAyush Sawal <ayush.sawal@chelsio.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      5a5fac99
    • A
      chtls: Remove invalid set_tcb call · 827d3291
      Ayush Sawal 提交于
      At the time of SYN_RECV, connection information is not
      initialized at FW, updating tcb flag over uninitialized
      connection causes adapter crash. We don't need to
      update the flag during SYN_RECV state, so avoid this.
      
      Fixes: cc35c88a ("crypto : chtls - CPL handler definition")
      Signed-off-by: NRohit Maheshwari <rohitm@chelsio.com>
      Signed-off-by: NAyush Sawal <ayush.sawal@chelsio.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      827d3291
    • A
      chtls: Fix hardware tid leak · 717df0f4
      Ayush Sawal 提交于
      send_abort_rpl() is not calculating cpl_abort_req_rss offset and
      ends up sending wrong TID with abort_rpl WR causng tid leaks.
      Replaced send_abort_rpl() with chtls_send_abort_rpl() as it is
      redundant.
      
      Fixes: cc35c88a ("crypto : chtls - CPL handler definition")
      Signed-off-by: NRohit Maheshwari <rohitm@chelsio.com>
      Signed-off-by: NAyush Sawal <ayush.sawal@chelsio.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      717df0f4
    • D
      net/mlx5e: Fix memleak in mlx5e_create_l2_table_groups · 5b0bb12c
      Dinghao Liu 提交于
      When mlx5_create_flow_group() fails, ft->g should be
      freed just like when kvzalloc() fails. The caller of
      mlx5e_create_l2_table_groups() does not catch this
      issue on failure, which leads to memleak.
      
      Fixes: 33cfaaa8 ("net/mlx5e: Split the main flow steering table")
      Signed-off-by: NDinghao Liu <dinghao.liu@zju.edu.cn>
      Reviewed-by: NLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      5b0bb12c
    • D
      net/mlx5e: Fix two double free cases · 7a6eb072
      Dinghao Liu 提交于
      mlx5e_create_ttc_table_groups() frees ft->g on failure of
      kvzalloc(), but such failure will be caught by its caller
      in mlx5e_create_ttc_table() and ft->g will be freed again
      in mlx5e_destroy_flow_table(). The same issue also occurs
      in mlx5e_create_ttc_table_groups(). Set ft->g to NULL after
      kfree() to avoid double free.
      
      Fixes: 7b3722fa ("net/mlx5e: Support RSS for GRE tunneled packets")
      Fixes: 33cfaaa8 ("net/mlx5e: Split the main flow steering table")
      Signed-off-by: NDinghao Liu <dinghao.liu@zju.edu.cn>
      Reviewed-by: NLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      7a6eb072
    • L
      net/mlx5: Release devlink object if adev fails · 4d8be211
      Leon Romanovsky 提交于
      Add missed freeing previously allocated devlink object.
      
      Fixes: a925b5e3 ("net/mlx5: Register mlx5 devices to auxiliary virtual bus")
      Signed-off-by: NLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      4d8be211
    • A
      net/mlx5e: ethtool, Fix restriction of autoneg with 56G · b1c0aca3
      Aya Levin 提交于
      Prior to this patch, configuring speed to 50G with autoneg off over
      devices supporting 50G per lane failed.
      Support for 50G per lane introduced a new set of link-modes, on which
      driver always performed a speed validation as if only legacy link-modes
      were configured. Fix driver speed validation to force setting autoneg
      over 56G only if in legacy link-mode.
      
      Fixes: 3d7cadae ("net/mlx5e: ethtool, Fix analysis of speed setting")
      Signed-off-by: NAya Levin <ayal@nvidia.com>
      Reviewed-by: NEran Ben Elisha <eranbe@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      b1c0aca3
    • M
      net/mlx5e: In skb build skip setting mark in switchdev mode · e13ed0ac
      Maor Dickman 提交于
      sop_drop_qpn field in the cqe is used by two features, in SWITCHDEV mode
      to restore the chain id in case of a miss and in LEGACY mode to support
      skbedit mark action. In build RX skb, the skb mark field is set regardless
      of the configured mode which cause a corruption of the mark field in case
      of switchdev mode.
      
      Fix by overriding the mark value back to 0 in the representor tc update
      skb flow.
      
      Fixes: 8f1e0b97 ("net/mlx5: E-Switch, Mark miss packets with new chain id mapping")
      Signed-off-by: NMaor Dickman <maord@nvidia.com>
      Reviewed-by: NRaed Salem <raeds@nvidia.com>
      Reviewed-by: NOz Shlomo <ozsh@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      e13ed0ac
    • A
      net/mlx5: E-Switch, fix changing vf VLANID · 25c904b5
      Alaa Hleihel 提交于
      Adding vf VLANID for the first time, or after having cleared previously
      defined VLANID works fine, however, attempting to change an existing vf
      VLANID clears the rules on the firmware, but does not add new rules for
      the new vf VLANID.
      
      Fix this by changing the logic in function esw_acl_egress_lgcy_setup()
      so that it will always configure egress rules.
      
      Fixes: ea651a86 ("net/mlx5: E-Switch, Refactor eswitch egress acl codes")
      Signed-off-by: NAlaa Hleihel <alaa@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      25c904b5
    • M
      net/mlx5e: Fix SWP offsets when vlan inserted by driver · b544011f
      Moshe Shemesh 提交于
      In case WQE includes inline header the vlan is inserted by driver even
      if vlan offload is set. On geneve over vlan interface where software
      parser is used the SWP offsets should be updated according to the added
      vlan.
      
      Fixes: e3cfc7e6 ("net/mlx5e: TX, Add geneve tunnel stateless offload support")
      Signed-off-by: NMoshe Shemesh <moshe@mellanox.com>
      Reviewed-by: NTariq Toukan <tariqt@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      b544011f
    • O
      net/mlx5e: CT: Use per flow counter when CT flow accounting is enabled · eed38eee
      Oz Shlomo 提交于
      Connection counters may be shared for both directions when the counter
      is used for connection aging purposes. However, if TC flow
      accounting is enabled then a unique counter is required per direction.
      
      Instantiate a unique counter per direction if the conntrack accounting
      extension is enabled. Use a shared counter when the connection accounting
      extension is disabled.
      
      Fixes: 1edae233 ("net/mlx5e: CT: Use the same counter for both directions")
      Signed-off-by: NOz Shlomo <ozsh@nvidia.com>
      Reported-by: NMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Reviewed-by: NRoi Dayan <roid@nvidia.com>
      Reviewed-by: NPaul Blakey <paulb@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      eed38eee
    • M
      net/mlx5: Use port_num 1 instead of 0 when delete a RoCE address · 0f2dcade
      Mark Zhang 提交于
      In multi-port mode, FW reports syndrome 0x2ea48 (invalid vhca_port_number)
      if the port_num is not 1 or 2.
      
      Fixes: 80f09dfc ("net/mlx5: Eswitch, enable RoCE loopback traffic")
      Signed-off-by: NMark Zhang <markzhang@nvidia.com>
      Reviewed-by: NMaor Gottlieb <maorg@nvidia.com>
      Signed-off-by: NSaeed Mahameed <saeedm@nvidia.com>
      0f2dcade