Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Jun 21, 2023
    • Greg Kroah-Hartman's avatar
    • Christian Loehle's avatar
      mmc: block: ensure error propagation for non-blk · 569e40c0
      Christian Loehle authored
      commit 003fb0a5 upstream.
      
      Requests to the mmc layer usually come through a block device IO.
      The exceptions are the ioctl interface, RPMB chardev ioctl
      and debugfs, which issue their own blk_mq requests through
      blk_execute_rq and do not query the BLK_STS error but the
      mmcblk-internal drv_op_result. This patch ensures that drv_op_result
      defaults to an error and has to be overwritten by the operation
      to be considered successful.
      
      The behavior leads to a bug where the request never propagates
      the error, e.g. by directly erroring out at mmc_blk_mq_issue_rq if
      mmc_blk_part_switch fails. The ioctl caller of the rpmb chardev then
      can never see an error (BLK_STS_IOERR, but drv_op_result is unchanged)
      and thus may assume that their call executed successfully when it did not.
      
      While always checking the blk_execute_rq return value would be
      advised, let's eliminate the error by always setting
      drv_op_result as -EIO to be overwritten on success (or other error)
      
      Fixes: 614f0388
      
       ("mmc: block: move single ioctl() commands to block requests")
      Signed-off-by: default avatarChristian Loehle <cloehle@hyperstone.com>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/59c17ada35664b818b7bd83752119b2d@hyperstone.com
      
      
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarChristian Loehle <cloehle@hyperstone.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      569e40c0
    • Michael Ellerman's avatar
      powerpc: Fix defconfig choice logic when cross compiling · 3c995890
      Michael Ellerman authored
      commit af5cd05d
      
       upstream.
      
      Our logic for choosing defconfig doesn't work well in some situations.
      
      For example if you're on a ppc64le machine but you specify a non-empty
      CROSS_COMPILE, in order to use a non-default toolchain, then defconfig
      will give you ppc64_defconfig (big endian):
      
        $ make CROSS_COMPILE=~/toolchains/gcc-8/bin/powerpc-linux- defconfig
        *** Default configuration is based on 'ppc64_defconfig'
      
      This is because we assume that CROSS_COMPILE being set means we
      can't be on a ppc machine and rather than checking we just default to
      ppc64_defconfig.
      
      We should just ignore CROSS_COMPILE, instead check the machine with
      uname and if it's one of ppc, ppc64 or ppc64le then use that
      defconfig. If it's none of those then we fall back to ppc64_defconfig.
      
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarAlyssa Ross <hi@alyssa.is>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3c995890
    • Alexander Kapshuk's avatar
      drm/nouveau/kms: Fix NULL pointer dereference in nouveau_connector_detect_depth · 44d566c3
      Alexander Kapshuk authored
      commit 630f5122 upstream.
      
      This oops manifests itself on the following hardware:
      01:00.0 VGA compatible controller: NVIDIA Corporation G98M [GeForce G 103M] (rev a1)
      
      Oct 09 14:17:46 lp-sasha kernel: BUG: kernel NULL pointer dereference, address: 0000000000000000
      Oct 09 14:17:46 lp-sasha kernel: #PF: supervisor read access in kernel mode
      Oct 09 14:17:46 lp-sasha kernel: #PF: error_code(0x0000) - not-present page
      Oct 09 14:17:46 lp-sasha kernel: PGD 0 P4D 0
      Oct 09 14:17:46 lp-sasha kernel: Oops: 0000 [#1] SMP PTI
      Oct 09 14:17:46 lp-sasha kernel: CPU: 1 PID: 191 Comm: systemd-udevd Not tainted 5.9.0-rc8-next-20201009 #38
      Oct 09 14:17:46 lp-sasha kernel: Hardware name: Hewlett-Packard Compaq Presario CQ61 Notebook PC/306A, BIOS F.03 03/23/2009
      Oct 09 14:17:46 lp-sasha kernel: RIP: 0010:nouveau_connector_detect_depth+0x71/0xc0 [nouveau]
      Oct 09 14:17:46 lp-sasha kernel: Code: 0a 00 00 48 8b 49 48 c7 87 b8 00 00 00 06 00 00 00 80 b9 4d 0a 00 00 00 75 1e 83 fa 41 75 05 48 85 c0 75 29 8b 81 10 0d 00 00 <39> 06 7c 25 f6 81 14 0d 00 00 02 75 b7 c3 80 b9 0c 0d 00 00 00 75
      Oct 09 14:17:46 lp-sasha kernel: RSP: 0018:ffffc9000028f8c0 EFLAGS: 00010297
      Oct 09 14:17:46 lp-sasha kernel: RAX: 0000000000014c08 RBX: ffff8880369d4000 RCX: ffff8880369d3000
      Oct 09 14:17:46 lp-sasha kernel: RDX: 0000000000000040 RSI: 0000000000000000 RDI: ffff8880369d4000
      Oct 09 14:17:46 lp-sasha kernel: RBP: ffff88800601cc00 R08: ffff8880051da298 R09: ffffffff8226201a
      Oct 09 14:17:46 lp-sasha kernel: R10: ffff88800469aa80 R11: ffff888004c84ff8 R12: 0000000000000000
      Oct 09 14:17:46 lp-sasha kernel: R13: ffff8880051da000 R14: 0000000000002000 R15: 0000000000000003
      Oct 09 14:17:46 lp-sasha kernel: FS:  00007fd0192b3440(0000) GS:ffff8880bc900000(0000) knlGS:0000000000000000
      Oct 09 14:17:46 lp-sasha kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      Oct 09 14:17:46 lp-sasha kernel: CR2: 0000000000000000 CR3: 0000000004976000 CR4: 00000000000006e0
      Oct 09 14:17:46 lp-sasha kernel: Call Trace:
      Oct 09 14:17:46 lp-sasha kernel:  nouveau_connector_get_modes+0x1e6/0x240 [nouveau]
      Oct 09 14:17:46 lp-sasha kernel:  ? kfree+0xb9/0x240
      Oct 09 14:17:46 lp-sasha kernel:  ? drm_connector_list_iter_next+0x7c/0xa0
      Oct 09 14:17:46 lp-sasha kernel:  drm_helper_probe_single_connector_modes+0x1ba/0x7c0
      Oct 09 14:17:46 lp-sasha kernel:  drm_client_modeset_probe+0x27e/0x1360
      Oct 09 14:17:46 lp-sasha kernel:  ? nvif_object_sclass_put+0xc/0x20 [nouveau]
      Oct 09 14:17:46 lp-sasha kernel:  ? nouveau_cli_init+0x3cc/0x440 [nouveau]
      Oct 09 14:17:46 lp-sasha kernel:  ? ktime_get_mono_fast_ns+0x49/0xa0
      Oct 09 14:17:46 lp-sasha kernel:  ? nouveau_drm_open+0x4e/0x180 [nouveau]
      Oct 09 14:17:46 lp-sasha kernel:  __drm_fb_helper_initial_config_and_unlock+0x3f/0x4a0
      Oct 09 14:17:46 lp-sasha kernel:  ? drm_file_alloc+0x18f/0x260
      Oct 09 14:17:46 lp-sasha kernel:  ? mutex_lock+0x9/0x40
      Oct 09 14:17:46 lp-sasha kernel:  ? drm_client_init+0x110/0x160
      Oct 09 14:17:46 lp-sasha kernel:  nouveau_fbcon_init+0x14d/0x1c0 [nouveau]
      Oct 09 14:17:46 lp-sasha kernel:  nouveau_drm_device_init+0x1c0/0x880 [nouveau]
      Oct 09 14:17:46 lp-sasha kernel:  nouveau_drm_probe+0x11a/0x1e0 [nouveau]
      Oct 09 14:17:46 lp-sasha kernel:  pci_device_probe+0xcd/0x140
      Oct 09 14:17:46 lp-sasha kernel:  really_probe+0xd8/0x400
      Oct 09 14:17:46 lp-sasha kernel:  driver_probe_device+0x4a/0xa0
      Oct 09 14:17:46 lp-sasha kernel:  device_driver_attach+0x9c/0xc0
      Oct 09 14:17:46 lp-sasha kernel:  __driver_attach+0x6f/0x100
      Oct 09 14:17:46 lp-sasha kernel:  ? device_driver_attach+0xc0/0xc0
      Oct 09 14:17:46 lp-sasha kernel:  bus_for_each_dev+0x75/0xc0
      Oct 09 14:17:46 lp-sasha kernel:  bus_add_driver+0x106/0x1c0
      Oct 09 14:17:46 lp-sasha kernel:  driver_register+0x86/0xe0
      Oct 09 14:17:46 lp-sasha kernel:  ? 0xffffffffa044e000
      Oct 09 14:17:46 lp-sasha kernel:  do_one_initcall+0x48/0x1e0
      Oct 09 14:17:46 lp-sasha kernel:  ? _cond_resched+0x11/0x60
      Oct 09 14:17:46 lp-sasha kernel:  ? kmem_cache_alloc_trace+0x19c/0x1e0
      Oct 09 14:17:46 lp-sasha kernel:  do_init_module+0x57/0x220
      Oct 09 14:17:46 lp-sasha kernel:  __do_sys_finit_module+0xa0/0xe0
      Oct 09 14:17:46 lp-sasha kernel:  do_syscall_64+0x33/0x40
      Oct 09 14:17:46 lp-sasha kernel:  entry_SYSCALL_64_after_hwframe+0x44/0xa9
      Oct 09 14:17:46 lp-sasha kernel: RIP: 0033:0x7fd01a060d5d
      Oct 09 14:17:46 lp-sasha kernel: Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 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 73 01 c3 48 8b 0d e3 70 0c 00 f7 d8 64 89 01 48
      Oct 09 14:17:46 lp-sasha kernel: RSP: 002b:00007ffc8ad38a98 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
      Oct 09 14:17:46 lp-sasha kernel: RAX: ffffffffffffffda RBX: 0000563f6e7fd530 RCX: 00007fd01a060d5d
      Oct 09 14:17:46 lp-sasha kernel: RDX: 0000000000000000 RSI: 00007fd01a19f95d RDI: 000000000000000f
      Oct 09 14:17:46 lp-sasha kernel: RBP: 0000000000020000 R08: 0000000000000000 R09: 0000000000000007
      Oct 09 14:17:46 lp-sasha kernel: R10: 000000000000000f R11: 0000000000000246 R12: 00007fd01a19f95d
      Oct 09 14:17:46 lp-sasha kernel: R13: 0000000000000000 R14: 0000563f6e7fbc10 R15: 0000563f6e7fd530
      Oct 09 14:17:46 lp-sasha kernel: Modules linked in: nouveau(+) ttm xt_string xt_mark xt_LOG vgem v4l2_dv_timings uvcvideo ulpi udf ts_kmp ts_fsm ts_bm snd_aloop sil164 qat_dh895xccvf nf_nat_sip nf_nat_irc nf_nat_ftp nf_nat nf_log_ipv6 nf_log_ipv4 nf_log_common ltc2990 lcd intel_qat input_leds i2c_mux gspca_main videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev mc drivetemp cuse fuse crc_itu_t coretemp ch7006 ath5k ath algif_hash
      Oct 09 14:17:46 lp-sasha kernel: CR2: 0000000000000000
      Oct 09 14:17:46 lp-sasha kernel: ---[ end trace 0ddafe218ad30017 ]---
      Oct 09 14:17:46 lp-sasha kernel: RIP: 0010:nouveau_connector_detect_depth+0x71/0xc0 [nouveau]
      Oct 09 14:17:46 lp-sasha kernel: Code: 0a 00 00 48 8b 49 48 c7 87 b8 00 00 00 06 00 00 00 80 b9 4d 0a 00 00 00 75 1e 83 fa 41 75 05 48 85 c0 75 29 8b 81 10 0d 00 00 <39> 06 7c 25 f6 81 14 0d 00 00 02 75 b7 c3 80 b9 0c 0d 00 00 00 75
      Oct 09 14:17:46 lp-sasha kernel: RSP: 0018:ffffc9000028f8c0 EFLAGS: 00010297
      Oct 09 14:17:46 lp-sasha kernel: RAX: 0000000000014c08 RBX: ffff8880369d4000 RCX: ffff8880369d3000
      Oct 09 14:17:46 lp-sasha kernel: RDX: 0000000000000040 RSI: 0000000000000000 RDI: ffff8880369d4000
      Oct 09 14:17:46 lp-sasha kernel: RBP: ffff88800601cc00 R08: ffff8880051da298 R09: ffffffff8226201a
      Oct 09 14:17:46 lp-sasha kernel: R10: ffff88800469aa80 R11: ffff888004c84ff8 R12: 0000000000000000
      Oct 09 14:17:46 lp-sasha kernel: R13: ffff8880051da000 R14: 0000000000002000 R15: 0000000000000003
      Oct 09 14:17:46 lp-sasha kernel: FS:  00007fd0192b3440(0000) GS:ffff8880bc900000(0000) knlGS:0000000000000000
      Oct 09 14:17:46 lp-sasha kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      Oct 09 14:17:46 lp-sasha kernel: CR2: 0000000000000000 CR3: 0000000004976000 CR4: 00000000000006e0
      
      The disassembly:
      Code: 0a 00 00 48 8b 49 48 c7 87 b8 00 00 00 06 00 00 00 80 b9 4d 0a 00 00 00 75 1e 83 fa 41 75 05 48 85 c0 75 29 8b 81 10 0d 00 00 <39> 06 7c 25 f6 81 14 0d 00 00 02 75 b7 c3 80 b9 0c 0d 00 00 00 75
      All code
      ========
         0:   0a 00                   or     (%rax),%al
         2:   00 48 8b                add    %cl,-0x75(%rax)
         5:   49                      rex.WB
         6:   48 c7 87 b8 00 00 00    movq   $0x6,0xb8(%rdi)
         d:   06 00 00 00
        11:   80 b9 4d 0a 00 00 00    cmpb   $0x0,0xa4d(%rcx)
        18:   75 1e                   jne    0x38
        1a:   83 fa 41                cmp    $0x41,%edx
        1d:   75 05                   jne    0x24
        1f:   48 85 c0                test   %rax,%rax
        22:   75 29                   jne    0x4d
        24:   8b 81 10 0d 00 00       mov    0xd10(%rcx),%eax
        2a:*  39 06                   cmp    %eax,(%rsi)              <-- trapping instruction
        2c:   7c 25                   jl     0x53
        2e:   f6 81 14 0d 00 00 02    testb  $0x2,0xd14(%rcx)
        35:   75 b7                   jne    0xffffffffffffffee
        37:   c3                      retq
        38:   80 b9 0c 0d 00 00 00    cmpb   $0x0,0xd0c(%rcx)
        3f:   75                      .byte 0x75
      
      Code starting with the faulting instruction
      ===========================================
         0:   39 06                   cmp    %eax,(%rsi)
         2:   7c 25                   jl     0x29
         4:   f6 81 14 0d 00 00 02    testb  $0x2,0xd14(%rcx)
         b:   75 b7                   jne    0xffffffffffffffc4
         d:   c3                      retq
         e:   80 b9 0c 0d 00 00 00    cmpb   $0x0,0xd0c(%rcx)
        15:   75                      .byte 0x75
      
      objdump -SF --disassemble=nouveau_connector_detect_depth
      [...]
              if (nv_connector->edid &&
         c85e1:       83 fa 41                cmp    $0x41,%edx
         c85e4:       75 05                   jne    c85eb <nouveau_connector_detect_depth+0x6b> (File Offset: 0xc866b)
         c85e6:       48 85 c0                test   %rax,%rax
         c85e9:       75 29                   jne    c8614 <nouveau_connector_detect_depth+0x94> (File Offset: 0xc8694)
                  nv_connector->type == DCB_CONNECTOR_LVDS_SPWG)
                      duallink = ((u8 *)nv_connector->edid)[121] == 2;
              else
                      duallink = mode->clock >= bios->fp.duallink_transition_clk;
      
              if ((!duallink && (bios->fp.strapless_is_24bit & 1)) ||
         c85eb:       8b 81 10 0d 00 00       mov    0xd10(%rcx),%eax
         c85f1:       39 06                   cmp    %eax,(%rsi)
         c85f3:       7c 25                   jl     c861a <nouveau_connector_detect_depth+0x9a> (File Offset: 0xc869a)
                  ( duallink && (bios->fp.strapless_is_24bit & 2)))
         c85f5:       f6 81 14 0d 00 00 02    testb  $0x2,0xd14(%rcx)
         c85fc:       75 b7                   jne    c85b5 <nouveau_connector_detect_depth+0x35> (File Offset: 0xc8635)
                      connector->display_info.bpc = 8;
      [...]
      
      % scripts/faddr2line /lib/modules/5.9.0-rc8-next-20201009/kernel/drivers/gpu/drm/nouveau/nouveau.ko nouveau_connector_detect_depth+0x71/0xc0
      nouveau_connector_detect_depth+0x71/0xc0:
      nouveau_connector_detect_depth at /home/sasha/linux-next/drivers/gpu/drm/nouveau/nouveau_connector.c:891
      
      It is actually line 889. See the disassembly below.
      889                     duallink = mode->clock >= bios->fp.duallink_transition_clk;
      
      The NULL pointer being dereferenced is mode.
      
      Git bisect has identified the following commit as bad:
      f28e32d3 drm/nouveau/kms: Don't change EDID when it hasn't actually changed
      
      Here is the chain of events that causes the oops.
      On entry to nouveau_connector_detect_lvds, edid is set to NULL.  The call
      to nouveau_connector_detect sets nv_connector->edid to valid memory,
      with status set to connector_status_connected and the flow of execution
      branching to the out label.
      
      The subsequent call to nouveau_connector_set_edid erronously clears
      nv_connector->edid, via the local edid pointer which remains set to NULL.
      
      Fix this by setting edid to the value of the just acquired
      nv_connector->edid and executing the body of nouveau_connector_set_edid
      only if nv_connector->edid and edid point to different memory addresses
      thus preventing nv_connector->edid from being turned into a dangling
      pointer.
      
      Fixes: f28e32d3
      
       ("drm/nouveau/kms: Don't change EDID when it hasn't actually changed")
      Signed-off-by: default avatarAlexander Kapshuk <alexander.kapshuk@gmail.com>
      Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
      Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      44d566c3
    • Leon Romanovsky's avatar
      neighbour: delete neigh_lookup_nodev as not used · bd1c9c2b
      Leon Romanovsky authored
      commit 76b9bf96 upstream.
      
      neigh_lookup_nodev isn't used in the kernel after removal
      of DECnet. So let's remove it.
      
      Fixes: 1202cdd6
      
       ("Remove DECnet support from kernel")
      Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Link: https://lore.kernel.org/r/eb5656200d7964b2d177a36b77efa3c597d6d72d.1678267343.git.leonro@nvidia.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bd1c9c2b
    • Gaosheng Cui's avatar
      net: Remove unused inline function dst_hold_and_use() · d70ab0d6
      Gaosheng Cui authored
      commit 0b81882d upstream.
      
      All uses of dst_hold_and_use() have
      been removed since commit 1202cdd6
      
       ("Remove DECnet support
      from kernel"), so remove it.
      
      Signed-off-by: default avatarGaosheng Cui <cuigaosheng1@huawei.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d70ab0d6
    • Gaosheng Cui's avatar
      neighbour: Remove unused inline function neigh_key_eq16() · a2729c59
      Gaosheng Cui authored
      commit c8f01a4a upstream.
      
      All uses of neigh_key_eq16() have
      been removed since commit 1202cdd6
      
       ("Remove DECnet support
      from kernel"), so remove it.
      
      Signed-off-by: default avatarGaosheng Cui <cuigaosheng1@huawei.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a2729c59
    • Alex Maftei's avatar
      selftests/ptp: Fix timestamp printf format for PTP_SYS_OFFSET · 97112288
      Alex Maftei authored
      [ Upstream commit 76a4c8b8 ]
      
      Previously, timestamps were printed using "%lld.%u" which is incorrect
      for nanosecond values lower than 100,000,000 as they're fractional
      digits, therefore leading zeros are meaningful.
      
      This patch changes the format strings to "%lld.%09u" in order to add
      leading zeros to the nanosecond value.
      
      Fixes: 568ebc59 ("ptp: add the PTP_SYS_OFFSET ioctl to the testptp program")
      Fixes: 4ec54f95 ("ptp: Fix compiler warnings in the testptp utility")
      Fixes: 6ab0e475
      
       ("Documentation: fix misc. warnings")
      Signed-off-by: default avatarAlex Maftei <alex.maftei@amd.com>
      Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
      Link: https://lore.kernel.org/r/20230615083404.57112-1-alex.maftei@amd.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      97112288
    • Lin Ma's avatar
      net: tipc: resize nlattr array to correct size · 403353c4
      Lin Ma authored
      [ Upstream commit 44194cb1 ]
      
      According to nla_parse_nested_deprecated(), the tb[] is supposed to the
      destination array with maxtype+1 elements. In current
      tipc_nl_media_get() and __tipc_nl_media_set(), a larger array is used
      which is unnecessary. This patch resize them to a proper size.
      
      Fixes: 1e55417d ("tipc: add media set to new netlink api")
      Fixes: 46f15c67
      
       ("tipc: add media get/dump to new netlink api")
      Signed-off-by: default avatarLin Ma <linma@zju.edu.cn>
      Reviewed-by: default avatarFlorian Westphal <fw@strlen.de>
      Reviewed-by: default avatarTung Nguyen <tung.q.nguyen@dektech.com.au>
      Link: https://lore.kernel.org/r/20230614120604.1196377-1-linma@zju.edu.cn
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      403353c4
    • Eric Dumazet's avatar
      net: lapbether: only support ethernet devices · 02d8ac90
      Eric Dumazet authored
      [ Upstream commit 9eed321c ]
      
      It probbaly makes no sense to support arbitrary network devices
      for lapbether.
      
      syzbot reported:
      
      skbuff: skb_under_panic: text:ffff80008934c100 len:44 put:40 head:ffff0000d18dd200 data:ffff0000d18dd1ea tail:0x16 end:0x140 dev:bond1
      kernel BUG at net/core/skbuff.c:200 !
      Internal error: Oops - BUG: 00000000f2000800 [#1] PREEMPT SMP
      Modules linked in:
      CPU: 0 PID: 5643 Comm: dhcpcd Not tainted 6.4.0-rc5-syzkaller-g4641cff8e810 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
      pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      pc : skb_panic net/core/skbuff.c:196 [inline]
      pc : skb_under_panic+0x13c/0x140 net/core/skbuff.c:210
      lr : skb_panic net/core/skbuff.c:196 [inline]
      lr : skb_under_panic+0x13c/0x140 net/core/skbuff.c:210
      sp : ffff8000973b7260
      x29: ffff8000973b7270 x28: ffff8000973b7360 x27: dfff800000000000
      x26: ffff0000d85d8150 x25: 0000000000000016 x24: ffff0000d18dd1ea
      x23: ffff0000d18dd200 x22: 000000000000002c x21: 0000000000000140
      x20: 0000000000000028 x19: ffff80008934c100 x18: ffff8000973b68a0
      x17: 0000000000000000 x16: ffff80008a43bfbc x15: 0000000000000202
      x14: 0000000000000000 x13: 0000000000000001 x12: 0000000000000001
      x11: 0000000000000201 x10: 0000000000000000 x9 : f22f7eb937cced00
      x8 : f22f7eb937cced00 x7 : 0000000000000001 x6 : 0000000000000001
      x5 : ffff8000973b6b78 x4 : ffff80008df9ee80 x3 : ffff8000805974f4
      x2 : 0000000000000001 x1 : 0000000100000201 x0 : 0000000000000086
      Call trace:
      skb_panic net/core/skbuff.c:196 [inline]
      skb_under_panic+0x13c/0x140 net/core/skbuff.c:210
      skb_push+0xf0/0x108 net/core/skbuff.c:2409
      ip6gre_header+0xbc/0x738 net/ipv6/ip6_gre.c:1383
      dev_hard_header include/linux/netdevice.h:3137 [inline]
      lapbeth_data_transmit+0x1c4/0x298 drivers/net/wan/lapbether.c:257
      lapb_data_transmit+0x8c/0xb0 net/lapb/lapb_iface.c:447
      lapb_transmit_buffer+0x178/0x204 net/lapb/lapb_out.c:149
      lapb_send_control+0x220/0x320 net/lapb/lapb_subr.c:251
      lapb_establish_data_link+0x94/0xec
      lapb_device_event+0x348/0x4e0
      notifier_call_chain+0x1a4/0x510 kernel/notifier.c:93
      raw_notifier_call_chain+0x3c/0x50 kernel/notifier.c:461
      __dev_notify_flags+0x2bc/0x544
      dev_change_flags+0xd0/0x15c net/core/dev.c:8643
      devinet_ioctl+0x858/0x17e4 net/ipv4/devinet.c:1150
      inet_ioctl+0x2ac/0x4d8 net/ipv4/af_inet.c:979
      sock_do_ioctl+0x134/0x2dc net/socket.c:1201
      sock_ioctl+0x4ec/0x858 net/socket.c:1318
      vfs_ioctl fs/ioctl.c:51 [inline]
      __do_sys_ioctl fs/ioctl.c:870 [inline]
      __se_sys_ioctl fs/ioctl.c:856 [inline]
      __arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:856
      __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
      invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
      el0_svc_common+0x138/0x244 arch/arm64/kernel/syscall.c:142
      do_el0_svc+0x64/0x198 arch/arm64/kernel/syscall.c:191
      el0_svc+0x4c/0x160 arch/arm64/kernel/entry-common.c:647
      el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:665
      el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591
      Code: aa1803e6 aa1903e7 a90023f5 947730f5 (d4210000)
      
      Fixes: 1da177e4
      
       ("Linux-2.6.12-rc2")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Martin Schiller <ms@dev.tdt.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      02d8ac90
    • Natalia Petrova's avatar
      drm/nouveau: add nv_encoder pointer check for NULL · 27ab1570
      Natalia Petrova authored
      [ Upstream commit 55b94bb8 ]
      
      Pointer nv_encoder could be dereferenced at nouveau_connector.c
      in case it's equal to NULL by jumping to goto label.
      This patch adds a NULL-check to avoid it.
      
      Found by Linux Verification Center (linuxtesting.org) with SVACE.
      
      Fixes: 3195c5f9
      
       ("drm/nouveau: set encoder for lvds")
      Signed-off-by: default avatarNatalia Petrova <n.petrova@fintech.ru>
      Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
      [Fixed patch title]
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230512103320.82234-1-n.petrova@fintech.ru
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      27ab1570
    • Lyude Paul's avatar
      drm/nouveau/kms: Don't change EDID when it hasn't actually changed · 2681f84e
      Lyude Paul authored
      [ Upstream commit f28e32d3 ]
      
      Currently in nouveau_connector_ddc_detect() and
      nouveau_connector_detect_lvds(), we start the connector probing process
      by releasing the previous EDID and informing DRM of the change. However,
      since commit 5186421c
      
       ("drm: Introduce epoch counter to
      drm_connector") drm_connector_update_edid_property() actually checks
      whether the new EDID we've specified is different from the previous one,
      and updates the connector's epoch accordingly if it is. But, because we
      always set the EDID to NULL first in nouveau_connector_ddc_detect() and
      nouveau_connector_detect_lvds() we end up making DRM think that the EDID
      changes every single time we do a connector probe - which isn't needed.
      
      So, let's fix this by not clearing the EDID at the start of the
      connector probing process, and instead simply changing or removing it
      once near the end of the probing process. This will help prevent us from
      sending unneeded hotplug events to userspace when nothing has actually
      changed.
      
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Reviewed-by: default avatarBen Skeggs <bskeggs@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200826182456.322681-19-lyude@redhat.com
      Stable-dep-of: 55b94bb8
      
       ("drm/nouveau: add nv_encoder pointer check for NULL")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2681f84e
    • Natalia Petrova's avatar
      drm/nouveau/dp: check for NULL nv_connector->native_mode · 2db30054
      Natalia Petrova authored
      [ Upstream commit 20a2ce87 ]
      
      Add checking for NULL before calling nouveau_connector_detect_depth() in
      nouveau_connector_get_modes() function because nv_connector->native_mode
      could be dereferenced there since connector pointer passed to
      nouveau_connector_detect_depth() and the same value of
      nv_connector->native_mode is used there.
      
      Found by Linux Verification Center (linuxtesting.org) with SVACE.
      
      Fixes: d4c2c99b
      
       ("drm/nouveau/dp: remove broken display depth function, use the improved one")
      
      Signed-off-by: default avatarNatalia Petrova <n.petrova@fintech.ru>
      Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230512111526.82408-1-n.petrova@fintech.ru
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2db30054
    • Aleksandr Loktionov's avatar
      igb: fix nvm.ops.read() error handling · f6f2a554
      Aleksandr Loktionov authored
      [ Upstream commit 48a821fd ]
      
      Add error handling into igb_set_eeprom() function, in case
      nvm.ops.read() fails just quit with error code asap.
      
      Fixes: 9d5c8243
      
       ("igb: PCI-Express 82575 Gigabit Ethernet driver")
      Signed-off-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f6f2a554
    • Dan Carpenter's avatar
      sctp: fix an error code in sctp_sf_eat_auth() · aacf8ef5
      Dan Carpenter authored
      [ Upstream commit 75e6def3 ]
      
      The sctp_sf_eat_auth() function is supposed to enum sctp_disposition
      values and returning a kernel error code will cause issues in the
      caller.  Change -ENOMEM to SCTP_DISPOSITION_NOMEM.
      
      Fixes: 65b07e5d
      
       ("[SCTP]: API updates to suport SCTP-AUTH extensions.")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Acked-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      aacf8ef5
    • Saravanan Vajravel's avatar
      IB/isert: Fix incorrect release of isert connection · fb404307
      Saravanan Vajravel authored
      [ Upstream commit 699826f4 ]
      
      The ib_isert module is releasing the isert connection both in
      isert_wait_conn() handler as well as isert_free_conn() handler.
      In isert_wait_conn() handler, it is expected to wait for iSCSI
      session logout operation to complete. It should free the isert
      connection only in isert_free_conn() handler.
      
      When a bunch of iSER target is cleared, this issue can lead to
      use-after-free memory issue as isert conn is twice released
      
      Fixes: b02efbfc
      
       ("iser-target: Fix implicit termination of connections")
      Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: default avatarSaravanan Vajravel <saravanan.vajravel@broadcom.com>
      Signed-off-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
      Link: https://lore.kernel.org/r/20230606102531.162967-4-saravanan.vajravel@broadcom.com
      
      
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fb404307
    • Saravanan Vajravel's avatar
      IB/isert: Fix possible list corruption in CMA handler · 0c71ae6f
      Saravanan Vajravel authored
      [ Upstream commit 7651e2d6 ]
      
      When ib_isert module receives connection error event, it is
      releasing the isert session and removes corresponding list
      node but it doesn't take appropriate mutex lock to remove
      the list node.  This can lead to linked  list corruption
      
      Fixes: bd379220
      
       ("iser-target: Fix pending connections handling in target stack shutdown sequnce")
      Signed-off-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
      Signed-off-by: default avatarSaravanan Vajravel <saravanan.vajravel@broadcom.com>
      Link: https://lore.kernel.org/r/20230606102531.162967-3-saravanan.vajravel@broadcom.com
      
      
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0c71ae6f
    • Saravanan Vajravel's avatar
      IB/isert: Fix dead lock in ib_isert · 0d5aad75
      Saravanan Vajravel authored
      [ Upstream commit 691b0480 ]
      
      - When a iSER session is released, ib_isert module is taking a mutex
        lock and releasing all pending connections. As part of this, ib_isert
        is destroying rdma cm_id. To destroy cm_id, rdma_cm module is sending
        CM events to CMA handler of ib_isert. This handler is taking same
        mutex lock. Hence it leads to deadlock between ib_isert & rdma_cm
        modules.
      
      - For fix, created local list of pending connections and release the
        connection outside of mutex lock.
      
      Calltrace:
      ---------
      [ 1229.791410] INFO: task kworker/10:1:642 blocked for more than 120 seconds.
      [ 1229.791416]       Tainted: G           OE    --------- -  - 4.18.0-372.9.1.el8.x86_64 #1
      [ 1229.791418] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      [ 1229.791419] task:kworker/10:1    state:D stack:    0 pid:  642 ppid:     2 flags:0x80004000
      [ 1229.791424] Workqueue: ib_cm cm_work_handler [ib_cm]
      [ 1229.791436] Call Trace:
      [ 1229.791438]  __schedule+0x2d1/0x830
      [ 1229.791445]  ? select_idle_sibling+0x23/0x6f0
      [ 1229.791449]  schedule+0x35/0xa0
      [ 1229.791451]  schedule_preempt_disabled+0xa/0x10
      [ 1229.791453]  __mutex_lock.isra.7+0x310/0x420
      [ 1229.791456]  ? select_task_rq_fair+0x351/0x990
      [ 1229.791459]  isert_cma_handler+0x224/0x330 [ib_isert]
      [ 1229.791463]  ? ttwu_queue_wakelist+0x159/0x170
      [ 1229.791466]  cma_cm_event_handler+0x25/0xd0 [rdma_cm]
      [ 1229.791474]  cma_ib_handler+0xa7/0x2e0 [rdma_cm]
      [ 1229.791478]  cm_process_work+0x22/0xf0 [ib_cm]
      [ 1229.791483]  cm_work_handler+0xf4/0xf30 [ib_cm]
      [ 1229.791487]  ? move_linked_works+0x6e/0xa0
      [ 1229.791490]  process_one_work+0x1a7/0x360
      [ 1229.791491]  ? create_worker+0x1a0/0x1a0
      [ 1229.791493]  worker_thread+0x30/0x390
      [ 1229.791494]  ? create_worker+0x1a0/0x1a0
      [ 1229.791495]  kthread+0x10a/0x120
      [ 1229.791497]  ? set_kthread_struct+0x40/0x40
      [ 1229.791499]  ret_from_fork+0x1f/0x40
      
      [ 1229.791739] INFO: task targetcli:28666 blocked for more than 120 seconds.
      [ 1229.791740]       Tainted: G           OE    --------- -  - 4.18.0-372.9.1.el8.x86_64 #1
      [ 1229.791741] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      [ 1229.791742] task:targetcli       state:D stack:    0 pid:28666 ppid:  5510 flags:0x00004080
      [ 1229.791743] Call Trace:
      [ 1229.791744]  __schedule+0x2d1/0x830
      [ 1229.791746]  schedule+0x35/0xa0
      [ 1229.791748]  schedule_preempt_disabled+0xa/0x10
      [ 1229.791749]  __mutex_lock.isra.7+0x310/0x420
      [ 1229.791751]  rdma_destroy_id+0x15/0x20 [rdma_cm]
      [ 1229.791755]  isert_connect_release+0x115/0x130 [ib_isert]
      [ 1229.791757]  isert_free_np+0x87/0x140 [ib_isert]
      [ 1229.791761]  iscsit_del_np+0x74/0x120 [iscsi_target_mod]
      [ 1229.791776]  lio_target_np_driver_store+0xe9/0x140 [iscsi_target_mod]
      [ 1229.791784]  configfs_write_file+0xb2/0x110
      [ 1229.791788]  vfs_write+0xa5/0x1a0
      [ 1229.791792]  ksys_write+0x4f/0xb0
      [ 1229.791794]  do_syscall_64+0x5b/0x1a0
      [ 1229.791798]  entry_SYSCALL_64_after_hwframe+0x65/0xca
      
      Fixes: bd379220
      
       ("iser-target: Fix pending connections handling in target stack shutdown sequnce")
      Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
      Signed-off-by: default avatarSaravanan Vajravel <saravanan.vajravel@broadcom.com>
      Link: https://lore.kernel.org/r/20230606102531.162967-2-saravanan.vajravel@broadcom.com
      
      
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0d5aad75
    • Yishai Hadas's avatar
      IB/uverbs: Fix to consider event queue closing also upon non-blocking mode · 9d7178c7
      Yishai Hadas authored
      [ Upstream commit 62fab312 ]
      
      Fix ib_uverbs_event_read() to consider event queue closing also upon
      non-blocking mode.
      
      Once the queue is closed (e.g. hot-plug flow) all the existing events
      are cleaned-up as part of ib_uverbs_free_event_queue().
      
      An application that uses the non-blocking FD mode should get -EIO in
      that case to let it knows that the device was removed already.
      
      Otherwise, it can loose the indication that the device was removed and
      won't recover.
      
      As part of that, refactor the code to have a single flow with regards to
      'is_closed' for both blocking and non-blocking modes.
      
      Fixes: 14e23bd6
      
       ("RDMA/core: Fix locking in ib_uverbs_event_read")
      Reviewed-by: default avatarMaor Gottlieb <maorg@nvidia.com>
      Signed-off-by: default avatarYishai Hadas <yishaih@nvidia.com>
      Link: https://lore.kernel.org/r/97b00116a1e1e13f8dc4ec38a5ea81cf8c030210.1685960567.git.leon@kernel.org
      
      
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9d7178c7
    • Zhu Yanjun's avatar
      RDMA/rxe: Fix the use-before-initialization error of resp_pkts · a668769e
      Zhu Yanjun authored
      [ Upstream commit 2a62b621 ]
      
      In the following:
      
        Call Trace:
         <TASK>
         __dump_stack lib/dump_stack.c:88 [inline]
         dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106
         assign_lock_key kernel/locking/lockdep.c:982 [inline]
         register_lock_class+0xdb6/0x1120 kernel/locking/lockdep.c:1295
         __lock_acquire+0x10a/0x5df0 kernel/locking/lockdep.c:4951
         lock_acquire kernel/locking/lockdep.c:5691 [inline]
         lock_acquire+0x1b1/0x520 kernel/locking/lockdep.c:5656
         __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
         _raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162
         skb_dequeue+0x20/0x180 net/core/skbuff.c:3639
         drain_resp_pkts drivers/infiniband/sw/rxe/rxe_comp.c:555 [inline]
         rxe_completer+0x250d/0x3cc0 drivers/infiniband/sw/rxe/rxe_comp.c:652
         rxe_qp_do_cleanup+0x1be/0x820 drivers/infiniband/sw/rxe/rxe_qp.c:761
         execute_in_process_context+0x3b/0x150 kernel/workqueue.c:3473
         __rxe_cleanup+0x21e/0x370 drivers/infiniband/sw/rxe/rxe_pool.c:233
         rxe_create_qp+0x3f6/0x5f0 drivers/infiniband/sw/rxe/rxe_verbs.c:583
      
      This is a use-before-initialization problem.
      
      It happens because rxe_qp_do_cleanup is called during error unwind before
      the struct has been fully initialized.
      
      Move the initialization of the skb earlier.
      
      Fixes: 8700e3e7 ("Soft RoCE driver")
      Link: https://lore.kernel.org/r/20230602035408.741534-1-yanjun.zhu@intel.com
      
      
      Reported-by: default avatar <syzbot+eba589d8f49c73d356da@syzkaller.appspotmail.com>
      Signed-off-by: default avatarZhu Yanjun <yanjun.zhu@linux.dev>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a668769e
    • Bob Pearson's avatar
      RDMA/rxe: Removed unused name from rxe_task struct · 1ce4a08e
      Bob Pearson authored
      [ Upstream commit de669ae8 ]
      
      The name field in struct rxe_task is never used. This patch removes it.
      
      Link: https://lore.kernel.org/r/20221021200118.2163-4-rpearsonhpe@gmail.com
      
      
      Signed-off-by: default avatarIan Ziemba <ian.ziemba@hpe.com>
      Signed-off-by: default avatarBob Pearson <rpearsonhpe@gmail.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Stable-dep-of: 2a62b621
      
       ("RDMA/rxe: Fix the use-before-initialization error of resp_pkts")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1ce4a08e
    • Zhu Yanjun's avatar
      RDMA/rxe: Remove the unused variable obj · 225d81a0
      Zhu Yanjun authored
      [ Upstream commit f0785358 ]
      
      The member variable obj in struct rxe_task is not needed.
      So remove it to save memory.
      
      Link: https://lore.kernel.org/r/20220822011615.805603-4-yanjun.zhu@linux.dev
      
      
      Signed-off-by: default avatarZhu Yanjun <yanjun.zhu@linux.dev>
      Reviewed-by: default avatarLi Zhijian <lizhijian@fujitsu.com>
      Reviewed-by: default avatarBob Pearson <rpearsonhpe@gmail.com>
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Stable-dep-of: 2a62b621
      
       ("RDMA/rxe: Fix the use-before-initialization error of resp_pkts")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      225d81a0
    • Guillaume Nault's avatar
      ping6: Fix send to link-local addresses with VRF. · 17c46e7f
      Guillaume Nault authored
      [ Upstream commit 91ffd1ba
      
       ]
      
      Ping sockets can't send packets when they're bound to a VRF master
      device and the output interface is set to a slave device.
      
      For example, when net.ipv4.ping_group_range is properly set, so that
      ping6 can use ping sockets, the following kind of commands fails:
        $ ip vrf exec red ping6 fe80::854:e7ff:fe88:4bf1%eth1
      
      What happens is that sk->sk_bound_dev_if is set to the VRF master
      device, but 'oif' is set to the real output device. Since both are set
      but different, ping_v6_sendmsg() sees their value as inconsistent and
      fails.
      
      Fix this by allowing 'oif' to be a slave device of ->sk_bound_dev_if.
      
      This fixes the following kselftest failure:
        $ ./fcnal-test.sh -t ipv6_ping
        [...]
        TEST: ping out, vrf device+address bind - ns-B IPv6 LLA        [FAIL]
      
      Reported-by: default avatarMirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
      Closes: https://lore.kernel.org/netdev/b6191f90-ffca-dbca-7d06-88a9788def9c@alu.unizg.hr/
      
      
      Tested-by: default avatarMirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
      Fixes: 5e457896
      
       ("net: ipv6: Fix ping to link-local addresses.")
      Signed-off-by: default avatarGuillaume Nault <gnault@redhat.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://lore.kernel.org/r/6c8b53108816a8d0d5705ae37bdc5a8322b5e3d9.1686153846.git.gnault@redhat.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      17c46e7f
    • Pablo Neira Ayuso's avatar
      netfilter: nfnetlink: skip error delivery on batch in case of ENOMEM · 844e091a
      Pablo Neira Ayuso authored
      [ Upstream commit a1a64a15 ]
      
      If caller reports ENOMEM, then stop iterating over the batch and send a
      single netlink message to userspace to report OOM.
      
      Fixes: cbb8125e
      
       ("netfilter: nfnetlink: deliver netlink errors on batch completion")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      844e091a
    • Romain Izard's avatar
      usb: gadget: f_ncm: Fix NTP-32 support · ae03af64
      Romain Izard authored
      commit 550eef0c
      
       upstream.
      
      When connecting a CDC-NCM gadget to an host that uses the NTP-32 mode,
      or that relies on the default CRC setting, the current implementation gets
      confused, and does not expect the correct signature for its packets.
      
      Fix this, by ensuring that the ndp_sign member in the f_ncm structure
      always contain a valid value.
      
      Signed-off-by: default avatarRomain Izard <romain.izard.pro@gmail.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarJoakim Tjernlund <joakim.tjernlund@infinera.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ae03af64
    • Romain Izard's avatar
      usb: gadget: f_ncm: Add OS descriptor support · ed30d925
      Romain Izard authored
      commit 79340929
      
       upstream.
      
      To be able to use the default USB class drivers available in Microsoft
      Windows, we need to add OS descriptors to the exported USB gadget to
      tell the OS that we are compatible with the built-in drivers.
      
      Copy the OS descriptor support from f_rndis into f_ncm. As a result,
      using the WINNCM compatible ID, the UsbNcm driver is loaded on
      enumeration without the need for a custom driver or inf file.
      
      Signed-off-by: default avatarRomain Izard <romain.izard.pro@gmail.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      Signed-off-by: default avatarJoakim Tjernlund <joakim.tjernlund@infinera.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed30d925
    • Elson Roy Serrao's avatar
      usb: dwc3: gadget: Reset num TRBs before giving back the request · e9d63500
      Elson Roy Serrao authored
      commit 00f8205f upstream.
      
      Consider a scenario where cable disconnect happens when there is an active
      usb reqest queued to the UDC. As part of the disconnect we would issue an
      end transfer with no interrupt-on-completion before giving back this
      request. Since we are giving back the request without skipping TRBs the
      num_trbs field of dwc3_request still holds the stale value previously used.
      Function drivers re-use same request for a given bind-unbind session and
      hence their dwc3_request context gets preserved across cable
      disconnect/connect. When such a request gets re-queued after cable connect,
      we would increase the num_trbs field on top of the previous stale value
      thus incorrectly representing the number of TRBs used. Fix this by
      resetting num_trbs field before giving back the request.
      
      Fixes: 09fe1f8d
      
       ("usb: dwc3: gadget: track number of TRBs per request")
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarElson Roy Serrao <quic_eserrao@quicinc.com>
      Acked-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
      Message-ID: <1685654850-8468-1-git-send-email-quic_eserrao@quicinc.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e9d63500
    • Jerry Meng's avatar
      USB: serial: option: add Quectel EM061KGL series · b6dbcf61
      Jerry Meng authored
      commit f1832e2b
      
       upstream.
      
      Add support for Quectel EM061KGL series which are based on Qualcomm
      SDX12 chip:
      
      EM061KGL_LTA(0x2c7c / 0x0123): MBIM + GNSS + DIAG + NMEA + AT + QDSS + DPL
      EM061KGL_LMS(0x2c7c / 0x0124): MBIM + GNSS + DIAG + NMEA + AT + QDSS + DPL
      EM061KGL_LWW(0x2c7c / 0x6008): MBIM + GNSS + DIAG + NMEA + AT + QDSS + DPL
      EM061KGL_LCN(0x2c7c / 0x6009): MBIM + GNSS + DIAG + NMEA + AT + QDSS + DPL
      
      Above products use the exact same interface layout and
      option driver is for interfaces DIAG, NMEA and AT.
      
      T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  5 Spd=480  MxCh= 0
      D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=2c7c ProdID=6008 Rev= 5.04
      S:  Manufacturer=Quectel
      S:  Product=Quectel EM061K-GL
      S:  SerialNumber=f6fa08b6
      C:* #Ifs= 8 Cfg#= 1 Atr=a0 MxPwr=500mA
      A:  FirstIf#= 0 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
      I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
      E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
      E:  Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=32ms
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
      E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=40 Driver=option
      E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
      E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 6 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=70 Driver=(none)
      E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      I:* If#= 7 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
      E:  Ad=8f(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Signed-off-by: default avatarJerry Meng <jerry-meng@foxmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b6dbcf61
    • Stephen Hemminger's avatar
      Remove DECnet support from kernel · 3e77bbc8
      Stephen Hemminger authored
      commit 1202cdd6
      
       upstream.
      
      DECnet is an obsolete network protocol that receives more attention
      from kernel janitors than users. It belongs in computer protocol
      history museum not in Linux kernel.
      
      It has been "Orphaned" in kernel since 2010. The iproute2 support
      for DECnet was dropped in 5.0 release. The documentation link on
      Sourceforge says it is abandoned there as well.
      
      Leave the UAPI alone to keep userspace programs compiling.
      This means that there is still an empty neighbour table
      for AF_DECNET.
      
      The table of /proc/sys/net entries was updated to match
      current directories and reformatted to be alphabetical.
      
      Signed-off-by: default avatarStephen Hemminger <stephen@networkplumber.org>
      Acked-by: default avatarDavid Ahern <dsahern@kernel.org>
      Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3e77bbc8
    • Wes Huang's avatar
      net: usb: qmi_wwan: add support for Compal RXM-G1 · 58b3ebca
      Wes Huang authored
      commit 86319919
      
       upstream.
      
      Add support for Compal RXM-G1 which is based on Qualcomm SDX55 chip.
      This patch adds support for two compositions:
      
      0x9091: DIAG + MODEM + QMI_RMNET + ADB
      0x90db: DIAG + DUN + RMNET + DPL + QDSS(Trace) + ADB
      
      T:  Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=5000 MxCh= 0
      D:  Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
      P:  Vendor=05c6 ProdID=9091 Rev= 4.14
      S:  Manufacturer=QCOM
      S:  Product=SDXPRAIRIE-MTP _SN:719AB680
      S:  SerialNumber=719ab680
      C:* #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=896mA
      I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=(none)
      E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
      E:  Ad=84(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
      E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      
      T:  Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=5000 MxCh= 0
      D:  Ver= 3.20 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 9 #Cfgs=  1
      P:  Vendor=05c6 ProdID=90db Rev= 4.14
      S:  Manufacturer=QCOM
      S:  Product=SDXPRAIRIE-MTP _SN:719AB680
      S:  SerialNumber=719ab680
      C:* #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=896mA
      I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=(none)
      E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
      E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
      E:  Ad=84(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
      E:  Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=8f(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 4 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=85(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      I:* If#= 5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
      E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarWes Huang <wes.huang@moxa.com>
      Acked-by: default avatarBjørn Mork <bjorn@mork.no>
      Link: https://lore.kernel.org/r/20230608030141.3546-1-wes.huang@moxa.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      58b3ebca
    • Edward Srouji's avatar
      RDMA/uverbs: Restrict usage of privileged QKEYs · 22cd0db2
      Edward Srouji authored
      commit 0cadb4db upstream.
      
      According to the IB specification rel-1.6, section 3.5.3:
      "QKEYs with the most significant bit set are considered controlled
      QKEYs, and a HCA does not allow a consumer to arbitrarily specify a
      controlled QKEY."
      
      Thus, block non-privileged users from setting such a QKEY.
      
      Cc: stable@vger.kernel.org
      Fixes: bc38a6ab
      
       ("[PATCH] IB uverbs: core implementation")
      Signed-off-by: default avatarEdward Srouji <edwards@nvidia.com>
      Link: https://lore.kernel.org/r/c00c809ddafaaf87d6f6cb827978670989a511b3.1685960567.git.leon@kernel.org
      
      
      Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      22cd0db2
    • Dave Airlie's avatar
      nouveau: fix client work fence deletion race · 02dfdc07
      Dave Airlie authored
      commit c8a5d5ea upstream.
      
      This seems to have existed for ever but is now more apparant after
      commit 9bff18d1
      
       ("drm/ttm: use per BO cleanup workers")
      
      My analysis: two threads are running, one in the irq signalling the
      fence, in dma_fence_signal_timestamp_locked, it has done the
      DMA_FENCE_FLAG_SIGNALLED_BIT setting, but hasn't yet reached the
      callbacks.
      
      The second thread in nouveau_cli_work_ready, where it sees the fence is
      signalled, so then puts the fence, cleanups the object and frees the
      work item, which contains the callback.
      
      Thread one goes again and tries to call the callback and causes the
      use-after-free.
      
      Proposed fix: lock the fence signalled check in nouveau_cli_work_ready,
      so either the callbacks are done or the memory is freed.
      
      Reviewed-by: default avatarKarol Herbst <kherbst@redhat.com>
      Fixes: 11e451e7
      
       ("drm/nouveau: remove fence wait code from deferred client work handler")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      Link: https://lore.kernel.org/dri-devel/20230615024008.1600281-1-airlied@gmail.com/
      
      
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      02dfdc07
    • Ricardo Ribalda's avatar
      powerpc/purgatory: remove PGO flags · ba4853d5
      Ricardo Ribalda authored
      commit 20188bac upstream.
      
      If profile-guided optimization is enabled, the purgatory ends up with
      multiple .text sections.  This is not supported by kexec and crashes the
      system.
      
      Link: https://lkml.kernel.org/r/20230321-kexec_clang16-v7-3-b05c520b7296@chromium.org
      Fixes: 93045705
      
       ("kernel/kexec_file.c: split up __kexec_load_puragory")
      Signed-off-by: default avatarRicardo Ribalda <ribalda@chromium.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: <stable@vger.kernel.org>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Borislav Petkov (AMD) <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Palmer Dabbelt <palmer@rivosinc.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Philipp Rudo <prudo@redhat.com>
      Cc: Ross Zwisler <zwisler@google.com>
      Cc: Simon Horman <horms@kernel.org>
      Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tom Rix <trix@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ba4853d5
    • Ricardo Ribalda's avatar
      kexec: support purgatories with .text.hot sections · 4947a0eb
      Ricardo Ribalda authored
      commit 8652d44f upstream.
      
      Patch series "kexec: Fix kexec_file_load for llvm16 with PGO", v7.
      
      When upreving llvm I realised that kexec stopped working on my test
      platform.
      
      The reason seems to be that due to PGO there are multiple .text sections
      on the purgatory, and kexec does not supports that.
      
      
      This patch (of 4):
      
      Clang16 links the purgatory text in two sections when PGO is in use:
      
        [ 1] .text             PROGBITS         0000000000000000  00000040
             00000000000011a1  0000000000000000  AX       0     0     16
        [ 2] .rela.text        RELA             0000000000000000  00003498
             0000000000000648  0000000000000018   I      24     1     8
        ...
        [17] .text.hot.        PROGBITS         0000000000000000  00003220
             000000000000020b  0000000000000000  AX       0     0     1
        [18] .rela.text.hot.   RELA             0000000000000000  00004428
             0000000000000078  0000000000000018   I      24    17     8
      
      And both of them have their range [sh_addr ... sh_addr+sh_size] on the
      area pointed by `e_entry`.
      
      This causes that image->start is calculated twice, once for .text and
      another time for .text.hot. The second calculation leaves image->start
      in a random location.
      
      Because of this, the system crashes immediately after:
      
      kexec_core: Starting new kernel
      
      Link: https://lkml.kernel.org/r/20230321-kexec_clang16-v7-0-b05c520b7296@chromium.org
      Link: https://lkml.kernel.org/r/20230321-kexec_clang16-v7-1-b05c520b7296@chromium.org
      Fixes: 93045705
      
       ("kernel/kexec_file.c: split up __kexec_load_puragory")
      Signed-off-by: default avatarRicardo Ribalda <ribalda@chromium.org>
      Reviewed-by: default avatarRoss Zwisler <zwisler@google.com>
      Reviewed-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Reviewed-by: default avatarPhilipp Rudo <prudo@redhat.com>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Borislav Petkov (AMD) <bp@alien8.de>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Palmer Dabbelt <palmer@rivosinc.com>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Simon Horman <horms@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tom Rix <trix@redhat.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4947a0eb
    • Ryusuke Konishi's avatar
      nilfs2: fix possible out-of-bounds segment allocation in resize ioctl · bae3a1b7
      Ryusuke Konishi authored
      commit fee5eaec upstream.
      
      Syzbot reports that in its stress test for resize ioctl, the log writing
      function nilfs_segctor_do_construct hits a WARN_ON in
      nilfs_segctor_truncate_segments().
      
      It turned out that there is a problem with the current implementation of
      the resize ioctl, which changes the writable range on the device (the
      range of allocatable segments) at the end of the resize process.
      
      This order is necessary for file system expansion to avoid corrupting the
      superblock at trailing edge.  However, in the case of a file system
      shrink, if log writes occur after truncating out-of-bounds trailing
      segments and before the resize is complete, segments may be allocated from
      the truncated space.
      
      The userspace resize tool was fine as it limits the range of allocatable
      segments before performing the resize, but it can run into this issue if
      the resize ioctl is called alone.
      
      Fix this issue by changing nilfs_sufile_resize() to update the range of
      allocatable segments immediately after successful truncation of segment
      space in case of file system shrink.
      
      Link: https://lkml.kernel.org/r/20230524094348.3784-1-konishi.ryusuke@gmail.com
      Fixes: 4e33f9ea
      
       ("nilfs2: implement resize ioctl")
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Reported-by: default avatar <syzbot+33494cd0df2ec2931851@syzkaller.appspotmail.com>
      Closes: https://lkml.kernel.org/r/0000000000005434c405fbbafdc5@google.com
      
      
      Tested-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bae3a1b7
    • Ryusuke Konishi's avatar
      nilfs2: fix incomplete buffer cleanup in nilfs_btnode_abort_change_key() · 5a8de639
      Ryusuke Konishi authored
      commit 2f012f2b upstream.
      
      A syzbot fault injection test reported that nilfs_btnode_create_block, a
      helper function that allocates a new node block for b-trees, causes a
      kernel BUG for disk images where the file system block size is smaller
      than the page size.
      
      This was due to unexpected flags on the newly allocated buffer head, and
      it turned out to be because the buffer flags were not cleared by
      nilfs_btnode_abort_change_key() after an error occurred during a b-tree
      update operation and the buffer was later reused in that state.
      
      Fix this issue by using nilfs_btnode_delete() to abandon the unused
      preallocated buffer in nilfs_btnode_abort_change_key().
      
      Link: https://lkml.kernel.org/r/20230513102428.10223-1-konishi.ryusuke@gmail.com
      
      
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Reported-by: default avatar <syzbot+b0a35a5c1f7e846d3b09@syzkaller.appspotmail.com>
      Closes: https://lkml.kernel.org/r/000000000000d1d6c205ebc4d512@google.com
      
      
      Tested-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5a8de639
    • Janne Grunau's avatar
      nios2: dts: Fix tse_mac "max-frame-size" property · 3b82acb4
      Janne Grunau authored
      commit 85041e12 upstream.
      
      The given value of 1518 seems to refer to the layer 2 ethernet frame
      size without 802.1Q tag. Actual use of the "max-frame-size" including in
      the consumer of the "altr,tse-1.0" compatible is the MTU.
      
      Fixes: 95acd4c7 ("nios2: Device tree support")
      Fixes: 61c610ec
      
       ("nios2: Add Max10 device tree")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarJanne Grunau <j@jannau.net>
      Signed-off-by: default avatarDinh Nguyen <dinguyen@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3b82acb4
    • Luís Henriques's avatar
      ocfs2: check new file size on fallocate call · aef251cc
      Luís Henriques authored
      commit 26a6ffff upstream.
      
      When changing a file size with fallocate() the new size isn't being
      checked.  In particular, the FSIZE ulimit isn't being checked, which makes
      fstest generic/228 fail.  Simply adding a call to inode_newsize_ok() fixes
      this issue.
      
      Link: https://lkml.kernel.org/r/20230529152645.32680-1-lhenriques@suse.de
      
      
      Signed-off-by: default avatarLuís Henriques <lhenriques@suse.de>
      Reviewed-by: default avatarMark Fasheh <mark@fasheh.com>
      Reviewed-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Cc: Changwei Ge <gechangwei@live.cn>
      Cc: Gang He <ghe@suse.com>
      Cc: Jun Piao <piaojun@huawei.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aef251cc
    • Luís Henriques's avatar
      ocfs2: fix use-after-free when unmounting read-only filesystem · 5731afbe
      Luís Henriques authored
      commit 50d92788 upstream.
      
      It's trivial to trigger a use-after-free bug in the ocfs2 quotas code using
      fstest generic/452.  After a read-only remount, quotas are suspended and
      ocfs2_mem_dqinfo is freed through ->ocfs2_local_free_info().  When unmounting
      the filesystem, an UAF access to the oinfo will eventually cause a crash.
      
      BUG: KASAN: slab-use-after-free in timer_delete+0x54/0xc0
      Read of size 8 at addr ffff8880389a8208 by task umount/669
      ...
      Call Trace:
       <TASK>
       ...
       timer_delete+0x54/0xc0
       try_to_grab_pending+0x31/0x230
       __cancel_work_timer+0x6c/0x270
       ocfs2_disable_quotas.isra.0+0x3e/0xf0 [ocfs2]
       ocfs2_dismount_volume+0xdd/0x450 [ocfs2]
       generic_shutdown_super+0xaa/0x280
       kill_block_super+0x46/0x70
       deactivate_locked_super+0x4d/0xb0
       cleanup_mnt+0x135/0x1f0
       ...
       </TASK>
      
      Allocated by task 632:
       kasan_save_stack+0x1c/0x40
       kasan_set_track+0x21/0x30
       __kasan_kmalloc+0x8b/0x90
       ocfs2_local_read_info+0xe3/0x9a0 [ocfs2]
       dquot_load_quota_sb+0x34b/0x680
       dquot_load_quota_inode+0xfe/0x1a0
       ocfs2_enable_quotas+0x190/0x2f0 [ocfs2]
       ocfs2_fill_super+0x14ef/0x2120 [ocfs2]
       mount_bdev+0x1be/0x200
       legacy_get_tree+0x6c/0xb0
       vfs_get_tree+0x3e/0x110
       path_mount+0xa90/0xe10
       __x64_sys_mount+0x16f/0x1a0
       do_syscall_64+0x43/0x90
       entry_SYSCALL_64_after_hwframe+0x72/0xdc
      
      Freed by task 650:
       kasan_save_stack+0x1c/0x40
       kasan_set_track+0x21/0x30
       kasan_save_free_info+0x2a/0x50
       __kasan_slab_free+0xf9/0x150
       __kmem_cache_free+0x89/0x180
       ocfs2_local_free_info+0x2ba/0x3f0 [ocfs2]
       dquot_disable+0x35f/0xa70
       ocfs2_susp_quotas.isra.0+0x159/0x1a0 [ocfs2]
       ocfs2_remount+0x150/0x580 [ocfs2]
       reconfigure_super+0x1a5/0x3a0
       path_mount+0xc8a/0xe10
       __x64_sys_mount+0x16f/0x1a0
       do_syscall_64+0x43/0x90
       entry_SYSCALL_64_after_hwframe+0x72/0xdc
      
      Link: https://lkml.kernel.org/r/20230522102112.9031-1-lhenriques@suse.de
      
      
      Signed-off-by: default avatarLuís Henriques <lhenriques@suse.de>
      Reviewed-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
      Tested-by: default avatarJoseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Junxiao Bi <junxiao.bi@oracle.com>
      Cc: Changwei Ge <gechangwei@live.cn>
      Cc: Gang He <ghe@suse.com>
      Cc: Jun Piao <piaojun@huawei.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5731afbe
    • Ross Lagerwall's avatar
      xen/blkfront: Only check REQ_FUA for writes · 2540c662
      Ross Lagerwall authored
      [ Upstream commit b6ebaa81
      
       ]
      
      The existing code silently converts read operations with the
      REQ_FUA bit set into write-barrier operations. This results in data
      loss as the backend scribbles zeroes over the data instead of returning
      it.
      
      While the REQ_FUA bit doesn't make sense on a read operation, at least
      one well-known out-of-tree kernel module does set it and since it
      results in data loss, let's be safe here and only look at REQ_FUA for
      writes.
      
      Signed-off-by: default avatarRoss Lagerwall <ross.lagerwall@citrix.com>
      Acked-by: default avatarJuergen Gross <jgross@suse.com>
      Link: https://lore.kernel.org/r/20230426164005.2213139-1-ross.lagerwall@citrix.com
      
      
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2540c662