diff options
author | Jan Harkes <jaharkes@cs.cmu.edu> | 2007-07-19 04:48:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 13:04:48 -0400 |
commit | 38c2e4370da495813ca93d7cad31ed5090e8c310 (patch) | |
tree | bf48c4a17f3f2f7cf17a20e37f55f898a332a2c7 /fs/coda/psdev.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/psdev.c')
-rw-r--r-- | fs/coda/psdev.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index 803aacf0d49c..09382d47a4e1 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c | |||
@@ -195,7 +195,8 @@ static ssize_t coda_psdev_write(struct file *file, const char __user *buf, | |||
195 | if (req->uc_opcode == CODA_OPEN_BY_FD) { | 195 | if (req->uc_opcode == CODA_OPEN_BY_FD) { |
196 | struct coda_open_by_fd_out *outp = | 196 | struct coda_open_by_fd_out *outp = |
197 | (struct coda_open_by_fd_out *)req->uc_data; | 197 | (struct coda_open_by_fd_out *)req->uc_data; |
198 | outp->fh = fget(outp->fd); | 198 | if (!outp->oh.result) |
199 | outp->fh = fget(outp->fd); | ||
199 | } | 200 | } |
200 | 201 | ||
201 | wake_up(&req->uc_sleep); | 202 | wake_up(&req->uc_sleep); |