All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Eric Sandeen <sandeen@sandeen.net>
Cc: Eric Sandeen <sandeen@redhat.com>, xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH] xfs_io: don't leak fd in open -Tr failure case
Date: Thu, 27 Feb 2014 12:34:13 -0800	[thread overview]
Message-ID: <20140227203413.GA4568@infradead.org> (raw)
In-Reply-To: <530FA0EF.50301@sandeen.net>

On Thu, Feb 27, 2014 at 02:32:47PM -0600, Eric Sandeen wrote:
> On 2/27/14, 2:25 PM, Eric Sandeen wrote:
> > Coverity spotted this.
> > 
> > It complained that we didn't close the fd before returning in
> > this case of incompatible options, but it seems like we should
> > just test for the incompatible flags before even trying to open
> > the file, no?
> > 
> > (The open would have failed in any case, but with a somewhat
> > cryptic "Invalid argument" - so it's probably better to state
> > it plainly and bail immediately.)
> 
> So actually, we wouldn't leak, because the open would fail.
> So I guess it's not the best subject & description...

It's not, but doing the check earlier seems sensible.

Reviewed-by: Christoph Hellwig <hch@lst.de>

(with a better description)

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2014-02-27 20:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-27 20:25 [PATCH] xfs_io: don't leak fd in open -Tr failure case Eric Sandeen
2014-02-27 20:32 ` Eric Sandeen
2014-02-27 20:34   ` Christoph Hellwig [this message]
2014-02-27 20:41 ` [PATCH V2] xfs_io: test for invalid -Tr flag combination before open Eric Sandeen

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=20140227203413.GA4568@infradead.org \
    --to=hch@infradead.org \
    --cc=sandeen@redhat.com \
    --cc=sandeen@sandeen.net \
    --cc=xfs@oss.sgi.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.