From: Willy Tarreau Date: Wed, 4 Oct 2017 18:24:54 +0000 (+0200) Subject: BUG/MEDIUM: cli: fix "show fd" crash when dumping closed FDs X-Git-Tag: v1.8-dev3~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=017af2477eb478e95b2e2e09e3daffaf34979f2d;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: cli: fix "show fd" crash when dumping closed FDs I misplaced the "if (!fdt.owner)" test so it can occasionally crash when dumping an fd that's already been closed but still appears in the table. It's not critical since this was not pushed into any release nor backported though. --- diff --git a/src/cli.c b/src/cli.c index f1f0977a75..bfed024a82 100644 --- a/src/cli.c +++ b/src/cli.c @@ -812,6 +812,9 @@ static int cli_io_handler_show_fd(struct appctx *appctx) fdt = fdtab[fd]; + if (!fdt.owner) + goto skip; // closed + if (fdt.iocb == conn_fd_handler) { conn_flags = ((struct connection *)fdt.owner)->flags; li = objt_listener(((struct connection *)fdt.owner)->target); @@ -821,9 +824,6 @@ static int cli_io_handler_show_fd(struct appctx *appctx) else if (fdt.iocb == listener_accept) li = fdt.owner; - if (!fdt.owner) - goto skip; // closed - chunk_printf(&trash, " %5d : st=0x%02x(R:%c%c%c W:%c%c%c) ev=0x%02x(%c%c%c%c%c) [%c%c%c%c] cache=%u owner=%p iocb=%p(%s)", fd,