Patchwork [1/1] UBUNTU: ubuntu: overlayfs -- fix missmerge of vfs_open changes

login
register
mail settings
Submitter Andy Whitcroft
Date March 8, 2013, 2:12 p.m.
Message ID <1362751921-4977-2-git-send-email-apw@canonical.com>
Download mbox | patch
Permalink /patch/226130/
State New
Headers show

Comments

Andy Whitcroft - March 8, 2013, 2:12 p.m.
Quantal is based on v3.5 which sits at an unfortuanate juncture in the
evolution of the open code.  At this specific time there is an open coded
side effect (see below) on the success path for the calls do_dentry_open().
When injecting the vfs_open (again open coded) into the nameidata_to_filp()
routine to avoid the success path reference counting issues, this side
effect was lost.  Re-add this to avoid panics:

    nd->intent.open.file = NULL;

BugLink: http://bugs.launchpad.net/bugs/1122094
BugLink: http://bugs.launchpad.net/bugs/1147678
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 fs/open.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
Brad Figg - March 8, 2013, 2:17 p.m.
On 03/08/2013 06:12 AM, Andy Whitcroft wrote:
> Quantal is based on v3.5 which sits at an unfortuanate juncture in the
> evolution of the open code.  At this specific time there is an open coded
> side effect (see below) on the success path for the calls do_dentry_open().
> When injecting the vfs_open (again open coded) into the nameidata_to_filp()
> routine to avoid the success path reference counting issues, this side
> effect was lost.  Re-add this to avoid panics:
> 
>     nd->intent.open.file = NULL;
> 
> BugLink: http://bugs.launchpad.net/bugs/1122094
> BugLink: http://bugs.launchpad.net/bugs/1147678
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
> ---
>  fs/open.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/open.c b/fs/open.c
> index a500c82..97b46a3 100644
> --- a/fs/open.c
> +++ b/fs/open.c
> @@ -833,8 +833,13 @@ struct file *nameidata_to_filp(struct nameidata *nd)
>  		struct file *res;
>  		struct inode *inode = nd->path.dentry->d_inode;
>  
> -		if (inode->i_op->open)
> -			return inode->i_op->open(nd->path.dentry, filp, cred);
> +		if (inode->i_op->open) {
> +			res = inode->i_op->open(nd->path.dentry, filp, cred);
> +			if (!IS_ERR(res)) {
> +				nd->intent.open.file = NULL;
> +			}
> +			return res;
> +		}
>  
>  		res = do_dentry_open(&nd->path, filp, NULL, cred);
>  		if (!IS_ERR(res)) {
>
Leann Ogasawara - March 8, 2013, 2:49 p.m.
On 03/08/2013 06:12 AM, Andy Whitcroft wrote:
> Quantal is based on v3.5 which sits at an unfortuanate juncture in the
> evolution of the open code.  At this specific time there is an open coded
> side effect (see below) on the success path for the calls do_dentry_open().
> When injecting the vfs_open (again open coded) into the nameidata_to_filp()
> routine to avoid the success path reference counting issues, this side
> effect was lost.  Re-add this to avoid panics:
>
>     nd->intent.open.file = NULL;
>
> BugLink: http://bugs.launchpad.net/bugs/1122094
> BugLink: http://bugs.launchpad.net/bugs/1147678
> Signed-off-by: Andy Whitcroft <apw@canonical.com>

Acked-by: Leann Ogasawara <leann.ogasawara@canonical.com>

> ---
>  fs/open.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/fs/open.c b/fs/open.c
> index a500c82..97b46a3 100644
> --- a/fs/open.c
> +++ b/fs/open.c
> @@ -833,8 +833,13 @@ struct file *nameidata_to_filp(struct nameidata *nd)
>  		struct file *res;
>  		struct inode *inode = nd->path.dentry->d_inode;
>  
> -		if (inode->i_op->open)
> -			return inode->i_op->open(nd->path.dentry, filp, cred);
> +		if (inode->i_op->open) {
> +			res = inode->i_op->open(nd->path.dentry, filp, cred);
> +			if (!IS_ERR(res)) {
> +				nd->intent.open.file = NULL;
> +			}
> +			return res;
> +		}
>  
>  		res = do_dentry_open(&nd->path, filp, NULL, cred);
>  		if (!IS_ERR(res)) {
Brad Figg - March 8, 2013, 3:03 p.m.
On 03/08/2013 06:12 AM, Andy Whitcroft wrote:
> Quantal is based on v3.5 which sits at an unfortuanate juncture in the
> evolution of the open code.  At this specific time there is an open coded
> side effect (see below) on the success path for the calls do_dentry_open().
> When injecting the vfs_open (again open coded) into the nameidata_to_filp()
> routine to avoid the success path reference counting issues, this side
> effect was lost.  Re-add this to avoid panics:
> 
>     nd->intent.open.file = NULL;
> 
> BugLink: http://bugs.launchpad.net/bugs/1122094
> BugLink: http://bugs.launchpad.net/bugs/1147678
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
> ---
>  fs/open.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/open.c b/fs/open.c
> index a500c82..97b46a3 100644
> --- a/fs/open.c
> +++ b/fs/open.c
> @@ -833,8 +833,13 @@ struct file *nameidata_to_filp(struct nameidata *nd)
>  		struct file *res;
>  		struct inode *inode = nd->path.dentry->d_inode;
>  
> -		if (inode->i_op->open)
> -			return inode->i_op->open(nd->path.dentry, filp, cred);
> +		if (inode->i_op->open) {
> +			res = inode->i_op->open(nd->path.dentry, filp, cred);
> +			if (!IS_ERR(res)) {
> +				nd->intent.open.file = NULL;
> +			}
> +			return res;
> +		}
>  
>  		res = do_dentry_open(&nd->path, filp, NULL, cred);
>  		if (!IS_ERR(res)) {
>

Patch

diff --git a/fs/open.c b/fs/open.c
index a500c82..97b46a3 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -833,8 +833,13 @@  struct file *nameidata_to_filp(struct nameidata *nd)
 		struct file *res;
 		struct inode *inode = nd->path.dentry->d_inode;
 
-		if (inode->i_op->open)
-			return inode->i_op->open(nd->path.dentry, filp, cred);
+		if (inode->i_op->open) {
+			res = inode->i_op->open(nd->path.dentry, filp, cred);
+			if (!IS_ERR(res)) {
+				nd->intent.open.file = NULL;
+			}
+			return res;
+		}
 
 		res = do_dentry_open(&nd->path, filp, NULL, cred);
 		if (!IS_ERR(res)) {