Re: [PATCH v2] audit: Avoid excessive dput/dget in audit_context setup and reset paths

From: Waiman Long

Date: Thu Feb 05 2026 - 20:20:30 EST


On 2/5/26 6:53 PM, Al Viro wrote:
On Wed, Feb 04, 2026 at 11:45:17PM -0500, Waiman Long wrote:

@@ -70,6 +74,8 @@ void chroot_fs_refs(const struct path *old_root, const
struct>
                                count++;
                                path_get(new_root);
                        }
+                       count += fs->pwd_xrefs;
+                       fs->pwd_xrefs = 0;
                        write_sequnlock(&fs->seq);
Nope - you only need that for threads that have ->pwd equal to old_root.
Incidentally, I'd forgotten about that sucker - it kills the idea of
fdget-like tricks dead, more's the pity. Third-party modification of
task->fs->pwd (under task->lock and task->fs->seq), possible even with
task->fs->users == 1.

Yes, I am aware of that when I took a further look at the patch that I sent out yesterday. I am testing the updated patch now and is trying to figure out why I get a warning from mntput_no_expire_slowpath() with a count of -1 when doing an umount. It is off by 1 somewhere. I will post the patch once I resolve this bug.

Thanks,
Longman