Skip to content
/ linux Public

Commit 70d9bd9

Browse files
cris-magregkh
authored andcommitted
firmware: arm_scmi: Fix NULL dereference on notify error path
[ Upstream commit 555317d ] Since commit b5daf93 ("firmware: arm_scmi: Avoid notifier registration for unsupported events") the call chains leading to the helper __scmi_event_handler_get_ops expect an ERR_PTR to be returned on failure to get an handler for the requested event key, while the current helper can still return a NULL when no handler could be found or created. Fix by forcing an ERR_PTR return value when the handler reference is NULL. Fixes: b5daf93 ("firmware: arm_scmi: Avoid notifier registration for unsupported events") Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Message-Id: <20260305131011.541444-1-cristian.marussi@arm.com> Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d282757 commit 70d9bd9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/firmware/arm_scmi/notify.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ static int scmi_register_event_handler(struct scmi_notify_instance *ni,
10661066
* since at creation time we usually want to have all setup and ready before
10671067
* events really start flowing.
10681068
*
1069-
* Return: A properly refcounted handler on Success, NULL on Failure
1069+
* Return: A properly refcounted handler on Success, ERR_PTR on Failure
10701070
*/
10711071
static inline struct scmi_event_handler *
10721072
__scmi_event_handler_get_ops(struct scmi_notify_instance *ni,
@@ -1113,7 +1113,7 @@ __scmi_event_handler_get_ops(struct scmi_notify_instance *ni,
11131113
}
11141114
mutex_unlock(&ni->pending_mtx);
11151115

1116-
return hndl;
1116+
return hndl ?: ERR_PTR(-ENODEV);
11171117
}
11181118

11191119
static struct scmi_event_handler *

0 commit comments

Comments
 (0)