linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-linux 3.10][PATCH] f2fs: Fix a system panic caused by f2fs_follow_link
@ 2015-11-28  6:38 Yunlei He
  2015-11-30 23:14 ` Jaegeuk Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Yunlei He @ 2015-11-28  6:38 UTC (permalink / raw)
  To: linux-f2fs-devel, jaegeuk, chao2.yu; +Cc: Shuoran Liu

In linux 3.10, we can not make sure the return value of nd_get_link function
is valid. So this patch add a check before use it.

Signed-off-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Shuoran Liu <liushuoran@huawei.com>

---
 fs/f2fs/namei.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 336d43d..bfaec10 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -319,13 +319,18 @@ fail:
 static void *f2fs_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
 	struct page *page;
+	char *link;
 
 	page = page_follow_link_light(dentry, nd);
 	if (IS_ERR(page))
 		return page;
 
+	link = nd_get_link(nd);
+	if (IS_ERR(link))
+		return link;
+
 	/* this is broken symlink case */
-	if (*nd_get_link(nd) == 0) {
+	if (*link == 0) {
 		kunmap(page);
 		page_cache_release(page);
 		return ERR_PTR(-ENOENT);
-- 
1.9.1


------------------------------------------------------------------------------

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [f2fs-linux 3.10][PATCH] f2fs: Fix a system panic caused by f2fs_follow_link
  2015-11-28  6:38 [f2fs-linux 3.10][PATCH] f2fs: Fix a system panic caused by f2fs_follow_link Yunlei He
@ 2015-11-30 23:14 ` Jaegeuk Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Jaegeuk Kim @ 2015-11-30 23:14 UTC (permalink / raw)
  To: Yunlei He; +Cc: Shuoran Liu, linux-f2fs-devel

Hi Yunlei,

Merged into the new 3.10 repo:

http://git.kernel.org/cgit/linux/kernel/git/jaegeuk/f2fs-stable.git/log/?h=linux-3.10.y

Thanks,

On Sat, Nov 28, 2015 at 02:38:40PM +0800, Yunlei He wrote:
> In linux 3.10, we can not make sure the return value of nd_get_link function
> is valid. So this patch add a check before use it.
> 
> Signed-off-by: Yunlei He <heyunlei@huawei.com>
> Signed-off-by: Shuoran Liu <liushuoran@huawei.com>
> 
> ---
>  fs/f2fs/namei.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
> index 336d43d..bfaec10 100644
> --- a/fs/f2fs/namei.c
> +++ b/fs/f2fs/namei.c
> @@ -319,13 +319,18 @@ fail:
>  static void *f2fs_follow_link(struct dentry *dentry, struct nameidata *nd)
>  {
>  	struct page *page;
> +	char *link;
>  
>  	page = page_follow_link_light(dentry, nd);
>  	if (IS_ERR(page))
>  		return page;
>  
> +	link = nd_get_link(nd);
> +	if (IS_ERR(link))
> +		return link;
> +
>  	/* this is broken symlink case */
> -	if (*nd_get_link(nd) == 0) {
> +	if (*link == 0) {
>  		kunmap(page);
>  		page_cache_release(page);
>  		return ERR_PTR(-ENOENT);
> -- 
> 1.9.1

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-30 23:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-28  6:38 [f2fs-linux 3.10][PATCH] f2fs: Fix a system panic caused by f2fs_follow_link Yunlei He
2015-11-30 23:14 ` Jaegeuk Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).