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


Groups > linux.kernel > #1593159

[PATCH] zram: set physical queue limits to avoid array out of bounds accesses

From Johannes Thumshirn <jthumshirn@suse.de>
Newsgroups linux.kernel
Subject [PATCH] zram: set physical queue limits to avoid array out of bounds accesses
Date 2017-03-06 11:30 +0100
Message-ID <thY3U-6MU-11@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


zram can handle at most SECTORS_PER_PAGE sectors in a bio's bvec. When using
the NVMe over Fabrics loopback target which potentially sends a huge bulk of
pages attached to the bio's bvec this results in a kernel panic because of
array out of bounds accesses in zram_decompress_page().

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 drivers/block/zram/zram_drv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index e27d89a..dceb5ed 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1189,6 +1189,8 @@ static int zram_add(void)
 	blk_queue_io_min(zram->disk->queue, PAGE_SIZE);
 	blk_queue_io_opt(zram->disk->queue, PAGE_SIZE);
 	zram->disk->queue->limits.discard_granularity = PAGE_SIZE;
+	zram->disk->queue->limits.max_sectors = SECTORS_PER_PAGE;
+	zram->disk->queue->limits.chunk_sectors = 0;
 	blk_queue_max_discard_sectors(zram->disk->queue, UINT_MAX);
 	/*
 	 * zram_bio_discard() will clear all logical blocks if logical block
-- 
1.8.5.6

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


Thread

[PATCH] zram: set physical queue limits to avoid array out of bounds accesses Johannes Thumshirn <jthumshirn@suse.de> - 2017-03-06 11:30 +0100
  Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-03-06 11:50 +0100
  Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Andrew Morton <akpm@linux-foundation.org> - 2017-03-06 22:40 +0100
  Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Minchan Kim <minchan@kernel.org> - 2017-03-07 07:10 +0100
    Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Minchan Kim <minchan@kernel.org> - 2017-03-07 08:30 +0100
      Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Minchan Kim <minchan@kernel.org> - 2017-03-07 10:20 +0100
        Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Johannes Thumshirn <jthumshirn@suse.de> - 2017-03-07 11:30 +0100
          Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Minchan Kim <minchan@kernel.org> - 2017-03-08 06:50 +0100
            Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Johannes Thumshirn <jthumshirn@suse.de> - 2017-03-08 09:50 +0100
              Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Minchan Kim <minchan@kernel.org> - 2017-03-09 06:30 +0100
      Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Hannes Reinecke <hare@suse.de> - 2017-03-07 12:40 +0100
    Re: [PATCH] zram: set physical queue limits to avoid array out of  bounds accesses Hannes Reinecke <hare@suse.de> - 2017-03-07 08:40 +0100

csiph-web