Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp848341pxb; Tue, 9 Nov 2021 00:53:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxMQB/Xbrm1TnJcatmFb7wF7MwmeYLSvg7i0BaxBmg9y5h/JeFycPC9H8pHw2p2Hbr45lDd X-Received: by 2002:a50:ee01:: with SMTP id g1mr7955802eds.389.1636448017765; Tue, 09 Nov 2021 00:53:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636448017; cv=none; d=google.com; s=arc-20160816; b=PcLYpufuVwx0HUF80yRb2RlxkEZA8hCZqfu6XvxxJlfNB/rb4NAGiJam45iNrYtc2K flF/OTUixXPoT+z23cdtqfRBpvLC/Df0Ec5cMimDxrgpK80PHrc01pnhlX27dqyxFwOd 2ZjrzTXn6YelDIoo79yRaby9rj3Yk2Cdc9apL5doc5t8mpqm51pAtKlfRrCkHY/Zj8ZB ma9pybyrqg3dBN1brOU9GCtpNtausdS73WtpYJiKxH3F/zA7QHNNq2u1tU5UULUFpRRt IxMnNy5RGSFpsvAfn8XYHG+etcoQC2pnLGJW7JQ85zUfMCYG96PZ1zfv8eaxxUki2r77 xfLg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eIWJAAJTRDaFXRloq5wb4dlVc6IXa2nOoZFpLcAgL0U=; b=h5ljFH4o3LnFAl6LZ/OfvAkyAysUpO+8LGe346IM6evL05DtW3ThC44UejynT8cgEF tPZdAHTcrJFDSW3jGk1KkFHZMQGSC9lKIwB4kH0GCjPue762kBXKDQCKA8KVgD4klydt DfEpgAknCP3gqGc2GBdZx4flQ+D7V8rw7yqd0FZJjNsnuO0NjfDnUWRX/BVyzUkQaIme 56zewqm4vcdvD7JxTWLtWpo10e+JE53zryoEbPK7n5zOVejG2xzabDRbq2PEOvns6LtI K8zoHZCQQtTycMiOyhWfbywBOP7N9s3Vl3CQ6Qf5cEDpWT1LFSsLY9PHZ/TNXfybCcJr gAzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YGAsnJ6u; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b23si32401680edt.342.2021.11.09.00.53.09; Tue, 09 Nov 2021 00:53:37 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=YGAsnJ6u; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236483AbhKIBFi (ORCPT + 99 others); Mon, 8 Nov 2021 20:05:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:60044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241769AbhKIBET (ORCPT ); Mon, 8 Nov 2021 20:04:19 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C00E76124D; Tue, 9 Nov 2021 01:01:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636419680; bh=hCBZVbn5ACGsSoRa85leu+ceg8jHthpi32UI/d/3jZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YGAsnJ6u4iJpYmHjC+w183slSvA5hHn+5izqp/tn0uKWmtM2p65fZ8Q1hEsRn1WxE Ea66bXMNyERAIbtJHdFSMkPK473ouz2okzv7nopkIWNZxh2s1Kp0a7O2R2sYIoFKKy gtARW/9nTOMiejW4tNFe1ICHiA0PHVXLFH3+f/k97beG+UGEvGQ4IPmJc4EMc/29du m7sLFZoy7fz2RQb/etuqss4FygOmJ3oO+cLzFeCokVT1uSYijBPKDwhREWqLtJ2Qkv rb3EEW3kqYTnqDZ5RSpQKH4ez4RWommwtPWVzVsKp5m/s8p9QvWUPVWg0EEEy5H3xO xegv9QfmEa30Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nadezda Lutovinova , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin , a.hajda@samsung.com, mchehab@kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 047/146] media: s5p-mfc: Add checking to s5p_mfc_probe(). Date: Mon, 8 Nov 2021 12:43:14 -0500 Message-Id: <20211108174453.1187052-47-sashal@kernel.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211108174453.1187052-1-sashal@kernel.org> References: <20211108174453.1187052-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nadezda Lutovinova [ Upstream commit cdfaf4752e6915a4b455ad4400133e540e4dc965 ] If of_device_get_match_data() return NULL, then null pointer dereference occurs in s5p_mfc_init_pm(). The patch adds checking if dev->variant is NULL. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Nadezda Lutovinova Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index c763c0a03140c..f336a95432732 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1288,6 +1288,10 @@ static int s5p_mfc_probe(struct platform_device *pdev) } dev->variant = of_device_get_match_data(&pdev->dev); + if (!dev->variant) { + dev_err(&pdev->dev, "Failed to get device MFC hardware variant information\n"); + return -ENOENT; + } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); dev->regs_base = devm_ioremap_resource(&pdev->dev, res); -- 2.33.0