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
58b31cc9
Commit
58b31cc9
authored
Sep 01, 2004
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Free neigh_parms using RCU to fix neigh_create/inetdev_destroy race.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
5f9cf8d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
include/net/neighbour.h
include/net/neighbour.h
+3
-0
net/core/neighbour.c
net/core/neighbour.c
+11
-1
No files found.
include/net/neighbour.h
View file @
58b31cc9
...
...
@@ -46,6 +46,7 @@
#include <asm/atomic.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/rcupdate.h>
#include <linux/err.h>
#include <linux/sysctl.h>
...
...
@@ -66,6 +67,8 @@ struct neigh_parms
void
*
sysctl_table
;
struct
rcu_head
rcu_head
;
int
base_reachable_time
;
int
retrans_time
;
int
gc_staletime
;
...
...
net/core/neighbour.c
View file @
58b31cc9
...
...
@@ -1120,6 +1120,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
if
(
p
)
{
memcpy
(
p
,
&
tbl
->
parms
,
sizeof
(
*
p
));
p
->
tbl
=
tbl
;
INIT_RCU_HEAD
(
&
p
->
rcu_head
);
p
->
reachable_time
=
neigh_rand_reach_time
(
p
->
base_reachable_time
);
if
(
dev
&&
dev
->
neigh_setup
&&
dev
->
neigh_setup
(
dev
,
p
))
{
...
...
@@ -1135,6 +1136,14 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
return
p
;
}
static
void
neigh_rcu_free_parms
(
struct
rcu_head
*
head
)
{
struct
neigh_parms
*
parms
=
container_of
(
head
,
struct
neigh_parms
,
rcu_head
);
kfree
(
parms
);
}
void
neigh_parms_release
(
struct
neigh_table
*
tbl
,
struct
neigh_parms
*
parms
)
{
struct
neigh_parms
**
p
;
...
...
@@ -1146,7 +1155,7 @@ void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms)
if
(
*
p
==
parms
)
{
*
p
=
parms
->
next
;
write_unlock_bh
(
&
tbl
->
lock
);
kfree
(
parms
);
call_rcu
(
&
parms
->
rcu_head
,
neigh_rcu_free_
parms
);
return
;
}
}
...
...
@@ -1159,6 +1168,7 @@ void neigh_table_init(struct neigh_table *tbl)
{
unsigned
long
now
=
jiffies
;
INIT_RCU_HEAD
(
&
tbl
->
parms
.
rcu_head
);
tbl
->
parms
.
reachable_time
=
neigh_rand_reach_time
(
tbl
->
parms
.
base_reachable_time
);
...
...
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