From fa87dc829a352b669226de7cc197959952b689b2 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Thu, 29 Apr 2021 14:56:19 +0800 Subject: [PATCH] net/sunrpc: return 0 on attempt to write to "transports" mainline inclusion from mainline-5.10-rc4 commit d435c05ab0197ee302290e1cee3f2d9c9024a64f category: bugfix bugzilla: 51817 CVE: NA ------------------------------------------------- You can't write to this file because the permissions are 0444. But it sort of looked like you could do a write and it would result in a read. Then it looked like proc_sys_call_handler() just ignored it. Which is confusing. It's more clear if the "write" just returns zero. Also, the "lenp" pointer is never NULL so that check can be removed. Signed-off-by: Dan Carpenter Signed-off-by: J. Bruce Fields (cherry picked from commit d435c05ab0197ee302290e1cee3f2d9c9024a64f) Signed-off-by: Baisong Zhong Reviewed-by: Yue Haibing Signed-off-by: Yang Yingliang --- net/sunrpc/sysctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c index c39b90ac2402..dee2983ecfd0 100644 --- a/net/sunrpc/sysctl.c +++ b/net/sunrpc/sysctl.c @@ -64,7 +64,7 @@ static int proc_do_xprt(struct ctl_table *table, int write, char tmpbuf[256]; size_t len; - if ((*ppos && !write) || !*lenp) { + if (write || *ppos) { *lenp = 0; return 0; } -- GitLab