From: Christian Brauner Date: Mon, 14 Apr 2025 13:55:05 +0000 (+0200) Subject: pidfs: move O_RDWR into pidfs_alloc_file() X-Git-Tag: v6.16-rc1~220^2~1^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c57f07b235871c9e5bffaccd458dca2d9a62b164;p=thirdparty%2Flinux.git pidfs: move O_RDWR into pidfs_alloc_file() Since all pidfds must be O_RDWR currently enfore that directly in the file allocation function itself instead of letting callers specify it. Link: https://lore.kernel.org/20250414-work-coredump-v2-1-685bf231f828@kernel.org Tested-by: Luca Boccassi Reviewed-by: Oleg Nesterov Signed-off-by: Christian Brauner --- diff --git a/fs/pidfs.c b/fs/pidfs.c index 9d993ecadad75..3b39e471840b1 100644 --- a/fs/pidfs.c +++ b/fs/pidfs.c @@ -892,6 +892,7 @@ struct file *pidfs_alloc_file(struct pid *pid, unsigned int flags) return ERR_PTR(-ESRCH); flags &= ~PIDFD_STALE; + flags |= O_RDWR; pidfd_file = dentry_open(&path, flags, current_cred()); /* Raise PIDFD_THREAD explicitly as do_dentry_open() strips it. */ if (!IS_ERR(pidfd_file))