]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
staging: vchiq_core: Bail out in case of invalid tx_pos
authorStefan Wahren <stefan.wahren@i2se.com>
Thu, 25 May 2017 22:26:25 +0000 (00:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 29 May 2017 15:04:13 +0000 (17:04 +0200)
Properly handle the error case in case of an invalid tx_pos.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c

index b0119b80b776a1f596b0e7bbe35778c5a8bcf60a..c61f5ac18b935ee76506eed3981c1bfcf37f3dee 100644 (file)
@@ -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) &