From patchwork Thu Jan 2 22:06:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 234599 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 197BFC3276C for ; Thu, 2 Jan 2020 22:47:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D9D5C20866 for ; Thu, 2 Jan 2020 22:47:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578005252; bh=5SA/MWKEaTJ9HLmwGdbvndUTwoKDc5JGScTKHVKqJ/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=cYl3vOQDHYCSACzJvmo9jxxLYh0Y45UsuvRs6WiYLM4utnY8NaycnXsdNMOYzRVHY NC8p9Zol9b1yFkJTz47CfQuTC+KlXNFVpdcV9o5Vvk19M+KPGcgd/1HvQ4HrNphEpj tHkRA5w0iBMv5sJrL+/pLta/Hpyi836ubtZT2nzg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730057AbgABW3d (ORCPT ); Thu, 2 Jan 2020 17:29:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:60608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729869AbgABW3a (ORCPT ); Thu, 2 Jan 2020 17:29:30 -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 179EF24650; Thu, 2 Jan 2020 22:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004169; bh=5SA/MWKEaTJ9HLmwGdbvndUTwoKDc5JGScTKHVKqJ/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dKrVqSv8St9eMq1fm46VeyjnR3Wef85cj5rfQ/EXL5YLrJmbAjxRVAB6G8SaIbr33 IQ1a/VP4zkl3q3zQBDYKb2Kmr6BTCvaWBCTK3iwIcVtWPzDbnPoAQVom2lBOlNdZoi 9YWezIWEUsptlNNntBhYECNZj03bIWbyxdP56SrI= 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 4.9 066/171] spi: pxa2xx: Add missed security checks Date: Thu, 2 Jan 2020 23:06:37 +0100 Message-Id: <20200102220556.044450236@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.960200039@linuxfoundation.org> References: <20200102220546.960200039@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 6dd195b94c57..2f84d7653afd 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1529,7 +1529,13 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev) } 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);