Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1734791

Re: [PATCH] zram: fix null dereference of handle

From Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] zram: fix null dereference of handle
Date 2017-09-19 12:20 +0200
Message-ID <urnNf-47l-1@gated-at.bofh.it> (permalink)
References <urgC5-6EL-3@gated-at.bofh.it> <urjqi-8ru-13@gated-at.bofh.it> <urkFH-Lc-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Minchan,

On (09/19/17 15:59), Minchan Kim wrote:
[..]
> > another question, "!handle  ==  value & ZRAM_SAME"? if so, then why not
> > just check for `flags & ZRAM_SAME'? if not then:
> > 
> > -  for `value & ZRAM_SAME' you fill the page with zram_get_element(zram, index)
> >    and return 0. ok.
> > 
> > -  for !handle.... you also fill the page with zram_get_element(zram, index)
> >    and return 0. is this ok? shouldn't !handle return error in this case?
> 
> We discussed it before that we shouldn't return error.
> Userspace can ask reading unallocated buffer freely.

ok, so this is intentional behaviour.

> And in this case, it fills the buffer zero because handle and element is unified.
> However, if your concern is readability, I will make it more explict.

correct.
... but I thought that we would also return an error.

> > I really suspect that there are some paths that can lead to !handle
> > entry, that will not be ZRAM_SAME. e.g. error return from compression
> > path.
> 
> Could you be more specific?

I just meant that there are error paths in zram write, which will leave
us both with !handle entries and !ZRAM_SAME. but it seems that this is
the intentional behaviour.

	-ss

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] zram: fix null dereference of handle Minchan Kim <minchan@kernel.org> - 2017-09-19 04:40 +0200
  Re: [PATCH] zram: fix null dereference of handle Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-09-19 07:40 +0200
    Re: [PATCH] zram: fix null dereference of handle Minchan Kim <minchan@kernel.org> - 2017-09-19 09:00 +0200
      Re: [PATCH] zram: fix null dereference of handle Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-09-19 12:20 +0200

csiph-web