Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11813787pjo; Thu, 2 Jan 2020 14:44:25 -0800 (PST) X-Google-Smtp-Source: APXvYqzBHO0oJrEtWbLFaoVIDNvg2jz8Eve4S4otgxF6LssYRrjj+4OP1a/R8MC8MeSF3r/HyH78 X-Received: by 2002:a9d:1d02:: with SMTP id m2mr88641584otm.45.1578005065835; Thu, 02 Jan 2020 14:44:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578005065; cv=none; d=google.com; s=arc-20160816; b=PeLXOY/+kdc1OGpoPdS4kIwKriorRJKMpmGLilEM7SOmfYJI9e0sZquFpeFCMhi/MQ N5Wmmm/EtPWTt+ABrJZW5NuDlKO1srNUw3GzlJXvKh+bIpIq8SJ+DmJXUv7IKdEWK4V9 /kACfU1lTAB9Wsq26ZC+7NS96n4rb6nQ+OS74c+9kqfU1MDEiPVl1WZbBgntuP2phQxH I01fthFLXst/+/5GORp5g76iJHhyPeLbu05DYWK0cST3AG+QqCHjWs6nnE02jsuif0Mf OJpDNd0S/LuvoZVJzvwAV9gVtb5eIbyNUQwXfwB8VQFyvk4y3AiIfOwvis74mt5OzlGA rkkQ== 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=uyWSyOaGk1GfXVOQauKAKKcmL/N6RISl5i4TKTnCLsc=; b=YYrKiDmQWzGe9fPdKND5e4r5dlbQzWLTYHxGFM2UvOExmoluUbm3C0uAm2Qku3KEHI nPokHiBmyw0v258V2nVghkoGYU4vfmVJadviQ53yELiPtfgK4PNcrh9eEdgN7eZ2jbtN I1aiYsn4orbUV78kVaI8MV4/w8pIKYtizIvFgvOZAXu9wl6zRKBhAg6+eEZIxW7DnCsd gmS+riMlQRfwMontrpuBq8AY8qJ6fl7PdqJfzEvx+E8+jR7Xeauh5dwGoBZv9FwdBx4z 5L4iw8SbDst56wfgj8rMQSwXTjy49h3w7ciMABvrAfb+wNMVvlIIhUwaHl1hUqgEkLcI 2C/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=q8vcJXSA; 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 c79si27183039oig.208.2020.01.02.14.44.14; Thu, 02 Jan 2020 14:44:25 -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=q8vcJXSA; 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 S1731287AbgABWmI (ORCPT + 99 others); Thu, 2 Jan 2020 17:42:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:47866 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730563AbgABWgc (ORCPT ); Thu, 2 Jan 2020 17:36: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 4574421835; Thu, 2 Jan 2020 22:36:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004590; bh=f160mG0OuevRzBxd7nlx3AVqJfgARLe47fn1vVaGqu4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q8vcJXSAL5hDrr6BTMresijOUNVm9fai7PGptMBrGMqT4EHXfJit+xJJ+X3l3b/Tc nXf0GtlpEFUxpw6L7DsIXjAvwnFqY8usG7VH4dCg0BJATfGr/3XXRpu16UVcbCw221 wI6iTEZ3iKpNyGpQfkYRpWfs73o9RTzwgOHkHKEI= 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.4 053/137] spi: pxa2xx: Add missed security checks Date: Thu, 2 Jan 2020 23:07:06 +0100 Message-Id: <20200102220553.652840941@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.618583146@linuxfoundation.org> References: <20200102220546.618583146@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 193aa3da5033..96ed01cb6489 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1425,7 +1425,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); -- 2.20.1