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: <20200427134031.323403-17-Jerome.Pouiller@silabs.com>
Date:   Mon, 27 Apr 2020 15:40:30 +0200
From:   Jerome Pouiller <Jerome.Pouiller@...abs.com>
To:     devel@...verdev.osuosl.org, linux-wireless@...r.kernel.org
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Kalle Valo <kvalo@...eaurora.org>,
        "David S . Miller" <davem@...emloft.net>,
        Jérôme Pouiller 
        <jerome.pouiller@...abs.com>
Subject: [PATCH 16/17] staging: wfx: fix display of exception indication

From: Jérôme Pouiller <jerome.pouiller@...abs.com>

Until now, the exception received from the chip was only displayed if
driver was compiled with DEBUG enabled. It was not very convenient to
help users. We prefer to show the exception unconditionally.

In add, this patch provides the semantic of the first bytes of the
struct.

Signed-off-by: Jérôme Pouiller <jerome.pouiller@...abs.com>
---
 drivers/staging/wfx/hif_api_general.h | 11 +++++------
 drivers/staging/wfx/hif_rx.c          | 12 +++++++++---
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wfx/hif_api_general.h b/drivers/staging/wfx/hif_api_general.h
index 275354eb6b6a..1c010f15c6d0 100644
--- a/drivers/staging/wfx/hif_api_general.h
+++ b/drivers/staging/wfx/hif_api_general.h
@@ -223,12 +223,6 @@ struct hif_ind_generic {
 	union hif_indication_data indication_data;
 } __packed;
 
-
-struct hif_ind_exception {
-	u8     data[124];
-} __packed;
-
-
 enum hif_error {
 	HIF_ERROR_FIRMWARE_ROLLBACK       = 0x0,
 	HIF_ERROR_FIRMWARE_DEBUG_ENABLED  = 0x1,
@@ -248,6 +242,11 @@ struct hif_ind_error {
 	u8     data[];
 } __packed;
 
+struct hif_ind_exception {
+	__le32 type;
+	u8     data[];
+} __packed;
+
 enum hif_secure_link_state {
 	SEC_LINK_UNAVAILABLE = 0x0,
 	SEC_LINK_RESERVED    = 0x1,
diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c
index e6daac36f5c8..783f301d58a8 100644
--- a/drivers/staging/wfx/hif_rx.c
+++ b/drivers/staging/wfx/hif_rx.c
@@ -331,10 +331,16 @@ static int hif_generic_indication(struct wfx_dev *wdev,
 static int hif_exception_indication(struct wfx_dev *wdev,
 				    const struct hif_msg *hif, const void *buf)
 {
-	size_t len = hif->len - 4; // drop header
+	const struct hif_ind_exception *body = buf;
+	int type = le32_to_cpu(body->type);
 
-	dev_err(wdev->dev, "firmware exception\n");
-	print_hex_dump_bytes("Dump: ", DUMP_PREFIX_NONE, buf, len);
+	if (type == 4)
+		dev_err(wdev->dev, "firmware assert %d\n",
+			le32_to_cpup((__le32 *)body->data));
+	else
+		dev_err(wdev->dev, "firmware exception\n");
+	print_hex_dump(KERN_INFO, "hif: ", DUMP_PREFIX_OFFSET,
+		       16, 1, hif, hif->len, false);
 	wdev->chip_frozen = true;
 
 	return -1;
-- 
2.26.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ