mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 08:03:01 +09:00
Merge tag 'v6.6-rc7.vfs.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull vfs fix from Christian Brauner: "An openat() call from io_uring triggering an audit call can apparently cause the refcount of struct filename to be incremented from multiple threads concurrently during async execution, triggering a refcount underflow and hitting a BUG_ON(). That bug has been lurking around since at least v5.16 apparently. Switch to an atomic counter to fix that. The underflow check is downgraded from a BUG_ON() to a WARN_ON_ONCE() but we could easily remove that check altogether tbh" * tag 'v6.6-rc7.vfs.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: audit,io_uring: io_uring openat triggers audit reference count underflow
This commit is contained in:
@@ -2212,7 +2212,7 @@ __audit_reusename(const __user char *uptr)
|
||||
if (!n->name)
|
||||
continue;
|
||||
if (n->name->uptr == uptr) {
|
||||
n->name->refcnt++;
|
||||
atomic_inc(&n->name->refcnt);
|
||||
return n->name;
|
||||
}
|
||||
}
|
||||
@@ -2241,7 +2241,7 @@ void __audit_getname(struct filename *name)
|
||||
n->name = name;
|
||||
n->name_len = AUDIT_NAME_FULL;
|
||||
name->aname = n;
|
||||
name->refcnt++;
|
||||
atomic_inc(&name->refcnt);
|
||||
}
|
||||
|
||||
static inline int audit_copy_fcaps(struct audit_names *name,
|
||||
@@ -2373,7 +2373,7 @@ out_alloc:
|
||||
return;
|
||||
if (name) {
|
||||
n->name = name;
|
||||
name->refcnt++;
|
||||
atomic_inc(&name->refcnt);
|
||||
}
|
||||
|
||||
out:
|
||||
@@ -2500,7 +2500,7 @@ void __audit_inode_child(struct inode *parent,
|
||||
if (found_parent) {
|
||||
found_child->name = found_parent->name;
|
||||
found_child->name_len = AUDIT_NAME_FULL;
|
||||
found_child->name->refcnt++;
|
||||
atomic_inc(&found_child->name->refcnt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user