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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190111053223.GA24338@kroah.com>
Date:   Fri, 11 Jan 2019 06:32:23 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Joe Perches <joe@...ches.com>
Cc:     Marcel Holtmann <marcel@...tmann.org>,
        Johan Hedberg <johan.hedberg@...il.com>,
        linux-bluetooth@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH 1/2] Bluetooth: check message types in l2cap_get_conf_opt

On Thu, Jan 10, 2019 at 01:02:09PM -0800, Joe Perches wrote:
> On Thu, 2019-01-10 at 07:28 +0100, Greg Kroah-Hartman wrote:
> > l2cap_get_conf_opt can handle a "default" message type, but it needs to
> > be verified that it really is the correct type (CONF_EFS or CONF_RFC)
> > before passing it back to the caller.  To do this we need to check the
> > return value of this call now and handle the error correctly up the
> > stack.
> []
> > diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> []
> > @@ -3324,7 +3328,7 @@ static int l2cap_parse_conf_req(struct l2cap_chan *chan, void *data, size_t data
> >  	void *endptr = data + data_size;
> >  	void *req = chan->conf_req;
> >  	int len = chan->conf_len;
> > -	int type, hint, olen;
> > +	int type, hint, olen, err;
> 
> err doesn't seem the right name for any of these as the
> return is now negative only when there is an error.
> 
> Maybe opt_len instead.

I was copying the style that was used in the rest of the file.  If the
maintainers want me to use a different name, I'll be glad to do so.  My
personal preference is just 'ret'.

> >  	unsigned long val;
> >  	struct l2cap_conf_rfc rfc = { .mode = L2CAP_MODE_BASIC };
> >  	struct l2cap_conf_efs efs;
> > @@ -3336,7 +3340,10 @@ static int l2cap_parse_conf_req(struct l2cap_chan *chan, void *data, size_t data
> >  	BT_DBG("chan %p", chan);
> >  
> >  	while (len >= L2CAP_CONF_OPT_SIZE) {
> > -		len -= l2cap_get_conf_opt(&req, &type, &olen, &val);
> > +		err = l2cap_get_conf_opt(&req, &type, &olen, &val);
> > +		if (err < 0)
> > +			return err;
> > +		len -= err;
> 
> especially as you subtract the positive return not
> an error value.

True, 'ret' would be nicer, but again, I was trying to follow the file's
style.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ