public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Aditya Pakki <pakki001@umn.edu>
Cc: kjlu@umn.edu, Jan Kara <jack@suse.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] udf: Fix to check the return value of load_nls
Date: Tue, 19 Mar 2019 09:52:59 +0100	[thread overview]
Message-ID: <20190319085259.GD17334@quack2.suse.cz> (raw)
In-Reply-To: <20190319025950.18311-1-pakki001@umn.edu>

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

      reply	other threads:[~2019-03-19  8:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190319085259.GD17334@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=jack@suse.com \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pakki001@umn.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox