From patchwork Wed May 4 16:45:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 569711 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD219C433F5 for ; Wed, 4 May 2022 17:08:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355895AbiEDRMb (ORCPT ); Wed, 4 May 2022 13:12:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356906AbiEDRJs (ORCPT ); Wed, 4 May 2022 13:09:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C75F47066; Wed, 4 May 2022 09:56:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 95C6AB827A3; Wed, 4 May 2022 16:56:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FC29C385AA; Wed, 4 May 2022 16:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683381; bh=3hl5Abyr5dqFZ/zVqmKDc6D8kC4kQ2wP/P9hBWlUJCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pscxf8jWR3/Ue76JBwcnW3uYbBYOz9YnxBLMkJyrx/xUJnOfCZYPQDODQDsfBT0Dp IdHFMkLIu6bmuDQ36JPItmcuaPysTcO6dyh/2snI5WoKJa7A8/Vr+YbcpmdACIY/L8 DE3Sf7L/nRr53eoCEvX3ZRAoJBlu91fVOCy5qKcM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dongliang Mu , Jens Wiklander , Sasha Levin Subject: [PATCH 5.17 066/225] tee: optee: add missing mutext_destroy in optee_ffa_probe Date: Wed, 4 May 2022 18:45:04 +0200 Message-Id: <20220504153116.059763982@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153110.096069935@linuxfoundation.org> References: <20220504153110.096069935@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dongliang Mu [ Upstream commit b5e22886839ae466fcf03295150094516c0fd8eb ] The error handling code of optee_ffa_probe misses the mutex_destroy of ffa.mutex when mutext_init succeeds. Fix this by adding mutex_destory of ffa.mutex at the error handling part Fixes: aceeafefff73 ("optee: use driver internal tee_context for some rpc") Signed-off-by: Dongliang Mu Signed-off-by: Jens Wiklander Signed-off-by: Sasha Levin --- drivers/tee/optee/ffa_abi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c index f744ab15bf2c..30a6119a2b16 100644 --- a/drivers/tee/optee/ffa_abi.c +++ b/drivers/tee/optee/ffa_abi.c @@ -894,6 +894,7 @@ static int optee_ffa_probe(struct ffa_device *ffa_dev) rhashtable_free_and_destroy(&optee->ffa.global_ids, rh_free_fn, NULL); optee_supp_uninit(&optee->supp); mutex_destroy(&optee->call_queue.mutex); + mutex_destroy(&optee->ffa.mutex); err_unreg_supp_teedev: tee_device_unregister(optee->supp_teedev); err_unreg_teedev: