FreeBSD Bugzilla – Attachment 187689 Details for
Bug 220078
[patch] [panic] repeatable kernel panic due to unlocked INADDR_TO_IFP usage
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
stable/10: lock access to INADDR_TO_IFP in the in_mcast.c
in_mcast.c.10.diff (text/plain), 1.75 KB, created by
Eugene Grosbein
on 2017-11-03 10:35:57 UTC
(
hide
)
Description:
stable/10: lock access to INADDR_TO_IFP in the in_mcast.c
Filename:
MIME Type:
Creator:
Eugene Grosbein
Created:
2017-11-03 10:35:57 UTC
Size:
1.75 KB
patch
obsolete
>Index: sys/netinet/in_mcast.c >=================================================================== >--- sys/netinet/in_mcast.c (revision 325353) >+++ sys/netinet/in_mcast.c (working copy) >@@ -1339,9 +1339,11 @@ inp_block_unblock_source(struct inpcb *i > ssa->sin.sin_len = sizeof(struct sockaddr_in); > ssa->sin.sin_addr = mreqs.imr_sourceaddr; > >- if (!in_nullhost(mreqs.imr_interface)) >+ if (!in_nullhost(mreqs.imr_interface)) { >+ IN_IFADDR_RLOCK(); > INADDR_TO_IFP(mreqs.imr_interface, ifp); >- >+ IN_IFADDR_RUNLOCK(); >+ } > if (sopt->sopt_name == IP_BLOCK_SOURCE) > doblock = 1; > >@@ -1836,7 +1838,6 @@ inp_getmoptions(struct inpcb *inp, struc > * > * Returns NULL if no ifp could be found. > * >- * SMPng: TODO: Acquire the appropriate locks for INADDR_TO_IFP. > * FUTURE: Implement IPv4 source-address selection. > */ > static struct ifnet * >@@ -1851,7 +1852,9 @@ inp_lookup_mcast_ifp(const struct inpcb > > ifp = NULL; > if (!in_nullhost(ina)) { >+ IN_IFADDR_RLOCK(); > INADDR_TO_IFP(ina, ifp); >+ IN_IFADDR_RUNLOCK(); > } else { > struct route ro; > >@@ -2247,9 +2250,11 @@ inp_leave_group(struct inpcb *inp, struc > * XXX NOTE WELL: The RFC 3678 API is preferred because > * using an IPv4 address as a key is racy. > */ >- if (!in_nullhost(mreqs.imr_interface)) >+ if (!in_nullhost(mreqs.imr_interface)) { >+ IN_IFADDR_RLOCK(); > INADDR_TO_IFP(mreqs.imr_interface, ifp); >- >+ IN_IFADDR_RUNLOCK(); >+ } > CTR3(KTR_IGMPV3, "%s: imr_interface = %s, ifp = %p", > __func__, inet_ntoa(mreqs.imr_interface), ifp); > >@@ -2447,7 +2452,9 @@ inp_set_multicast_if(struct inpcb *inp, > if (in_nullhost(addr)) { > ifp = NULL; > } else { >+ IN_IFADDR_RLOCK(); > INADDR_TO_IFP(addr, ifp); >+ IN_IFADDR_RUNLOCK(); > if (ifp == NULL) > return (EADDRNOTAVAIL); > }
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 220078
:
183567
|
183568
|
183569
|
183570
|
183590
|
187688
| 187689