linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] ovl: Fix dereferencing possible ERR_PTR()
@ 2019-09-12  5:18 Ding Xiang
  2019-09-12  6:01 ` Amir Goldstein
  0 siblings, 1 reply; 4+ messages in thread
From: Ding Xiang @ 2019-09-12  5:18 UTC (permalink / raw)
  To: miklos, linux-unionfs; +Cc: linux-kernel, sfr

if ovl_encode_real_fh() fails, no memory was allocated
and the error in the error-valued pointer should be returned.

V1->V2: fix SHA1 length problem

Fixes: 9b6faee07470 ("ovl: check ERR_PTR() return value from ovl_encode_fh()")
Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
---
 fs/overlayfs/export.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c
index cb8ec1f..50ade19 100644
--- a/fs/overlayfs/export.c
+++ b/fs/overlayfs/export.c
@@ -229,7 +229,7 @@ static int ovl_d_to_fh(struct dentry *dentry, char *buf, int buflen)
 				ovl_dentry_upper(dentry), !enc_lower);
 	err = PTR_ERR(fh);
 	if (IS_ERR(fh))
-		goto fail;
+		return err;
 
 	err = -EOVERFLOW;
 	if (fh->len > buflen)
-- 
1.9.1




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

* Re: [PATCH V2] ovl: Fix dereferencing possible ERR_PTR()
  2019-09-12  5:18 [PATCH V2] ovl: Fix dereferencing possible ERR_PTR() Ding Xiang
@ 2019-09-12  6:01 ` Amir Goldstein
  2019-09-12  9:28   ` Miklos Szeredi
  0 siblings, 1 reply; 4+ messages in thread
From: Amir Goldstein @ 2019-09-12  6:01 UTC (permalink / raw)
  To: Ding Xiang; +Cc: Miklos Szeredi, overlayfs, linux-kernel, Stephen Rothwell

On Thu, Sep 12, 2019 at 8:24 AM Ding Xiang
<dingxiang@cmss.chinamobile.com> wrote:
>
> if ovl_encode_real_fh() fails, no memory was allocated
> and the error in the error-valued pointer should be returned.
>
> V1->V2: fix SHA1 length problem
>
> Fixes: 9b6faee07470 ("ovl: check ERR_PTR() return value from ovl_encode_fh()")
> Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
> ---
>  fs/overlayfs/export.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c
> index cb8ec1f..50ade19 100644
> --- a/fs/overlayfs/export.c
> +++ b/fs/overlayfs/export.c
> @@ -229,7 +229,7 @@ static int ovl_d_to_fh(struct dentry *dentry, char *buf, int buflen)
>                                 ovl_dentry_upper(dentry), !enc_lower);
>         err = PTR_ERR(fh);
>         if (IS_ERR(fh))
> -               goto fail;
> +               return err;
>

Please fix the code in warning message instead of skipping the warning.

Thanks,
Amir.

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

* Re: [PATCH V2] ovl: Fix dereferencing possible ERR_PTR()
  2019-09-12  6:01 ` Amir Goldstein
@ 2019-09-12  9:28   ` Miklos Szeredi
  2019-09-12 10:17     ` Amir Goldstein
  0 siblings, 1 reply; 4+ messages in thread
From: Miklos Szeredi @ 2019-09-12  9:28 UTC (permalink / raw)
  To: Amir Goldstein; +Cc: Ding Xiang, overlayfs, linux-kernel, Stephen Rothwell

On Thu, Sep 12, 2019 at 8:02 AM Amir Goldstein <amir73il@gmail.com> wrote:
>
> On Thu, Sep 12, 2019 at 8:24 AM Ding Xiang
> <dingxiang@cmss.chinamobile.com> wrote:
> >
> > if ovl_encode_real_fh() fails, no memory was allocated
> > and the error in the error-valued pointer should be returned.
> >
> > V1->V2: fix SHA1 length problem
> >
> > Fixes: 9b6faee07470 ("ovl: check ERR_PTR() return value from ovl_encode_fh()")
> > Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
> > ---
> >  fs/overlayfs/export.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c
> > index cb8ec1f..50ade19 100644
> > --- a/fs/overlayfs/export.c
> > +++ b/fs/overlayfs/export.c
> > @@ -229,7 +229,7 @@ static int ovl_d_to_fh(struct dentry *dentry, char *buf, int buflen)
> >                                 ovl_dentry_upper(dentry), !enc_lower);
> >         err = PTR_ERR(fh);
> >         if (IS_ERR(fh))
> > -               goto fail;
> > +               return err;
> >
>
> Please fix the code in warning message instead of skipping the warning.

Not sure that makes sense.   ovl_encode_real_fh() will either return
-EIO in case of an internal error with WARN_ON() or it will return
-ENOMEM on memory allocation failure, which doesn't warrant a debug
message.

Thanks,
Miklos

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

* Re: [PATCH V2] ovl: Fix dereferencing possible ERR_PTR()
  2019-09-12  9:28   ` Miklos Szeredi
@ 2019-09-12 10:17     ` Amir Goldstein
  0 siblings, 0 replies; 4+ messages in thread
From: Amir Goldstein @ 2019-09-12 10:17 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: Ding Xiang, overlayfs, linux-kernel, Stephen Rothwell

On Thu, Sep 12, 2019 at 12:28 PM Miklos Szeredi <miklos@szeredi.hu> wrote:
>
> On Thu, Sep 12, 2019 at 8:02 AM Amir Goldstein <amir73il@gmail.com> wrote:
> >
> > On Thu, Sep 12, 2019 at 8:24 AM Ding Xiang
> > <dingxiang@cmss.chinamobile.com> wrote:
> > >
> > > if ovl_encode_real_fh() fails, no memory was allocated
> > > and the error in the error-valued pointer should be returned.
> > >
> > > V1->V2: fix SHA1 length problem
> > >
> > > Fixes: 9b6faee07470 ("ovl: check ERR_PTR() return value from ovl_encode_fh()")
> > > Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
> > > ---
> > >  fs/overlayfs/export.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/fs/overlayfs/export.c b/fs/overlayfs/export.c
> > > index cb8ec1f..50ade19 100644
> > > --- a/fs/overlayfs/export.c
> > > +++ b/fs/overlayfs/export.c
> > > @@ -229,7 +229,7 @@ static int ovl_d_to_fh(struct dentry *dentry, char *buf, int buflen)
> > >                                 ovl_dentry_upper(dentry), !enc_lower);
> > >         err = PTR_ERR(fh);
> > >         if (IS_ERR(fh))
> > > -               goto fail;
> > > +               return err;
> > >
> >
> > Please fix the code in warning message instead of skipping the warning.
>
> Not sure that makes sense.   ovl_encode_real_fh() will either return
> -EIO in case of an internal error with WARN_ON() or it will return
> -ENOMEM on memory allocation failure, which doesn't warrant a debug
> message.
>

Very well. I did not look that deep.

No objections then.

Thanks,
Amir.

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

end of thread, other threads:[~2019-09-12 10:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-12  5:18 [PATCH V2] ovl: Fix dereferencing possible ERR_PTR() Ding Xiang
2019-09-12  6:01 ` Amir Goldstein
2019-09-12  9:28   ` Miklos Szeredi
2019-09-12 10:17     ` Amir Goldstein

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