gsi: Fix NULL pointer dereference on event-less channels

If gsi_start_channel() or gsi_stop_channel() are called
on a channel with no event ring allocated, there will be
null pointer dereference error.
Adding null pointer check.

Change-Id: I200aa09f49c2394041f66c33c458f7daa9aeaf8c
Signed-off-by: Ilia Lin <ilial@codeaurora.org>
This commit is contained in:
Ilia Lin
2020-07-13 12:04:33 +03:00
parent 8ca7410b47
commit 554a879753

View File

@@ -2991,7 +2991,8 @@ int gsi_start_channel(unsigned long chan_hdl)
/* check if INTSET is in IRQ mode for GPI channel */
val = gsi_readl(gsi_ctx->base +
GSI_EE_n_CNTXT_INTSET_OFFS(gsi_ctx->per.ee));
if (ctx->evtr->props.intf == GSI_EVT_CHTYPE_GPI_EV &&
if (ctx->evtr &&
ctx->evtr->props.intf == GSI_EVT_CHTYPE_GPI_EV &&
val != GSI_INTR_IRQ) {
GSIERR("GSI_EE_n_CNTXT_INTSET_OFFS %d\n", val);
BUG();
@@ -3074,7 +3075,8 @@ int gsi_stop_channel(unsigned long chan_hdl)
/* check if INTSET is in IRQ mode for GPI channel */
val = gsi_readl(gsi_ctx->base +
GSI_EE_n_CNTXT_INTSET_OFFS(gsi_ctx->per.ee));
if (ctx->evtr->props.intf == GSI_EVT_CHTYPE_GPI_EV &&
if (ctx->evtr &&
ctx->evtr->props.intf == GSI_EVT_CHTYPE_GPI_EV &&
val != GSI_INTR_IRQ) {
GSIERR("GSI_EE_n_CNTXT_INTSET_OFFS %d\n", val);
BUG();