f2fs: Fix a system panic caused by f2fs_follow_link
PATCH 1/1 f2fs: Fix a system panic caused by f2fs_follow_link
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.
--- fs/f2fs/namei.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
fs/f2fs/namei.c +6 -1
@@ -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 );
Signature · 4 lines
1.9.1 ------------------------------------------------------------------------------
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,
Quoted 36 lines · Yunlei He
In linux 3.10, we can not make sure the return value of
nd_get_linkfunction is valid. So this patch add a check before use it.Signed-off-by Yunlei He <[email protected]>Signed-off-by Shuoran Liu <[email protected]>--- fs/f2fs/namei.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)fs/f2fs/namei.c +6
-1@@ -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 );Signature · 1 line
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