Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753392AbbFHOv4 (ORCPT ); Mon, 8 Jun 2015 10:51:56 -0400 Received: from mail-vn0-f50.google.com ([209.85.216.50]:33491 "EHLO mail-vn0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751947AbbFHOvq (ORCPT ); Mon, 8 Jun 2015 10:51:46 -0400 MIME-Version: 1.0 In-Reply-To: <1433694425-23478-5-git-send-email-ygardi@codeaurora.org> References: <1433694425-23478-1-git-send-email-ygardi@codeaurora.org> <1433694425-23478-5-git-send-email-ygardi@codeaurora.org> Date: Mon, 8 Jun 2015 23:51:45 +0900 Message-ID: Subject: Re: [PATCH v3 4/4] scsi: ufs: probe and init of variant driver from the platform device From: Akinobu Mita To: Yaniv Gardi Cc: Jej B , LKML , "linux-scsi@vger.kernel.org" , linux-arm-msm@vger.kernel.org, Santosh Y , linux-scsi-owner@vger.kernel.org, Subhash Jadavani , Paul Bolle , Gilad Broner , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Vinayak Holikatti , "James E.J. Bottomley" , Dolev Raviv , Christoph Hellwig , Sujit Reddy Thumma , Raviv Shvili , Sahitya Tummala , "open list:OPEN FIRMWARE AND..." Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1234 Lines: 31 2015-06-08 1:27 GMT+09:00 Yaniv Gardi : > static int ufshcd_pltfrm_remove(struct platform_device *pdev) > { > struct ufs_hba *hba = platform_get_drvdata(pdev); > + struct device_node *node = pdev->dev.of_node; > + struct device_node *ufs_variant_node; > + struct platform_device *ufs_variant_pdev; > + > + ufs_variant_node = of_get_next_available_child(node, NULL); > + > + if (!ufs_variant_node) > + dev_dbg(&pdev->dev, "no ufs_variant_node found\n"); > + else > + ufs_variant_pdev = of_find_device_by_node(ufs_variant_node); > > pm_runtime_get_sync(&(pdev)->dev); > ufshcd_remove(hba); > + module_put(ufs_variant_pdev->dev.driver->owner); module_put() should only be called when ufs_variant sub-node exists and hba->vops was found. If ufs->vops == NULL or no ufs_variant sub-node exists, this line causes uninitialized pointer dereference. > return 0; > } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/