Date: Tue, 14 Dec 2021 17:39:35 GMT From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 185e659c40ef - main - inpcb: use locked variant of prison_check_ip*() Message-ID: <202112141739.1BEHdZFC061687@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=185e659c40ef4dbd6855dfa0f735f06dfcf01c6f commit 185e659c40ef4dbd6855dfa0f735f06dfcf01c6f Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2021-12-14 17:38:52 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2021-12-14 17:38:52 +0000 inpcb: use locked variant of prison_check_ip*() The pcb lookup always happens in the network epoch and in SMR section. We can't block on a mutex due to the latter. Right now this patch opens up a race. But soon that will be addressed by D33339. Reviewed by: markj, jamie Differential revision: https://reviews.freebsd.org/D33340 Fixes: de2d47842e8 --- sys/netinet/in_pcb.c | 4 ++-- sys/netinet6/in6_pcb.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index ffcc93553c22..4dc3c737b914 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -2330,8 +2330,8 @@ in_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, struct in_addr faddr, injail = prison_flag(inp->inp_cred, PR_IP4); if (injail) { - if (prison_check_ip4(inp->inp_cred, - &laddr) != 0) + if (prison_check_ip4_locked( + inp->inp_cred->cr_prison, &laddr) != 0) continue; } else { if (local_exact != NULL) diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index d6c6593f2adf..f86c72958a9e 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -1079,8 +1079,8 @@ in6_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, injail = prison_flag(inp->inp_cred, PR_IP6); if (injail) { - if (prison_check_ip6(inp->inp_cred, - laddr) != 0) + if (prison_check_ip6_locked( + inp->inp_cred->cr_prison, laddr) != 0) continue; } else { if (local_exact != NULL)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202112141739.1BEHdZFC061687>