Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
75da3492
Commit
75da3492
authored
Mar 19, 2002
by
Alexey Kuznetsov
Committed by
David S. Miller
Mar 19, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IPv4 FIB routing fixes:
- fix device leakage in multipath - fix oops due to race by adding spinlock
parent
ff36c646
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
7 deletions
+25
-7
net/ipv4/fib_frontend.c
net/ipv4/fib_frontend.c
+3
-0
net/ipv4/fib_semantics.c
net/ipv4/fib_semantics.c
+22
-7
No files found.
net/ipv4/fib_frontend.c
View file @
75da3492
...
...
@@ -579,6 +579,9 @@ static int fib_inetaddr_event(struct notifier_block *this, unsigned long event,
switch
(
event
)
{
case
NETDEV_UP
:
fib_add_ifaddr
(
ifa
);
#ifdef CONFIG_IP_ROUTE_MULTIPATH
fib_sync_up
(
ifa
->
ifa_dev
->
dev
);
#endif
rt_cache_flush
(
-
1
);
break
;
case
NETDEV_DOWN
:
...
...
net/ipv4/fib_semantics.c
View file @
75da3492
...
...
@@ -56,6 +56,8 @@ int fib_info_cnt;
#ifdef CONFIG_IP_ROUTE_MULTIPATH
static
spinlock_t
fib_multipath_lock
=
SPIN_LOCK_UNLOCKED
;
#define for_nexthops(fi) { int nhsel; const struct fib_nh * nh; \
for (nhsel=0, nh = (fi)->fib_nh; nhsel < (fi)->fib_nhs; nh++, nhsel++)
...
...
@@ -869,8 +871,14 @@ int fib_sync_down(u32 local, struct net_device *dev, int force)
nh
->
nh_scope
!=
scope
)
{
nh
->
nh_flags
|=
RTNH_F_DEAD
;
#ifdef CONFIG_IP_ROUTE_MULTIPATH
spin_lock_bh
(
&
fib_multipath_lock
);
fi
->
fib_power
-=
nh
->
nh_power
;
nh
->
nh_power
=
0
;
spin_unlock_bh
(
&
fib_multipath_lock
);
if
(
force
&&
nh
->
nh_dev
)
{
dev_put
(
nh
->
nh_dev
);
nh
->
nh_dev
=
NULL
;
}
#endif
dead
++
;
}
...
...
@@ -906,13 +914,19 @@ int fib_sync_up(struct net_device *dev)
alive
++
;
continue
;
}
if
(
nh
->
nh_dev
==
NULL
&&
nh
->
nh_oif
==
dev
->
ifindex
)
{
dev_hold
(
dev
);
nh
->
nh_dev
=
dev
;
}
if
(
nh
->
nh_dev
==
NULL
||
!
(
nh
->
nh_dev
->
flags
&
IFF_UP
))
continue
;
if
(
nh
->
nh_dev
!=
dev
||
__in_dev_get
(
dev
)
==
NULL
)
continue
;
alive
++
;
spin_lock_bh
(
&
fib_multipath_lock
);
nh
->
nh_power
=
0
;
nh
->
nh_flags
&=
~
RTNH_F_DEAD
;
spin_unlock_bh
(
&
fib_multipath_lock
);
}
endfor_nexthops
(
fi
)
if
(
alive
>
0
)
{
...
...
@@ -933,6 +947,7 @@ void fib_select_multipath(const struct rt_key *key, struct fib_result *res)
struct
fib_info
*
fi
=
res
->
fi
;
int
w
;
spin_lock_bh
(
&
fib_multipath_lock
);
if
(
fi
->
fib_power
<=
0
)
{
int
power
=
0
;
change_nexthops
(
fi
)
{
...
...
@@ -942,12 +957,12 @@ void fib_select_multipath(const struct rt_key *key, struct fib_result *res)
}
}
endfor_nexthops
(
fi
);
fi
->
fib_power
=
power
;
#if 1
if
(
power
<=
0
)
{
printk
(
KERN_CRIT
"impossible 777
\n
"
);
spin_unlock_bh
(
&
fib_multipath_lock
);
/* Race condition: route has just become dead. */
res
->
nh_sel
=
0
;
return
;
}
#endif
}
...
...
@@ -963,15 +978,15 @@ void fib_select_multipath(const struct rt_key *key, struct fib_result *res)
nh
->
nh_power
--
;
fi
->
fib_power
--
;
res
->
nh_sel
=
nhsel
;
spin_unlock_bh
(
&
fib_multipath_lock
);
return
;
}
}
}
endfor_nexthops
(
fi
);
#if 1
printk
(
KERN_CRIT
"impossible 888
\n
"
);
#endif
return
;
/* Race condition: route has just become dead. */
res
->
nh_sel
=
0
;
spin_unlock_bh
(
&
fib_multipath_lock
);
}
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment