Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752248AbdDDEzK (ORCPT ); Tue, 4 Apr 2017 00:55:10 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33204 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750998AbdDDEzJ (ORCPT ); Tue, 4 Apr 2017 00:55:09 -0400 Date: Tue, 4 Apr 2017 13:55:09 +0900 From: Sergey Senozhatsky To: Minchan Kim Cc: Andrew Morton , linux-kernel@vger.kernel.org, Sergey Senozhatsky , kernel-team@lge.com, Jens Axboe , Hannes Reinecke , Johannes Thumshirn Subject: Re: [PATCH 1/5] zram: handle multiple pages attached bio's bvec Message-ID: <20170404045509.GA470@jagdpanzerIV.localdomain> References: <1491196653-7388-1-git-send-email-minchan@kernel.org> <1491196653-7388-2-git-send-email-minchan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1491196653-7388-2-git-send-email-minchan@kernel.org> User-Agent: Mutt/1.8.0 (2017-02-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1282 Lines: 35 On (04/03/17 14:17), Minchan Kim wrote: > Johannes Thumshirn reported system goes the panic when using NVMe over > Fabrics loopback target with zram. > > The reason is zram expects each bvec in bio contains a single page > but nvme can attach a huge bulk of pages attached to the bio's bvec > so that zram's index arithmetic could be wrong so that out-of-bound > access makes panic. > > It can be solved by limiting max_sectors with SECTORS_PER_PAGE like > [1] but it makes zram slow because bio should split with each pages > so this patch makes zram aware of multiple pages in a bvec so it > could solve without any regression. > > [1] 0bc315381fe9, zram: set physical queue limits to avoid array out of > bounds accesses > > Cc: Jens Axboe > Cc: Hannes Reinecke > Reported-by: Johannes Thumshirn > Tested-by: Johannes Thumshirn > Reviewed-by: Johannes Thumshirn > Signed-off-by: Johannes Thumshirn > Signed-off-by: Minchan Kim Reviewed-by: Sergey Senozhatsky > + unsigned int remained = bvec.bv_len; ... > + } while (remained); a tiny nitpick, "-ed" in variable name looks a bit unusual. -ss