From 38c2e4370da495813ca93d7cad31ed5090e8c310 Mon Sep 17 00:00:00 2001 From: Jan Harkes Date: Thu, 19 Jul 2007 01:48:41 -0700 Subject: 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/coda/file.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'fs/coda/file.c') diff --git a/fs/coda/file.c b/fs/coda/file.c index 99dbe86..e7d6227 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; -- cgit v1.1