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: <20251024-fix-module-info-json-v3-1-36862ce701ae@a-eberle.de>
Date: Fri, 24 Oct 2025 12:32:51 +0200
From: Johannes Eigner <johannes.eigner@...berle.de>
To: netdev@...r.kernel.org
Cc: Michal Kubecek <mkubecek@...e.cz>, 
 Danielle Ratson <danieller@...dia.com>, 
 Stephan Wurm <stephan.wurm@...berle.de>, Andrew Lunn <andrew@...n.ch>, 
 Johannes Eigner <johannes.eigner@...berle.de>
Subject: [PATCH ethtool v3 1/2] sfpid: Fix JSON output of SFP diagnostics

Close and delete JSON object only after output of SFP diagnostics so
that it is also JSON formatted. If the JSON object is deleted too early,
some of the output will not be JSON formatted, resulting in mixed output
formats.

Fixes: 703bfee13649 (ethtool: Enable JSON output support for SFF8079 and SFF8472 modules)
Reviewed-by: Danielle Ratson <danieller@...dia.com>
Signed-off-by: Johannes Eigner <johannes.eigner@...berle.de>
---
 sfpid.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sfpid.c b/sfpid.c
index 62acb4f..9d09256 100644
--- a/sfpid.c
+++ b/sfpid.c
@@ -520,22 +520,23 @@ int sff8079_show_all_nl(struct cmd_context *ctx)
 	new_json_obj(ctx->json);
 	open_json_object(NULL);
 	sff8079_show_all_common(buf);
-	close_json_object();
-	delete_json_obj();
 
 	/* Finish if A2h page is not present */
 	if (!(buf[92] & (1 << 6)))
-		goto out;
+		goto out_json;
 
 	/* Read A2h page */
 	ret = sff8079_get_eeprom_page(ctx, SFF8079_I2C_ADDRESS_HIGH,
 				      buf + ETH_MODULE_SFF_8079_LEN);
 	if (ret) {
 		fprintf(stderr, "Failed to read Page A2h.\n");
-		goto out;
+		goto out_json;
 	}
 
 	sff8472_show_all(buf);
+out_json:
+	close_json_object();
+	delete_json_obj();
 out:
 	free(buf);
 

-- 
2.43.0


Download attachment "smime.p7s" of type "application/x-pkcs7-signature" (4153 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ