drivers/rapidio/rio_cm.c: fix potential oops in riocm_ch_listen()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 8 Mar 2019 00:29:33 +0000 (16:29 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jan 2020 09:24:18 +0000 (10:24 +0100)
commit743f4da870bf40b11101be0177ed8ea9e86fceeb
tree63065b9fbbe56e901da18523218d5d9da1376d04
parent285313274df7c8c99fad7d793d1396534302b587
drivers/rapidio/rio_cm.c: fix potential oops in riocm_ch_listen()

[ Upstream commit 5ac188b12e7cbdd92dee60877d1fac913fc1d074 ]

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 <dan.carpenter@oracle.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Alexandre Bounine <alexandre.bounine@idt.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/rapidio/rio_cm.c