Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1479958pxf; Fri, 26 Mar 2021 08:27:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpR/A3mPGeLO0pv7r/Wkk3VfS7e5dfMWacKcXA0gaJoCu+tcvqgLyHxAygrI/APeiTeQ5o X-Received: by 2002:aa7:c3c4:: with SMTP id l4mr15566603edr.335.1616772425581; Fri, 26 Mar 2021 08:27:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616772425; cv=none; d=google.com; s=arc-20160816; b=t+q9JUqwN53gNhV2tIOSaqDR7GUM6X6zw0OUbmIPN5GHMGtSEgQ1+qjCS9elkyuA6D GJ7Qa4vk68tOUe6OdTBusGVv1BqwKxtAFDldXx0mSmTXuKsKxtzr7pEpH0XdQ/QRdyZc t5sf9eq+ZrFf9kGrt9ft0YArKSSe9AScLdM8+fslPlecvinsnGuSnZ931ffWiRIGcnTC w2pCNUrFQPZC2GJdGBZ7lAR07VsUKIRTnfO6ISrcC8qKckStLgbK08z0yjqh7xESCT2T s0sgyxUq/HNpjbi1XoDXfBgvTGmkW2qkTXcFgmGQ8EyadN0BtrgZpz20yMCndNLtDbB3 ME5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=QyWOLZCwdomtFsB1QE0Xg+o6Lzn/ENvHRJhAKdGZd3c=; b=L5w1iPeLkT3omN+QQ7MfpZpntBIJvI+8cqB8CXz4HqjVdj+TLqm43gmcJe+WE965S/ HVd0QjNOAT3vp7NEHtmhEschqmK2rjCOQOzJIjt9EfOzLz9TvmQc8LJakW7k/E0eCqpB r9Ry0uUjF1YqEE5zAXrp5TBB5pIDVQTJeEHgo55l1dZMdm7RM9TrYkwo1csROb6AaETY hZcaQatay4hPT/SetjJPmhP1Z1NXPfUwTT8k/BwoYUX3SsJKQRlLipjw+xgrrQF5puIU tiBZbKFOonsriwXmm277i7/ImzjznfvP7CRtr49SmeagzZMMuawEqCIW2yeZSzm3NUds MSZw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lr6si7967305ejb.9.2021.03.26.08.26.42; Fri, 26 Mar 2021 08:27:05 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230240AbhCZPX1 (ORCPT + 99 others); Fri, 26 Mar 2021 11:23:27 -0400 Received: from foss.arm.com ([217.140.110.172]:35376 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230100AbhCZPXS (ORCPT ); Fri, 26 Mar 2021 11:23:18 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0FEBC1474; Fri, 26 Mar 2021 08:23:18 -0700 (PDT) Received: from e123427-lin.arm.com (unknown [10.57.46.206]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5DD9E3F792; Fri, 26 Mar 2021 08:23:15 -0700 (PDT) From: Lorenzo Pieralisi To: linux-kernel@vger.kernel.org, Shradha Todi , linux-pci@vger.kernel.org Cc: Lorenzo Pieralisi , hari.tv@samsung.com, p.rajanbabu@samsung.com, niyas.ahmed@samsung.com, bhelgaas@google.com, pankaj.dubey@samsung.com, Sriram Dash , l.mehra@samsung.com, kishon@ti.com Subject: Re: [PATCH v5] PCI: endpoint: Fix NULL pointer dereference for ->get_features() Date: Fri, 26 Mar 2021 15:23:08 +0000 Message-Id: <161677217283.28772.11255664363565834754.b4-ty@arm.com> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20210324101609.79278-1-shradha.t@samsung.com> References: <20210324101609.79278-1-shradha.t@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 24 Mar 2021 15:46:09 +0530, Shradha Todi wrote: > get_features ops of pci_epc_ops may return NULL, causing NULL pointer > dereference in pci_epf_test_alloc_space 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. > > [...] Applied to pci/endpoint, thanks! [1/1] PCI: endpoint: Fix NULL pointer dereference for ->get_features() https://git.kernel.org/lpieralisi/pci/c/6613bc2301 Thanks, Lorenzo