mirror of
https://github.com/torvalds/linux.git
synced 2025-12-01 07:26:02 +07:00
coredump: fix core_pattern input validation
Inbe1e028302("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:be1e028302("coredump: don't pointlessly check and spew warnings") Fixes:16195d2c7d("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>
This commit is contained in:
@@ -1468,7 +1468,7 @@ static int proc_dostring_coredump(const struct ctl_table *table, int write,
|
|||||||
ssize_t retval;
|
ssize_t retval;
|
||||||
char old_core_pattern[CORENAME_MAX_SIZE];
|
char old_core_pattern[CORENAME_MAX_SIZE];
|
||||||
|
|
||||||
if (write)
|
if (!write)
|
||||||
return proc_dostring(table, write, buffer, lenp, ppos);
|
return proc_dostring(table, write, buffer, lenp, ppos);
|
||||||
|
|
||||||
retval = strscpy(old_core_pattern, core_pattern, CORENAME_MAX_SIZE);
|
retval = strscpy(old_core_pattern, core_pattern, CORENAME_MAX_SIZE);
|
||||||
|
|||||||
@@ -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);
|
int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
|
||||||
|
|
||||||
if (!error && !write)
|
if (!error && write)
|
||||||
validate_coredump_safety();
|
validate_coredump_safety();
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user