BUG/MINOR: debug: fix "show fd" null-deref when built with DEBUG_FD

DEBUG_FD was added by commit 38e8a1c in 2.2-dev, and "show fd" was
slightly modified to still allow to print orphaned/closed FDs if their
count is non-null. But bypassing the existing test made it possible
to dereference fdt.owner which can be null. Let's adjust the condition
to avoid this.

No backport is needed.
This commit is contained in:
Willy Tarreau 2020-06-29 14:23:31 +02:00
parent 20dc3cd4a6
commit 13c1a01de6

View File

@ -1005,14 +1005,13 @@ static int cli_io_handler_show_fd(struct appctx *appctx)
/* When DEBUG_FD is set, we also report closed FDs that have a
* non-null event count to detect stuck ones.
*/
if (!fdt.owner
if (!fdt.owner) {
#ifdef DEBUG_FD
&& !fdt.event_count
if (!fdt.event_count)
#endif
)
goto skip; // closed
if (fdt.iocb == conn_fd_handler) {
goto skip; // closed
}
else if (fdt.iocb == conn_fd_handler) {
conn_flags = ((struct connection *)fdt.owner)->flags;
mux = ((struct connection *)fdt.owner)->mux;
ctx = ((struct connection *)fdt.owner)->ctx;