The patch titled Subject: drivers/rapidio/rio_cm.c: fix potential oops in riocm_ch_listen() has been added to the -mm tree. Its filename is rapidio-potential-oops-in-riocm_ch_listen.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/rapidio-potential-oops-in-riocm_ch_listen.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/rapidio-potential-oops-in-riocm_ch_listen.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Subject: drivers/rapidio/rio_cm.c: fix potential oops in riocm_ch_listen() 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@xxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Matt Porter <mporter@xxxxxxxxxxxxxxxxxxx> Cc: Alexandre Bounine <alexandre.bounine@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/drivers/rapidio/rio_cm.c~rapidio-potential-oops-in-riocm_ch_listen +++ a/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; _ Patches currently in -mm which might be from dan.carpenter@xxxxxxxxxx are rapidio-potential-oops-in-riocm_ch_listen.patch