summaryrefslogtreecommitdiffstats
path: root/sys/netinet/udp_usrreq.c
diff options
context:
space:
mode:
authortruckman <truckman@FreeBSD.org>2002-07-12 08:05:22 +0000
committertruckman <truckman@FreeBSD.org>2002-07-12 08:05:22 +0000
commiteadeed2263662ca7695f662eb9228c5017c82422 (patch)
tree4e78f010577b81d98d9e69cfc588077dc58d2a57 /sys/netinet/udp_usrreq.c
parent4d88d6566a61c3b7598a583389954ccba701acb4 (diff)
downloadFreeBSD-src-eadeed2263662ca7695f662eb9228c5017c82422.zip
FreeBSD-src-eadeed2263662ca7695f662eb9228c5017c82422.tar.gz
Lock inp while we're accessing it.
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
-rw-r--r--sys/netinet/udp_usrreq.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 56bb1e1..a40015c 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -681,7 +681,12 @@ udp_getcred(SYSCTL_HANDLER_ARGS)
INP_INFO_RLOCK(&udbinfo);
inp = in_pcblookup_hash(&udbinfo, addrs[1].sin_addr, addrs[1].sin_port,
addrs[0].sin_addr, addrs[0].sin_port, 1, NULL);
- if (inp == NULL || inp->inp_socket == NULL) {
+ if (inp == NULL) {
+ error = ENOENT;
+ goto outunlocked;
+ }
+ INP_LOCK(inp);
+ if (inp->inp_socket == NULL) {
error = ENOENT;
goto out;
}
@@ -690,6 +695,8 @@ udp_getcred(SYSCTL_HANDLER_ARGS)
goto out;
cru2x(inp->inp_socket->so_cred, &xuc);
out:
+ INP_UNLOCK(inp);
+outunlocked:
INP_INFO_RUNLOCK(&udbinfo);
splx(s);
if (error == 0)
OpenPOWER on IntegriCloud