FreeBSD Bugzilla – Attachment 221493 Details for
Bug 232192
Harmonize udp_input() and udp6_input() locking; should make the udp6 code simpler
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch (untested)
udp6_usrreq.c.diff (text/plain), 1.58 KB, created by
Andrey V. Elsukov
on 2021-01-12 14:41:33 UTC
(
hide
)
Description:
proposed patch (untested)
Filename:
MIME Type:
Creator:
Andrey V. Elsukov
Created:
2021-01-12 14:41:33 UTC
Size:
1.58 KB
patch
obsolete
>diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c >index 1535be90e1b..f08b3390161 100644 >--- a/sys/netinet6/udp6_usrreq.c >+++ b/sys/netinet6/udp6_usrreq.c >@@ -315,6 +315,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) > struct inpcb *last; > struct inpcbhead *pcblist; > struct ip6_moptions *imo; >+ bool inp_locked = false; > > /* > * In the event that laddr should be set to the link-local >@@ -392,8 +393,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) > INP_RUNLOCK(inp); /* XXX */ > continue; > } >- >- INP_RUNLOCK(inp); >+ inp_locked = true; > } > if (last != NULL) { > struct mbuf *n; >@@ -409,6 +409,8 @@ udp6_input(struct mbuf **mp, int *offp, int proto) > UDP_PROBE(receive, NULL, last, > ip6, last, uh); > if (udp6_append(last, n, off, fromsa)) { >+ if (inp_locked) >+ INP_RUNLOCK(inp); > /* XXX-BZ do we leak m here? */ > *mp = NULL; > return (IPPROTO_DONE); >@@ -429,6 +431,11 @@ udp6_input(struct mbuf **mp, int *offp, int proto) > if ((last->inp_socket->so_options & > (SO_REUSEPORT|SO_REUSEPORT_LB|SO_REUSEADDR)) == 0) > break; >+ >+ if (inp_locked) { >+ INP_RUNLOCK(inp); >+ inp_locked = false; >+ } > } > > if (last == NULL) { >@@ -441,7 +448,10 @@ udp6_input(struct mbuf **mp, int *offp, int proto) > UDPSTAT_INC(udps_noportmcast); > goto badunlocked; > } >- INP_RLOCK(last); >+ >+ if (!inp_locked) >+ INP_RLOCK(last); >+ > if (__predict_true(last->inp_flags2 & INP_FREED) == 0) { > if (nxt == IPPROTO_UDPLITE) > UDPLITE_PROBE(receive, NULL, last, ip6, last, uh);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 232192
:
221454
|
221493
|
221983