rdma: Check comm string before print in print_comm()
Subsystems (3)
PATCH 1/1 rdma: Check comm string before print in print_comm()
From: Mark Zhang <[email protected]>
Broken kernels (not-upstream) can provide wrong empty "comm" field. It causes to segfault while printing in JSON format.
--- rdma/res.c | 3 +++ 1 file changed, 3 insertions(+)
rdma/res.c +3 -0
@@ -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);
Signature · 1 line
2.20.1
Quoted 6 lines · Leon Romanovsky
From: Mark Zhang <[email protected]>
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")
that commit is from 2018, so this should go to master; re-assigned in patchwork.
Quoted 21 lines
Signed-off-by Mark Zhang <[email protected]>Signed-off-by Leon Romanovsky <[email protected]>--- rdma/res.c | 3 +++ 1 file changed, 3 insertions(+)rdma/res.c +3
-0@@ -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);
Quoted 10 lines · David Ahern
Quoted 6 lines · Leon Romanovsky
From: Mark Zhang <[email protected]>
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")that commit is from 2018, so this should go to master; re-assigned in patchwork.
This is exactly why I sent it to -next, it is not urgent :)
Thanks