提交 9aefe431 编写于 作者: D Dave Jones 提交者: Jens Axboe

[PATCH] splice: potential !page dereference

We can get to out: with a NULL page, which we probably
don't want to be calling page_cache_release() on.
Signed-off-by: NDave Jones <davej@redhat.com>
Signed-off-by: NJens Axboe <axboe@suse.de>
上级 c7f21e4f
...@@ -445,7 +445,7 @@ static int pipe_to_file(struct pipe_inode_info *info, struct pipe_buffer *buf, ...@@ -445,7 +445,7 @@ static int pipe_to_file(struct pipe_inode_info *info, struct pipe_buffer *buf,
ret = -ENOMEM; ret = -ENOMEM;
page = find_or_create_page(mapping, index, gfp_mask); page = find_or_create_page(mapping, index, gfp_mask);
if (!page) if (!page)
goto out; goto out_nomem;
/* /*
* If the page is uptodate, it is also locked. If it isn't * If the page is uptodate, it is also locked. If it isn't
...@@ -508,6 +508,7 @@ static int pipe_to_file(struct pipe_inode_info *info, struct pipe_buffer *buf, ...@@ -508,6 +508,7 @@ static int pipe_to_file(struct pipe_inode_info *info, struct pipe_buffer *buf,
page_cache_release(page); page_cache_release(page);
unlock_page(page); unlock_page(page);
} }
out_nomem:
buf->ops->unmap(info, buf); buf->ops->unmap(info, buf);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册