Subject: Re: linux-next: build failure after merge of the akpm tree

From: Kees Cook <[email-masked]>
Date: Mon, 25 Jun 2012 09:40:49 -0700

Hi Stephen,

On Mon, Jun 25, 2012 at 04:41:41PM +1000, Stephen Rothwell wrote:
> After merging the akpm tree, today's linux-next build (powerpc
> ppc64_defconfig) failed like this:
> 
> fs/namei.c: In function 'path_openat':
> fs/namei.c:2874:4: error: 'filp' undeclared (first use in this function)
> 
> Caused by patch "fs: add link restrictions" from the akpm tree
> interacting with (at least) commit 4066cd545681 ("vfs: remove open
> intents from nameidata") from the vfs tree.
> 
> I don't know how to fix this, so I have reverted the akpm patch for today
> (in the hope that someone else will fix it).

It looks like namei.c changed the logic of the lookup loop. This should
fix it.

Signed-off-by: Kees Cook <[email-masked]>

---

diff -uNrp a/fs/namei.c b/fs/namei.c
--- a/fs/namei.c	2012-06-25 09:30:28.125746562 -0700
+++ b/fs/namei.c	2012-06-25 09:31:29.456997558 -0700
@@ -2870,10 +2870,8 @@ static struct file *path_openat(int dfd,
 			break;
 		}
 		error = may_follow_link(&link);
-		if (unlikely(error)) {
-			filp = ERR_PTR(error);
+		if (unlikely(error))
 			break;
-		}
 		nd->flags |= LOOKUP_PARENT;
 		nd->flags &= ~(LOOKUP_OPEN|LOOKUP_CREATE|LOOKUP_EXCL);
 		error = follow_link(&link, nd, &cookie);

-- 
Kees Cook
Chrome OS Security