[PATCH RFC 1/5] proc: drop ->proc_write()

From: Christian Brauner

Date: Mon Nov 02 2026 - 12:26:41 EST


Every writable entry implements ->proc_write_buf() now and procfs
copies in what is written before it pins the entry. Remove
->proc_write().

Signed-off-by: Christian Brauner (Amutable) <brauner@xxxxxxxxxx>
---
fs/proc/generic.c | 2 --
fs/proc/inode.c | 15 +--------------
include/linux/proc_fs.h | 1 -
3 files changed, 1 insertion(+), 17 deletions(-)

diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 35dd745a0357..7b2ed3c42d32 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -469,8 +469,6 @@ static int pde_set_flags(struct proc_dir_entry *pde)
pde->flags |= PROC_ENTRY_proc_lseek;
}
if (proc_ops->proc_write_buf) {
- if (WARN_ON_ONCE(proc_ops->proc_write))
- return -EINVAL;
pde->flags |= PROC_ENTRY_proc_write_buf;
pde->write_size = proc_ops->proc_write_size ?: PAGE_SIZE - 1;
if (proc_ops->proc_flags & PROC_ENTRY_SHORT_WRITES)
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 7e4ca5751abb..dac5974d4652 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -491,14 +491,6 @@ static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count,
return rv;
}

-static ssize_t pde_write(struct proc_dir_entry *pde, struct file *file, const char __user *buf, size_t count, loff_t *ppos)
-{
- const auto write = pde->proc_ops->proc_write;
- if (write)
- return write(file, buf, count, ppos);
- return -EIO;
-}
-
/*
* procfs copies in what is written before it pins the entry. A writer that
* faults on its buffer then doesn't hold up remove_proc_entry().
@@ -533,15 +525,10 @@ static ssize_t pde_write_buf(struct proc_dir_entry *pde, struct file *file,
static ssize_t proc_reg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
struct proc_dir_entry *pde = PDE(file_inode(file));
- ssize_t rv;

if (pde_has_proc_write_buf(pde))
return pde_write_buf(pde, file, buf, count, ppos);
- if (!pde_pin(pde))
- return -EIO;
- rv = pde_write(pde, file, buf, count, ppos);
- pde_unpin(pde);
- return rv;
+ return -EIO;
}

static __poll_t pde_poll(struct proc_dir_entry *pde, struct file *file, struct poll_table_struct *pts)
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 2ba4e4a39e13..f21dd826eaa6 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -74,7 +74,6 @@ struct proc_ops {
int (*proc_open)(struct inode *, struct file *);
ssize_t (*proc_read)(struct file *, char __user *, size_t, loff_t *);
ssize_t (*proc_read_iter)(struct kiocb *, struct iov_iter *);
- ssize_t (*proc_write)(struct file *, const char __user *, size_t, loff_t *);
/*
* mandatory unless nonseekable_open() or equivalent is used, procfs
* seeks seq_file entries itself

--
2.53.0