From d48ad489ca353351c44535f0d4af843e685edcf8 Mon Sep 17 00:00:00 2001 From: glebius Date: Mon, 13 Jan 2020 21:12:10 +0000 Subject: [PATCH] Fix yet another regression from r354484. Error code from cr_cansee() aliases with hard error from other operations. Reported by: flo --- sys/netinet/tcp_subr.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 1cd1e95f23ec..77161db32796 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -2263,6 +2263,8 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) inp = CK_LIST_NEXT(inp, inp_list)) { INP_RLOCK(inp); if (inp->inp_gencnt <= xig.xig_gen) { + int crerr; + /* * XXX: This use of cr_cansee(), introduced with * TCP state changes, is not quite right, but for @@ -2270,13 +2272,13 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) */ if (inp->inp_flags & INP_TIMEWAIT) { if (intotw(inp) != NULL) - error = cr_cansee(req->td->td_ucred, + crerr = cr_cansee(req->td->td_ucred, intotw(inp)->tw_cred); else - error = EINVAL; /* Skip this inp. */ + crerr = EINVAL; /* Skip this inp. */ } else - error = cr_canseeinpcb(req->td->td_ucred, inp); - if (error == 0) { + crerr = cr_canseeinpcb(req->td->td_ucred, inp); + if (crerr == 0) { struct xtcpcb xt; tcp_inptoxtp(inp, &xt);