Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp857148pxb; Tue, 9 Nov 2021 01:03:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJyuAPLFyiVHvqH3kYRg4SAntjQrJrelrC/tpsu7u68mYx9eT6/c3SKEGkQmGNSzRLQRMMh+ X-Received: by 2002:a02:c78e:: with SMTP id n14mr4154631jao.40.1636448615423; Tue, 09 Nov 2021 01:03:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636448615; cv=none; d=google.com; s=arc-20160816; b=U9hBGlqW6Z/96QgLxZhPFqm9hyXmxQRRDX+jyJ36p8I8WcQ/nFI2i441KdU0lf57Ge Ggu3Iy9BAirt84j2+34iz6eMYK/ISw+ZbAs/WjYROQeQVCuEthlt/LTfblBFrvVPCXhT Ai1DPWfdJC72WH2Ei6E+t2OEQ21T39Gk+YpjwW1l9ht9QSADtdnpGART3e5ctvK3l2h1 Cz6vpH7E7tQPLUayWzFZagOOiy9kt5HkAlP7wxarJSIq0YYs8rHPtvkYJ9HqYzS+brdx PnQdzxOwhlSSGpUmhSZlQYAQd5jtfLsf7N9lJSTvSe1dE4fTwbDHCejOSM+v/J7i0rDT RYxA== 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=/lZELlsPg0kJ+I9UeZpFd+QunvBHldPVMvAKLVODPvw=; b=rRRpnKhUx9x73PlsgmnLDh2mzl4xWQBVh1w8iQMent6lVSLSXrujm4FeK1vx835y7S 4Ty8f85RrEual2lu7xyhiEGZ8byTVkpqI2rPWBFZBkrIXT45UiTL4ifQgg/UePnoKoaq a/14eBQzFwWHc1MkLLB80IEPH0QmYBQeaFuvXLQorBgOjgBllsZkv5RwVioz66QyvP1V lDt6C0Amr2z3cJiAxMXGJWrxetqqpghADK1TybqvERfR9mJkvqMhRmYK7CHTStM524CF /YeAi81MEqNnsRningXV72p5PgKde2gXWUV6lx6adhgjixpldk3ggz3Zer2Y91V09KbV wxCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="X/NbspBq"; 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 g14si30788518ilf.33.2021.11.09.01.03.19; Tue, 09 Nov 2021 01:03:35 -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="X/NbspBq"; 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 S238420AbhKIBFn (ORCPT + 99 others); Mon, 8 Nov 2021 20:05:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:33032 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238076AbhKIBET (ORCPT ); Mon, 8 Nov 2021 20:04:19 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 40A4A614C8; Tue, 9 Nov 2021 01:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636419679; bh=QJctPq2mvvXd9D5+REVvKRYsNwuWRooixOau3OZ0qMo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X/NbspBqFwh5wCL5w9MvpgM8u+7Ifzm5C/OdMcbAms68WxV0fGlDyOq3fqBRzxjFZ 1wQeyWKvkWbqBY71DcQGXc9gQggUPWB8XmgjY9DLduQw2qv/BU0U7V8jisiQ3hBg/6 RFAXvYRQr1HmcjS0HEusgXMpkkO6Qz2V3S0Br/PEFCpN8SppgCdByXQpoC53dj66M/ gWZbMiuP+XJQTixFK0dVLY/w7sLV32pU5goDr1r2AdGHP+0N+WOTSVYaFpXmHOeW4u dj4mC4C1BDAlDNEmCJm2RJJlG5Z9OA3kNxhGSPvko8Sr8/UznDUonqk5sjMn9dLa5N Ni3hk4Y0EaIUw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tuo Li , TOTE Robot , 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 046/146] media: s5p-mfc: fix possible null-pointer dereference in s5p_mfc_probe() Date: Mon, 8 Nov 2021 12:43:13 -0500 Message-Id: <20211108174453.1187052-46-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: Tuo Li [ Upstream commit 8515965e5e33f4feb56134348c95953f3eadfb26 ] The variable pdev is assigned to dev->plat_dev, and dev->plat_dev is checked in: if (!dev->plat_dev) This indicates both dev->plat_dev and pdev can be NULL. If so, the function dev_err() is called to print error information. dev_err(&pdev->dev, "No platform data specified\n"); However, &pdev->dev is an illegal address, and it is dereferenced in dev_err(). To fix this possible null-pointer dereference, replace dev_err() with mfc_err(). Reported-by: TOTE Robot Signed-off-by: Tuo Li Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/s5p-mfc/s5p_mfc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c index eba2b9f040df0..c763c0a03140c 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c @@ -1283,7 +1283,7 @@ static int s5p_mfc_probe(struct platform_device *pdev) spin_lock_init(&dev->condlock); dev->plat_dev = pdev; if (!dev->plat_dev) { - dev_err(&pdev->dev, "No platform data specified\n"); + mfc_err("No platform data specified\n"); return -ENODEV; } -- 2.33.0