Page MenuHomeFreeBSD

routing: fix rtentry use-after-free in multipath route append
ClosedPublic

Authored by olivier on Mon, Oct 5, 12:17 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 18, 5:10 AM
Unknown Object (File)
Fri, Oct 16, 11:56 PM
Unknown Object (File)
Fri, Oct 16, 12:51 PM
Unknown Object (File)
Wed, Oct 14, 6:08 PM
Unknown Object (File)
Wed, Oct 14, 1:42 PM
Unknown Object (File)
Wed, Oct 14, 4:21 AM
Unknown Object (File)
Tue, Oct 13, 11:41 AM
Unknown Object (File)
Tue, Oct 13, 8:58 AM
Subscribers

Details

Summary

add_route_flags() drops the RIB lock and passes the existing entry,
rt_orig, to add_route_flags_mpath(). If a concurrent delete removes
the prefix in that window, the retry re-inserts rt_orig, which is
then freed while still linked, crashing later in rn_match().

Pass the new rt instead, return ENOENT when the prefix is gone and
RTM_F_CREATE is not set, and fix the rnd_orig NULL check.

Fixes: c24a8f19c5d5 ("routing: fix rib_add_route_px()")

Test Plan

Detected during the net/frr10 upstream regression tests (topotest).

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

olivier created this revision.
pouria added inline comments.
net/route/route_ctl.c
871 ↗(On Diff #188669)
888 ↗(On Diff #188669)

Nice catch! Thank you

889 ↗(On Diff #188669)
This revision is now accepted and ready to land.Tue, Oct 6, 2:51 PM