The commit is pushed to "branch-rh10-6.12.0-211.16.1.12.x.vz10-ovz" and will 
appear at [email protected]:openvz/vzkernel.git
after rh10-6.12.0-211.16.1.el10
------>
commit ac143f3820be7679ac2aa696735921855d0f2e05
Author: Konstantin Khorenko <[email protected]>
Date:   Thu Jun 11 19:31:49 2026 +0200

    modules: use kvmalloc for the section attribute pointer array too
    
    The patch switched the struct module_sect_attrs allocation in
    add_sect_attrs() to kvzalloc() so a module with many ELF sections
    does not need a high-order allocation.
    
    The RHEL10.2 base carries upstream f47c0bebed44 ("module: sysfs:
    Simplify section attribute allocation"), which split the bin_attribute
    pointer array out of that struct into its own allocation:
    
            gattr = kcalloc(nloaded + 1, sizeof(*gattr), GFP_KERNEL);
    
    For a module with many sections this is another nloaded-sized array
    that can cross a page and require a high-order allocation - exactly
    what the patch set out to avoid. Allocate it with kvcalloc() and free
    it with kvfree() in free_sect_attrs().
    
    Fixes: 05fee8af6411 ("modules: use kvmalloc when creating sysfs attributes 
for ELF sections")
    
    Reported-by: Pavel Tikhomirov <[email protected]>
    https://virtuozzo.atlassian.net/browse/VSTOR-132310
    Feature: mm: avoid high order allocations in all subsystems
    Signed-off-by: Konstantin Khorenko <[email protected]>
---
 kernel/module/sysfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/module/sysfs.c b/kernel/module/sysfs.c
index a896022e6186..4d0286559123 100644
--- a/kernel/module/sysfs.c
+++ b/kernel/module/sysfs.c
@@ -59,7 +59,7 @@ static void free_sect_attrs(struct module_sect_attrs 
*sect_attrs)
 
        for (bin_attr = sect_attrs->grp.bin_attrs_new; *bin_attr; bin_attr++)
                kfree((*bin_attr)->attr.name);
-       kfree(sect_attrs->grp.bin_attrs_new);
+       kvfree(sect_attrs->grp.bin_attrs_new);
        kvfree(sect_attrs);
 }
 
@@ -79,7 +79,7 @@ static int add_sect_attrs(struct module *mod, const struct 
load_info *info)
        if (!sect_attrs)
                return -ENOMEM;
 
-       gattr = kcalloc(nloaded + 1, sizeof(*gattr), GFP_KERNEL);
+       gattr = kvcalloc(nloaded + 1, sizeof(*gattr), GFP_KERNEL);
        if (!gattr) {
                kvfree(sect_attrs);
                return -ENOMEM;
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to