Merge "msm: ipa3: Fix race condition during teardwon pipe"

This commit is contained in:
qctecmdr 2020-10-27 18:01:51 -07:00 committed by Gerrit - the friendly Code Review server
commit 625c41160e
2 changed files with 10 additions and 5 deletions

View File

@ -4008,6 +4008,12 @@ int gsi_poll_n_channel(unsigned long chan_hdl,
return -GSI_STATUS_UNSUPPORTED_OP;
}
/* Before going to poll packet make sure it was in allocated state */
if (unlikely(ctx->state == GSI_CHAN_STATE_NOT_ALLOCATED)) {
GSIERR("bad state %d\n", ctx->state);
return -GSI_STATUS_UNSUPPORTED_OP;
}
if (!ctx->evtr) {
GSIERR("no event ring associated chan_hdl=%lu\n", chan_hdl);
return -GSI_STATUS_UNSUPPORTED_OP;

View File

@ -1479,11 +1479,10 @@ int ipa3_teardown_sys_pipe(u32 clnt_hdl)
return result;
}
if (ep->sys->napi_obj) {
do {
usleep_range(95, 105);
} while (atomic_read(&ep->sys->curr_polling_state));
}
/* Wait untill end point moving to interrupt mode before teardown */
do {
usleep_range(95, 105);
} while (atomic_read(&ep->sys->curr_polling_state));
if (IPA_CLIENT_IS_CONS(ep->client))
cancel_delayed_work_sync(&ep->sys->replenish_rx_work);