rdma: Check comm string before print in print_comm()
Broken kernels (not-upstream) can provide wrong empty "comm" field.
It causes to segfault while printing in JSON format.
Fixes: 8ecac46a60 ("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>
This commit is contained in:
parent
2caa8012e8
commit
4e2d9fc4d8
|
|
@ -159,6 +159,9 @@ void print_comm(struct rd *rd, const char *str, struct nlattr **nla_line)
|
||||||
{
|
{
|
||||||
char tmp[18];
|
char tmp[18];
|
||||||
|
|
||||||
|
if (!str)
|
||||||
|
return;
|
||||||
|
|
||||||
if (rd->json_output) {
|
if (rd->json_output) {
|
||||||
/* Don't beatify output in JSON format */
|
/* Don't beatify output in JSON format */
|
||||||
jsonw_string_field(rd->jw, "comm", str);
|
jsonw_string_field(rd->jw, "comm", str);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue