Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1729321ybg; Sat, 19 Oct 2019 01:14:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkVCwecaICO0e4AIx31gF8FGoTLzbA402l+Gy6niKhGDUul5pvhb5kWHr14MN+LcJfrJa4 X-Received: by 2002:a17:906:3946:: with SMTP id g6mr12444966eje.49.1571472859538; Sat, 19 Oct 2019 01:14:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571472859; cv=none; d=google.com; s=arc-20160816; b=GM5t97oAIjMyxrTbcM773REEBtksVfBqosjk8U9MRdY1ZaxTpxy6mRu8fhOQ6DkRo/ NbViGxwQ0e1cS/gjQCW/6pG3MtJoQ8KwG2cX9fMUvjHL3CxLA4/eH7zqhZrbkJNETiPd o+omtXkChxnvnDBcK9Fzdmm3kffC/CU3+ebCXhQvEJUmB6Vua9RoU9w0BDf2CciI5Cxd /UA/IIR7sajo1m0X0Ik3XtlsJpcuivOOZpIIDAGrlM1MEyPnyaub8xrHzY1emVNgnZwb 0NtR5cEGRpX96i3KswDEgHk/AWQPhq/rp7NzEs54f5+u5317nkDt1eo1HqAR4KhVf9R9 RHIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=TdGZ/O1UBefa0/Aw3vNnx5zYKetp+so1lp2xpas4umw=; b=tF6Rxapnool3rmNFNb8v1D86Dr6qTxTuKPcKIHj1WNGZnyUU5uicApeaJI+E+TFCSO 0n1xuyWvQ3PHRE2BA+xBH38hjlPjJj0M1aDNKJxEdF8P8JiFDVNzFbjN+gtO41qSK3AW TlFIDzHsrWIz1o4Q4GyTXao0/83yPG2xSLj+Z6al5MwWa/1ASUvOwhG5W3l2oDNT4IuP h0AwyaopGyShL1YMwhHC+5L4Oeb8XmZrwOK6R2W13ygCRcelrsPOLWNrRYQdUip8Rmuy Pk5EkT6zk3C/WT9AKUhEy62xuh1eYlqPq0C/vZfisv8egUjTykdk/ohnwfws+oOFsziZ V04g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mEHKyOoT; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k23si5437621ede.274.2019.10.19.01.13.56; Sat, 19 Oct 2019 01:14:19 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=mEHKyOoT; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2442459AbfJRKjc (ORCPT + 99 others); Fri, 18 Oct 2019 06:39:32 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:38284 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439353AbfJRKjU (ORCPT ); Fri, 18 Oct 2019 06:39:20 -0400 Received: by mail-ed1-f66.google.com with SMTP id l21so4186437edr.5; Fri, 18 Oct 2019 03:39:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TdGZ/O1UBefa0/Aw3vNnx5zYKetp+so1lp2xpas4umw=; b=mEHKyOoTqwmR0aTE5OFLDghsTCB1Biaiy9UW26U9qCuaq2iKlynp+5R60NwG2zQoA+ eQ1yHJYUuhWt6BYmxywdlbb3UKjpI6eNc2EskkhrTvpzSzq8QgmVafMzyay88Cuzewkt xWg6HLQqtUDtm1UD+ZxdHdTEJbrL8HuAbvCaT+9u4eiWMq7DDyYHt/CQzpUF6JeHDhru oNFOoPhIKHkPPOokpuk8cTKvKlEvCzb7PvbFFKcgK0qZUpBWyB8LIoK2fKEzI5z2ptoN 8xRZ0AvKeQKyNA86QSGbipvZjS/4BwpaqwF0fZEUYo8/eVoaC5Uk6aomkkaquXT44XS7 wU/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TdGZ/O1UBefa0/Aw3vNnx5zYKetp+so1lp2xpas4umw=; b=E5XtPnS5E1JSFNfHmT1QdFgsHiz708/8WcPprOYDUTFi0XvJn0mh7BITQXqkKw/VEH JCk8eabTo7jktWdg8sOo+yjxuhV57YQzOlXX6wDlMoCdDzp/YjLowr7VXd59Sad+vfZp UCLfHr4liBMcjPnrEX6pC9cZQjzZcRLfaAINNu60n+LkSwrYP+4x33WWhfILgNiuhYvt fJPqExbLfM46vLdbW4+QP+BYQ6KvRGC70w3h2krpo9IcGay5WdX1STSp074G/H3x2GZW J/elBVAsqCKC8ccQwnBYsE7/zlocNxe7vFBSB/odFTLZHVEd3RM0xm4OkZw3DG5/JadK o0rg== X-Gm-Message-State: APjAAAWOojnQJWofqPaXOxGeplNW+QAzD1EOTymCqnroIHYvLyID8AzV XNLP5a3SEKlViP0i0GghIv4O2657E3uqjaua7x4= X-Received: by 2002:a17:906:8313:: with SMTP id j19mr8131952ejx.196.1571395159085; Fri, 18 Oct 2019 03:39:19 -0700 (PDT) MIME-Version: 1.0 References: <20191017025058.31528-1-hslester96@gmail.com> In-Reply-To: From: Chuhong Yuan Date: Fri, 18 Oct 2019 18:39:08 +0800 Message-ID: Subject: Re: [PATCH] spi: pxa2xx: Add missed security checks To: Andy Shevchenko Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Mark Brown , linux-arm Mailing List , linux-spi , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 18, 2019 at 5:35 PM Andy Shevchenko wrote: > > On Fri, Oct 18, 2019 at 8:59 AM Chuhong Yuan wrote: > > > > pxa2xx_spi_init_pdata misses checks for devm_clk_get and > > platform_get_irq. > > Add checks for them to fix the bugs. > > > > Signed-off-by: Chuhong Yuan > > --- > > 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; > > I'm not sure they are mandatory for all platforms. > To be on the safe side, you simple need to add _optional() to the both > call along with above change. > As I know, this is the only one in spi which does not have a check for devm_clk_get. Even if add _optional(), they still may return errors and need security checks. > -- > With Best Regards, > Andy Shevchenko