netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [iproute PATCH] rdma: Don't pass garbage to rd_check_is_filtered()
@ 2018-10-18 12:35 Phil Sutter
  2018-10-22 17:07 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Sutter @ 2018-10-18 12:35 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

Variables 'src_port' and 'dst_port' are initialized only if attributes
RDMA_NLDEV_ATTR_RES_SRC_ADDR or RDMA_NLDEV_ATTR_RES_DST_ADDR are
present. Make sure to pass them over to rd_check_is_filtered() only if
that is the case.

Fixes: 9a362cc71a455 ("rdma: Add CM_ID resource tracking information")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 rdma/res.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/rdma/res.c b/rdma/res.c
index 074b9929a38b2..0d8c1c388c4ca 100644
--- a/rdma/res.c
+++ b/rdma/res.c
@@ -621,6 +621,8 @@ static int res_cm_id_parse_cb(const struct nlmsghdr *nlh, void *data)
 			if (rd_check_is_string_filtered(rd, "src-addr",
 							src_addr_str))
 				continue;
+			if (rd_check_is_filtered(rd, "src-port", src_port))
+				continue;
 		}
 
 		if (nla_line[RDMA_NLDEV_ATTR_RES_DST_ADDR]) {
@@ -630,14 +632,10 @@ static int res_cm_id_parse_cb(const struct nlmsghdr *nlh, void *data)
 			if (rd_check_is_string_filtered(rd, "dst-addr",
 							dst_addr_str))
 				continue;
+			if (rd_check_is_filtered(rd, "dst-port", dst_port))
+				continue;
 		}
 
-		if (rd_check_is_filtered(rd, "src-port", src_port))
-			continue;
-
-		if (rd_check_is_filtered(rd, "dst-port", dst_port))
-			continue;
-
 		if (nla_line[RDMA_NLDEV_ATTR_RES_PID]) {
 			pid = mnl_attr_get_u32(
 					nla_line[RDMA_NLDEV_ATTR_RES_PID]);
-- 
2.19.0

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

* Re: [iproute PATCH] rdma: Don't pass garbage to rd_check_is_filtered()
  2018-10-18 12:35 [iproute PATCH] rdma: Don't pass garbage to rd_check_is_filtered() Phil Sutter
@ 2018-10-22 17:07 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2018-10-22 17:07 UTC (permalink / raw)
  To: Phil Sutter; +Cc: netdev

On Thu, 18 Oct 2018 14:35:50 +0200
Phil Sutter <phil@nwl.cc> wrote:

> Variables 'src_port' and 'dst_port' are initialized only if attributes
> RDMA_NLDEV_ATTR_RES_SRC_ADDR or RDMA_NLDEV_ATTR_RES_DST_ADDR are
> present. Make sure to pass them over to rd_check_is_filtered() only if
> that is the case.
> 
> Fixes: 9a362cc71a455 ("rdma: Add CM_ID resource tracking information")
> Signed-off-by: Phil Sutter <phil@nwl.cc>

Applied, thanks.

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

end of thread, other threads:[~2018-10-23  1:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18 12:35 [iproute PATCH] rdma: Don't pass garbage to rd_check_is_filtered() Phil Sutter
2018-10-22 17:07 ` Stephen Hemminger

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