 null_blk: fix kmemleak by releasing references to fault configfs items · gregkh/linux@1a3286e · GitHub Skip to content Navigation Menu Toggle navigation Sign in Appearance settings Platform AI CODE CREATION GitHub Copilot Write better code with AI GitHub Spark Build and deploy intelligent apps GitHub Models Manage and compare prompts MCP Registry New Integrate external tools DEVELOPER WORKFLOWS Actions Automate any workflow Codespaces Instant dev environments Issues Plan and track work Code Review Manage code changes APPLICATION SECURITY GitHub Advanced Security Find and fix vulnerabilities Code security Secure your code as you build Secret protection  EXPLORE Why GitHub Documentation Blog Changelog Marketplace View all features Solutions BY COMPANY SIZE Enterprises Small and medium teams Startups Nonprofits BY USE CASE App Modernization DevSecOps DevOps CI/CD View all use cases BY INDUSTRY Healthcare Financial services Manufacturing Government View all industries View all solutions Resources EXPLORE BY TOPIC AI Software Development DevOps Security View all topics EXPLORE BY TYPE Customer stories Events &amp; webinars Ebooks &amp; reports Business insights GitHub Skills SUPPORT &amp; SERVICES Documentation Customer support Community forum Trust center Partners View all resources Open Source COMMUNITY GitHub Sponsors Fund open source developers PROGRAMS Security Lab Maintainer Community Accelerator GitHub Stars Archive Program REPOSITORIES Topics Trending Collections Enterprise ENTERPRISE SOLUTIONS Enterprise platform AI-powered developer platform AVAILABLE ADD-ONS GitHub Advanced Security Enterprise-grade security features Copilot for Business Enterprise-grade AI features Premium Support Enterprise-grade 24/7 support Pricing Search or jump to... Search code, repositories, users, issues, pull requests... --> Search Clear Search syntax tips Provide feedback --> We read every piece of feedback, and take your input very seriously.  Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly --> Name Query To see all available qualifiers, see our documentation . Cancel Create saved search Sign in Sign up Appearance settings Resetting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} gregkh / linux Public Notifications You must be signed in to change notification settings Fork 676 Star 636 Code Actions Security and quality 0 Insights Additional navigation options Code Actions Security and quality Insights Commit 1a3286e Browse files Browse files shroffni authored and gregkh committed null_blk: fix kmemleak by releasing references to fault configfs items commit 40b94ec upstream. When CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION is enabled, the null-blk driver sets up fault injection support by creating the timeout_inject, requeue_inject, and init_hctx_fault_inject configfs items as children of the top-level nullbX configfs group. However, when the nullbX device is removed, the references taken to these fault-config configfs items are not released. As a result, kmemleak reports a memory leak, for example: unreferenced object 0xc00000021ff25c40 (size 32): comm "mkdir", pid 10665, jiffies 4322121578 hex dump (first 32 bytes): 69 6e 69 74 5f 68 63 74 78 5f 66 61 75 6c 74 5f init_hctx_fault_ 69 6e 6a 65 63 74 00 88 00 00 00 00 00 00 00 00 inject.......... backtrace (crc 1a018c86): __kmalloc_node_track_caller_noprof+0x494/0xbd8 kvasprintf+0x74/0xf4 config_item_set_name+0xf0/0x104 config_group_init_type_name+0x48/0xfc fault_config_init+0x48/0xf0 0xc0080000180559e4 configfs_mkdir+0x304/0x814 vfs_mkdir+0x49c/0x604 do_mkdirat+0x314/0x3d0 sys_mkdir+0xa0/0xd8 system_call_exception+0x1b0/0x4f0 system_call_vectored_common+0x15c/0x2ec Fix this by explicitly releasing the references to the fault-config configfs items when dropping the reference to the top-level nullbX configfs group. Cc: stable@vger.kernel.org Reviewed-by: Chaitanya Kulkarni &lt;kch@nvidia.com&gt; Fixes: bb4c19e ("block: null_blk: make fault-injection dynamically configurable per device") Signed-off-by: Nilay Shroff &lt;nilay@linux.ibm.com&gt; Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt; Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt; 1 parent 2de6d33 commit 1a3286e Copy full SHA for 1a3286e 1 file changed + 11 - 1 Lines changed: 11 additions &amp; 1 deletion File tree Expand file tree Collapse file tree Open diff view settings Filter options drivers/block/null_blk main.c Expand file tree Collapse file tree Open diff view settings Collapse file ‎ drivers/block/null_blk/main.c ‎ Copy file name to clipboard Expand all lines: drivers/block/null_blk/main.c + 11 - 1 Lines changed: 11 additions &amp; 1 deletion Original file line number Diff line number Diff line change @@ -622,12 +622,22 @@ static void nullb_add_fault_config(struct nullb_device *dev) 622 622 configfs_add_default_group ( &amp; dev -&gt; init_hctx_fault_config . group , &amp; dev -&gt; group ); 623 623 } 624 624 625 + static void nullb_del_fault_config ( struct nullb_device * dev ) 626 + { 627 + config_item_put ( &amp; dev -&gt; init_hctx_fault_config . group . cg_item ); 628 + config_item_put ( &amp; dev -&gt; requeue_config . group . cg_item ); 629 + config_item_put ( &amp; dev -&gt; timeout_config . group . cg_item ); 630 + } 631 + 625 632 #else 626 633 627 634 static void nullb_add_fault_config ( struct nullb_device * dev ) 628 635 { 629 636 } 630 637 638 + static void nullb_del_fault_config ( struct nullb_device * dev ) 639 + { 640 + } 631 641 #endif 632 642 633 643 static struct @@ -659,7 +669,7 @@ nullb_group_drop_item(struct config_group *group, struct config_item *item) 659 669 null_del_dev ( dev -&gt; nullb ); 660 670 mutex_unlock ( &amp; lock ); 661 671 } 662 - 672 + nullb_del_fault_config ( dev ); 663 673 config_item_put ( item ); 664 674 } 665 675 0 commit comments Comments 0 ( 0 ) Footer &copy; 2026 GitHub,&nbsp;Inc. Footer navigation Terms Privacy Security Status Community Docs Contact Manage cookies Do not share my personal information You can’t perform that action at this time. 