 null_blk: fix kmemleak by releasing references to fault configfs items · gregkh/linux@d59ba44 · 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 d59ba44 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 e3073d1 commit d59ba44 Copy full SHA for d59ba44 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 @@ -655,12 +655,22 @@ static void nullb_add_fault_config(struct nullb_device *dev) 655 655 configfs_add_default_group ( &amp; dev -&gt; init_hctx_fault_config . group , &amp; dev -&gt; group ); 656 656 } 657 657 658 + static void nullb_del_fault_config ( struct nullb_device * dev ) 659 + { 660 + config_item_put ( &amp; dev -&gt; init_hctx_fault_config . group . cg_item ); 661 + config_item_put ( &amp; dev -&gt; requeue_config . group . cg_item ); 662 + config_item_put ( &amp; dev -&gt; timeout_config . group . cg_item ); 663 + } 664 + 658 665 #else 659 666 660 667 static void nullb_add_fault_config ( struct nullb_device * dev ) 661 668 { 662 669 } 663 670 671 + static void nullb_del_fault_config ( struct nullb_device * dev ) 672 + { 673 + } 664 674 #endif 665 675 666 676 static struct @@ -692,7 +702,7 @@ nullb_group_drop_item(struct config_group *group, struct config_item *item) 692 702 null_del_dev ( dev -&gt; nullb ); 693 703 mutex_unlock ( &amp; lock ); 694 704 } 695 - 705 + nullb_del_fault_config ( dev ); 696 706 config_item_put ( item ); 697 707 } 698 708 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. 