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: <20231229065241.554726-2-huangjunxian6@hisilicon.com>
Date: Fri, 29 Dec 2023 14:52:40 +0800
From: Junxian Huang <huangjunxian6@...ilicon.com>
To: <jgg@...pe.ca>, <leon@...nel.org>, <dsahern@...il.com>,
	<stephen@...workplumber.org>
CC: <netdev@...r.kernel.org>, <linux-rdma@...r.kernel.org>,
	<linuxarm@...wei.com>, <linux-kernel@...r.kernel.org>,
	<huangjunxian6@...ilicon.com>
Subject: [PATCH iproute2-rc 1/2] rdma: Fix core dump when pretty is used

From: Chengchang Tang <tangchengchang@...wei.com>

There will be a core dump when pretty is used as the JSON object
hasn't been opened and closed properly.

Before:
$ rdma res show qp -jp -dd
[ {
    "ifindex": 1,
    "ifname": "hns_1",
    "port": 1,
    "lqpn": 1,
    "type": "GSI",
    "state": "RTS",
    "sq-psn": 0,
    "comm": "ib_core"
},
"drv_sq_wqe_cnt": 128,
"drv_sq_max_gs": 2,
"drv_rq_wqe_cnt": 512,
"drv_rq_max_gs": 1,
rdma: json_writer.c:130: jsonw_end: Assertion `self->depth > 0' failed.
Aborted (core dumped)

After:
$ rdma res show qp -jp -dd
[ {
        "ifindex": 2,
        "ifname": "hns_2",
        "port": 1,
        "lqpn": 1,
        "type": "GSI",
        "state": "RTS",
        "sq-psn": 0,
        "comm": "ib_core",{
            "drv_sq_wqe_cnt": 128,
            "drv_sq_max_gs": 2,
            "drv_rq_wqe_cnt": 512,
            "drv_rq_max_gs": 1,
            "drv_ext_sge_sge_cnt": 256
        }
    } ]

Fixes: 331152752a97 ("rdma: print driver resource attributes")
Signed-off-by: Chengchang Tang <tangchengchang@...wei.com>
Signed-off-by: Junxian Huang <huangjunxian6@...ilicon.com>
---
 rdma/utils.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/rdma/utils.c b/rdma/utils.c
index 09985069..dcf24337 100644
--- a/rdma/utils.c
+++ b/rdma/utils.c
@@ -926,7 +926,7 @@ void print_driver_table(struct rd *rd, struct nlattr *tb)
 		return;
 
 	if (rd->pretty_output)
-		newline_indent(rd);
+		open_json_object(NULL);
 
 	/*
 	 * Driver attrs are tuples of {key, [print-type], value}.
@@ -960,5 +960,9 @@ void print_driver_table(struct rd *rd, struct nlattr *tb)
 			key = NULL;
 		}
 	}
+
+	if (rd->pretty_output)
+		newline_indent(rd);
+
 	return;
 }
-- 
2.30.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ