Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
d0352d3e
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看板
提交
d0352d3e
编写于
6月 06, 2010
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hostfs: sanitize symlinks
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
c5322220
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
35 addition
and
26 deletion
+35
-26
fs/hostfs/hostfs_kern.c
fs/hostfs/hostfs_kern.c
+35
-26
未找到文件。
fs/hostfs/hostfs_kern.c
浏览文件 @
d0352d3e
...
...
@@ -14,6 +14,7 @@
#include <linux/slab.h>
#include <linux/seq_file.h>
#include <linux/mount.h>
#include <linux/namei.h>
#include "hostfs.h"
#include "init.h"
#include "kern.h"
...
...
@@ -48,7 +49,7 @@ static int append = 0;
static
const
struct
inode_operations
hostfs_iops
;
static
const
struct
inode_operations
hostfs_dir_iops
;
static
const
struct
address_space_operations
hostfs_link_a
ops
;
static
const
struct
inode_operations
hostfs_link_i
ops
;
#ifndef MODULE
static
int
__init
hostfs_args
(
char
*
options
,
int
*
add
)
...
...
@@ -471,8 +472,7 @@ static int read_name(struct inode *ino, char *name)
switch
(
st
.
mode
&
S_IFMT
)
{
case
S_IFLNK
:
ino
->
i_op
=
&
page_symlink_inode_operations
;
ino
->
i_mapping
->
a_ops
=
&
hostfs_link_aops
;
ino
->
i_op
=
&
hostfs_link_iops
;
break
;
case
S_IFDIR
:
ino
->
i_op
=
&
hostfs_dir_iops
;
...
...
@@ -835,32 +835,41 @@ static const struct inode_operations hostfs_dir_iops = {
.
setattr
=
hostfs_setattr
,
};
int
hostfs_link_readpage
(
struct
file
*
file
,
struct
page
*
page
)
{
char
*
buffer
,
*
name
;
i
nt
err
;
buffer
=
kmap
(
page
)
;
name
=
inode_name
(
page
->
mapping
->
host
);
if
(
name
==
NULL
)
return
-
ENOMEM
;
err
=
hostfs_do_readlink
(
name
,
buffer
,
PAGE_CACHE_SIZE
)
;
kfree
(
name
);
if
(
err
==
PAGE_CACHE_SIZE
)
err
=
-
E2BIG
;
else
if
(
err
>
0
)
{
flush_dcache_page
(
page
);
SetPageUptodate
(
page
);
if
(
PageError
(
page
))
ClearPageError
(
page
);
err
=
0
;
static
void
*
hostfs_follow_link
(
struct
dentry
*
dentry
,
struct
nameidata
*
nd
)
{
char
*
link
=
__getname
()
;
i
f
(
link
)
{
char
*
path
=
dentry_name
(
dentry
);
int
err
=
-
ENOMEM
;
if
(
path
)
{
int
err
=
hostfs_do_readlink
(
path
,
link
,
PATH_MAX
);
if
(
err
==
PATH_MAX
)
err
=
-
E2BIG
;
kfree
(
path
);
}
if
(
err
<
0
)
{
__putname
(
link
);
link
=
ERR_PTR
(
err
);
}
}
else
{
link
=
ERR_PTR
(
-
ENOMEM
)
;
}
kunmap
(
page
);
unlock_page
(
page
);
return
err
;
nd_set_link
(
nd
,
link
);
return
NULL
;
}
static
void
hostfs_put_link
(
struct
dentry
*
dentry
,
struct
nameidata
*
nd
,
void
*
cookie
)
{
char
*
s
=
nd_get_link
(
nd
);
if
(
!
IS_ERR
(
s
))
__putname
(
s
);
}
static
const
struct
address_space_operations
hostfs_link_aops
=
{
.
readpage
=
hostfs_link_readpage
,
static
const
struct
inode_operations
hostfs_link_iops
=
{
.
readlink
=
generic_readlink
,
.
follow_link
=
hostfs_follow_link
,
.
put_link
=
hostfs_put_link
,
};
static
int
hostfs_fill_sb_common
(
struct
super_block
*
sb
,
void
*
d
,
int
silent
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录