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

Configure Feed

Select the types of activity you want to include in your feed.

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: syzbot+12479ae15958fc3f54ec@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/68d32659.a70a0220.4f78.0012.GAE@google.com/
Fixes: 2ef435a872ab ("fs: add might_sleep() annotation to iput() and more")
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Link: https://patch.msgid.link/20251105212025.807549-2-mjguzik@gmail.com
Reviewed-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Mateusz Guzik and committed by
Christian Brauner
56325e8c 12741624

+3 -4
+3 -4
security/landlock/fs.c
··· 1335 1335 * At this point, we own the ihold() reference that was 1336 1336 * originally set up by get_inode_object() and the 1337 1337 * __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. 1341 1340 */ 1342 - iput(inode); 1341 + iput_not_last(inode); 1343 1342 } else { 1344 1343 spin_unlock(&object->lock); 1345 1344 rcu_read_unlock();