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: <20130624.113420.778980615077488498.davem@davemloft.net>
Date:	Mon, 24 Jun 2013 11:34:20 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	mst@...hat.com
Cc:	sergei.shtylyov@...entembedded.com, linux-kernel@...r.kernel.org,
	jasowang@...hat.com, edumazet@...gle.com, nhorman@...driver.com,
	netdev@...r.kernel.org, bhubbard@...hat.com
Subject: Re: [PATCH net] tun: fix recovery from gup errors

From: "Michael S. Tsirkin" <mst@...hat.com>
Date: Mon, 24 Jun 2013 15:54:12 +0300

> On Sun, Jun 23, 2013 at 07:36:21PM +0400, Sergei Shtylyov wrote:
>> Hello.
>> 
>> On 23-06-2013 18:19, Michael S. Tsirkin wrote:
>> 
>> >get user pages might fail partially in tun zero copy
>> >mode. To recover we need to put all pages that we got,
>> >but code used a wrong index resulting in double-free
>> >errors.
>> 
>> >Reported-by: Brad Hubbard <bhubbard@...hat.com>
>> >Signed-off-by: Michael S. Tsirkin <mst@...hat.com>
>> >---
>> 
>> >I haven't figured out why do we get failures,
>> >but recovery is clearly wrong.
>> 
>> >This is also -stable material.
>> 
>> >  drivers/net/tun.c | 5 +++--
>> >  1 file changed, 3 insertions(+), 2 deletions(-)
>> 
>> >diff --git a/drivers/net/tun.c b/drivers/net/tun.c
>> >index bfa9bb4..c098b1e 100644
>> >--- a/drivers/net/tun.c
>> >+++ b/drivers/net/tun.c
>> >@@ -1010,8 +1010,9 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
>> >  			return -EMSGSIZE;
>> >  		num_pages = get_user_pages_fast(base, size, 0, &page[i]);
>> >  		if (num_pages != size) {
>> >-			for (i = 0; i < num_pages; i++)
>> >-				put_page(page[i]);
>> >+			int j;
>> 
>>   Empty line wouldn't hurt here, after declaration.
>> 
>> >+			for (j = 0; j < num_pages; j++)
>> >+				put_page(page[i + j]);
> 
> I think it's clearer without: this is the only code
> within this block, declaration is really part of
> the loop that comes after it.
> An empty line would break it up visually.

No, really, an empty line after local variable declarations please.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ