OSDN Git Service

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>
Mon, 27 Jan 2020 13:50:31 +0000 (14:50 +0100)
commit5f4144822d2adf5449ad6b835eaad25eb00589fa
tree8d11c3c8d078a7139780c3450d53fb35ded2e01e
parentdd123c299c304ef782205adbc27d96473cb67e12
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