[PATCH] fs: debugfs: fix open proxy for unsafe files

Johannes Berg posted 1 patch 1 year ago
fs/debugfs/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] fs: debugfs: fix open proxy for unsafe files
Posted by Johannes Berg 1 year ago
From: Johannes Berg <johannes.berg@intel.com>

In the previous commit referenced below, I had to split
the short fops handling into different proxy fops. This
necessitated knowing out-of-band whether or not the ops
are short or full, when attempting to convert from fops
to allocated fsdata.

Unfortunately, I only converted full_proxy_open() which
is used for the new full_proxy_open_regular() and
full_proxy_open_short(), but forgot about the call in
open_proxy_open(), used for debugfs_create_file_unsafe().

Fix that, it never has short fops.

Fixes: f8f25893a477 ("fs: debugfs: differentiate short fops with proxy ops")
Reported-by: Suresh Kumar Kurmi <suresh.kumar.kurmi@intel.com>
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202501101055.bb8bf3e7-lkp@intel.com
Reported-by: Venkat Rao Bagalkote <venkat88@linux.vnet.ibm.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 fs/debugfs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index bdb4f2ca0506..16e198a26339 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -280,7 +280,7 @@ static int open_proxy_open(struct inode *inode, struct file *filp)
 	const struct file_operations *real_fops = NULL;
 	int r;
 
-	r = debugfs_file_get(dentry);
+	r = __debugfs_file_get(dentry, DBGFS_GET_REGULAR);
 	if (r)
 		return r == -EIO ? -ENOENT : r;
 
-- 
2.47.1
Re: [PATCH] fs: debugfs: fix open proxy for unsafe files
Posted by Venkat Rao Bagalkote 1 year ago
Applied and Verified the below patch. Proposed fix works fine.

Please add below tag.

Tested-by: Venkat Rao Bagalkote <venkat88@linux.vnet.ibm.com>

Regards,
Venkat.


On 10/01/25 1:28 pm, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> In the previous commit referenced below, I had to split
> the short fops handling into different proxy fops. This
> necessitated knowing out-of-band whether or not the ops
> are short or full, when attempting to convert from fops
> to allocated fsdata.
>
> Unfortunately, I only converted full_proxy_open() which
> is used for the new full_proxy_open_regular() and
> full_proxy_open_short(), but forgot about the call in
> open_proxy_open(), used for debugfs_create_file_unsafe().
>
> Fix that, it never has short fops.
>
> Fixes: f8f25893a477 ("fs: debugfs: differentiate short fops with proxy ops")
> Reported-by: Suresh Kumar Kurmi <suresh.kumar.kurmi@intel.com>
> Reported-by: kernel test robot <oliver.sang@intel.com>
> Closes: https://lore.kernel.org/oe-lkp/202501101055.bb8bf3e7-lkp@intel.com
> Reported-by: Venkat Rao Bagalkote <venkat88@linux.vnet.ibm.com>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
>   fs/debugfs/file.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
> index bdb4f2ca0506..16e198a26339 100644
> --- a/fs/debugfs/file.c
> +++ b/fs/debugfs/file.c
> @@ -280,7 +280,7 @@ static int open_proxy_open(struct inode *inode, struct file *filp)
>   	const struct file_operations *real_fops = NULL;
>   	int r;
>   
> -	r = debugfs_file_get(dentry);
> +	r = __debugfs_file_get(dentry, DBGFS_GET_REGULAR);
>   	if (r)
>   		return r == -EIO ? -ENOENT : r;
>