linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] binderfs: fix error return code in binderfs_fill_super()
@ 2019-01-16  3:01 Wei Yongjun
  2019-01-16  6:25 ` Christian Brauner
  2019-01-16  8:34 ` [PATCH -next v2] " Wei Yongjun
  0 siblings, 2 replies; 11+ messages in thread
From: Wei Yongjun @ 2019-01-16  3:01 UTC (permalink / raw)
  To: gregkh, arve, tkjos, maco, joel, christian
  Cc: Wei Yongjun, devel, linux-kernel, kernel-janitors

Fix to return a negative error code -ENOMEM from the new_inode() and
d_make_root() error handling cases instead of 0, as done elsewhere in
this function.

Fixes: 3ad20fe393b3 ("binder: implement binderfs")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/android/binderfs.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
index 9518e2e..2bf4b2b 100644
--- a/drivers/android/binderfs.c
+++ b/drivers/android/binderfs.c
@@ -519,8 +519,10 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent)
 	sb->s_fs_info = info;
 
 	inode = new_inode(sb);
-	if (!inode)
+	if (!inode) {
+		ret = -ENOMEM;
 		goto err_without_dentry;
+	}
 
 	inode->i_ino = FIRST_INODE;
 	inode->i_fop = &simple_dir_operations;
@@ -530,8 +532,10 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent)
 	set_nlink(inode, 2);
 
 	sb->s_root = d_make_root(inode);
-	if (!sb->s_root)
+	if (!sb->s_root) {
+		ret = -ENOMEM;
 		goto err_without_dentry;
+	}
 
 	ret = binderfs_binder_ctl_create(sb);
 	if (ret)




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

* Re: [PATCH -next] binderfs: fix error return code in binderfs_fill_super()
  2019-01-16  3:01 [PATCH -next] binderfs: fix error return code in binderfs_fill_super() Wei Yongjun
@ 2019-01-16  6:25 ` Christian Brauner
  2019-01-16  6:28   ` Christian Brauner
  2019-01-16  8:54   ` Dan Carpenter
  2019-01-16  8:34 ` [PATCH -next v2] " Wei Yongjun
  1 sibling, 2 replies; 11+ messages in thread
From: Christian Brauner @ 2019-01-16  6:25 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: gregkh, arve, tkjos, maco, joel, devel, linux-kernel, kernel-janitors

On Wed, Jan 16, 2019 at 03:01:04AM +0000, Wei Yongjun wrote:
> Fix to return a negative error code -ENOMEM from the new_inode() and
> d_make_root() error handling cases instead of 0, as done elsewhere in
> this function.
> 
> Fixes: 3ad20fe393b3 ("binder: implement binderfs")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/android/binderfs.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
> index 9518e2e..2bf4b2b 100644
> --- a/drivers/android/binderfs.c
> +++ b/drivers/android/binderfs.c
> @@ -519,8 +519,10 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent)
>  	sb->s_fs_info = info;
>  
>  	inode = new_inode(sb);
> -	if (!inode)
> +	if (!inode) {
> +		ret = -ENOMEM;

Hey, thanks for the patch. Just a nit:
can you please just do?

	ret = -ENOMEM;
        inode = new_inode(sb);

This is more consistent with how we do it everywhere else and let's us
avoid shoving ret = -ENOMEM into two places.

Thanks!
Christian

>  		goto err_without_dentry;
> +	}
>  
>  	inode->i_ino = FIRST_INODE;
>  	inode->i_fop = &simple_dir_operations;
> @@ -530,8 +532,10 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent)
>  	set_nlink(inode, 2);
>  
>  	sb->s_root = d_make_root(inode);
> -	if (!sb->s_root)
> +	if (!sb->s_root) {
> +		ret = -ENOMEM;
>  		goto err_without_dentry;
> +	}
>  
>  	ret = binderfs_binder_ctl_create(sb);
>  	if (ret)
> 
> 
> 

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

* Re: [PATCH -next] binderfs: fix error return code in binderfs_fill_super()
  2019-01-16  6:25 ` Christian Brauner
@ 2019-01-16  6:28   ` Christian Brauner
  2019-01-16  6:53     ` Greg KH
  2019-01-16  8:54   ` Dan Carpenter
  1 sibling, 1 reply; 11+ messages in thread
From: Christian Brauner @ 2019-01-16  6:28 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: gregkh, arve, tkjos, maco, joel, devel, linux-kernel, kernel-janitors

On Wed, Jan 16, 2019 at 07:25:46AM +0100, Christian Brauner wrote:
> On Wed, Jan 16, 2019 at 03:01:04AM +0000, Wei Yongjun wrote:
> > Fix to return a negative error code -ENOMEM from the new_inode() and
> > d_make_root() error handling cases instead of 0, as done elsewhere in
> > this function.
> > 
> > Fixes: 3ad20fe393b3 ("binder: implement binderfs")

This Fixes tag is technically wrong since this codepath was introduced
by a commit that is still sitting in Greg's char-misc-linus branch. Not
sure how to handle that though. Might just leave it.

> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> > ---
> >  drivers/android/binderfs.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
> > index 9518e2e..2bf4b2b 100644
> > --- a/drivers/android/binderfs.c
> > +++ b/drivers/android/binderfs.c
> > @@ -519,8 +519,10 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent)
> >  	sb->s_fs_info = info;
> >  
> >  	inode = new_inode(sb);
> > -	if (!inode)
> > +	if (!inode) {
> > +		ret = -ENOMEM;
> 
> Hey, thanks for the patch. Just a nit:
> can you please just do?
> 
> 	ret = -ENOMEM;
>         inode = new_inode(sb);
> 
> This is more consistent with how we do it everywhere else and let's us
> avoid shoving ret = -ENOMEM into two places.
> 
> Thanks!
> Christian
> 
> >  		goto err_without_dentry;
> > +	}
> >  
> >  	inode->i_ino = FIRST_INODE;
> >  	inode->i_fop = &simple_dir_operations;
> > @@ -530,8 +532,10 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent)
> >  	set_nlink(inode, 2);
> >  
> >  	sb->s_root = d_make_root(inode);
> > -	if (!sb->s_root)
> > +	if (!sb->s_root) {
> > +		ret = -ENOMEM;
> >  		goto err_without_dentry;
> > +	}
> >  
> >  	ret = binderfs_binder_ctl_create(sb);
> >  	if (ret)
> > 
> > 
> > 

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

* Re: [PATCH -next] binderfs: fix error return code in binderfs_fill_super()
  2019-01-16  6:28   ` Christian Brauner
@ 2019-01-16  6:53     ` Greg KH
  0 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2019-01-16  6:53 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Wei Yongjun, devel, tkjos, kernel-janitors, linux-kernel, arve,
	joel, maco

On Wed, Jan 16, 2019 at 07:28:26AM +0100, Christian Brauner wrote:
> On Wed, Jan 16, 2019 at 07:25:46AM +0100, Christian Brauner wrote:
> > On Wed, Jan 16, 2019 at 03:01:04AM +0000, Wei Yongjun wrote:
> > > Fix to return a negative error code -ENOMEM from the new_inode() and
> > > d_make_root() error handling cases instead of 0, as done elsewhere in
> > > this function.
> > > 
> > > Fixes: 3ad20fe393b3 ("binder: implement binderfs")
> 
> This Fixes tag is technically wrong since this codepath was introduced
> by a commit that is still sitting in Greg's char-misc-linus branch. Not
> sure how to handle that though. Might just leave it.

Use the git commit id of the patch in that branch, it is not going to
change as I do not rebase that branch.

thanks,

greg k-h

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

* [PATCH -next v2] binderfs: fix error return code in binderfs_fill_super()
  2019-01-16  3:01 [PATCH -next] binderfs: fix error return code in binderfs_fill_super() Wei Yongjun
  2019-01-16  6:25 ` Christian Brauner
@ 2019-01-16  8:34 ` Wei Yongjun
  2019-01-16  8:41   ` Christian Brauner
  2019-01-16 10:39   ` [PATCH v3] " Wei Yongjun
  1 sibling, 2 replies; 11+ messages in thread
From: Wei Yongjun @ 2019-01-16  8:34 UTC (permalink / raw)
  To: gregkh, arve, tkjos, maco, joel, christian
  Cc: Wei Yongjun, devel, linux-kernel, kernel-janitors

Fix to return a negative error code -ENOMEM from the new_inode() and
d_make_root() error handling cases instead of 0, as done elsewhere in
this function.

Fixes: 3ad20fe393b3 ("binder: implement binderfs")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
v1 -> v2: move 'ret = -ENOMEM' out of if
---
 drivers/android/binderfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
index 9518e2e..e4ff4c3 100644
--- a/drivers/android/binderfs.c
+++ b/drivers/android/binderfs.c
@@ -518,6 +518,7 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent)
 
 	sb->s_fs_info = info;
 
+	ret = -ENOMEM;
 	inode = new_inode(sb);
 	if (!inode)
 		goto err_without_dentry;




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

* Re: [PATCH -next v2] binderfs: fix error return code in binderfs_fill_super()
  2019-01-16  8:34 ` [PATCH -next v2] " Wei Yongjun
@ 2019-01-16  8:41   ` Christian Brauner
  2019-01-16  8:45     ` Christian Brauner
  2019-01-16 10:39   ` [PATCH v3] " Wei Yongjun
  1 sibling, 1 reply; 11+ messages in thread
From: Christian Brauner @ 2019-01-16  8:41 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: gregkh, arve, tkjos, maco, joel, devel, linux-kernel, kernel-janitors

On Wed, Jan 16, 2019 at 08:34:02AM +0000, Wei Yongjun wrote:
> Fix to return a negative error code -ENOMEM from the new_inode() and
> d_make_root() error handling cases instead of 0, as done elsewhere in
> this function.
> 
> Fixes: 3ad20fe393b3 ("binder: implement binderfs")

This should be:

Fixes: 849d540ddfcd ("binderfs: implement "max" mount option")

If you have added that feel free to also add my Reviewed-by.

Thanks!
Christian

> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
> v1 -> v2: move 'ret = -ENOMEM' out of if
> ---
>  drivers/android/binderfs.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
> index 9518e2e..e4ff4c3 100644
> --- a/drivers/android/binderfs.c
> +++ b/drivers/android/binderfs.c
> @@ -518,6 +518,7 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent)
>  
>  	sb->s_fs_info = info;
>  
> +	ret = -ENOMEM;
>  	inode = new_inode(sb);
>  	if (!inode)
>  		goto err_without_dentry;
> 
> 
> 

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

* Re: [PATCH -next v2] binderfs: fix error return code in binderfs_fill_super()
  2019-01-16  8:41   ` Christian Brauner
@ 2019-01-16  8:45     ` Christian Brauner
  0 siblings, 0 replies; 11+ messages in thread
From: Christian Brauner @ 2019-01-16  8:45 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: gregkh, arve, tkjos, maco, joel, devel, linux-kernel, kernel-janitors

On Wed, Jan 16, 2019 at 09:41:08AM +0100, Christian Brauner wrote:
> On Wed, Jan 16, 2019 at 08:34:02AM +0000, Wei Yongjun wrote:
> > Fix to return a negative error code -ENOMEM from the new_inode() and
> > d_make_root() error handling cases instead of 0, as done elsewhere in
> > this function.
> > 
> > Fixes: 3ad20fe393b3 ("binder: implement binderfs")
> 
> This should be:
> 
> Fixes: 849d540ddfcd ("binderfs: implement "max" mount option")
> 
> If you have added that feel free to also add my Reviewed-by.

Also, this does need to go into char-misc-linus and not -next so you can
drop the -next prefix from the [PATCH ...] prefix. :) Greg will do the
right thing in any case but it's just clearer if you don't add it. :)

Thanks!
Christian

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

* Re: [PATCH -next] binderfs: fix error return code in binderfs_fill_super()
  2019-01-16  6:25 ` Christian Brauner
  2019-01-16  6:28   ` Christian Brauner
@ 2019-01-16  8:54   ` Dan Carpenter
  1 sibling, 0 replies; 11+ messages in thread
From: Dan Carpenter @ 2019-01-16  8:54 UTC (permalink / raw)
  To: Christian Brauner
  Cc: Wei Yongjun, devel, tkjos, gregkh, kernel-janitors, linux-kernel,
	arve, joel, maco

On Wed, Jan 16, 2019 at 07:25:47AM +0100, Christian Brauner wrote:
> On Wed, Jan 16, 2019 at 03:01:04AM +0000, Wei Yongjun wrote:
> > Fix to return a negative error code -ENOMEM from the new_inode() and
> > d_make_root() error handling cases instead of 0, as done elsewhere in
> > this function.
> > 
> > Fixes: 3ad20fe393b3 ("binder: implement binderfs")
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> > ---
> >  drivers/android/binderfs.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
> > index 9518e2e..2bf4b2b 100644
> > --- a/drivers/android/binderfs.c
> > +++ b/drivers/android/binderfs.c
> > @@ -519,8 +519,10 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent)
> >  	sb->s_fs_info = info;
> >  
> >  	inode = new_inode(sb);
> > -	if (!inode)
> > +	if (!inode) {
> > +		ret = -ENOMEM;
> 
> Hey, thanks for the patch. Just a nit:
> can you please just do?
> 
> 	ret = -ENOMEM;
>         inode = new_inode(sb);
> 
> This is more consistent with how we do it everywhere else and let's us
> avoid shoving ret = -ENOMEM into two places.
> 

Btw, your style is why you have this bug.  I don't have strong feelings
about this either way, I'm just pointing it out.

regards,
dan carpenter


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

* RE: [PATCH v3] binderfs: fix error return code in binderfs_fill_super()
  2019-01-16 10:39   ` [PATCH v3] " Wei Yongjun
@ 2019-01-16 10:34     ` weiyongjun (A)
  2019-01-16 10:42     ` [PATCH v4] " Wei Yongjun
  1 sibling, 0 replies; 11+ messages in thread
From: weiyongjun (A) @ 2019-01-16 10:34 UTC (permalink / raw)
  To: gregkh, arve, tkjos, maco, joel, christian
  Cc: devel, linux-kernel, kernel-janitors

Sorry,  please ignore this patch, missing reviewed-by line, I will send a new version.

> -----Original Message-----
> From: weiyongjun (A)
> Sent: Wednesday, January 16, 2019 6:39 PM
> To: gregkh@linuxfoundation.org; arve@android.com; tkjos@android.com;
> maco@android.com; joel@joelfernandes.org; christian@brauner.io
> Cc: weiyongjun (A) <weiyongjun1@huawei.com>;
> devel@driverdev.osuosl.org; linux-kernel@vger.kernel.org; kernel-
> janitors@vger.kernel.org
> Subject: [PATCH v3] binderfs: fix error return code in binderfs_fill_super()
> 
> Fix to return a negative error code -ENOMEM from the new_inode() and
> d_make_root() error handling cases instead of 0, as done elsewhere in
> this function.
> 
> Fixes: 849d540ddfcd ("binderfs: implement "max" mount option")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
> v1 -> v2: move 'ret = -ENOMEM' out of if
> v2 -> v3: use correct fixes commit
> ---
>  drivers/android/binderfs.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
> index 9518e2e..e4ff4c3 100644
> --- a/drivers/android/binderfs.c
> +++ b/drivers/android/binderfs.c
> @@ -518,6 +518,7 @@ static int binderfs_fill_super(struct super_block *sb,
> void *data, int silent)
> 
>  	sb->s_fs_info = info;
> 
> +	ret = -ENOMEM;
>  	inode = new_inode(sb);
>  	if (!inode)
>  		goto err_without_dentry;
> 
> 


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

* [PATCH v3] binderfs: fix error return code in binderfs_fill_super()
  2019-01-16  8:34 ` [PATCH -next v2] " Wei Yongjun
  2019-01-16  8:41   ` Christian Brauner
@ 2019-01-16 10:39   ` Wei Yongjun
  2019-01-16 10:34     ` weiyongjun (A)
  2019-01-16 10:42     ` [PATCH v4] " Wei Yongjun
  1 sibling, 2 replies; 11+ messages in thread
From: Wei Yongjun @ 2019-01-16 10:39 UTC (permalink / raw)
  To: gregkh, arve, tkjos, maco, joel, christian
  Cc: Wei Yongjun, devel, linux-kernel, kernel-janitors

Fix to return a negative error code -ENOMEM from the new_inode() and
d_make_root() error handling cases instead of 0, as done elsewhere in
this function.

Fixes: 849d540ddfcd ("binderfs: implement "max" mount option")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
v1 -> v2: move 'ret = -ENOMEM' out of if
v2 -> v3: use correct fixes commit
---
 drivers/android/binderfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
index 9518e2e..e4ff4c3 100644
--- a/drivers/android/binderfs.c
+++ b/drivers/android/binderfs.c
@@ -518,6 +518,7 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent)
 
 	sb->s_fs_info = info;
 
+	ret = -ENOMEM;
 	inode = new_inode(sb);
 	if (!inode)
 		goto err_without_dentry;




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

* [PATCH v4] binderfs: fix error return code in binderfs_fill_super()
  2019-01-16 10:39   ` [PATCH v3] " Wei Yongjun
  2019-01-16 10:34     ` weiyongjun (A)
@ 2019-01-16 10:42     ` Wei Yongjun
  1 sibling, 0 replies; 11+ messages in thread
From: Wei Yongjun @ 2019-01-16 10:42 UTC (permalink / raw)
  To: gregkh, arve, tkjos, maco, joel, christian
  Cc: Wei Yongjun, devel, linux-kernel, kernel-janitors

Fix to return a negative error code -ENOMEM from the new_inode() and
d_make_root() error handling cases instead of 0, as done elsewhere in
this function.

Fixes: 849d540ddfcd ("binderfs: implement "max" mount option")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Christian Brauner <christian@brauner.io>
---
v1 -> v2: move 'ret = -ENOMEM' out of if
v2 -> v3: use correct fixes commit
v3 -> v4: add reviewed-by
---
 drivers/android/binderfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c
index 9518e2e..e4ff4c3 100644
--- a/drivers/android/binderfs.c
+++ b/drivers/android/binderfs.c
@@ -518,6 +518,7 @@ static int binderfs_fill_super(struct super_block *sb, void *data, int silent)
 
 	sb->s_fs_info = info;
 
+	ret = -ENOMEM;
 	inode = new_inode(sb);
 	if (!inode)
 		goto err_without_dentry;




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

end of thread, other threads:[~2019-01-16 10:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-16  3:01 [PATCH -next] binderfs: fix error return code in binderfs_fill_super() Wei Yongjun
2019-01-16  6:25 ` Christian Brauner
2019-01-16  6:28   ` Christian Brauner
2019-01-16  6:53     ` Greg KH
2019-01-16  8:54   ` Dan Carpenter
2019-01-16  8:34 ` [PATCH -next v2] " Wei Yongjun
2019-01-16  8:41   ` Christian Brauner
2019-01-16  8:45     ` Christian Brauner
2019-01-16 10:39   ` [PATCH v3] " Wei Yongjun
2019-01-16 10:34     ` weiyongjun (A)
2019-01-16 10:42     ` [PATCH v4] " Wei Yongjun

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