Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp441695iog; Mon, 13 Jun 2022 06:05:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzecDADS7tkceAudgYHmTGct2QhY+XIofdhF3JE1Abf6wFWlVA8IU5AAX/7vdsuYo6MXW+i X-Received: by 2002:a17:906:3e8e:b0:70f:9a81:8218 with SMTP id a14-20020a1709063e8e00b0070f9a818218mr44981051ejj.525.1655125517038; Mon, 13 Jun 2022 06:05:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125517; cv=none; d=google.com; s=arc-20160816; b=wYTr6txXISCRiZ9qpTfWkgkMXUtA4QtatSI7Z35oCPjZiqiW9CAARfoa+LrfsQtMWw lK7fSbUZ9RawgdZRzOqvAOY2+C2SPduckjwX9+cJQmpnN+Ms3urwcmZQ9UnaOrtnMZVc /YM8C8Cj36V/Ph1U1c8Z5lEgvjkxhOJHrjWMLm0fo6qVSQYY7q8Myy6pUgr/DUOprD4E JxRljeoxkyOeV865Z9+GijqvyFnkix/HeFduk3HIDsN6xVfxpb/cPOl5qOi9onVA/ZTx trpZbvKq2PaITSSjD3CEuk09GFafrDvKo4uQ44OwWCEUNy1uYClqYzlHKVb0EVF97EGl sNOQ== 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=LYMedo3DRMeRF5+88UV+HesgHvcqJgQBXs+g9XlaFvw=; b=bLEH82AliLnX+6TOxwItzFUpdhTy2i29AN05kfxmk20Z5EaO3vd9f6tF1FFR7jPAN4 ThYcQJTzl+3zJmcZRVhPvEB/DqgNIxxqhVLFCLc1mXhrPMAzW4j5vQDJfHKhnXkEGJkd Zh9DDLEJlq03poLFwG3XBhBch3yUpUR0x71xfvvQj+OMasn/+umwYrdxfqXUVy0eawvP q96YxblPUfZizi2vtm2uzb9DsvYu+cPRvc/kvh+8awVS9RtIl9pWfsYMmxemvXA/4o7d rOGQJVz768EYhVDefCa3Sr0OXdNOFUTeR0rrpYHgfBzMIZYE5yPCoXeC25MMo981uY6E KrEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="THo3M/PL"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cb24-20020a0564020b7800b0042b38edaa53si6851809edb.293.2022.06.13.06.04.51; Mon, 13 Jun 2022 06:05:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="THo3M/PL"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350390AbiFMK6l (ORCPT + 99 others); Mon, 13 Jun 2022 06:58:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350065AbiFMKyl (ORCPT ); Mon, 13 Jun 2022 06:54:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0516DFBE; Mon, 13 Jun 2022 03:28:58 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 5E05860B8B; Mon, 13 Jun 2022 10:28:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CFC0C34114; Mon, 13 Jun 2022 10:28:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655116137; bh=w45OzuGuLmtj9sEylkHgxYIfZXvDGqEsrxVIkJCabSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=THo3M/PLQzGCqGF1tticXNQ+goG+uu+ooIj1+3WNXChtRYIUN7YUkUeJJCmNp+JMm 0pAlI/f8nUhLahE0cWLN45UCN2DzW420oh1WFZGcYrEm8yIcNBl5lOFf92S9WSunjz 628j1/S9D0QilTjUplGeuYeSgIuncmjWLsRVLvVA= 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.4 026/411] media: venus: hfi: avoid null dereference in deinit Date: Mon, 13 Jun 2022 12:04:59 +0200 Message-Id: <20220613094929.286618788@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@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=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 3d8b1284d1f3..68964a80fe61 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