From: NeilBrown <neilb@suse.de>
To: Jes.Sorensen@redhat.com
Cc: linux-raid@vger.kernel.org
Subject: Re: [PATCH] Avoid double close()
Date: Wed, 31 Jul 2013 08:52:56 +1000 [thread overview]
Message-ID: <20130731085256.5774273f@notabene.brown> (raw)
In-Reply-To: <1375201803-9797-1-git-send-email-Jes.Sorensen@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 779 bytes --]
On Tue, 30 Jul 2013 18:30:03 +0200 Jes.Sorensen@redhat.com wrote:
> From: Jes Sorensen <Jes.Sorensen@redhat.com>
>
> Coverity discovered a possible double close(fd2) in Grow.c. Avoided by
> invalidating fd2 after the first close.
>
> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
> ---
> Grow.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/Grow.c b/Grow.c
> index c1ae6e8..ff4ed5d 100644
> --- a/Grow.c
> +++ b/Grow.c
> @@ -4685,6 +4685,8 @@ int Grow_continue_command(char *devname, int fd,
> continue;
> err = st->ss->load_super(st, fd2, NULL);
> close(fd2);
> + /* invalidate fd2 to avoid possible double close() */
> + fd2 = -1;
> if (err)
> continue;
> break;
Applied, thanks.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
prev parent reply other threads:[~2013-07-30 22:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-30 16:30 [PATCH] Avoid double close() Jes.Sorensen
2013-07-30 22:52 ` NeilBrown [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=20130731085256.5774273f@notabene.brown \
--to=neilb@suse.de \
--cc=Jes.Sorensen@redhat.com \
--cc=linux-raid@vger.kernel.org \
/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 NNTP newsgroup(s).