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/psdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'fs/coda/psdev.c') diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index 803aacf0d49..09382d47a4e 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, if (req->uc_opcode == CODA_OPEN_BY_FD) { struct coda_open_by_fd_out *outp = (struct coda_open_by_fd_out *)req->uc_data; - outp->fh = fget(outp->fd); + if (!outp->oh.result) + outp->fh = fget(outp->fd); } wake_up(&req->uc_sleep); -- cgit v1.2.3