Unverified Commit 15623c86 authored by Deepanshu Kartikey's avatar Deepanshu Kartikey Committed by Christian Brauner
Browse files

nsfs: handle inode number mismatches gracefully in file handles



Replace VFS_WARN_ON_ONCE() with graceful error handling when file
handles contain inode numbers that don't match the actual namespace
inode. This prevents userspace from triggering kernel warnings by
providing malformed file handles to open_by_handle_at().

The issue occurs when userspace provides a file handle with valid
namespace type and ID that successfully locates a namespace, but
specifies an incorrect inode number. Previously, this would trigger
VFS_WARN_ON_ONCE() when comparing the real inode number against the
provided value.

Since file handle data is user-controllable, inode number mismatches
should be treated as invalid input rather than kernel consistency
errors. Handle this case by returning NULL to indicate the file
handle is invalid, rather than warning about what is essentially
user input validation.

Reported-by: default avatar <syzbot+9eefe09bedd093f156c2@syzkaller.appspotmail.com>
Suggested-by: default avatarJan Kara <jack@suse.cz>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarDeepanshu Kartikey <kartikey406@gmail.com>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent fd94619c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment