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: <20140908120820.GB9560@localhost>
Date:	Mon, 8 Sep 2014 14:08:20 +0200
From:	Johan Hovold <johan@...nel.org>
To:	Octavian Purdila <octavian.purdila@...el.com>
Cc:	gregkh@...uxfoundation.org, linus.walleij@...aro.org,
	gnurou@...il.com, wsa@...-dreams.de, sameo@...ux.intel.com,
	lee.jones@...aro.org, arnd@...db.de, johan@...nel.org,
	daniel.baluta@...el.com, laurentiu.palcu@...el.com,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-gpio@...r.kernel.org, linux-i2c@...r.kernel.org
Subject: Re: [PATCH v3 1/3] mfd: add support for Diolan DLN-2 devices

On Mon, Sep 08, 2014 at 01:32:33PM +0200, Johan Hovold wrote:
> On Fri, Sep 05, 2014 at 06:17:57PM +0300, Octavian Purdila wrote:

> > +static int _dln2_transfer(struct dln2_dev *dln2, u16 handle, u16 cmd,
> > +			  void *obuf, int obuf_len, void *ibuf, int *ibuf_len)
> > +{

<snip>

> > +	/* if we got here we know that the response header has been checked */
> > +	rsp = rxc->urb->transfer_buffer;
> > +	result = le16_to_cpu(rsp->result);
> 
> Yes, but you haven't verified that rsp->hdr.size > 0, so you may still
> be reading stale data.

I meant that you haven't verified that the payload size > 1 (the header
size is included in rsp->hdr.size and result is two byte wide).

> > +
> > +	if (result) {
> > +		dev_dbg(dev, "%d received response with error %d\n",
> > +			handle, result);
> > +		ret = -EREMOTEIO;
> > +		goto out_free_rx_slot;
> > +	}
> > +
> > +	if (!ibuf) {
> > +		ret = 0;
> > +		goto out_free_rx_slot;
> > +	}
> > +
> > +	if (*ibuf_len > rxc->urb->actual_length - sizeof(*rsp))
> > +		*ibuf_len = rxc->urb->actual_length - sizeof(*rsp);
> 
> And then you get an underflow here, although that doesn't seem to cause
> any troubles in this case.

Unless ibuf_len is -1... 

> But why isn't ibuf_len unsigned?
>
> > +
> > +	memcpy(ibuf, rsp + 1, *ibuf_len);
> > +
> > +out_free_rx_slot:
> > +	free_rx_slot(dln2, rxs, rx_slot);
> > +
> > +	return ret;
> > +}

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ