lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20180107074455.GA6823@mtr-leonro.local>
Date:   Sun, 7 Jan 2018 09:44:56 +0200
From:   Leon Romanovsky <leon@...nel.org>
To:     David Ahern <dsahern@...il.com>
Cc:     Doug Ledford <dledford@...hat.com>,
        Jason Gunthorpe <jgg@...lanox.com>,
        RDMA mailing list <linux-rdma@...r.kernel.org>,
        netdev <netdev@...r.kernel.org>,
        Stephen Hemminger <stephen@...workplumber.org>
Subject: Re: [PATCH iproute2-next v1 3/9] rdma: Add filtering infrastructure

On Thu, Jan 04, 2018 at 08:29:31PM -0700, David Ahern wrote:
> On 1/4/18 12:01 AM, Leon Romanovsky wrote:
> > diff --git a/rdma/utils.c b/rdma/utils.c
> > index af2b374d..446c23da 100644
> > --- a/rdma/utils.c
> > +++ b/rdma/utils.c
> > @@ -114,6 +114,225 @@ static void dev_map_cleanup(struct rd *rd)
> >  	}
> >  }
> >
> > +static int add_filter(struct rd *rd, char *key, char *value,
> > +		      const char * const valid_filters[])
> > +{
> > +	char cset[] = "1234567890,-";
> > +	struct filter_entry *fe;
> > +	bool key_found = false;
> > +	int idx = 0;
> > +	int ret;
> > +
> > +	fe = calloc(1, sizeof(*fe));
> > +	if (!fe)
> > +		return -ENOMEM;
> > +
> > +	while (valid_filters[idx]) {
> > +		if (!strcmpx(key, valid_filters[idx])) {
> > +			key_found = true;
> > +			break;
> > +		}
> > +		idx++;
> > +	}
> > +	if (!key_found) {
> > +		pr_err("Unsupported filter option: %s\n", key);
> > +		ret = -EINVAL;
> > +		goto err;
> > +	}
> > +
> > +	/*
> > +	 * Check the filter validity, not optimal, but works
> > +	 *
> > +	 * Actually, there are three types of filters
> > +	 *  numeric - for example PID or QPN
> > +	 *  string  - for example states, currently only "display"
> > +	 *            is from this type
> > +	 *  link    - user requested to filter on specific link
> > +	 *            e.g. mlx5_1/1, mlx5_1/-, mlx5_1 ...
> > +	 */
> > +	if (strcmpx(key, "link") && strcmpx(key, "display") &&
> > +	    strspn(value, cset) != strlen(value)) {
> > +		pr_err("%s filter accepts \"%s\" characters only\n", key, cset);
> > +		ret = -EINVAL;
> > +		goto err;
> > +	}
> > +
> > +	fe->key = strdup(key);
> > +	fe->value = strdup(value);
> > +
>
> Missed this the other day. 2 more strdup's that should be checked.

Thanks, David,

I'll fix and send new version once the RDMA kernel part will be accepted.

Thanks

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ