When freeing the chain of if_ef devices on an aborted load, use
SLIST_FOREACH_SAFE() rather than SLIST_FOREACH(), as elements are freed on each iteration of the loop. This prevents use-after-free. Noticed by: Coverity Prevent analysis tool MFC after: 3 days
This commit is contained in:
parent
63074a901a
commit
ae7c484e82
@ -491,7 +491,7 @@ ef_load(void)
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
struct efnet *efp;
|
||||
struct ef_link *efl = NULL;
|
||||
struct ef_link *efl = NULL, *efl_temp;
|
||||
int error = 0, d;
|
||||
|
||||
IFNET_RLOCK();
|
||||
@ -529,7 +529,7 @@ ef_load(void)
|
||||
if (error) {
|
||||
if (efl)
|
||||
SLIST_INSERT_HEAD(&efdev, efl, el_next);
|
||||
SLIST_FOREACH(efl, &efdev, el_next) {
|
||||
SLIST_FOREACH_SAFE(efl, &efdev, el_next, efl_temp) {
|
||||
for (d = 0; d < EF_NFT; d++)
|
||||
if (efl->el_units[d]) {
|
||||
if (efl->el_units[d]->ef_pifp != NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user