]> Git Repo - linux.git/commitdiff
rpmsg: glink: Avoid dereferencing NULL channel
authorBjorn Andersson <[email protected]>
Mon, 17 Jul 2023 16:55:38 +0000 (09:55 -0700)
committerMathieu Poirier <[email protected]>
Tue, 18 Jul 2023 16:12:26 +0000 (10:12 -0600)
The newly introduced signal command handler checks for non-existing
channel and print an error message, but then continues on to dereference
that same channel.

Instead abort the handler when no channel is found.

Fixes: a2b73aa512a4 ("rpmsg: glink: Add support to handle signals command")
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Closes: https://lore.kernel.org/r/[email protected]/
Signed-off-by: Bjorn Andersson <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mathieu Poirier <[email protected]>
drivers/rpmsg/qcom_glink_native.c

index e10c05ed21bbd2b2ddfbc3692ddf107f831f2bbd..82d460ff477718e5a847401186e8b7ca6e4fbe7a 100644 (file)
@@ -1070,8 +1070,10 @@ static void qcom_glink_handle_signals(struct qcom_glink *glink,
        spin_lock_irqsave(&glink->idr_lock, flags);
        channel = idr_find(&glink->rcids, rcid);
        spin_unlock_irqrestore(&glink->idr_lock, flags);
-       if (!channel)
+       if (!channel) {
                dev_err(glink->dev, "signal for non-existing channel\n");
+               return;
+       }
 
        enable = sigs & NATIVE_DSR_SIG || sigs & NATIVE_CTS_SIG;
 
This page took 0.058489 seconds and 4 git commands to generate.