Skip to content

Commit a779e27

Browse files
committed
coredump: fix core_pattern input validation
In be1e028 ("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: be1e028 ("coredump: don't pointlessly check and spew warnings") Fixes: 16195d2 ("coredump: validate socket name as it is written") Reviewed-by: Jan Kara <[email protected]> Reported-by: Yu Watanabe <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 56094ad commit a779e27

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

fs/coredump.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,7 @@ static int proc_dostring_coredump(const struct ctl_table *table, int write,
14681468
ssize_t retval;
14691469
char old_core_pattern[CORENAME_MAX_SIZE];
14701470

1471-
if (write)
1471+
if (!write)
14721472
return proc_dostring(table, write, buffer, lenp, ppos);
14731473

14741474
retval = strscpy(old_core_pattern, core_pattern, CORENAME_MAX_SIZE);

fs/exec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2048,7 +2048,7 @@ static int proc_dointvec_minmax_coredump(const struct ctl_table *table, int writ
20482048
{
20492049
int error = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
20502050

2051-
if (!error && !write)
2051+
if (!error && write)
20522052
validate_coredump_safety();
20532053
return error;
20542054
}

0 commit comments

Comments
 (0)