Skip to content

Commit

Permalink
rawip: Take the inpcb lock when appropriate in rip_ctloutput()
Browse files Browse the repository at this point in the history
Reviewed by:	glebius
MFC after:	1 week
Sponsored by:	Klara, Inc.
Sponsored by:	Stormshield
Differential Revision:	https://reviews.freebsd.org/D48344
  • Loading branch information
markjdb committed Jan 7, 2025
1 parent c945c9d commit fd94571
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sys/netinet/raw_ip.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,6 @@ rip_send(struct socket *so, int pruflags, struct mbuf *m, struct sockaddr *nam,
*
* When adding new socket options here, make sure to add access control
* checks here as necessary.
*
* XXX-BZ inp locking?
*/
int
rip_ctloutput(struct socket *so, struct sockopt *sopt)
Expand All @@ -637,7 +635,9 @@ rip_ctloutput(struct socket *so, struct sockopt *sopt)
if (sopt->sopt_level != IPPROTO_IP) {
if ((sopt->sopt_level == SOL_SOCKET) &&
(sopt->sopt_name == SO_SETFIB)) {
INP_WLOCK(inp);
inp->inp_inc.inc_fibnum = so->so_fibnum;
INP_WUNLOCK(inp);
return (0);
}
return (EINVAL);
Expand Down Expand Up @@ -707,10 +707,12 @@ rip_ctloutput(struct socket *so, struct sockopt *sopt)
sizeof optval);
if (error)
break;
INP_WLOCK(inp);
if (optval)
inp->inp_flags |= INP_HDRINCL;
else
inp->inp_flags &= ~INP_HDRINCL;
INP_WUNLOCK(inp);
break;

case IP_FW3: /* generic ipfw v.3 functions */
Expand Down

0 comments on commit fd94571

Please sign in to comment.