diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2017-01-28 00:47:01 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-01-28 00:47:01 -0800 |
commit | bbfe37512bbcad7829764001cda82265fe7f09f3 (patch) | |
tree | e17385dd53460e5846e3ee9ffb489a033fd0c737 | |
parent | 0c3a0adf9b0edecde62caca362ebab3ca06b21c3 (diff) | |
parent | 170979c4fd7c824e7c40b0c0fc3c77b1d4ba1bb5 (diff) |
Merge "msm: gsi: fix event ring handle in gsi_alloc_channel"
-rw-r--r-- | drivers/platform/msm/gsi/gsi.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/platform/msm/gsi/gsi.c b/drivers/platform/msm/gsi/gsi.c index f32d3d9646c1..fd241f6b62da 100644 --- a/drivers/platform/msm/gsi/gsi.c +++ b/drivers/platform/msm/gsi/gsi.c @@ -1591,15 +1591,21 @@ int gsi_alloc_channel(struct gsi_chan_props *props, unsigned long dev_hdl, return -GSI_STATUS_INVALID_PARAMS; } - if (props->evt_ring_hdl != ~0 && - atomic_read(&gsi_ctx->evtr[props->evt_ring_hdl].chan_ref_cnt) && - gsi_ctx->evtr[props->evt_ring_hdl].props.exclusive) { - GSIERR("evt ring=%lu already in exclusive use chan_hdl=%p\n", + if (props->evt_ring_hdl != ~0) { + if (props->evt_ring_hdl >= GSI_EVT_RING_MAX) { + GSIERR("invalid evt ring=%lu\n", props->evt_ring_hdl); + return -GSI_STATUS_INVALID_PARAMS; + } + + if (atomic_read( + &gsi_ctx->evtr[props->evt_ring_hdl].chan_ref_cnt) && + gsi_ctx->evtr[props->evt_ring_hdl].props.exclusive) { + GSIERR("evt ring=%lu exclusively used by chan_hdl=%p\n", props->evt_ring_hdl, chan_hdl); - return -GSI_STATUS_UNSUPPORTED_OP; + return -GSI_STATUS_UNSUPPORTED_OP; + } } - ctx = &gsi_ctx->chan[props->ch_id]; if (ctx->allocated) { GSIERR("chan %d already allocated\n", props->ch_id); |