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

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).