linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] udf: Fix to check the return value of load_nls
@ 2019-03-19  2:59 Aditya Pakki
  2019-03-19  8:52 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Aditya Pakki @ 2019-03-19  2:59 UTC (permalink / raw)
  To: pakki001; +Cc: kjlu, Jan Kara, linux-kernel

load_nls may fail and return an error message. The patch checks
for such a scenario and passes the error upstream.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
 fs/udf/super.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/udf/super.c b/fs/udf/super.c
index ffd8038ff728..1a38271de6d9 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -573,6 +573,8 @@ static int udf_parse_options(char *options, struct udf_options *uopt,
 				if (uopt->nls_map)
 					unload_nls(uopt->nls_map);
 				uopt->nls_map = load_nls(args[0].from);
+				if (!uopt->nls_map)
+					return 0;
 				uopt->flags |= (1 << UDF_FLAG_NLS_MAP);
 			}
 			break;
-- 
2.17.1


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

* Re: [PATCH] udf: Fix to check the return value of load_nls
  2019-03-19  2:59 [PATCH] udf: Fix to check the return value of load_nls Aditya Pakki
@ 2019-03-19  8:52 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2019-03-19  8:52 UTC (permalink / raw)
  To: Aditya Pakki; +Cc: kjlu, Jan Kara, linux-kernel

On Mon 18-03-19 21:59:49, Aditya Pakki wrote:
> load_nls may fail and return an error message. The patch checks
> for such a scenario and passes the error upstream.
> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>

Thanks for the patch! But there's other code handling nls_map in
udf_fill_super() which takes care about this situation:

        if ((uopt.flags & (1 << UDF_FLAG_NLS_MAP)) && !uopt.nls_map) {
                uopt.nls_map = load_nls_default();
                if (!uopt.nls_map)
                        uopt.flags &= ~(1 << UDF_FLAG_NLS_MAP);
                else
                        udf_debug("Using default NLS map\n");
        }

So if we failed to load nls map admin originally requested, we fall back to
a default nls map or just don't load anything. It is questionable whether
we shouldn't fail mount rather than trying to continue with a different nls
map but at this point I don't see a strong reason to change the current
behavior users can depend on...

I've added a comment to udf_parse_options() to explain the code flow.

								Honza

> ---
>  fs/udf/super.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/udf/super.c b/fs/udf/super.c
> index ffd8038ff728..1a38271de6d9 100644
> --- a/fs/udf/super.c
> +++ b/fs/udf/super.c
> @@ -573,6 +573,8 @@ static int udf_parse_options(char *options, struct udf_options *uopt,
>  				if (uopt->nls_map)
>  					unload_nls(uopt->nls_map);
>  				uopt->nls_map = load_nls(args[0].from);
> +				if (!uopt->nls_map)
> +					return 0;
>  				uopt->flags |= (1 << UDF_FLAG_NLS_MAP);
>  			}
>  			break;
> -- 
> 2.17.1
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

end of thread, other threads:[~2019-03-19  8:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-19  2:59 [PATCH] udf: Fix to check the return value of load_nls Aditya Pakki
2019-03-19  8:52 ` Jan Kara

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