Skip to content

Commit

Permalink
mctpd: Exit on control socket EOF
Browse files Browse the repository at this point in the history
If we hit an EOF on the control socket, we'll keep getting
cb_listen_control_message() invoked in a loop, as there will always be a
POLLIN|POLLERR event pending.

Instead, just exit here.

Signed-off-by: Jeremy Kerr <[email protected]>
  • Loading branch information
jk-ozlabs committed Jan 12, 2024
1 parent ee9b1af commit ea5c9a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/mctp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,7 @@ int main(int argc, char **argv)
if (!cmd)
errx(EXIT_FAILURE, "no such command '%s'", cmdname);

mctp_ops_init();
ctx->nl = mctp_nl_new(ctx->verbose);
if (!ctx->nl)
errx(EXIT_FAILURE, "Error creating netlink object");
Expand Down
3 changes: 3 additions & 0 deletions src/mctpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,9 @@ static int cb_listen_control_msg(sd_event_source *s, int sd, uint32_t revents,
if (rc < 0)
goto out;

if (rc == 0)
errx(EXIT_FAILURE, "Control socket returned EOF");

if (addr.smctp_base.smctp_type != MCTP_CTRL_HDR_MSG_TYPE) {
warnx("BUG: Wrong message type for listen socket");
rc = -EINVAL;
Expand Down

0 comments on commit ea5c9a3

Please sign in to comment.