Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177552852
D61410.1794699543.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D61410.1794699543.diff
View Options
Index: sys/net/route/route_ctl.c
===================================================================
--- sys/net/route/route_ctl.c
+++ sys/net/route/route_ctl.c
@@ -840,8 +840,13 @@
nhop_can_multipath(rnd_add->rnd_nhop) &&
nhop_can_multipath(rnd_orig.rnd_nhop)) {
+ /*
+ * @rt_orig may be freed once unlocked. Pass @rt if any: it
+ * is what gets inserted if the prefix vanishes.
+ */
for (int i = 0; i < RIB_MAX_RETRIES; i++) {
- error = add_route_flags_mpath(rnh, rt_orig, rnd_add, &rnd_orig,
+ error = add_route_flags_mpath(rnh,
+ rt != NULL ? rt : rt_orig, rnd_add, &rnd_orig,
op_flags, rc);
if (error != EAGAIN)
break;
@@ -879,6 +884,10 @@
struct route_nhop_data rnd_new;
int error = 0;
+ /* Prefix vanished: nothing to append to, @rt may be deleted. */
+ if (rnd_orig->rnd_nhop == NULL && !(op_flags & RTM_F_CREATE))
+ return (ENOENT);
+
error = nhgrp_get_addition_group(rnh, rnd_orig, rnd_add, &rnd_new);
if (error != 0) {
if (error == EAGAIN) {
@@ -890,7 +899,8 @@
RIB_RLOCK(rnh);
lookup_prefix_rt(rnh, rt, rnd_orig);
RIB_RUNLOCK(rnh);
- if (rnd_orig == NULL && !(op_flags & RTM_F_CREATE)) {
+ if (rnd_orig->rnd_nhop == NULL &&
+ !(op_flags & RTM_F_CREATE)) {
/* In this iteration route doesn't exist */
error = ENOENT;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 14, 11:39 PM (8 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41681561
Default Alt Text
D61410.1794699543.diff (1 KB)
Attached To
Mode
D61410: [stable/14] routing: fix rtentry use-after-free in multipath route append
Attached
Detach File
Event Timeline