Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Linux-御风守护者
linux
提交
8c7b49b3
L
linux
项目概览
Linux-御风守护者
/
linux
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8c7b49b3
编写于
11月 30, 2009
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix a struct file leak in do_mmap_pgoff()
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
f8b72560
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
15 addition
and
18 deletion
+15
-18
mm/mmap.c
mm/mmap.c
+0
-18
mm/util.c
mm/util.c
+15
-0
未找到文件。
mm/mmap.c
浏览文件 @
8c7b49b3
...
...
@@ -948,24 +948,6 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
if
(
mm
->
map_count
>
sysctl_max_map_count
)
return
-
ENOMEM
;
if
(
flags
&
MAP_HUGETLB
)
{
struct
user_struct
*
user
=
NULL
;
if
(
file
)
return
-
EINVAL
;
/*
* VM_NORESERVE is used because the reservations will be
* taken when vm_ops->mmap() is called
* A dummy user value is used because we are not locking
* memory so no accounting is necessary
*/
len
=
ALIGN
(
len
,
huge_page_size
(
&
default_hstate
));
file
=
hugetlb_file_setup
(
HUGETLB_ANON_FILE
,
len
,
VM_NORESERVE
,
&
user
,
HUGETLB_ANONHUGE_INODE
);
if
(
IS_ERR
(
file
))
return
PTR_ERR
(
file
);
}
/* Obtain the address to map to. we verify (or select) it and ensure
* that it represents a valid section of the address space.
*/
...
...
mm/util.c
浏览文件 @
8c7b49b3
...
...
@@ -280,9 +280,24 @@ SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
unsigned
long
retval
=
-
EBADF
;
if
(
!
(
flags
&
MAP_ANONYMOUS
))
{
if
(
unlikely
(
flags
&
MAP_HUGETLB
))
return
-
EINVAL
;
file
=
fget
(
fd
);
if
(
!
file
)
goto
out
;
}
else
if
(
flags
&
MAP_HUGETLB
)
{
struct
user_struct
*
user
=
NULL
;
/*
* VM_NORESERVE is used because the reservations will be
* taken when vm_ops->mmap() is called
* A dummy user value is used because we are not locking
* memory so no accounting is necessary
*/
len
=
ALIGN
(
len
,
huge_page_size
(
&
default_hstate
));
file
=
hugetlb_file_setup
(
HUGETLB_ANON_FILE
,
len
,
VM_NORESERVE
,
&
user
,
HUGETLB_ANONHUGE_INODE
);
if
(
IS_ERR
(
file
))
return
PTR_ERR
(
file
);
}
flags
&=
~
(
MAP_EXECUTABLE
|
MAP_DENYWRITE
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录