Skip to content

Commit d6527db

Browse files
committed
coredump: use a single helper for the socket
Don't split it into multiple functions. Just use a single one like we do for coredump_file() and coredump_pipe() now. Link: https://lore.kernel.org/20250612-work-coredump-massage-v1-15-315c0c34ba94@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 5153053 commit d6527db

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

fs/coredump.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -855,17 +855,18 @@ static bool coredump_sock_request(struct core_name *cn, struct coredump_params *
855855
cn->mask = ack.mask;
856856
return coredump_sock_mark(cprm->file, COREDUMP_MARK_REQACK);
857857
}
858-
#else
859-
static bool coredump_sock_connect(struct core_name *cn,
860-
struct coredump_params *cprm)
858+
859+
static bool coredump_socket(struct core_name *cn, struct coredump_params *cprm)
861860
{
862-
coredump_report_failure("Core dump socket support %s disabled", cn->corename);
863-
return false;
861+
if (!coredump_sock_connect(cn, cprm))
862+
return false;
863+
864+
return coredump_sock_request(cn, cprm);
864865
}
865-
static bool coredump_sock_request(struct core_name *cn,
866-
struct coredump_params *cprm) { return false; }
866+
#else
867867
static inline void coredump_sock_wait(struct file *file) { }
868868
static inline void coredump_sock_shutdown(struct file *file) { }
869+
static inline bool coredump_socket(struct core_name *cn, struct coredump_params *cprm) { return false; }
869870
#endif
870871

871872
/* cprm->mm_flags contains a stable snapshot of dumpability flags. */
@@ -1104,10 +1105,7 @@ void vfs_coredump(const kernel_siginfo_t *siginfo)
11041105
case COREDUMP_SOCK_REQ:
11051106
fallthrough;
11061107
case COREDUMP_SOCK:
1107-
if (!coredump_sock_connect(&cn, &cprm))
1108-
goto close_fail;
1109-
1110-
if (!coredump_sock_request(&cn, &cprm))
1108+
if (!coredump_socket(&cn, &cprm))
11111109
goto close_fail;
11121110
break;
11131111
default:

0 commit comments

Comments
 (0)