Message ID | 20181018123550.20817-1-phil@nwl.cc |
---|---|
State | Accepted, archived |
Delegated to: | stephen hemminger |
Headers | show |
Series | [iproute] rdma: Don't pass garbage to rd_check_is_filtered() | expand |
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.
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]);
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(-)