All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Nitin Gupta <ngupta@vflare.org>
Cc: Greg KH <greg@kroah.com>,
	Seth Jennings <sjenning@linux.vnet.ibm.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Sam Hansen <solid.se7en@gmail.com>, Tomas M <tomas@slax.org>,
	Mihail Kasadjikov <hamer.mk@gmail.com>,
	Linux Driver Project <devel@linuxdriverproject.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] zram: Prevent use of unmapped buffer
Date: Wed, 28 Nov 2012 14:15:05 +0900	[thread overview]
Message-ID: <20121128051505.GD23136@blaptop> (raw)
In-Reply-To: <1354001167-24878-1-git-send-email-ngupta@vflare.org>

Hi Nitin,

On Mon, Nov 26, 2012 at 11:26:07PM -0800, Nitin Gupta wrote:
> The commit c8f2f0db1 ("zram: Fix handling of incompressible pages")
> introduced a bug which caused a kunmap()'ed buffer to be used in case

I got confused by the descripton. :(
The descripton is not right.
The problem is to access freed memory, not accessing to kunmaped buffer.

partial I/O write.

1. uncmem = kmalloc
2. zram_decompress_page(uncmem)
3. memcpy(uncmem, user_mem)
4. lzo1x_1_compress(uncmem)
5. kfree(uncmem)
6. src = uncmem
7. memcpy(cmem, src, clen) <----- HIT

> of partial writes where the data was found to be incompressible.
> 
> This fixes bug 50081:
> https://bugzilla.kernel.org/show_bug.cgi?id=50081
> 
> Signed-off-by: Nitin Gupta <ngupta@vflare.org>
> Reported-by: Mihail Kasadjikov <hamer.mk@gmail.com>
> Reported-by: Tomas M <tomas@slax.org>

Good catch! Shame on me. I should have reivewed more carefully. :(
Please resend it with revised descrption and title.
I will rebase mh patchset just sent on top of this bug fix patch.

P.S) Sigh, Now code isn't clean due to partial read/write path handling.
     IMHO, sooner or later, we need refactoring.

-- 
Kind regards,
Minchan Kim

  parent reply	other threads:[~2012-11-28  5:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-27  7:26 [PATCH] zram: Prevent use of unmapped buffer Nitin Gupta
2012-11-27  7:52 ` Tomas M
2012-11-28  5:15 ` Minchan Kim [this message]
2012-11-29  1:33   ` Minchan Kim
2012-11-29  1:45     ` Nitin Gupta
2012-11-29  2:08       ` Minchan Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121128051505.GD23136@blaptop \
    --to=minchan@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@linuxdriverproject.org \
    --cc=greg@kroah.com \
    --cc=hamer.mk@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ngupta@vflare.org \
    --cc=sjenning@linux.vnet.ibm.com \
    --cc=solid.se7en@gmail.com \
    --cc=tomas@slax.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.