[Top] [All Lists]

Re: [PATCH] xfs_io: don't leak fd in open -Tr failure case

To: Eric Sandeen <sandeen@xxxxxxxxxxx>
Subject: Re: [PATCH] xfs_io: don't leak fd in open -Tr failure case
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Thu, 27 Feb 2014 12:34:13 -0800
Cc: Eric Sandeen <sandeen@xxxxxxxxxx>, xfs-oss <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <530FA0EF.50301@xxxxxxxxxxx>
References: <530F9F37.8020408@xxxxxxxxxx> <530FA0EF.50301@xxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
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@xxxxxx>

(with a better description)

<Prev in Thread] Current Thread [Next in Thread>