[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180205132231.GD2567@mtr-leonro.local>
Date: Mon, 5 Feb 2018 15:22:31 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Steve Wise <swise@...ngridcomputing.com>
Cc: 'David Ahern' <dsahern@...il.com>,
'RDMA mailing list' <linux-rdma@...r.kernel.org>,
'netdev' <netdev@...r.kernel.org>,
'Stephen Hemminger' <stephen@...workplumber.org>
Subject: Re: [PATCH iproute2-next 08/10] rdma: Add QP resource tracking
information
On Thu, Feb 01, 2018 at 02:05:08PM -0600, Steve Wise wrote:
> Hey Leon,
<...>
>
> > +static int res_qp_parse_cb(const struct nlmsghdr *nlh, void *data)
> > +{
<...>
> > +
> > + mnl_attr_for_each_nested(nla_entry, nla_table) {
> > + struct nlattr *nla_line[RDMA_NLDEV_ATTR_MAX] = {};
> > + uint32_t lqpn, rqpn = 0, rq_psn = 0, sq_psn;
> > + uint8_t type, state, path_mig_state = 0;
> > + uint32_t port = 0, pid = 0;
> > + char *comm = NULL;
<...>
> > +
> > + if (rd_check_is_filtered(rd, "pid", pid))
> > + continue;
>
> Is comm leaked here when ATTR_RES_PID is present?
>
>
> > +
> > + if (nla_line[RDMA_NLDEV_ATTR_RES_KERN_NAME])
> > + /* discard const from mnl_attr_get_str */
> > + comm = (char
> > *)mnl_attr_get_str(nla_line[RDMA_NLDEV_ATTR_RES_KERN_NAME]);
>
> And also here if the kernel ever passes up both PID and KERN_NAME (which it
> isn't supposed to).
Yes, you are right, and the bad thing that I prepared everything to call
free() unconditionally by setting comm to be NULL.
Thanks
>
>
> Steve.
>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists