mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 18:09:56 +00:00
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: 16195d2c7d ("coredump: validate socket name as it is written")
Reported-by: Brad Spengler <brad.spengler@opensrcsec.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
@@ -1466,11 +1466,15 @@ static int proc_dostring_coredump(const struct ctl_table *table, int write,
|
||||
ssize_t retval;
|
||||
char old_core_pattern[CORENAME_MAX_SIZE];
|
||||
|
||||
if (write)
|
||||
return proc_dostring(table, write, buffer, lenp, ppos);
|
||||
|
||||
retval = strscpy(old_core_pattern, core_pattern, CORENAME_MAX_SIZE);
|
||||
|
||||
error = proc_dostring(table, write, buffer, lenp, ppos);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
if (!check_coredump_socket()) {
|
||||
strscpy(core_pattern, old_core_pattern, retval + 1);
|
||||
return -EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user