Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
a775eb84
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
a775eb84
编写于
1月 19, 2011
作者:
M
Marek Lindner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
batman-adv: protect neigh_nodes used outside of rcu_locks with refcounting
Signed-off-by:
N
Marek Lindner
<
lindner_marek@yahoo.de
>
上级
1a241a57
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
9 deletion
+31
-9
net/batman-adv/routing.c
net/batman-adv/routing.c
+31
-9
未找到文件。
net/batman-adv/routing.c
浏览文件 @
a775eb84
...
...
@@ -151,6 +151,7 @@ static int is_bidirectional_neigh(struct orig_node *orig_node,
struct
neigh_node
*
neigh_node
=
NULL
,
*
tmp_neigh_node
=
NULL
;
struct
hlist_node
*
node
;
unsigned
char
total_count
;
int
ret
=
0
;
if
(
orig_node
==
orig_neigh_node
)
{
rcu_read_lock
();
...
...
@@ -162,7 +163,6 @@ static int is_bidirectional_neigh(struct orig_node *orig_node,
(
tmp_neigh_node
->
if_incoming
==
if_incoming
))
neigh_node
=
tmp_neigh_node
;
}
rcu_read_unlock
();
if
(
!
neigh_node
)
neigh_node
=
create_neighbor
(
orig_node
,
...
...
@@ -171,7 +171,10 @@ static int is_bidirectional_neigh(struct orig_node *orig_node,
if_incoming
);
/* create_neighbor failed, return 0 */
if
(
!
neigh_node
)
return
0
;
goto
unlock
;
kref_get
(
&
neigh_node
->
refcount
);
rcu_read_unlock
();
neigh_node
->
last_valid
=
jiffies
;
}
else
{
...
...
@@ -185,7 +188,6 @@ static int is_bidirectional_neigh(struct orig_node *orig_node,
(
tmp_neigh_node
->
if_incoming
==
if_incoming
))
neigh_node
=
tmp_neigh_node
;
}
rcu_read_unlock
();
if
(
!
neigh_node
)
neigh_node
=
create_neighbor
(
orig_neigh_node
,
...
...
@@ -194,7 +196,10 @@ static int is_bidirectional_neigh(struct orig_node *orig_node,
if_incoming
);
/* create_neighbor failed, return 0 */
if
(
!
neigh_node
)
return
0
;
goto
unlock
;
kref_get
(
&
neigh_node
->
refcount
);
rcu_read_unlock
();
}
orig_node
->
last_valid
=
jiffies
;
...
...
@@ -250,9 +255,16 @@ static int is_bidirectional_neigh(struct orig_node *orig_node,
/* if link has the minimum required transmission quality
* consider it bidirectional */
if
(
batman_packet
->
tq
>=
TQ_TOTAL_BIDRECT_LIMIT
)
ret
urn
1
;
ret
=
1
;
return
0
;
goto
out
;
unlock:
rcu_read_unlock
();
out:
if
(
neigh_node
)
kref_put
(
&
neigh_node
->
refcount
,
neigh_node_free_ref
);
return
ret
;
}
static
void
update_orig
(
struct
bat_priv
*
bat_priv
,
...
...
@@ -287,23 +299,25 @@ static void update_orig(struct bat_priv *bat_priv,
tmp_neigh_node
->
tq_avg
=
ring_buffer_avg
(
tmp_neigh_node
->
tq_recv
);
}
rcu_read_unlock
();
if
(
!
neigh_node
)
{
struct
orig_node
*
orig_tmp
;
orig_tmp
=
get_orig_node
(
bat_priv
,
ethhdr
->
h_source
);
if
(
!
orig_tmp
)
return
;
goto
unlock
;
neigh_node
=
create_neighbor
(
orig_node
,
orig_tmp
,
ethhdr
->
h_source
,
if_incoming
);
if
(
!
neigh_node
)
return
;
goto
unlock
;
}
else
bat_dbg
(
DBG_BATMAN
,
bat_priv
,
"Updating existing last-hop neighbor of originator
\n
"
);
kref_get
(
&
neigh_node
->
refcount
);
rcu_read_unlock
();
orig_node
->
flags
=
batman_packet
->
flags
;
neigh_node
->
last_valid
=
jiffies
;
...
...
@@ -357,6 +371,14 @@ static void update_orig(struct bat_priv *bat_priv,
(
atomic_read
(
&
bat_priv
->
gw_mode
)
==
GW_MODE_CLIENT
)
&&
(
atomic_read
(
&
bat_priv
->
gw_sel_class
)
>
2
))
gw_check_election
(
bat_priv
,
orig_node
);
goto
out
;
unlock:
rcu_read_unlock
();
out:
if
(
neigh_node
)
kref_put
(
&
neigh_node
->
refcount
,
neigh_node_free_ref
);
}
/* checks whether the host restarted and is in the protection time.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录