Module Name: src Committed By: rtr Date: Tue Aug 5 07:10:41 UTC 2014
Modified Files: src/sys/netinet: tcp_usrreq.c Log Message: get_tcppcb() is nearly always called upon entry to usrreqs so KASSERT(solocked(so)) inside it and remove the redundant KASSERT everywhere we are using tcp_getpcb() To generate a diff of this commit: cvs rdiff -u -r1.196 -r1.197 src/sys/netinet/tcp_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet/tcp_usrreq.c diff -u src/sys/netinet/tcp_usrreq.c:1.196 src/sys/netinet/tcp_usrreq.c:1.197 --- src/sys/netinet/tcp_usrreq.c:1.196 Tue Aug 5 05:24:26 2014 +++ src/sys/netinet/tcp_usrreq.c Tue Aug 5 07:10:41 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_usrreq.c,v 1.196 2014/08/05 05:24:26 rtr Exp $ */ +/* $NetBSD: tcp_usrreq.c,v 1.197 2014/08/05 07:10:41 rtr Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -99,7 +99,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.196 2014/08/05 05:24:26 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.197 2014/08/05 07:10:41 rtr Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -181,6 +181,9 @@ static int tcp_getpcb(struct socket *so, struct inpcb **inp, struct in6pcb **in6p, struct tcpcb **tp) { + + KASSERT(solocked(so)); + /* * When a TCP is attached to a socket, then there will be * a (struct inpcb) pointed at by the socket, and this @@ -273,8 +276,6 @@ tcp_usrreq(struct socket *so, int req, s return (0); } - KASSERT(solocked(so)); - if ((error = tcp_getpcb(so, &inp, &in6p, &tp)) != 0) { splx(s); return error; @@ -687,8 +688,6 @@ tcp_detach(struct socket *so) struct tcpcb *tp = NULL; int s; - KASSERT(solocked(so)); - if (tcp_getpcb(so, &inp, &in6p, &tp) != 0) return; @@ -707,8 +706,6 @@ tcp_accept(struct socket *so, struct mbu int error = 0; int s; - KASSERT(solocked(so)); - if ((error = tcp_getpcb(so, &inp, &in6p, &tp)) != 0) return error; @@ -746,8 +743,6 @@ tcp_bind(struct socket *so, struct mbuf int error = 0; int ostate = 0; - KASSERT(solocked(so)); - if ((error = tcp_getpcb(so, &inp, &in6p, &tp)) != 0) return error; @@ -792,8 +787,6 @@ tcp_listen(struct socket *so, struct lwp int ostate = 0; int s; - KASSERT(solocked(so)); - if ((error = tcp_getpcb(so, &inp, &in6p, &tp)) != 0) return error; @@ -836,8 +829,6 @@ tcp_connect(struct socket *so, struct mb int error = 0; int ostate = 0; - KASSERT(solocked(so)); - if ((error = tcp_getpcb(so, &inp, &in6p, &tp)) != 0) return error; @@ -925,8 +916,6 @@ tcp_disconnect(struct socket *so) int ostate = 0; int s; - KASSERT(solocked(so)); - if ((error = tcp_getpcb(so, &inp, &in6p, &tp)) != 0) return error; @@ -961,8 +950,6 @@ tcp_shutdown(struct socket *so) int ostate = 0; int s; - KASSERT(solocked(so)); - if ((error = tcp_getpcb(so, &inp, &in6p, &tp)) != 0) return error; @@ -991,8 +978,6 @@ tcp_abort(struct socket *so) int ostate = 0; int s; - KASSERT(solocked(so)); - if ((error = tcp_getpcb(so, &inp, &in6p, &tp)) != 0) return error;