Re: blktests failures with v6.12-rc1 kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



在 2024/10/4 4:56, Bart Van Assche 写道:
On 10/3/24 1:02 AM, Shinichiro Kawasaki wrote:
#3: srp/001,002,011,012,013,014,016

    The seven test cases in srp test group failed due to the WARN
    "kmem_cache of name 'srpt-rsp-buf' already exists" [4]. The failures are
    recreated in stable manner. They need further debug effort.

Does the patch below help?

Hi, Bart

What is the root cause of this problem?

The following patch just allocates a new memory with a unique name. Can we make sure that the allocated memory is freed?

Does this will cause memory leak?

Thanks,
Zhu Yanjun


Thanks,

Bart.


Subject: [PATCH] RDMA/srpt: Make kmem cache names unique

Make sure that the "srpt-rsp-buf" cache names are unique. An example of
a unique name generated by this patch:

srpt-rsp-buf-fe80:0000:0000:0000:5054:00ff:fe5e:4708-enp1s0_siw-1

Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@xxxxxxx>
Fixes: 5dabcd0456d7 ("RDMA/srpt: Add support for immediate data")
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
  drivers/infiniband/ulp/srpt/ib_srpt.c | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ ulp/srpt/ib_srpt.c
index 9632afbd727b..c4feb39b3106 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -2164,6 +2164,7 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev,
      u32 it_iu_len;
      int i, tag_num, tag_size, ret;
      struct srpt_tpg *stpg;
+    char *cache_name;

      WARN_ON_ONCE(irqs_disabled());

@@ -2245,8 +2246,13 @@ static int srpt_cm_req_recv(struct srpt_device *const sdev,
      INIT_LIST_HEAD(&ch->cmd_wait_list);
      ch->max_rsp_size = ch->sport->port_attrib.srp_max_rsp_size;

-    ch->rsp_buf_cache = kmem_cache_create("srpt-rsp-buf", ch- >max_rsp_size,
+    cache_name = kasprintf(GFP_KERNEL, "srpt-rsp-buf-%s-%s-%d", src_addr,
+                   dev_name(&sport->sdev->device->dev), port_num);
+    if (!cache_name)
+        goto free_ch;
+    ch->rsp_buf_cache = kmem_cache_create(cache_name, ch->max_rsp_size,
                            512, 0, NULL);
+    kfree(cache_name);
      if (!ch->rsp_buf_cache)
          goto free_ch;







[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux