From: Stefan Wahren Date: Thu, 25 May 2017 22:26:25 +0000 (+0200) Subject: staging: vchiq_core: Bail out in case of invalid tx_pos X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d1eab9dec6108e68d43d869a3b6645cc1df3fa9d;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git staging: vchiq_core: Bail out in case of invalid tx_pos Properly handle the error case in case of an invalid tx_pos. Signed-off-by: Stefan Wahren Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index b0119b80b776..c61f5ac18b93 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -600,8 +600,10 @@ reserve_space(VCHIQ_STATE_T *state, size_t space, int is_blocking) return NULL; /* No space available */ } - BUG_ON(tx_pos == - (state->slot_queue_available * VCHIQ_SLOT_SIZE)); + if (tx_pos == (state->slot_queue_available * VCHIQ_SLOT_SIZE)) { + pr_warn("%s: invalid tx_pos: %d\n", __func__, tx_pos); + return NULL; + } slot_index = local->slot_queue[ SLOT_QUEUE_INDEX_FROM_POS(tx_pos) &