Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp4682370pxv; Tue, 20 Jul 2021 09:14:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyq+YxzN29edSGTvAAth44ZcrHmw5CcfNng0vv3+XSpCyI68vE7gmG1O6jDP23CfA7VM4WA X-Received: by 2002:a92:d8d2:: with SMTP id l18mr21294874ilo.165.1626797646993; Tue, 20 Jul 2021 09:14:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626797646; cv=none; d=google.com; s=arc-20160816; b=A9xh9d7Wac2SDy5S3STW9are0EBQwW10a2NdGXOwjdmYhkRC19/ATqhs+EaNqry27W G1h/PhZONF1n6v4+Z+mK5feCdaftlteGkrhqoeAfynEPWNyHfT5LSC30xyGDB/eJSBth MX7OJ79kjXWVpb4Sz+hp+Ciit6uqjxVPPLbe993YGicd+bnCemr8agd7JfiBTJ7Xd3xr J3I/ThAMF9g9eGus0rW9ny7Q92WO82ompEX65tgqBKF238wzEgno/nPe45Wyh9tQu8Kt vo1tdAd67lrWxCUN9Oc6D9xIqmiL//6h0uHSDepATaSNSXmtX6U6GYxvwIl4S1qJd5ZT OOzA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=BamL6ieKcOJ11og7wi6bzdOGpaM7S+jvOc9FCtOg8M8=; b=EwxiiiKJcSQ19+Nws7oKxtwJDa+EVQTtw4qVapNYkHuCGP+eyKY2WFZy5pKXi6Yar+ 50NrNGVZUR6ib+dr8w1CzaqLEAdAqaGDcNW/0nGLOkMQKbC4Bz/eYz5p/NQkFwJ6Yvgv EpYRCguhCYQxIrHPVa7/mFwR1qnyEsGmvgZ/B215yM0arFDpsVtRRRfTApckx9TchhLO 7YVFz2VAqOubyxOGyL0svm6hIpUsuqPU8c3wvXUG12cj8T6KH1ASDvCBpg1vok4CK6fC FlQnxmyggHasv00dnKLr9q8ou+eN+lirC9Z4AT/pxk6zkC4ooXdSfwDt2hgSown+NOzq vm+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=NyfLiqeb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q17si24722354ilm.115.2021.07.20.09.13.54; Tue, 20 Jul 2021 09:14:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=NyfLiqeb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230080AbhGTPcW (ORCPT + 99 others); Tue, 20 Jul 2021 11:32:22 -0400 Received: from smtp-relay-canonical-0.canonical.com ([185.125.188.120]:39970 "EHLO smtp-relay-canonical-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238592AbhGTP1X (ORCPT ); Tue, 20 Jul 2021 11:27:23 -0400 Received: from localhost (1.general.cking.uk.vpn [10.172.193.212]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 65E4C405FC; Tue, 20 Jul 2021 16:07:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1626797280; bh=BamL6ieKcOJ11og7wi6bzdOGpaM7S+jvOc9FCtOg8M8=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=NyfLiqebzsym5tHDre5MuWTGGfK9ZUZ2cmBcjhN2wcgbuiCv5eUZFfLq+eZHn2L/i ZVl8gZeIr2MoF+Q77zTFpILtEQK8awIOFz5H6wVC7IL9mHlzlENMYDGwsfP4TdkWvB tvGOVz1p/h+pazRcJWxCugaWoCEVzn10CUqkAt0YXzh/rcx6FDXoZaXBN6yWDXuqrH x5anBAj6g/FSJVTS6lXGYqK5P0CHjNMQbqeAM9fk67gONo2Vdc4do2r6DlwQq8ur4T qlpR42+NfoCprnEceF7nkjKqFc5S0m/WETkDZCre9+cNn3Iwf/RYFV0s81HU427CcS C9ngs5Hlxrz1g== From: Colin King To: Yasunari Takiguchi , Mauro Carvalho Chehab , Christophe JAILLET , Sean Young , linux-media@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] media: cxd2880-spi: Fix a null pointer dereference on error handling path Date: Tue, 20 Jul 2021 17:07:49 +0100 Message-Id: <20210720160749.73928-1-colin.king@canonical.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King Currently the null pointer check on dvb_spi->vcc_supply is inverted and this leads to only null values of the dvb_spi->vcc_supply being passed to the call of regulator_disable causing null pointer dereferences. Fix this by only calling regulator_disable if dvb_spi->vcc_supply is not null. Addresses-Coverity: ("Dereference after null check") Fixes: dcb014582101 ("media: cxd2880-spi: Fix an error handling path") Signed-off-by: Colin Ian King --- drivers/media/spi/cxd2880-spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/spi/cxd2880-spi.c b/drivers/media/spi/cxd2880-spi.c index b91a1e845b97..506f52c1af10 100644 --- a/drivers/media/spi/cxd2880-spi.c +++ b/drivers/media/spi/cxd2880-spi.c @@ -618,7 +618,7 @@ cxd2880_spi_probe(struct spi_device *spi) fail_attach: dvb_unregister_adapter(&dvb_spi->adapter); fail_adapter: - if (!dvb_spi->vcc_supply) + if (dvb_spi->vcc_supply) regulator_disable(dvb_spi->vcc_supply); fail_regulator: kfree(dvb_spi); -- 2.31.1