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: <1525342843.21176.635.camel@linux.intel.com>
Date:   Thu, 03 May 2018 13:20:43 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Amit Pundir <amit.pundir@...aro.org>,
        lkml <linux-kernel@...r.kernel.org>,
        linux-wireless@...r.kernel.org
Cc:     Suren Baghdasaryan <surenb@...gle.com>,
        Samuel Ortiz <sameo@...ux.intel.com>,
        Christophe Ricard <christophe.ricard@...il.com>,
        Greg KH <gregkh@...uxfoundation.org>,
        John Stultz <john.stultz@...aro.org>,
        Dmitry Shmidt <dimitrysh@...gle.com>,
        Todd Kjos <tkjos@...gle.com>,
        Android Kernel Team <kernel-team@...roid.com>
Subject: Re: [PATCH v2 3/3] NFC: fdp: Fix possible buffer overflow in
 WCS4000 NFC driver

On Wed, 2018-05-02 at 23:18 +0530, Amit Pundir wrote:
> From: Suren Baghdasaryan <surenb@...gle.com>
> 
> Possible buffer overflow when reading next_read_size bytes into
> tmp buffer after next_read_size was extracted from a previous packet.
> 
> Signed-off-by: Suren Baghdasaryan <surenb@...gle.com>
> Signed-off-by: Amit Pundir <amit.pundir@...aro.org>
> ---
> v2:
> Remove redundant __func__ from dev_dgb().
> 
>  drivers/nfc/fdp/i2c.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/nfc/fdp/i2c.c b/drivers/nfc/fdp/i2c.c
> index c4da50e..b80d1ad 100644
> --- a/drivers/nfc/fdp/i2c.c
> +++ b/drivers/nfc/fdp/i2c.c
> @@ -176,6 +176,15 @@ static int fdp_nci_i2c_read(struct fdp_i2c_phy
> *phy, struct sk_buff **skb)
>  		/* Packet that contains a length */
>  		if (tmp[0] == 0 && tmp[1] == 0) {
>  			phy->next_read_size = (tmp[2] << 8) + tmp[3]
> + 3;
> +			/*
> +			 * Ensure next_read_size does not exceed
> sizeof(tmp)
> +			 * for reading that many bytes during next
> iteration
> +			 */
> +			if (phy->next_read_size >
> FDP_NCI_I2C_MAX_PAYLOAD) {
> +				dev_dbg(&client->dev, "corrupted
> packet\n");

> +				phy->next_read_size = 5;

Shouldn't be this magic replaced by

	phy->next_read_size = FDP_NCI_I2C_MIN_PAYLOAD;

? 

> +				goto flush;
> +			}
>  		} else {
>  			phy->next_read_size =
> FDP_NCI_I2C_MIN_PAYLOAD;
>  

-- 
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Intel Finland Oy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ