projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f90fb3c
)
coda: add error handling for fget
author
Zhouyang Jia
<
[email protected]
>
Tue, 16 Jul 2019 23:28:13 +0000
(16:28 -0700)
committer
Linus Torvalds
<
[email protected]
>
Wed, 17 Jul 2019 02:23:23 +0000
(19:23 -0700)
When fget fails, the lack of error-handling code may cause unexpected
results.
This patch adds error-handling code after calling fget.
Link:
http://lkml.kernel.org/r/2514ec03df9c33b86e56748513267a80dd8004d9.1558117389.git.jaharkes@cs.cmu.edu
Signed-off-by: Zhouyang Jia <
[email protected]
>
Signed-off-by: Jan Harkes <
[email protected]
>
Cc: Arnd Bergmann <
[email protected]
>
Cc: Colin Ian King <
[email protected]
>
Cc: Dan Carpenter <
[email protected]
>
Cc: David Howells <
[email protected]
>
Cc: Fabian Frederick <
[email protected]
>
Cc: Mikko Rapeli <
[email protected]
>
Cc: Sam Protsenko <
[email protected]
>
Cc: Yann Droneaud <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
fs/coda/psdev.c
patch
|
blob
|
history
diff --git
a/fs/coda/psdev.c
b/fs/coda/psdev.c
index 0ceef32e6fae0c986bb4921799f1256ccfb12e96..241f7e04ad04d0674540e72b39c9911f72c23bcd 100644
(file)
--- a/
fs/coda/psdev.c
+++ b/
fs/coda/psdev.c
@@
-182,8
+182,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);