Skip to content

Commit be1e028

Browse files
committed
coredump: don't pointlessly check and spew warnings
When a write happens it doesn't make sense to check perform checks on the input. Skip them. Whether a fixes tag is licensed is a bit of a gray area here but I'll add one for the socket validation part I added recently. Link: https://lore.kernel.org/20250821-moosbedeckt-denunziant-7908663f3563@brauner Fixes: 16195d2 ("coredump: validate socket name as it is written") Reported-by: Brad Spengler <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 41a86f6 commit be1e028

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

fs/coredump.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,11 +1466,15 @@ static int proc_dostring_coredump(const struct ctl_table *table, int write,
14661466
ssize_t retval;
14671467
char old_core_pattern[CORENAME_MAX_SIZE];
14681468

1469+
if (write)
1470+
return proc_dostring(table, write, buffer, lenp, ppos);
1471+
14691472
retval = strscpy(old_core_pattern, core_pattern, CORENAME_MAX_SIZE);
14701473

14711474
error = proc_dostring(table, write, buffer, lenp, ppos);
14721475
if (error)
14731476
return error;
1477+
14741478
if (!check_coredump_socket()) {
14751479
strscpy(core_pattern, old_core_pattern, retval + 1);
14761480
return -EINVAL;

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)
2051+
if (!error && !write)
20522052
validate_coredump_safety();
20532053
return error;
20542054
}

0 commit comments

Comments
 (0)