staging: vchiq_core: Fix missing semaphore release in error case
authorStefan Wahren <stefan.wahren@i2se.com>
Sat, 31 Mar 2018 20:09:37 +0000 (22:09 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Aug 2018 05:50:39 +0000 (07:50 +0200)
[ Upstream commit 8113b89fc615cfb531df0334fb3a091cf6a45ce0 ]

The bail out branch in case of a invalid tx_pos missed a semaphore
release. Dan Carpenter found this with a static checker.

Fixes: d1eab9dec610 ("staging: vchiq_core: Bail out in case of invalid tx_pos")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c

index 486be99..a457034 100644 (file)
@@ -601,6 +601,7 @@ reserve_space(VCHIQ_STATE_T *state, size_t space, int is_blocking)
                }
 
                if (tx_pos == (state->slot_queue_available * VCHIQ_SLOT_SIZE)) {
+                       up(&state->slot_available_event);
                        pr_warn("%s: invalid tx_pos: %d\n", __func__, tx_pos);
                        return NULL;
                }