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] [day] [month] [year] [list]
Message-Id: <20190106083754.6004-2-afaerber@suse.de>
Date:   Sun,  6 Jan 2019 09:37:44 +0100
From:   Andreas Färber <afaerber@...e.de>
To:     linux-lpwan@...ts.infradead.org
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        Andreas Färber <afaerber@...e.de>,
        "David S. Miller" <davem@...emloft.net>
Subject: [PATCH lora-next 01/11] net: lora: sx125x: Abort on wrong version

This helps detect issues such as the concentrator being in reset.

Enhance error output while at it.

Signed-off-by: Andreas Färber <afaerber@...e.de>
---
 drivers/net/lora/sx125x.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/lora/sx125x.c b/drivers/net/lora/sx125x.c
index 90e7cdb9d1a8..0228d1f887a0 100644
--- a/drivers/net/lora/sx125x.c
+++ b/drivers/net/lora/sx125x.c
@@ -195,9 +195,13 @@ static int __maybe_unused sx125x_regmap_probe(struct device *dev, struct regmap
 	if (true) {
 		ret = regmap_read(priv->regmap, SX1255_VERSION, &val);
 		if (ret) {
-			dev_err(dev, "version read failed\n");
+			dev_err(dev, "version read failed (%d)\n", ret);
 			return ret;
 		}
+		if (val != 0x21) {
+			dev_err(dev, "unexpected version: %u\n", val);
+			return -EINVAL;
+		}
 		dev_info(dev, "SX125x version: %02x\n", val);
 	}
 
-- 
2.16.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ