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:
4b04700
)
drivers/rapidio/rio_cm.c: fix potential oops in riocm_ch_listen()
author
Dan Carpenter
<
[email protected]
>
Fri, 8 Mar 2019 00:29:33 +0000
(16:29 -0800)
committer
Linus Torvalds
<
[email protected]
>
Fri, 8 Mar 2019 02:32:01 +0000
(18:32 -0800)
If riocm_get_channel() fails, then we should just return -EINVAL.
Calling riocm_put_channel() will trigger a NULL dereference and
generally we should call put() if the get() didn't succeed.
Link:
http://lkml.kernel.org/r/20190110130230.GB27017@kadam
Fixes: b6e8d4aa1110 ("rapidio: add RapidIO channelized messaging driver")
Signed-off-by: Dan Carpenter <
[email protected]
>
Reviewed-by: Andrew Morton <
[email protected]
>
Cc: Matt Porter <
[email protected]
>
Cc: Alexandre Bounine <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
drivers/rapidio/rio_cm.c
patch
|
blob
|
history
diff --git
a/drivers/rapidio/rio_cm.c
b/drivers/rapidio/rio_cm.c
index bad0e0ea4f3059e51b6cfaffc78c859c1be3aecb..cf45829585cb4a0faa6aa89345bf1d89572fa236 100644
(file)
--- a/
drivers/rapidio/rio_cm.c
+++ b/
drivers/rapidio/rio_cm.c
@@
-1215,7
+1215,9
@@
static int riocm_ch_listen(u16 ch_id)
riocm_debug(CHOP, "(ch_%d)", ch_id);
ch = riocm_get_channel(ch_id);
- if (!ch || !riocm_cmp_exch(ch, RIO_CM_CHAN_BOUND, RIO_CM_LISTEN))
+ if (!ch)
+ return -EINVAL;
+ if (!riocm_cmp_exch(ch, RIO_CM_CHAN_BOUND, RIO_CM_LISTEN))
ret = -EINVAL;
riocm_put_channel(ch);
return ret;