fs/coda: add error handling for fget
PATCH 1/1 fs/coda: add error handling for fget
When fget fails, the lack of error-handling code may cause unexpected results.
This patch adds error-handling code after calling fget.
Signed-off-by Zhouyang Jia <[email protected]>
--- fs/coda/psdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/coda/psdev.c +4 -1
@@ -187,8 +187,11 @@ 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; -if (!outp->oh.result) +if (!outp->oh.result) { outp->fh =fget (outp->fd); +if (!outp->fh) +return -EBADF ; + } }wake_up (&req->uc_sleep);
Signature · 1 line
2.7.4