]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
rdma: Check comm string before print in print_comm()
authorMark Zhang <markz@mellanox.com>
Wed, 11 Sep 2019 08:12:43 +0000 (11:12 +0300)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 17 Sep 2019 15:17:38 +0000 (17:17 +0200)
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>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
rdma/res.c

index ef863f142eca1c8da9f63eacf1e4973ba0d60f73..c5e8ba1d7774cdd8ba6fce2ab749ef506970eaec 100644 (file)
@@ -159,6 +159,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);