Probably a good (and efficient) fix would be to have check_recursion()
set a "removed" flag in the process structure. That way, open_file()
could very easily see if it has been removed or not. In my opinion,
that is much better than relying on the return value of dentry_open().
Rather than:
ec->file = dentry_open(dget(evt->dentry), mntget(evt->mnt),
O_RDONLY | O_LARGEFILE, current_cred());
if (IS_ERR(ec->file)) {
check_recursion(); /* remove myself from proc_list */
ret = PTR_ERR(ec->file);
goto error_out2;
}
the code could look like this:
ec->file = dentry_open(dget(evt->dentry), mntget(evt->mnt),
O_RDONLY | O_LARGEFILE, current_cred());
if (!proc.removed)
check_recursion(); /* remove myself from proc_list */
if (IS_ERR(ec->file)) {
ret = PTR_ERR(ec->file);
goto error_out2;
}
John Ogness