Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13475331ybl; Sun, 29 Dec 2019 12:48:30 -0800 (PST) X-Google-Smtp-Source: APXvYqx0u3M1J4twNmP697q8Ux2hqyWHawSywffZQuuqA72EYk2AJH2PoCls/y/Q1kVN+gLzLC8Q X-Received: by 2002:a9d:60c4:: with SMTP id b4mr47294448otk.166.1577652510893; Sun, 29 Dec 2019 12:48:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652510; cv=none; d=google.com; s=arc-20160816; b=sVazjzyUBvHDLe2Iy7GHFvfIZlPJ6SsukB7VJbrA7hv+EX9lL0o9/5fw8j94jqfeJU rn+c0e11UcRr6zPLV0+Aft7OsR28FPJQid9RdHu9snWFsiz+3CcCulPFdMl331cnsIcG ukG/k7kuK/d9xJJE3JhlD/9hLBl2GsoGsekl6lfcpNKhWDgqiBzmgzBXytt400QsRKtv 82Oupqf9SbBUwoPGzBr4ywuo69gWa/vZcDAh8aiBqy3VcwLLlQranwrJoCjMRnDfpwRn TTIqSLoOD/IbdyRarIwAftjUidnZHGghmb+aTdoVdwWLQ/cIz6QyR/sv0NYr4sL+1YTE VydA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pulQyaRq2BcIvpBnSNRMWkZCV9U+3chnzdx/sv4P2vk=; b=SpzRGXmVAiMT92Ft9k8UAz01ki0AHDH6fz3hwbpMHsIJuc14Q138+Y1b8qa3hmTxYF ReDWX+BgA9ZgyHznDBmEOTv3cGxcchss0SyfFr4IOSYitnxhjxVgFXcYthuZpVTaIwch 230wsN5GH2HdmDUFkZRiZdL4T/jB+1jKv3vuGT5bIi7HZlIdi6q+CnDpgOHiOKxNa7YN BmcR8ZDne8QjOraUf3arYc5HqYXbaNg6JidMS1air6uORgWriZuiALzyJYzzQRK9HG5i Nh08MZvZ+WwTQztXjZL9LuH5j+Zzm9bcJtTVfCFBq0KQhaY8H72pRKr4EK78bQSrDWtw W3SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nD7stJc9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v202si19524014oie.79.2019.12.29.12.48.19; Sun, 29 Dec 2019 12:48:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nD7stJc9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732718AbfL2Ryf (ORCPT + 99 others); Sun, 29 Dec 2019 12:54:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:42498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732708AbfL2Ryc (ORCPT ); Sun, 29 Dec 2019 12:54:32 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BFE1A208C4; Sun, 29 Dec 2019 17:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577642072; bh=cSt5E3nZqFuronXA91xSntFIgZvBLlPyvO9PQGCVYpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nD7stJc9WbAwQnGVHEVG8w3+D8Jm9m1LyCRAXc73O40HGOVlGYlRKqFmB79eIHzQo MZyAtCMw1vtcOLo+ulEDoRQfkYW2e9tXZ0NdHGMXNiXBPhCaM8284bN16XMi+ebjiA zIPgjdTqhPC+LVnims2siW0IbCOIzD15kED2vkk0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuhong Yuan , Mark Brown , Sasha Levin Subject: [PATCH 5.4 287/434] spi: pxa2xx: Add missed security checks Date: Sun, 29 Dec 2019 18:25:40 +0100 Message-Id: <20191229172721.013028546@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229172702.393141737@linuxfoundation.org> References: <20191229172702.393141737@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chuhong Yuan [ Upstream commit 5eb263ef08b5014cfc2539a838f39d2fd3531423 ] pxa2xx_spi_init_pdata misses checks for devm_clk_get and platform_get_irq. Add checks for them to fix the bugs. Since ssp->clk and ssp->irq are used in probe, they are mandatory here. So we cannot use _optional() for devm_clk_get and platform_get_irq. Signed-off-by: Chuhong Yuan Link: https://lore.kernel.org/r/20191109080943.30428-1-hslester96@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-pxa2xx.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index bb6a14d1ab0f..2e73d75a6ac5 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1565,7 +1565,13 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) #endif ssp->clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(ssp->clk)) + return NULL; + ssp->irq = platform_get_irq(pdev, 0); + if (ssp->irq < 0) + return NULL; + ssp->type = type; ssp->pdev = pdev; ssp->port_id = pxa2xx_spi_get_port_id(adev); -- 2.20.1