1. 17 Nov, 2022 5 commits
  2. 15 Nov, 2022 4 commits
    • Bernard Metzler's avatar
      RDMA/siw: Set defined status for work completion with undefined status · 60da2d11
      Bernard Metzler authored
      A malicious user may write undefined values into memory mapped completion
      queue elements status or opcode. Undefined status or opcode values will
      result in out-of-bounds access to an array mapping siw internal
      representation of opcode and status to RDMA core representation when
      reaping CQ elements. While siw detects those undefined values, it did not
      correctly set completion status to a defined value, thus defeating the
      whole purpose of the check.
      
      This bug leads to the following Smatch static checker warning:
      
      	drivers/infiniband/sw/siw/siw_cq.c:96 siw_reap_cqe()
      	error: buffer overflow 'map_cqe_status' 10 <= 21
      
      Fixes: bdf1da5d ("RDMA/siw: Fix immediate work request flush to completion queue")
      Link: https://lore.kernel.org/r/20221115170747.1263298-1-bmt@zurich.ibm.comReported-by: default avatarDan Carpenter <error27@gmail.com>
      Signed-off-by: default avatarBernard Metzler <bmt@zurich.ibm.com>
      Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      60da2d11
    • Mark Zhang's avatar
      RDMA/nldev: Return "-EAGAIN" if the cm_id isn't from expected port · ecacb375
      Mark Zhang authored
      When filling a cm_id entry, return "-EAGAIN" instead of 0 if the cm_id
      doesn'the have the same port as requested, otherwise an incomplete entry
      may be returned, which causes "rdam res show cm_id" to return an error.
      
      For example on a machine with two rdma devices with "rping -C 1 -v -s"
      running background, the "rdma" command fails:
        $ rdma -V
        rdma utility, iproute2-5.19.0
        $ rdma res show cm_id
        link mlx5_0/- cm-idn 0 state LISTEN ps TCP pid 28056 comm rping src-addr 0.0.0.0:7174
        error: Protocol not available
      
      While with this fix it succeeds:
        $ rdma res show cm_id
        link mlx5_0/- cm-idn 0 state LISTEN ps TCP pid 26395 comm rping src-addr 0.0.0.0:7174
        link mlx5_1/- cm-idn 0 state LISTEN ps TCP pid 26395 comm rping src-addr 0.0.0.0:7174
      
      Fixes: 00313983 ("RDMA/nldev: provide detailed CM_ID information")
      Signed-off-by: default avatarMark Zhang <markzhang@nvidia.com>
      Link: https://lore.kernel.org/r/a08e898cdac5e28428eb749a99d9d981571b8ea7.1667810736.git.leonro@nvidia.comSigned-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      ecacb375
    • Mark Zhang's avatar
      RDMA/core: Make sure "ib_port" is valid when access sysfs node · 5e15ff29
      Mark Zhang authored
      The "ib_port" structure must be set before adding the sysfs kobject,
      and reset after removing it, otherwise it may crash when accessing
      the sysfs node:
        Unable to handle kernel NULL pointer dereference at virtual address 0000000000000050
        Mem abort info:
          ESR = 0x96000006
          Exception class = DABT (current EL), IL = 32 bits
          SET = 0, FnV = 0
          EA = 0, S1PTW = 0
        Data abort info:
          ISV = 0, ISS = 0x00000006
          CM = 0, WnR = 0
        user pgtable: 4k pages, 48-bit VAs, pgdp = 00000000e85f5ba5
        [0000000000000050] pgd=0000000848fd9003, pud=000000085b387003, pmd=0000000000000000
        Internal error: Oops: 96000006 [#2] PREEMPT SMP
        Modules linked in: ib_umad(O) mlx5_ib(O) nfnetlink_cttimeout(E) nfnetlink(E) act_gact(E) cls_flower(E) sch_ingress(E) openvswitch(E) nsh(E) nf_nat_ipv6(E) nf_nat_ipv4(E) nf_conncount(E) nf_nat(E) nf_conntrack(E) nf_defrag_ipv6(E) nf_defrag_ipv4(E) mst_pciconf(O) ipmi_devintf(E) ipmi_msghandler(E) ipmb_dev_int(OE) mlx5_core(O) mlxfw(O) mlxdevm(O) auxiliary(O) ib_uverbs(O) ib_core(O) mlx_compat(O) psample(E) sbsa_gwdt(E) uio_pdrv_genirq(E) uio(E) mlxbf_pmc(OE) mlxbf_gige(OE) mlxbf_tmfifo(OE) gpio_mlxbf2(OE) pwr_mlxbf(OE) mlx_trio(OE) i2c_mlxbf(OE) mlx_bootctl(OE) bluefield_edac(OE) knem(O) ip_tables(E) ipv6(E) crc_ccitt(E) [last unloaded: mst_pci]
        Process grep (pid: 3372, stack limit = 0x0000000022055c92)
        CPU: 5 PID: 3372 Comm: grep Tainted: G      D    OE     4.19.161-mlnx.47.gadcd9e3 #1
        Hardware name: https://www.mellanox.com BlueField SoC/BlueField SoC, BIOS BlueField:3.9.2-15-ga2403ab Sep  8 2022
        pstate: 40000005 (nZcv daif -PAN -UAO)
        pc : hw_stat_port_show+0x4c/0x80 [ib_core]
        lr : port_attr_show+0x40/0x58 [ib_core]
        sp : ffff000029f43b50
        x29: ffff000029f43b50 x28: 0000000019375000
        x27: ffff8007b821a540 x26: ffff000029f43e30
        x25: 0000000000008000 x24: ffff000000eaa958
        x23: 0000000000001000 x22: ffff8007a4ce3000
        x21: ffff8007baff8000 x20: ffff8007b9066ac0
        x19: ffff8007bae97578 x18: 0000000000000000
        x17: 0000000000000000 x16: 0000000000000000
        x15: 0000000000000000 x14: 0000000000000000
        x13: 0000000000000000 x12: 0000000000000000
        x11: 0000000000000000 x10: 0000000000000000
        x9 : 0000000000000000 x8 : ffff8007a4ce4000
        x7 : 0000000000000000 x6 : 000000000000003f
        x5 : ffff000000e6a280 x4 : ffff8007a4ce3000
        x3 : 0000000000000000 x2 : aaaaaaaaaaaaaaab
        x1 : ffff8007b9066a10 x0 : ffff8007baff8000
        Call trace:
         hw_stat_port_show+0x4c/0x80 [ib_core]
         port_attr_show+0x40/0x58 [ib_core]
         sysfs_kf_seq_show+0x8c/0x150
         kernfs_seq_show+0x44/0x50
         seq_read+0x1b4/0x45c
         kernfs_fop_read+0x148/0x1d8
         __vfs_read+0x58/0x180
         vfs_read+0x94/0x154
         ksys_read+0x68/0xd8
         __arm64_sys_read+0x28/0x34
         el0_svc_common+0x88/0x18c
         el0_svc_handler+0x78/0x94
         el0_svc+0x8/0xe8
        Code: f2955562 aa1603e4 aa1503e0 f9405683 (f9402861)
      
      Fixes: d8a58838 ("RDMA/core: Replace the ib_port_data hw_stats pointers with a ib_port pointer")
      Signed-off-by: default avatarMark Zhang <markzhang@nvidia.com>
      Reviewed-by: default avatarMichael Guralnik <michaelgur@nvidia.com>
      Link: https://lore.kernel.org/r/88867e705c42c1cd2011e45201c25eecdb9fef94.1667810736.git.leonro@nvidia.comSigned-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      5e15ff29
    • Mark Zhang's avatar
      RDMA/restrack: Release MR restrack when delete · dac153f2
      Mark Zhang authored
      The MR restrack also needs to be released when delete it, otherwise it
      cause memory leak as the task struct won't be released.
      
      Fixes: 13ef5539 ("RDMA/restrack: Count references to the verbs objects")
      Signed-off-by: default avatarMark Zhang <markzhang@nvidia.com>
      Reviewed-by: default avatarMichael Guralnik <michaelgur@nvidia.com>
      Link: https://lore.kernel.org/r/703db18e8d4ef628691fb93980a709be673e62e3.1667810736.git.leonro@nvidia.comSigned-off-by: default avatarLeon Romanovsky <leon@kernel.org>
      dac153f2
  3. 14 Nov, 2022 1 commit
  4. 11 Nov, 2022 2 commits
  5. 10 Nov, 2022 28 commits