linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dax: Fix wrong error-number passed into xas_set_err()
@ 2020-07-29  3:44 Hao Li
  2020-07-29  4:23 ` Pankaj Gupta
  2020-07-30  4:33 ` Pankaj Gupta
  0 siblings, 2 replies; 3+ messages in thread
From: Hao Li @ 2020-07-29  3:44 UTC (permalink / raw)
  To: viro
  Cc: willy, jack, linux-fsdevel, linux-nvdimm, linux-kernel, lihao2018.fnst

The error-number passed into xas_set_err() should be negative. Otherwise,
the xas_error() will return 0, and grab_mapping_entry() will return the
found entry instead of a SIGBUS error when the entry is not a value.
And then, the subsequent code path would be wrong.

Signed-off-by: Hao Li <lihao2018.fnst@cn.fujitsu.com>
---
 fs/dax.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/dax.c b/fs/dax.c
index 11b16729b86f..acac675fe7a6 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -488,7 +488,7 @@ static void *grab_mapping_entry(struct xa_state *xas,
 		if (dax_is_conflict(entry))
 			goto fallback;
 		if (!xa_is_value(entry)) {
-			xas_set_err(xas, EIO);
+			xas_set_err(xas, -EIO);
 			goto out_unlock;
 		}
 
-- 
2.28.0


_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

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

* Re: [PATCH] dax: Fix wrong error-number passed into xas_set_err()
  2020-07-29  3:44 [PATCH] dax: Fix wrong error-number passed into xas_set_err() Hao Li
@ 2020-07-29  4:23 ` Pankaj Gupta
  2020-07-30  4:33 ` Pankaj Gupta
  1 sibling, 0 replies; 3+ messages in thread
From: Pankaj Gupta @ 2020-07-29  4:23 UTC (permalink / raw)
  To: Hao Li; +Cc: viro, Matthew Wilcox, Jan Kara, linux-fsdevel, linux-nvdimm, LKML

> The error-number passed into xas_set_err() should be negative. Otherwise,
> the xas_error() will return 0, and grab_mapping_entry() will return the
> found entry instead of a SIGBUS error when the entry is not a value.
> And then, the subsequent code path would be wrong.
>
> Signed-off-by: Hao Li <lihao2018.fnst@cn.fujitsu.com>
> ---
>  fs/dax.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/dax.c b/fs/dax.c
> index 11b16729b86f..acac675fe7a6 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -488,7 +488,7 @@ static void *grab_mapping_entry(struct xa_state *xas,
>                 if (dax_is_conflict(entry))
>                         goto fallback;
>                 if (!xa_is_value(entry)) {
> -                       xas_set_err(xas, EIO);
> +                       xas_set_err(xas, -EIO);
>                         goto out_unlock;
>                 }
>

Reviewed-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>


> --
> 2.28.0
>
>
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

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

* Re: [PATCH] dax: Fix wrong error-number passed into xas_set_err()
  2020-07-29  3:44 [PATCH] dax: Fix wrong error-number passed into xas_set_err() Hao Li
  2020-07-29  4:23 ` Pankaj Gupta
@ 2020-07-30  4:33 ` Pankaj Gupta
  1 sibling, 0 replies; 3+ messages in thread
From: Pankaj Gupta @ 2020-07-30  4:33 UTC (permalink / raw)
  To: Hao Li; +Cc: viro, Matthew Wilcox, Jan Kara, linux-fsdevel, linux-nvdimm, LKML

> The error-number passed into xas_set_err() should be negative. Otherwise,
> the xas_error() will return 0, and grab_mapping_entry() will return the
> found entry instead of a SIGBUS error when the entry is not a value.
> And then, the subsequent code path would be wrong.
>
> Signed-off-by: Hao Li <lihao2018.fnst@cn.fujitsu.com>
> ---
>  fs/dax.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/dax.c b/fs/dax.c
> index 11b16729b86f..acac675fe7a6 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -488,7 +488,7 @@ static void *grab_mapping_entry(struct xa_state *xas,
>                 if (dax_is_conflict(entry))
>                         goto fallback;
>                 if (!xa_is_value(entry)) {
> -                       xas_set_err(xas, EIO);
> +                       xas_set_err(xas, -EIO);
>                         goto out_unlock;
>                 }
>
> --

Reviewed-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>

> 2.28.0
>
>
> _______________________________________________
> Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
> To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

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

end of thread, other threads:[~2020-07-30  4:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29  3:44 [PATCH] dax: Fix wrong error-number passed into xas_set_err() Hao Li
2020-07-29  4:23 ` Pankaj Gupta
2020-07-30  4:33 ` Pankaj Gupta

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