netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2-next] rdma: Check comm string before print in print_comm()
@ 2019-09-11  8:12 Leon Romanovsky
  2019-09-15 17:47 ` David Ahern
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2019-09-11  8:12 UTC (permalink / raw)
  To: David Ahern
  Cc: Mark Zhang, netdev, RDMA mailing list, Stephen Hemminger,
	Leon Romanovsky

From: Mark Zhang <markz@mellanox.com>

Broken kernels (not-upstream) can provide wrong empty "comm" field.
It causes to segfault while printing in JSON format.

Fixes: 8ecac46a60ff ("rdma: Add QP resource tracking information")
Signed-off-by: Mark Zhang <markz@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 rdma/res.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/rdma/res.c b/rdma/res.c
index 97a7b964..6003006e 100644
--- a/rdma/res.c
+++ b/rdma/res.c
@@ -161,6 +161,9 @@ void print_comm(struct rd *rd, const char *str, struct nlattr **nla_line)
 {
 	char tmp[18];
 
+	if (!str)
+		return;
+
 	if (rd->json_output) {
 		/* Don't beatify output in JSON format */
 		jsonw_string_field(rd->jw, "comm", str);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-16  5:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-11  8:12 [PATCH iproute2-next] rdma: Check comm string before print in print_comm() Leon Romanovsky
2019-09-15 17:47 ` David Ahern
2019-09-16  5:25   ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).