Skip to content

Commit d629e5b

Browse files
quic-bjorandemathieupoirier
authored andcommitted
rpmsg: glink: Avoid dereferencing NULL channel
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: a2b73aa ("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]>
1 parent b5c9ee8 commit d629e5b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/rpmsg/qcom_glink_native.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,8 +1070,10 @@ static void qcom_glink_handle_signals(struct qcom_glink *glink,
10701070
spin_lock_irqsave(&glink->idr_lock, flags);
10711071
channel = idr_find(&glink->rcids, rcid);
10721072
spin_unlock_irqrestore(&glink->idr_lock, flags);
1073-
if (!channel)
1073+
if (!channel) {
10741074
dev_err(glink->dev, "signal for non-existing channel\n");
1075+
return;
1076+
}
10751077

10761078
enable = sigs & NATIVE_DSR_SIG || sigs & NATIVE_CTS_SIG;
10771079

0 commit comments

Comments
 (0)