diff options
| author | Christian Brauner <brauner@kernel.org> | 2025-10-07 11:32:42 +0200 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2025-10-07 13:12:46 +0200 |
| commit | a779e27f24aeb679969ddd1fdd7f636e22ddbc1e (patch) | |
| tree | a022bc55b3aa626e419785d91a5d6e95fb40a6a6 | |
| parent | 56094ad3eaa21e6621396cc33811d8f72847a834 (diff) | |
| download | linux-a779e27f24aeb679969ddd1fdd7f636e22ddbc1e.tar.gz linux-a779e27f24aeb679969ddd1fdd7f636e22ddbc1e.tar.bz2 linux-a779e27f24aeb679969ddd1fdd7f636e22ddbc1e.zip | |
coredump: fix core_pattern input validation
In be1e0283021e ("coredump: don't pointlessly check and spew warnings")
we tried to fix input validation so it only happens during a write to
core_pattern. This would avoid needlessly logging a lot of warnings
during a read operation. However the logic accidently got inverted in
this commit. Fix it so the input validation only happens on write and is
skipped on read.
Fixes: be1e0283021e ("coredump: don't pointlessly check and spew warnings")
Fixes: 16195d2c7dd2 ("coredump: validate socket name as it is written")
Reviewed-by: Jan Kara <jack@suse.cz>
Reported-by: Yu Watanabe <watanabe.yu@gmail.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
| -rw-r--r-- | fs/coredump.c | 2 | ||||
| -rw-r--r-- | fs/exec.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/fs/coredump.c b/fs/coredump.c index b5fc06a092a4..5c1c381ee380 100644 --- a/fs/coredump.c +++ b/fs/coredump.c @@ -1468,7 +1468,7 @@ static int proc_dostring_coredump(const struct ctl_table *table, int write, ssize_t retval; char old_core_pattern[CORENAME_MAX_SIZE]; - if (write) + if (!write) return proc_dostring(table, write, buffer, lenp, ppos); retval = strscpy(old_core_pattern, core_pattern, CORENAME_MAX_SIZE); diff --git a/fs/exec.c b/fs/exec.c index 6b70c6726d31..4298e7e08d5d 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -2048,7 +2048,7 @@ static int proc_dointvec_minmax_coredump(const struct ctl_table *table, int writ { int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos); - if (!error && !write) + if (!error && write) validate_coredump_safety(); return error; } |
