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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1515659799-23521-4-git-send-email-aspriel@gmail.com>
Date:   Thu, 11 Jan 2018 09:36:39 +0100
From:   Arend van Spriel <aspriel@...il.com>
To:     Greg Koah Hartmann <gregkh@...uxfoundation.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Arend van Spriel <aspriel@...il.com>
Subject: [RFC V2 3/3] brcmfmac: pcie: implement .coredump() driver callback

This implements the .coredump() driver callback obtaining binary data
from the device and using devcoredump function to expose it in sysfs.

Signed-off-by: Arend van Spriel <aspriel@...il.com>
---
V2:
 - no changes
---
 .../wireless/broadcom/brcm80211/brcmfmac/pcie.c    | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
index 3c87157..55d0d25 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
@@ -22,6 +22,7 @@
 #include <linux/interrupt.h>
 #include <linux/bcma/bcma.h>
 #include <linux/sched.h>
+#include <linux/devcoredump.h>
 #include <asm/unaligned.h>
 
 #include <soc.h>
@@ -1744,6 +1745,26 @@ static void brcmf_pcie_setup(struct device *dev, int ret,
 	device_release_driver(dev);
 }
 
+static int brcmf_pcie_dev_coredump(struct device *dev)
+{
+	struct brcmf_bus *bus_if = dev_get_drvdata(dev);
+	struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie;
+	struct brcmf_pciedev_info *devinfo = buspub->devinfo;
+	size_t len;
+	void *dump;
+
+	len = devinfo->ci->ramsize - devinfo->ci->srsize;
+	dump = vzalloc(len);
+	if (!dump)
+		return -ENOMEM;
+
+	brcmf_dbg(PCIE, "dump at 0x%08X: len=%zu\n", devinfo->ci->rambase, len);
+	brcmf_pcie_copy_dev_tomem(devinfo, devinfo->ci->rambase, dump, len);
+
+	dev_coredumpv(dev, dump, len, GFP_KERNEL);
+	return 0;
+}
+
 static int
 brcmf_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 {
@@ -2002,6 +2023,7 @@ static int brcmf_pcie_pm_leave_D3(struct device *dev)
 	.id_table = brcmf_pcie_devid_table,
 	.probe = brcmf_pcie_probe,
 	.remove = brcmf_pcie_remove,
+	.driver.coredump = brcmf_pcie_dev_coredump,
 #ifdef CONFIG_PM
 	.driver.pm = &brcmf_pciedrvr_pm,
 #endif
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ