Page MenuHomeFreeBSD

Take the ifnet's address lock in igmp_v3_cancel_link_timers().
ClosedPublic

Authored by markj on Jan 2 2020, 5:00 PM.

Details

Summary

inm_rele_locked() may remove the multicast address associated with inm.

Reported by: syzbot+871c5d1fd5fac6c28f52@syzkaller.appspotmail.com

Test Plan

I don't have a test for it yet, syzkaller did not generate a reproducer.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

markj created this revision.Jan 2 2020, 5:00 PM
markj edited the test plan for this revision. (Show Details)Jan 2 2020, 5:01 PM
markj added reviewers: hselasky, network.
markj added a comment.Jan 2 2020, 5:09 PM

Also note that this change is consistent with mld_v2_cancel_link_timers().

hselasky requested changes to this revision.Jan 2 2020, 5:56 PM

Looks good.

And add to the commit message that inm_disconnect() asserts the IF_ADDR_WLOCK() .

You might want to move this assert one level up and into: inm_rele_locked() ....

Then you see there is also a call at line 1891, which needs IF_ADDR_WLOCK() around it.

Might be better to only lock when inm_refcount == 0.

This revision now requires changes to proceed.Jan 2 2020, 5:56 PM
markj added a comment.Jan 2 2020, 6:12 PM

Looks good.
And add to the commit message that inm_disconnect() asserts the IF_ADDR_WLOCK() .
You might want to move this assert one level up and into: inm_rele_locked() ....

That assertion would be wrong for the call in igmp_initial_join(), where the refcount is > 1.

Then you see there is also a call at line 1891, which needs IF_ADDR_WLOCK() around it.

The caller, igmp_fasttimo_vnet(), already takes the addr wlock.

Might be better to only lock when inm_refcount == 0.

This revision is now accepted and ready to land.Jan 2 2020, 6:17 PM
This revision was automatically updated to reflect the committed changes.