Unverified Commit be1e0283 authored by Christian Brauner's avatar Christian Brauner
Browse files

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: 16195d2c ("coredump: validate socket name as it is written")
Reported-by: default avatarBrad Spengler <brad.spengler@opensrcsec.com>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 41a86f62
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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)
	if (!error && !write)
		validate_coredump_safety();
	return error;
}