Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bcachefs: Fix missing locking for dentry->d_parent access

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>

+9
+9
fs/bcachefs/xattr.c
··· 552 552 s.v = v + 1; 553 553 s.defined = true; 554 554 } else { 555 + /* 556 + * Check if this option was set on the parent - if so, switched 557 + * back to inheriting from the parent: 558 + * 559 + * rename() also has to deal with keeping inherited options up 560 + * to date - see bch2_reinherit_attrs() 561 + */ 562 + spin_lock(&dentry->d_lock); 555 563 if (!IS_ROOT(dentry)) { 556 564 struct bch_inode_info *dir = 557 565 to_bch_ei(d_inode(dentry->d_parent)); ··· 568 560 } else { 569 561 s.v = 0; 570 562 } 563 + spin_unlock(&dentry->d_lock); 571 564 572 565 s.defined = false; 573 566 }