All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keith Busch <keith.busch@intel.com>
To: linux-pci@vger.kernel.org, Bjorn Helgaas <helgaas@kernel.org>
Cc: Keith Busch <keith.busch@intel.com>,
	Logan Gunthorpe <logang@deltatee.com>
Subject: [PATCH] PCI/P2PDMA: Fix freeing dev_pagemap on error
Date: Fri, 12 Oct 2018 09:52:19 -0600	[thread overview]
Message-ID: <20181012155219.15360-1-keith.busch@intel.com> (raw)

The devres_free() API is only to be used after the resource has been
unlinked from the device tracking it. Calling this functino directly will
hit a kernel BUG_ON. This patch fixes this to use the managed resource
release function, devm_kfree().

Fixes: 1380472e7b855 ("PCI/P2PDMA: Support peer-to-peer memory")
Cc: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
---
 drivers/pci/p2pdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
index da66c7e31730..9c56a10eff15 100644
--- a/drivers/pci/p2pdma.c
+++ b/drivers/pci/p2pdma.c
@@ -222,7 +222,7 @@ int pci_p2pdma_add_resource(struct pci_dev *pdev, int bar, size_t size,
 	return 0;
 
 pgmap_free:
-	devres_free(pgmap);
+	devm_kfree(&pci->dev, pgmap);
 	return error;
 }
 EXPORT_SYMBOL_GPL(pci_p2pdma_add_resource);
-- 
2.14.4


             reply	other threads:[~2018-10-12 15:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-12 15:52 Keith Busch [this message]
2018-10-12 15:56 ` [PATCH] PCI/P2PDMA: Fix freeing dev_pagemap on error Keith Busch
2018-10-12 15:58 ` Logan Gunthorpe
2018-10-12 16:21   ` Keith Busch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181012155219.15360-1-keith.busch@intel.com \
    --to=keith.busch@intel.com \
    --cc=helgaas@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=logang@deltatee.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.