Skip to contentSkip to conversation

reiserfs: only call unlock_new_inode() if I_NEW

PATCH In review Eric Biggers 2 participants 4 messages Jun 28, 2020 – Sep 16, 2020 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reiserfs: only call unlock_new_inode() if I_NEW

From: Eric Biggers <[email protected]>

unlock_new_inode() is only meant to be called after a new inode has already been inserted into the hash table. But reiserfs_new_inode() can call it even before it has inserted the inode, triggering the WARNING in unlock_new_inode(). Fix this by only calling unlock_new_inode() if the inode has the I_NEW flag set, indicating that it's in the table.

This addresses the syzbot report "WARNING in unlock_new_inode"
(https://syzkaller.appspot.com/bug?extid=187510916eb6a14598f7).

---
 fs/reiserfs/inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/reiserfs/inode.c +2 -1
index 1509775da040..e3af44c61524 100644
@@ -2163,7 +2163,8 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
 out_inserted_sd:
 	clear_nlink(inode);
 	th->t_trans_id = 0;	/* so the caller can't use this handle later */
-	unlock_new_inode(inode); /* OK to do even if we hadn't locked it */
+	if (inode->i_state & I_NEW)
+		unlock_new_inode(inode);
 	iput(inode);
 	return err;
 }
Signature · 1 line
2.27.0
#1 lore raw
Quoted 8 lines · Eric Biggers

From: Eric Biggers <[email protected]>

unlock_new_inode() is only meant to be called after a new inode has already been inserted into the hash table. But reiserfs_new_inode() can call it even before it has inserted the inode, triggering the WARNING in unlock_new_inode(). Fix this by only calling unlock_new_inode() if the inode has the I_NEW flag set, indicating that it's in the table.

Quoted 5 lines

This addresses the syzbot report "WARNING in unlock_new_inode"
(https://syzkaller.appspot.com/bug?extid=187510916eb6a14598f7).

Anyone interested in taking this patch?

- Eric

#2 lore raw
Quoted 9 lines · Eric Biggers
Quoted 8 lines · Eric Biggers

From: Eric Biggers <[email protected]>

unlock_new_inode() is only meant to be called after a new inode has already been inserted into the hash table. But reiserfs_new_inode() can call it even before it has inserted the inode, triggering the WARNING in unlock_new_inode(). Fix this by only calling unlock_new_inode() if the inode has the I_NEW flag set, indicating that it's in the table.

Quoted 7 lines
Quoted 5 lines

This addresses the syzbot report "WARNING in unlock_new_inode"
(https://syzkaller.appspot.com/bug?extid=187510916eb6a14598f7).

Anyone interested in taking this patch?

Jan, you seem to be taking some reiserfs patches... Any interest in taking this one?

- Eric

reviewer
#3 lore raw
Quoted 13 lines · Eric Biggers
Quoted 12 lines · Eric Biggers
Quoted 11 lines · Eric Biggers

From: Eric Biggers <[email protected]>

unlock_new_inode() is only meant to be called after a new inode has already been inserted into the hash table. But reiserfs_new_inode() can call it even before it has inserted the inode, triggering the WARNING in unlock_new_inode(). Fix this by only calling unlock_new_inode() if the inode has the I_NEW flag set, indicating that it's in the table.

This addresses the syzbot report "WARNING in unlock_new_inode"
(https://syzkaller.appspot.com/bug?extid=187510916eb6a14598f7).

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Anyone interested in taking this patch?

Jan, you seem to be taking some reiserfs patches... Any interest in taking this one?

Sure, the patch looks good to me so I've added it to my tree. Thanks!

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR