[Devel] [PATCH hci-8.1 1/4] ms/eventfs: Fix use-after-free in eventfs_remove_rec()

no-reply at sashiko.virtuozzo.com no-reply at sashiko.virtuozzo.com
Wed Nov 11 23:39:08 MSK 2026


> From: Shuangpeng Bai <shuangpeng.kernel at gmail.com>
> 
> eventfs_remove_rec() recursively removes the child at the current loop
> position. After the recursive call returns, list_for_each_entry() advances
> by reading list.next from the removed child.
> 
> If free_ei() drops the final reference, release_ei() reuses the list/rcu
> union to queue an SRCU callback. The child may be freed before that read.
> The eventfs_mutex serializes list updates, but it does not keep the removed
> child alive or prevent the SRCU callback from running.
> 
> Use list_for_each_entry_safe() to save the next sibling before recursively
> removing the current child.
> 
> Cc: stable at vger.kernel.org
> Fixes: 43aa6f97c2d0 ("eventfs: Get rid of dentry pointers without refcounts")
> Link: https://patch.msgid.link/20260806022719.375354-1-shuangpeng.kernel@gmail.com
> Signed-off-by: Shuangpeng Bai <shuangpeng.kernel at gmail.com>
> Acked-by: Masami Hiramatsu (Google) <mhiramat at kernel.org>
> Signed-off-by: Steven Rostedt <rostedt at goodmis.org>
> (cherry picked from commit fd73b691702170d37d66f4b0278530cea8ed419a)
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-154529
> Feature: fix ms/tracefs
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261111203529.363554-1-eva.kurchatova@virtuozzo.com?part=1




More information about the Devel mailing list