Message ID | 20230420100501.32981-19-jth@kernel.org (mailing list archive) |
---|---|
State | Mainlined, archived |
Headers | show
Return-Path: <linux-fsdevel-owner@vger.kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2015AC77B7F for <linux-fsdevel@archiver.kernel.org>; Thu, 20 Apr 2023 10:08:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234691AbjDTKIL (ORCPT <rfc822;linux-fsdevel@archiver.kernel.org>); Thu, 20 Apr 2023 06:08:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234615AbjDTKGd (ORCPT <rfc822;linux-fsdevel@vger.kernel.org>); Thu, 20 Apr 2023 06:06:33 -0400 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80D0C3C32; Thu, 20 Apr 2023 03:06:13 -0700 (PDT) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-3f16b99b936so3347945e9.3; Thu, 20 Apr 2023 03:06:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985172; x=1684577172; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/zlw+dyGlfnLYWyTWZyG7072cksvgegzTzOhlPnlIpY=; b=SkaE1i5oextJEG5M68xutxi7e7vT+7bXsNTwIXdiJhJfvYhVln6+xJOR2CyPYdwpME fZx9/3c//0aYM3cXEN6rqHDAXs7g9TBS2RQnW9ZR+nXLZUFRQr/1ippNs90A1n6aCqkz TM2q1J8obE3WGi8Knxn/TRlu6iS2Mvb212U/Kr6jz4yo1vZiekAAH0hl21EDnU+F7O5R 6HOv4wb6GjFas6WG38OKV6AV2N4mIqMLUSKYsCR4B9I3Whc2WhTuhjcIKKFTO10Fpg+v SVGxCoua2VYxDY+9xYoEsrHn3QQNz1TCLglX1IEndXMDdZCALSPHhpkEfLVvG85mH9cw 7eVQ== X-Gm-Message-State: AAQBX9dxkDjVk9JnH2JmUJm1Fjy+lYZKWbUQ6WNKKCX6BgO5eYhN6mgu avXAtWcksq3kDttrrNCkpqQ= X-Google-Smtp-Source: AKy350b4+pGxVTyaXt7ZP5FpDVVarQnYRrcgBCCIE1KFKr5Sq8P0zgMU35+ypve4Bt1qBgDPW2LUww== X-Received: by 2002:a5d:640a:0:b0:2ee:d53b:d9ef with SMTP id z10-20020a5d640a000000b002eed53bd9efmr813643wru.55.1681985171893; Thu, 20 Apr 2023 03:06:11 -0700 (PDT) Received: from localhost.localdomain (aftr-62-216-205-208.dynamic.mnet-online.de. [62.216.205.208]) by smtp.googlemail.com with ESMTPSA id l11-20020a5d674b000000b0030276f42f08sm201410wrw.88.2023.04.20.03.06.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:11 -0700 (PDT) From: Johannes Thumshirn <jth@kernel.org> To: axboe@kernel.dk Cc: johannes.thumshirn@wdc.com, agruenba@redhat.com, cluster-devel@redhat.com, damien.lemoal@wdc.com, dm-devel@redhat.com, dsterba@suse.com, hare@suse.de, hch@lst.de, jfs-discussion@lists.sourceforge.net, kch@nvidia.com, linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-raid@vger.kernel.org, ming.lei@redhat.com, rpeterso@redhat.com, shaggy@kernel.org, snitzer@kernel.org, song@kernel.org, willy@infradead.org, Damien Le Moal <damien.lemoal@opensource.wdc.com> Subject: [PATCH v4 18/22] dm-crypt: check if adding pages to clone bio fails Date: Thu, 20 Apr 2023 12:04:57 +0200 Message-Id: <20230420100501.32981-19-jth@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230420100501.32981-1-jth@kernel.org> References: <20230420100501.32981-1-jth@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <linux-fsdevel.vger.kernel.org> X-Mailing-List: linux-fsdevel@vger.kernel.org |
Series |
bio: check return values of bio_add_page
|
expand
|
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 3ba53dc3cc3f..19f7e087c6df 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -1693,7 +1693,14 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned int size) len = (remaining_size > PAGE_SIZE) ? PAGE_SIZE : remaining_size; - bio_add_page(clone, page, len, 0); + if (!bio_add_page(clone, page, len, 0)) { + mempool_free(page, &cc->page_pool); + crypt_free_buffer_pages(cc, clone); + bio_put(clone); + gfp_mask |= __GFP_DIRECT_RECLAIM; + goto retry; + + } remaining_size -= len; }