Linux-RDMA Archive on lore.kernel.org
 help / color / 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	[flat|nested] 3+ messages in thread

* Re: [PATCH iproute2-next] rdma: Check comm string before print in print_comm()
  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
  0 siblings, 1 reply; 3+ messages in thread
From: David Ahern @ 2019-09-15 17:47 UTC (permalink / raw)
  To: Leon Romanovsky, David Ahern
  Cc: Mark Zhang, netdev, RDMA mailing list, Stephen Hemminger,
	Leon Romanovsky

On 9/11/19 2:12 AM, Leon Romanovsky wrote:
> 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")

that commit is from 2018, so this should go to master; re-assigned in
patchwork.

> 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);
> 


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

* Re: [PATCH iproute2-next] rdma: Check comm string before print in print_comm()
  2019-09-15 17:47 ` David Ahern
@ 2019-09-16  5:25   ` Leon Romanovsky
  0 siblings, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2019-09-16  5:25 UTC (permalink / raw)
  To: David Ahern; +Cc: Mark Zhang, netdev, RDMA mailing list, Stephen Hemminger

On Sun, Sep 15, 2019 at 11:47:19AM -0600, David Ahern wrote:
> On 9/11/19 2:12 AM, Leon Romanovsky wrote:
> > 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")
>
> 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

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

end of thread, back to index

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

Linux-RDMA Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-rdma/0 linux-rdma/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rdma linux-rdma/ https://lore.kernel.org/linux-rdma \
		linux-rdma@vger.kernel.org linux-rdma@archiver.kernel.org
	public-inbox-index linux-rdma


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-rdma


AGPL code for this site: git clone https://public-inbox.org/ public-inbox