Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
5615968a
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5615968a
编写于
5月 27, 2009
作者:
D
David S. Miller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
appletalk: Add proper locking around IPDDP routing table.
Signed-off-by:
N
David S. Miller
<
davem@davemloft.net
>
上级
385a154c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
32 addition
and
8 deletion
+32
-8
drivers/net/appletalk/ipddp.c
drivers/net/appletalk/ipddp.c
+32
-8
未找到文件。
drivers/net/appletalk/ipddp.c
浏览文件 @
5615968a
...
...
@@ -39,6 +39,7 @@
static
const
char
version
[]
=
KERN_INFO
"ipddp.c:v0.01 8/28/97 Bradford W. Johnson <johns393@maroon.tc.umn.edu>
\n
"
;
static
struct
ipddp_route
*
ipddp_route_list
;
static
DEFINE_SPINLOCK
(
ipddp_route_lock
);
#ifdef CONFIG_IPDDP_ENCAP
static
int
ipddp_mode
=
IPDDP_ENCAP
;
...
...
@@ -50,7 +51,7 @@ static int ipddp_mode = IPDDP_DECAP;
static
int
ipddp_xmit
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
);
static
int
ipddp_create
(
struct
ipddp_route
*
new_rt
);
static
int
ipddp_delete
(
struct
ipddp_route
*
rt
);
static
struct
ipddp_route
*
ipddp_find_route
(
struct
ipddp_route
*
rt
);
static
struct
ipddp_route
*
__
ipddp_find_route
(
struct
ipddp_route
*
rt
);
static
int
ipddp_ioctl
(
struct
net_device
*
dev
,
struct
ifreq
*
ifr
,
int
cmd
);
static
const
struct
net_device_ops
ipddp_netdev_ops
=
{
...
...
@@ -119,6 +120,8 @@ static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev)
struct
ipddp_route
*
rt
;
struct
atalk_addr
*
our_addr
;
spin_lock
(
&
ipddp_route_lock
);
/*
* Find appropriate route to use, based only on IP number.
*/
...
...
@@ -127,8 +130,10 @@ static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev)
if
(
rt
->
ip
==
paddr
)
break
;
}
if
(
rt
==
NULL
)
if
(
rt
==
NULL
)
{
spin_unlock
(
&
ipddp_route_lock
);
return
0
;
}
our_addr
=
atalk_find_dev_addr
(
rt
->
dev
);
...
...
@@ -174,6 +179,8 @@ static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev)
if
(
aarp_send_ddp
(
rt
->
dev
,
skb
,
&
rt
->
at
,
NULL
)
<
0
)
dev_kfree_skb
(
skb
);
spin_unlock
(
&
ipddp_route_lock
);
return
0
;
}
...
...
@@ -196,7 +203,9 @@ static int ipddp_create(struct ipddp_route *new_rt)
return
-
ENETUNREACH
;
}
if
(
ipddp_find_route
(
rt
))
{
spin_lock_bh
(
&
ipddp_route_lock
);
if
(
__ipddp_find_route
(
rt
))
{
spin_unlock_bh
(
&
ipddp_route_lock
);
kfree
(
rt
);
return
-
EEXIST
;
}
...
...
@@ -204,6 +213,8 @@ static int ipddp_create(struct ipddp_route *new_rt)
rt
->
next
=
ipddp_route_list
;
ipddp_route_list
=
rt
;
spin_unlock_bh
(
&
ipddp_route_lock
);
return
0
;
}
...
...
@@ -216,6 +227,7 @@ static int ipddp_delete(struct ipddp_route *rt)
struct
ipddp_route
**
r
=
&
ipddp_route_list
;
struct
ipddp_route
*
tmp
;
spin_lock_bh
(
&
ipddp_route_lock
);
while
((
tmp
=
*
r
)
!=
NULL
)
{
if
(
tmp
->
ip
==
rt
->
ip
...
...
@@ -223,19 +235,21 @@ static int ipddp_delete(struct ipddp_route *rt)
&&
tmp
->
at
.
s_node
==
rt
->
at
.
s_node
)
{
*
r
=
tmp
->
next
;
spin_unlock_bh
(
&
ipddp_route_lock
);
kfree
(
tmp
);
return
0
;
}
r
=
&
tmp
->
next
;
}
spin_unlock_bh
(
&
ipddp_route_lock
);
return
(
-
ENOENT
);
}
/*
* Find a routing entry, we only return a FULL match
*/
static
struct
ipddp_route
*
ipddp_find_route
(
struct
ipddp_route
*
rt
)
static
struct
ipddp_route
*
__
ipddp_find_route
(
struct
ipddp_route
*
rt
)
{
struct
ipddp_route
*
f
;
...
...
@@ -253,7 +267,7 @@ static struct ipddp_route* ipddp_find_route(struct ipddp_route *rt)
static
int
ipddp_ioctl
(
struct
net_device
*
dev
,
struct
ifreq
*
ifr
,
int
cmd
)
{
struct
ipddp_route
__user
*
rt
=
ifr
->
ifr_data
;
struct
ipddp_route
rcp
;
struct
ipddp_route
rcp
,
rcp2
,
*
rp
;
if
(
!
capable
(
CAP_NET_ADMIN
))
return
-
EPERM
;
...
...
@@ -267,9 +281,19 @@ static int ipddp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
return
(
ipddp_create
(
&
rcp
));
case
SIOCFINDIPDDPRT
:
if
(
copy_to_user
(
rt
,
ipddp_find_route
(
&
rcp
),
sizeof
(
struct
ipddp_route
)))
return
-
EFAULT
;
return
0
;
spin_lock_bh
(
&
ipddp_route_lock
);
rp
=
__ipddp_find_route
(
&
rcp
);
if
(
rp
)
memcpy
(
&
rcp2
,
rp
,
sizeof
(
rcp2
));
spin_unlock_bh
(
&
ipddp_route_lock
);
if
(
rp
)
{
if
(
copy_to_user
(
rt
,
&
rcp2
,
sizeof
(
struct
ipddp_route
)))
return
-
EFAULT
;
return
0
;
}
else
return
-
ENOENT
;
case
SIOCDELIPDDPRT
:
return
(
ipddp_delete
(
&
rcp
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录