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

2017-09-19 Thread Sergey Senozhatsky
Hello, On (09/20/17 14:51), Minchan Kim wrote: > On Tue, Sep 19, 2017 at 07:21:25PM +0900, Sergey Senozhatsky wrote: > > Minchan, > > > > I just ran across it [because I had a bug to analize where this > > part was involved]. I'd really prefer the kernel to BUG_ON immediately > > instead of dying

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

2017-09-19 Thread Minchan Kim
On Tue, Sep 19, 2017 at 07:21:25PM +0900, Sergey Senozhatsky wrote: > Minchan, > > I just ran across it [because I had a bug to analize where this > part was involved]. I'd really prefer the kernel to BUG_ON immediately > instead of dying in agony. > > can we, please, return BUG_ON() back? > > t

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

2017-09-19 Thread Sergey Senozhatsky
Minchan, I just ran across it [because I had a bug to analize where this part was involved]. I'd really prefer the kernel to BUG_ON immediately instead of dying in agony. can we, please, return BUG_ON() back? there is no point in trying to save the kernel once it did that type of violation. ---

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

2017-09-19 Thread Sergey Senozhatsky
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

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

2017-09-18 Thread Minchan Kim
Hi Sergey, On Tue, Sep 19, 2017 at 02:39:35PM +0900, Sergey Senozhatsky wrote: > On (09/19/17 11:34), Minchan Kim wrote: > [..] > > static void zram_meta_free(struct zram *zram, u64 disksize) > > { > > size_t num_pages = disksize >> PAGE_SHIFT; > > @@ -876,11 +855,18 @@ static int __zram_bve

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

2017-09-18 Thread Sergey Senozhatsky
On (09/19/17 11:34), Minchan Kim wrote: [..] > static void zram_meta_free(struct zram *zram, u64 disksize) > { > size_t num_pages = disksize >> PAGE_SHIFT; > @@ -876,11 +855,18 @@ static int __zram_bvec_read(struct zram *zram, struct > page *page, u32 index, > zram_slot_unloc

[PATCH] zram: fix null dereference of handle

2017-09-18 Thread Minchan Kim
For the testing, I found handle passed to zs_map_object in __zram_bvec_read is NULL so that kernel goes the oops by pin_object. The reason is there is no routine to check the slot's freeing after getting the slot's lock. This patch fixes it. Fixes: 1f7319c74275 ("zram: partial IO refactoring") Cc