From patchwork Tue Mar 19 00:30:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aditya Pakki X-Patchwork-Id: 10858661 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 69DDD1575 for ; Tue, 19 Mar 2019 00:30:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51336294B9 for ; Tue, 19 Mar 2019 00:30:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 456B129559; Tue, 19 Mar 2019 00:30:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2C2C200E5 for ; Tue, 19 Mar 2019 00:30:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727146AbfCSAaq (ORCPT ); Mon, 18 Mar 2019 20:30:46 -0400 Received: from mta-p7.oit.umn.edu ([134.84.196.207]:50280 "EHLO mta-p7.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727062AbfCSAap (ORCPT ); Mon, 18 Mar 2019 20:30:45 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-p7.oit.umn.edu (Postfix) with ESMTP id 2A3FB92C for ; Tue, 19 Mar 2019 00:30:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p7.oit.umn.edu ([127.0.0.1]) by localhost (mta-p7.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NJgsyM9-CEQO for ; Mon, 18 Mar 2019 19:30:44 -0500 (CDT) Received: from mail-it1-f199.google.com (mail-it1-f199.google.com [209.85.166.199]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p7.oit.umn.edu (Postfix) with ESMTPS id E28A4985 for ; Mon, 18 Mar 2019 19:30:43 -0500 (CDT) Received: by mail-it1-f199.google.com with SMTP id q184so16054973itd.6 for ; Mon, 18 Mar 2019 17:30:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=ooq4r/ebCnnXAe3/oQpav9WVOiGj8D+f04S8WUhRVzw=; b=lh76zgbc0mav3MUfU+qFag4uNnA8mal1nx7+n9/EsuuPXr/aAcS9wq0/+3v1QNUbkl LNxxgqG/XDhxhHlcNksIkw3YCSnMoKLDBTm4Or++aKyDZBaXlv0D0XtSvYqREbPdUtgt LB7QpDPQroOeUv1yop1n2TaocKgyTotypcN3urISSaoF3IRdgOPTyJ81XjBKzF+3G0sY wTAuvMU40b0pOQBwkPUqxHwZbaCTWV9EMlBmBvkG1ROOLomI03qax+8wyvKsV8/8aC4h Bw/Fp05uPwPCLYDg2I9sw9rWl4PcfJbe0lykzv0nVfWAMK8i47fLj9/mIILXtoVf8NEi 5WkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ooq4r/ebCnnXAe3/oQpav9WVOiGj8D+f04S8WUhRVzw=; b=sQTk5YUfTTGLq94sPuQIYqFB23ii1Tz2EnfMxh3J09FL8PqwdfW0sijnC3D3wNs0Lt U8ZCyiQ7dTASoPu6+poLDO3+XxXGQXx2Xm2WxgwbBJpEtGHSKrqjgss7fekEv2lWZkXi nRpj6eqE6g3iKTyhdHSsBzbv7e9XWyjuC+j102Xw6s2wEUPOLuvKV3d6EC3oYCx4llXW Zaxo+JtUYdjicKJwP5/+wy6RobCkk7DFApGRNiNoOLtBwr+rRrv3dB2Yu0b2//DxdkkX gaHpw7Ybfvby+uajgsdz1EC93BLBeRUIIbCTuVSh80YrRobfWoTvg0WyCf/4fZt+D/Gj l20A== X-Gm-Message-State: APjAAAUar+CMt89x2vo4YM3tIVTYKpkf5PKRlp4VsimoMSAdsu24Kn+g ClEoikuQDIJiq4pXX+Au2gJ9JlfkLnBp81rNTbvRk2ztp6d5HYSTTWCKcXdokEQWS1a4II2xoP5 6u8WsX4F3r0Mwapky+a/LDkveTQ== X-Received: by 2002:a24:e502:: with SMTP id g2mr969842iti.78.1552955443538; Mon, 18 Mar 2019 17:30:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwcIHFoZRgcNpgUZVwSaoHsKrh63C/yYMg3hbRGXhPoRErNIDkoD2D8T5qL1TvnvPqK3HIsHQ== X-Received: by 2002:a24:e502:: with SMTP id g2mr969834iti.78.1552955443357; Mon, 18 Mar 2019 17:30:43 -0700 (PDT) Received: from lenovo-1.hsd1.mn.comcast.net (c-73-242-25-233.hsd1.mn.comcast.net. [73.242.25.233]) by smtp.googlemail.com with ESMTPSA id r2sm456894itk.5.2019.03.18.17.30.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Mar 2019 17:30:42 -0700 (PDT) From: Aditya Pakki To: pakki001@umn.edu Cc: kjlu@umn.edu, Pedro Sousa , Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: ufs: Fix to avoid a potential NULL pointer dereference Date: Mon, 18 Mar 2019 19:30:38 -0500 Message-Id: <20190319003038.12896-1-pakki001@umn.edu> X-Mailer: git-send-email 2.17.1 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In tc_dwc_g210_pltfm_probe, of_match_node can return a NULL pointer in case of failure. The patch avoids a potential NULL pointer dereference in such scenarios. Signed-off-by: Aditya Pakki --- drivers/scsi/ufs/tc-dwc-g210-pltfrm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/ufs/tc-dwc-g210-pltfrm.c b/drivers/scsi/ufs/tc-dwc-g210-pltfrm.c index 6dfe5a9206e9..2b5bc6bd715e 100644 --- a/drivers/scsi/ufs/tc-dwc-g210-pltfrm.c +++ b/drivers/scsi/ufs/tc-dwc-g210-pltfrm.c @@ -61,6 +61,8 @@ static int tc_dwc_g210_pltfm_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; of_id = of_match_node(tc_dwc_g210_pltfm_match, dev->of_node); + if (!of_id) + return -ENXIO; vops = (struct ufs_hba_variant_ops *)of_id->data; /* Perform generic probe */