Linux-NVDIMM Archive mirror
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: Michal Suchanek <msuchanek@suse.de>
Cc: linux-nvdimm@lists.01.org, Zhiqiang Liu <liuzhiqiang26@huawei.com>
Subject: Re: [PATCH ndctl] dimm: re-fix potential fd leakage in dimm_action()
Date: Mon, 15 Feb 2021 13:15:28 -0500	[thread overview]
Message-ID: <x49pn11ci4f.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <20210106144343.22099-1-msuchanek@suse.de> (Michal Suchanek's message of "Wed, 6 Jan 2021 15:43:43 +0100")

Michal Suchanek <msuchanek@suse.de> writes:

> There are cases not covered by the original fix and cases added by the
> latter patch.
>
> Also there is one case of usage added without returning from the
> function.
>
> Fixes: ff434d87ccbd ("dimm: fix potential fd leakage in dimm_action()")
> Fixes: 41a7e24af5db ("ndctl/dimm: Auto-arm firmware activation")
>
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---
>  ndctl/dimm.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/ndctl/dimm.c b/ndctl/dimm.c
> index 09ce49e1d2ca..1c177b5494ec 100644
> --- a/ndctl/dimm.c
> +++ b/ndctl/dimm.c
> @@ -1333,12 +1333,15 @@ static int dimm_action(int argc, const char **argv, struct ndctl_ctx *ctx,
>  	if (param.arm_set && param.disarm_set) {
>  		fprintf(stderr, "set either --arm, or --disarm, not both\n");
>  		usage_with_options(u, options);
> +		rc = -EINVAL;
> +		goto out_close_fout;

usage_with_options calls exit():

void usage_with_options(const char * const *usagestr,
                        const struct option *opts)
{
        usage_with_options_internal(usagestr, opts, 0);
        exit(129);
}

So I don't think this patch is necessary.

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

      reply	other threads:[~2021-02-15 18:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06 14:43 [PATCH ndctl] dimm: re-fix potential fd leakage in dimm_action() Michal Suchanek
2021-02-15 18:15 ` Jeff Moyer [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=x49pn11ci4f.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=liuzhiqiang26@huawei.com \
    --cc=msuchanek@suse.de \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).