From patchwork Mon Aug 18 18:36:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Broz X-Patchwork-Id: 4738571 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2F5B9C0338 for ; Mon, 18 Aug 2014 18:41:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5877C20125 for ; Mon, 18 Aug 2014 18:41:26 +0000 (UTC) Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mail.kernel.org (Postfix) with ESMTP id 31DD820121 for ; Mon, 18 Aug 2014 18:41:25 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s7IIbCI8013264; Mon, 18 Aug 2014 14:37:13 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s7IIbBpU019775 for ; Mon, 18 Aug 2014 14:37:11 -0400 Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.20]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s7IIbA8L003796; Mon, 18 Aug 2014 14:37:11 -0400 Received: from mail-la0-f43.google.com (mail-la0-f43.google.com [209.85.215.43]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7IIb5cH010278 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL); Mon, 18 Aug 2014 14:37:06 -0400 Received: by mail-la0-f43.google.com with SMTP id gi9so2454130lab.30 for ; Mon, 18 Aug 2014 11:37:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=B42LJXQW4q8HEHdDqqynkBjQhXoDAsWsHZ7JjoVASd0=; b=Dc0mIcTPIFDXfa0eFCCKk4WLhhW+GeHOmyOeIaJvRK1uImL/JUYHC2pqE7bauvttKZ NY9PioKdWIh/fkQzUsLo7LTKqv6szFNsj62BRfjijTGTimqzYDAoiRhXNxW3uuDnCamT JsYMKImZOqVY2dNZa76P9GDJAbRrn+TrheHxK9n8ZBhLgG48wY3k5Oi5WVITnh2v6MKi osYIrgda/rhqoY1j0kSpU4scMcAk37fNoxs4REYd8zHQlSyMDXt/mU9gyHn+M20zkPUA ZldCECtWcU5co1ZKARyrA0/64MMei2wWaqzQNYhc0Oa6dawr9hJjPGZygML7fWQx+aTC ce3A== X-Received: by 10.112.35.97 with SMTP id g1mr30018621lbj.20.1408387024262; Mon, 18 Aug 2014 11:37:04 -0700 (PDT) Received: from merlot.mazyland.net (56.157.broadband5.iol.cz. [88.100.157.56]) by mx.google.com with ESMTPSA id o15sm10999351laa.44.2014.08.18.11.37.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Aug 2014 11:37:03 -0700 (PDT) From: Milan Broz To: dm-devel@redhat.com Date: Mon, 18 Aug 2014 20:36:37 +0200 Message-Id: <1408386997-14690-1-git-send-email-gmazyland@gmail.com> In-Reply-To: <53F238EF.10409@winsoft.pl> References: <53F238EF.10409@winsoft.pl> X-RedHat-Spam-Score: -3.1 (BAYES_00, DCC_REPUT_00_12, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.20 X-loop: dm-devel@redhat.com Cc: kkolasa@winsoft.pl, mpatocka@redhat.com, agk@redhat.com, snitzer@redhat.com, Milan Broz Subject: [dm-devel] [PATCH] dm-crypt: Fix per-bio data alignment X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The commit 298a9fa08a1577211d42a75e8fc073baef61e0d9 dm crypt: use per-bio data causes OOPS on 32bit i686 architecture BUG: unable to handle kernel paging request at 20000000 IP: [] clone_endio+0x13/0xe0 [dm_mod] ... [] bio_endio+0x61/0x90 [] crypt_dec_pending+0x8c/0xd0 [dm_crypt] [] kcryptd_crypt+0x4bf/0x4f0 [dm_crypt] This patch fixes the issue by aligning per-bio alocated structure size. Reported-by: Krzysztof Kolasa Signed-off-by: Milan Broz --- drivers/md/dm-crypt.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 2785007..33f26a2 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -1735,9 +1735,10 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv) goto bad; } - cc->per_bio_data_size = ti->per_bio_data_size = - sizeof(struct dm_crypt_io) + cc->dmreq_start + - sizeof(struct dm_crypt_request) + cc->iv_size; + cc->per_bio_data_size = ALIGN(sizeof(struct dm_crypt_io) + cc->dmreq_start + + sizeof(struct dm_crypt_request) + cc->iv_size, + ARCH_KMALLOC_MINALIGN); + ti->per_bio_data_size = cc->per_bio_data_size; cc->page_pool = mempool_create_page_pool(MIN_POOL_PAGES, 0); if (!cc->page_pool) {