Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2697255pxb; Tue, 19 Jan 2021 04:01:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+B6/gzKnewxjQ8NznAeE/aId0nshPe9ahp/EKConmoYG8xPQztZLC7rbS1YHDr/MI+cvi X-Received: by 2002:a17:906:eb46:: with SMTP id mc6mr2801085ejb.184.1611057681912; Tue, 19 Jan 2021 04:01:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611057681; cv=none; d=google.com; s=arc-20160816; b=EkmN1nGeDaght8cHhqyPvrN1wUSsEs6ignUWOeD6KFUEnd+cJK+iSxgFJEiJCHWX3F XkwULql8JvJId7IJnIwSLkDywkb4KjKJ/UEN/JUqSVz1+GNpS3LU0sXDgqeSD1xcn8J8 3BskAErG7R7iw4VrzhCQhwMRKPLNz5S/kGst4ZPuxXvRqfyLbgjMSU5jcezoIGtN5T8t 9VMM0jvUn3eDtJfB1IPtK7KtJJKf0+MXakp+gJPbtl1P6/texFaiYVgCP0/1n6vsHzAa JDNEMArrnwMmQaRuW2nS7Be0eddKzcuWmalexwwqqQ9BZWHOYLp+ITZJvXYMWruXL/gM o4Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-language :thread-index:content-transfer-encoding:mime-version:message-id:date :subject:in-reply-to:cc:to:from:dkim-signature:dkim-filter; bh=+7XKMc3T9eBTnjj09XrjdmMgt0rdKUYThtb6KsTWgyY=; b=cq0Pc8p9IGEDiIPqroKasyQbRw6UCr3Lq1eCFOzYfSG2R4bYw14nLYpuoPQ33zzCwQ lXJ5nBZZpI/bBBLohQe141iUNZwk5oSfYiJlEOphiJIwmqNS+i10gGmERbDAktJXlqM4 xTAGBWAhKcm/JRiV3s5l2c1R4nFYcUt+050pJNN9tFZyOUKIISdzyVFgPehA6WtQ7mMT H7j0W+VW/O2kEFHnKnwSgD8fFOFt2BILQC0kBhCJLdC0LA6Jm9FWAdAG20DPooo3dqjb n/l6Gtc3ulL7C3OcXuOeyiw5q7Juu7fVPMrBELVpcuKyFDkjeFQNGGrXbm9YDtjaBcaR 9eIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=g9KkCeMb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j22si8813998edh.496.2021.01.19.04.00.58; Tue, 19 Jan 2021 04:01:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=g9KkCeMb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404657AbhASKyM (ORCPT + 99 others); Tue, 19 Jan 2021 05:54:12 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:23596 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389203AbhASKkr (ORCPT ); Tue, 19 Jan 2021 05:40:47 -0500 Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20210119103946epoutp04c620fbdbf9b6f05dd08feed1da60df49~bm-lND4m12759027590epoutp045 for ; Tue, 19 Jan 2021 10:39:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20210119103946epoutp04c620fbdbf9b6f05dd08feed1da60df49~bm-lND4m12759027590epoutp045 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1611052786; bh=+7XKMc3T9eBTnjj09XrjdmMgt0rdKUYThtb6KsTWgyY=; h=From:To:Cc:In-Reply-To:Subject:Date:References:From; b=g9KkCeMbqiuNNk4avT//iXR7bl8amRzXXldX1MCRjJUXqtU1E9kx2NkBMLC39hao7 duYAvRaPv5N9wT1QF8vIxm+wN/AUoSODZzlwi67j2Pt0V8kuOTvZXiD/XUPkBpxidO CK2iYBof4vroQt2Zpf1Q9OVYHSXD0a8fao03Tjg4= Received: from epsmges5p2new.samsung.com (unknown [182.195.42.74]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20210119103946epcas5p2684a48457a7698f893fc34cb534cc22f~bm-kvQaR_0917709177epcas5p2H; Tue, 19 Jan 2021 10:39:46 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id C1.A9.50652.2F6B6006; Tue, 19 Jan 2021 19:39:46 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20210119095514epcas5p2f4b4f456955a8be3d05f094d38168b13~bmYsOQlMv1399313993epcas5p2L; Tue, 19 Jan 2021 09:55:14 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20210119095514epsmtrp2d472b2636a457d608dbe4c93ea4b8341~bmYsNYkfH1714417144epsmtrp2U; Tue, 19 Jan 2021 09:55:14 +0000 (GMT) X-AuditID: b6c32a4a-6c9ff7000000c5dc-f0-6006b6f2c65e Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id F3.F6.08745.28CA6006; Tue, 19 Jan 2021 18:55:14 +0900 (KST) Received: from shradhat02 (unknown [107.122.8.248]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20210119095512epsmtip1746f9e82069f4017eeeb552946cd0fc7~bmYqbTBGT1120911209epsmtip1k; Tue, 19 Jan 2021 09:55:12 +0000 (GMT) From: "Shradha Todi" To: "'Leon Romanovsky'" Cc: , , , , , , , , , , In-Reply-To: <20210113072104.GH4678@unreal> Subject: RE: [PATCH v4] PCI: endpoint: Fix NULL pointer dereference for ->get_features() Date: Tue, 19 Jan 2021 15:25:10 +0530 Message-ID: <147801d6ee49$2ecd2d30$8c678790$@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQGwxsy/0exZ02HWY9tkJuphsuoUGQKa3YDmAkSCdsmqVAjF8A== Content-Language: en-us X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJKsWRmVeSWpSXmKPExsWy7bCmpu6nbWwJBv8msVksacqw+DhtJZPF hac9bBZ3nt9gtJjyaymzxeVdc9gszs47zmbx5vcLdosnUx6xWhzdGGyxaOsXdosb69kdeDzW zFvD6LFgU6nHplWdbB59W1Yxehy/sZ3J4/MmuQC2KC6blNSczLLUIn27BK6MCecuMBWs46/Y veoAcwPjeZ4uRg4OCQETiRMvMrsYuTiEBHYzSnzp28cO4XxilJjZ+okVwvnMKHGhYwVTFyMn WMfnu0uZIBK7GCWmtc5mhHBeMErM2tjHDlLFJqAj8eTKH2YQW0RAU2JD7yU2kCJmgeVMEnOu tIGN4hTQluh+upMFxBYWiJI4P2c+WAOLgKrEuZf3wOK8ApYSZ6d/ZoKwBSVOznwCFmcWkJfY /nYOM8RJChI/ny5jhVjmJHFhwm5GiBpxiZdHj7BD1BzgkDi3KQ/CdpGYvvEEVFxY4tXxLVC2 lMTnd3vZIOx8iakXnrJAAqlCYnlPHUTYXuLAlTlgYWagv9bv0ocIy0pMPbWOCWIrn0Tv7yfQ wOKV2DEPxlaW+PJ3DwuELSkx79hl1gmMSrOQPDYLyWOzkDwwC2HbAka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1ytOzC0uzUvXS87P3cQIjkAtrR2Me1Z90DvEyMTBeIhRgoNZSYS3dB1TghBv SmJlVWpRfnxRaU5q8SFGaQ4WJXHeC10n44UE0hNLUrNTUwtSi2CyTBycUg1MK61PqBmdz7n7 dLbi3KWSN48IKBXJcj1LqrLdpjopNU90qmDIoS+silXnjfp/sJ3IY1Ds5w3Kz2SafoFv85PX Nt9aRY5ws5yVYF9vvELcS6diveO+c+mtU+cLTn9+x1og1CDj5gw7l5n1UgvfRlZXunSmxRZP lg7m2Xb4auYtlbxzEXc81NKvFeVx5FVEyWbWh95e+ivDc92iF2tPM0/Q/Xai+sG0wPQqRol/ EzfGPN+yryvv8t6Xtc9/aV/v7mmu27y9vvXUj9XJXpyeJ/X8TT/vPZtsHb/9pm3c3rT2/RXu XuzyRyxyAvS7D36ccEr2isO3uzecJuxM7p7+JJ77SHroHaYFnFLbYkubPDiUWIozEg21mIuK EwGcfR+sLwMAAA== X-CMS-MailID: 20210119095514epcas5p2f4b4f456955a8be3d05f094d38168b13 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20210112140234epcas5p4f97e9cf12e68df9fb55d1270bd14280c References: <1610460145-14645-1-git-send-email-shradha.t@samsung.com> <20210113072104.GH4678@unreal> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > -----Original Message----- > From: Leon Romanovsky > Subject: Re: [PATCH v4] PCI: endpoint: Fix NULL pointer dereference for - > >get_features() > > On Tue, Jan 12, 2021 at 07:32:25PM +0530, Shradha Todi wrote: > > get_features ops of pci_epc_ops may return NULL, causing NULL pointer > > dereference in pci_epf_test_bind function. Let us add a check for > > pci_epc_feature pointer in pci_epf_test_bind before we access it to > > avoid any such NULL pointer dereference and return -ENOTSUPP in case > > pci_epc_feature is not found. > > > > When the patch is not applied and EPC features is not implemented in > > the platform driver, we see the following dump due to kernel NULL > > pointer dereference. > > > > [ 105.135936] Call trace: > > [ 105.138363] pci_epf_test_bind+0xf4/0x388 [ 105.142354] > > pci_epf_bind+0x3c/0x80 [ 105.145817] pci_epc_epf_link+0xa8/0xcc [ > > 105.149632] configfs_symlink+0x1a4/0x48c [ 105.153616] > > vfs_symlink+0x104/0x184 [ 105.157169] do_symlinkat+0x80/0xd4 [ > > 105.160636] __arm64_sys_symlinkat+0x1c/0x24 [ 105.164885] > > el0_svc_common.constprop.3+0xb8/0x170 > > [ 105.169649] el0_svc_handler+0x70/0x88 [ 105.173377] > > el0_svc+0x8/0x640 [ 105.176411] Code: d2800581 b9403ab9 f9404ebb > > 8b394f60 (f9400400) [ 105.182478] ---[ end trace a438e3c5a24f9df0 > > ]--- > > > Description and call trace don't correlate with the proposed code change. > > The code in pci_epf_test_bind() doesn't dereference epc_features, at least in > direct manner. > > Thanks Thanks for the review. Yes, you're right. The dereference does not happen in the pci_epf_test_bind() itself, but in pci_epf_test_alloc_space() being called within. We will update the line "causing NULL pointer dereference in pci_epf_test_bind function. " in the commit message to "causing NULL pointer dereference in pci_epf_test_alloc_space function. " Would that be good enough?