Patch "RDMA/core: Use kvzalloc when allocating the struct ib_port" has been added to the 5.15-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    RDMA/core: Use kvzalloc when allocating the struct ib_port

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     rdma-core-use-kvzalloc-when-allocating-the-struct-ib.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 437aed5a636ed30bb8c79be07f08b267dae2ade0
Author: wangyugui <wangyugui@xxxxxxxxxxxx>
Date:   Tue Oct 19 08:26:56 2021 +0800

    RDMA/core: Use kvzalloc when allocating the struct ib_port
    
    [ Upstream commit 911a81c9c7092bfd75432ce79b2ef879127ea065 ]
    
    The 'struct attribute' flex array contains some struct lock_class_key's
    which become big when lockdep is turned on. Big enough that some drivers
    will not load when CONFIG_PROVE_LOCKING=y because they cannot allocate
    enough memory:
    
     WARNING: CPU: 36 PID: 8 at mm/page_alloc.c:5350 __alloc_pages+0x27e/0x3e0
      Call Trace:
       kmalloc_order+0x2a/0xb0
       kmalloc_order_trace+0x19/0xf0
       __kmalloc+0x231/0x270
       ib_setup_port_attrs+0xd8/0x870 [ib_core]
       ib_register_device+0x419/0x4e0 [ib_core]
       bnxt_re_task+0x208/0x2d0 [bnxt_re]
    
    Link: https://lore.kernel.org/r/20211019002656.17745-1-wangyugui@xxxxxxxxxxxx
    Signed-off-by: wangyugui <wangyugui@xxxxxxxxxxxx>
    Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index 6146c3c1cbe5c..8d709986b88c7 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -757,7 +757,7 @@ static void ib_port_release(struct kobject *kobj)
 	if (port->hw_stats_data)
 		kfree(port->hw_stats_data->stats);
 	kfree(port->hw_stats_data);
-	kfree(port);
+	kvfree(port);
 }
 
 static void ib_port_gid_attr_release(struct kobject *kobj)
@@ -1189,7 +1189,7 @@ static struct ib_port *setup_port(struct ib_core_device *coredev, int port_num,
 	struct ib_port *p;
 	int ret;
 
-	p = kzalloc(struct_size(p, attrs_list,
+	p = kvzalloc(struct_size(p, attrs_list,
 				attr->gid_tbl_len + attr->pkey_tbl_len),
 		    GFP_KERNEL);
 	if (!p)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux