diff options
author | Jan Harkes <jaharkes@cs.cmu.edu> | 2007-07-19 01:48:41 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 10:04:48 -0700 |
commit | 38c2e4370da495813ca93d7cad31ed5090e8c310 (patch) | |
tree | bf48c4a17f3f2f7cf17a20e37f55f898a332a2c7 /fs/coda/file.c | |
parent | 18991197b4b588255ccabf472ebc84db7b66a19c (diff) |
coda: do not grab an uninitialized fd when the open upcall returns an error
When open fails the fd in the response is uninitialized and we ended up taking
a reference on the file struct and never released it.
Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/coda/file.c')
-rw-r--r-- | fs/coda/file.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/coda/file.c b/fs/coda/file.c index 99dbe866816d..e7d622709c90 100644 --- a/fs/coda/file.c +++ b/fs/coda/file.c @@ -143,8 +143,11 @@ int coda_open(struct inode *coda_inode, struct file *coda_file) lock_kernel(); error = venus_open(coda_inode->i_sb, coda_i2f(coda_inode), coda_flags, - &host_file); - if (error || !host_file) { + &host_file); + if (!host_file) + error = -EIO; + + if (error) { kfree(cfi); unlock_kernel(); return error; |