lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <e705c6832df6eadf3bb978f1add26cf85a8ad4ea.1444649226.git.geliangtang@163.com>
Date:	Sun, 11 Oct 2015 21:05:13 -0700
From:	Geliang Tang <geliangtang@....com>
To:	Ashutosh Dixit <ashutosh.dixit@...el.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Sudeep Dutt <sudeep.dutt@...el.com>,
	Nikhil Rao <nikhil.rao@...el.com>
Cc:	Geliang Tang <geliangtang@....com>, linux-kernel@...r.kernel.org
Subject: [PATCH v3] misc: mic: replace kfree with put_device

Handle a failed device_register(), replace kfree() with put_device(),
which will call cosm/mbus/scif_release_dev().

Signed-off-by: Geliang Tang <geliangtang@....com>
---
Changes in v3:
  - Add the same change to cosm_bus.c
Changes in v2:
  - Just refresh this patch.
---
 drivers/misc/mic/bus/cosm_bus.c | 2 +-
 drivers/misc/mic/bus/mic_bus.c  | 2 +-
 drivers/misc/mic/bus/scif_bus.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/mic/bus/cosm_bus.c b/drivers/misc/mic/bus/cosm_bus.c
index 1e36830..d31d6c6 100644
--- a/drivers/misc/mic/bus/cosm_bus.c
+++ b/drivers/misc/mic/bus/cosm_bus.c
@@ -100,7 +100,7 @@ cosm_register_device(struct device *pdev, struct cosm_hw_ops *hw_ops)
 ida_remove:
 	ida_simple_remove(&cosm_index_ida, cdev->index);
 free_cdev:
-	kfree(cdev);
+	put_device(&cdev->dev);
 	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(cosm_register_device);
diff --git a/drivers/misc/mic/bus/mic_bus.c b/drivers/misc/mic/bus/mic_bus.c
index c64955d..be37890 100644
--- a/drivers/misc/mic/bus/mic_bus.c
+++ b/drivers/misc/mic/bus/mic_bus.c
@@ -175,7 +175,7 @@ mbus_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops,
 		goto free_mbdev;
 	return mbdev;
 free_mbdev:
-	kfree(mbdev);
+	put_device(&mbdev->dev);
 	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(mbus_register_device);
diff --git a/drivers/misc/mic/bus/scif_bus.c b/drivers/misc/mic/bus/scif_bus.c
index fd27021..ff6e01c 100644
--- a/drivers/misc/mic/bus/scif_bus.c
+++ b/drivers/misc/mic/bus/scif_bus.c
@@ -180,7 +180,7 @@ scif_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops,
 		goto free_sdev;
 	return sdev;
 free_sdev:
-	kfree(sdev);
+	put_device(&sdev->dev);
 	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(scif_register_device);
-- 
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists