Skip to contentSkip to conversation

rdma: Don't pass garbage to rd_check_is_filtered()

PATCH Applied Phil Sutter 2 participants 2 messages Oct 18, 2018 – Oct 23, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rdma: Don't pass garbage to rd_check_is_filtered()

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")
---
 rdma/res.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
rdma/res.c +4 -6
index 074b9929a38b2..0d8c1c388c4ca 100644
@@ -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]);
Signature · 1 line
2.19.0
#1 lore raw
Quoted 7 lines · On Thu, 18 Oct 2018 14:35:50 +0200 Phil Sutter <[email protected]> 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")

Applied, thanks.