Skip to content

Commit 56325e8

Browse files
mjguzikbrauner
authored andcommitted
landlock: fix splats from iput() after it started calling might_sleep()
At this point it is guaranteed this is not the last reference. However, a recent addition of might_sleep() at top of iput() started generating false-positives as it was executing for all values. Remedy the problem by using the newly introduced iput_not_last(). Reported-by: [email protected] Closes: https://lore.kernel.org/all/[email protected]/ Fixes: 2ef435a ("fs: add might_sleep() annotation to iput() and more") Signed-off-by: Mateusz Guzik <[email protected]> Link: https://patch.msgid.link/[email protected] Reviewed-by: Mickaël Salaün <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 1274162 commit 56325e8

File tree

1 file changed

+3
-4
lines changed
  • security/landlock

1 file changed

+3
-4
lines changed

security/landlock/fs.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,11 +1335,10 @@ static void hook_sb_delete(struct super_block *const sb)
13351335
* At this point, we own the ihold() reference that was
13361336
* originally set up by get_inode_object() and the
13371337
* __iget() reference that we just set in this loop
1338-
* walk. Therefore the following call to iput() will
1339-
* not sleep nor drop the inode because there is now at
1340-
* least two references to it.
1338+
* walk. Therefore there are at least two references
1339+
* on the inode.
13411340
*/
1342-
iput(inode);
1341+
iput_not_last(inode);
13431342
} else {
13441343
spin_unlock(&object->lock);
13451344
rcu_read_unlock();

0 commit comments

Comments
 (0)