Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2101687iof; Tue, 7 Jun 2022 19:48:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbmahqsjFlxtbAWnS4Kiry/eQLccK3fBD1DSXltdCRKoDr4Tzi4PxZDJ9F5qKi+M2DpvjU X-Received: by 2002:a63:cc53:0:b0:372:7d69:49fb with SMTP id q19-20020a63cc53000000b003727d6949fbmr28244884pgi.21.1654656491557; Tue, 07 Jun 2022 19:48:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654656491; cv=none; d=google.com; s=arc-20160816; b=EYa7zIex35n6gADJ0lhz9uRkmTy9Y+Yv5nIY3mSL/2TGsJ0Ddfk1+5UtoP4f/og3VZ chU3QY6AF7ehpNdOm2nznNVrkQLPKL4YuWVfhkdFo+oo5xg/ZWyErBQgRg0jeQN0ulJc GpUXcUZp/3SxD4NHS3WW6aGMF7gsNTLocuX5LZjidvP1XlWzvyUuwb6Ndwk1tSgLb7QW Ix8IpUKZXOdIrP1oGhtO8FqYatLzKGzM0cBON+eewSwBg2q7tpp7scnLuDkWTLogF4n8 TpWezZ0Ap4UdNnGzR/BopR7nc8+M2gXQnbvfaDNw8/IBh2nBvZOKisYTfEJ1vPqWPO2O VQUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TJ2hJdCkd0Cy52EKsDatKk3uvUAoWV7eiB0kl2BZE9E=; b=HKT4b82We8dhVdib9RbmIITymwfiifVpK9RJBamRic1t+L3SaRReN03YsdltD71BN3 eD+2jm/Udsfc+6V9m1nD4+RtqVU2cRws9BuNctQmyDChThqM9LbOL+gcimCq2aaiNQlk 0JJ0+ArI9kWwop/YtIHYYhRsj1buHmRNHwuTRFwOhT7a83MikDoHoz0PbSqZpyZJv6Ck 28O++pVwQQsIID5LVbG3o7iRm3TFU2endQBvkSmP5CsYz4ZdmP6dcZiw0d5rSyfJSD37 GeHpUp2ProaIabvUFOmwK9YOLQyuBJGGsQOEy40KWoJCDmU8keKemD6EALM0kcNQO9qh ntRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l+9GNFkc; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id je12-20020a170903264c00b0015f45278c31si23846218plb.233.2022.06.07.19.48.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 19:48:11 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l+9GNFkc; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7D83D277F92; Tue, 7 Jun 2022 18:18:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383867AbiFGWGm (ORCPT + 99 others); Tue, 7 Jun 2022 18:06:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379898AbiFGVGe (ORCPT ); Tue, 7 Jun 2022 17:06:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B4452122A0; Tue, 7 Jun 2022 11:50:35 -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 8932AB823A0; Tue, 7 Jun 2022 18:50:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4D9EC385A2; Tue, 7 Jun 2022 18:50:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627816; bh=1rMP8kZatU4ASe70FEHQC3m9PZKnZRDIpdNd/40kEeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l+9GNFkc4VvbjsD42sePFyIltijF4wdFZPi5CV1sg7sh8+txSRUk9kR/aVsL9IZPT ZrAyveAjbeSIKzmSELGyX0jaxAzSGAhGpPAvD4/rjum2NCZNhRJhyt/6wqQ+nfWYsK y9cIslDvWkrTo3RgiKdSYxNMd9NvfvLCeTJTOlMI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luca Weiss , Stanimir Varbanov , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.18 102/879] media: venus: hfi: avoid null dereference in deinit Date: Tue, 7 Jun 2022 18:53:40 +0200 Message-Id: <20220607165005.657321390@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Luca Weiss [ Upstream commit 86594f6af867b5165d2ba7b5a71fae3a5961e56c ] If venus_probe fails at pm_runtime_put_sync the error handling first calls hfi_destroy and afterwards hfi_core_deinit. As hfi_destroy sets core->ops to NULL, hfi_core_deinit cannot call the core_deinit function anymore. Avoid this null pointer derefence by skipping the call when necessary. Signed-off-by: Luca Weiss Signed-off-by: Stanimir Varbanov Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/qcom/venus/hfi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platform/qcom/venus/hfi.c index 4e2151fb47f0..1968f09ad177 100644 --- a/drivers/media/platform/qcom/venus/hfi.c +++ b/drivers/media/platform/qcom/venus/hfi.c @@ -104,6 +104,9 @@ int hfi_core_deinit(struct venus_core *core, bool blocking) mutex_lock(&core->lock); } + if (!core->ops) + goto unlock; + ret = core->ops->core_deinit(core); if (!ret) -- 2.35.1