Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4176983pxf; Tue, 23 Mar 2021 04:53:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSCxGOm3BrkgA1ZuxY0WoZlKgRdKgw1pFAlfu7X3CFT+qp0jCKWHK+g5WEzOJOwkLy3t9z X-Received: by 2002:a05:6402:5203:: with SMTP id s3mr4251724edd.79.1616500403228; Tue, 23 Mar 2021 04:53:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616500403; cv=none; d=google.com; s=arc-20160816; b=eW5guW5MwTvRTmIn8CQ00NTQ3fmCdjbI3dQIddJSMROEzjGg/3YibrpbDxzQFF6EJi khnaQ8ITnvHEVLbXVhnjhMO6UIaPbtFC5kkhBqPVnzVoUhTafSsKw9Ae+oVyG6CMqQa9 1CNVAI0j4ixANQRc6B0Ht46KPTGXlAOQuMgIOskQWia6+s7RdwvhlHsMOgk1c9q3QdzH TO33CfviXzd48dFZ1/UQsS5gNZC9YovGJySA+YyqZ/vHGuVW6nSQV2x3LzT1x9IIzzwO HT/4ajBWvmHmBQetpDPgjzamIV+r7df9DvxZs3osx/BsNx65nfOnuwUdqfkRr5zvZyAM lENA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=/4M7LwHDNpv3QnfR6OMnF5pPWU520KQP4VdKjFepKC0=; b=HEka67bWZW782r54mgpOFzvikxeQmiwEY3Lu8cLjj/Vm6GkjHxX4AlNFK9CSfLkUWE rxIASPxcb0EjBXuMCTSWck8KMojfaH1q+G0wvyQPwKYt5MCCVqX8FjbC/lCrIBjAdPOb 0UMXihe4CbVivTIGmciyEAZ6mfdbbqDJLc11dWuN/pbjFQYQWrpYd8JJJ10a9EGUF1wn 1gZrVDdGK2T8HWAxL1czL05srpNQbw2RBbFx1tFRJqctB2smMxVubo53jqwudUumZmA3 0j6lfUC7ymHf7/iHeF/ZZ2WgQ1B+Mklkr6SZs/fsDX5LnZS+RDpVURMB1pwQHLLwcQjo BWjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@veeam.com header.s=mx4 header.b=JUU0nsvD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=veeam.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h13si12736104edt.586.2021.03.23.04.53.00; Tue, 23 Mar 2021 04:53:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@veeam.com header.s=mx4 header.b=JUU0nsvD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=veeam.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229944AbhCWLtk (ORCPT + 99 others); Tue, 23 Mar 2021 07:49:40 -0400 Received: from mx4.veeam.com ([104.41.138.86]:34876 "EHLO mx4.veeam.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229493AbhCWLtG (ORCPT ); Tue, 23 Mar 2021 07:49:06 -0400 Received: from mail.veeam.com (prgmbx01.amust.local [172.24.0.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx4.veeam.com (Postfix) with ESMTPS id 91EDD7319B; Tue, 23 Mar 2021 14:49:01 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=veeam.com; s=mx4; t=1616500141; bh=/4M7LwHDNpv3QnfR6OMnF5pPWU520KQP4VdKjFepKC0=; h=From:To:CC:Subject:Date:From; b=JUU0nsvDoIxO/Ao+kCCoJ2L/fH4E88sRDDvpy84pAq2xUMz7eRumuONh5bNuerbuR ppRhfQXEQ9s+OwQYXZ+wISmBV3bfk6sOhJoo1A/KwVWNUcwzrleIo/uCt1gHjQvUmQ GfDeLSGATx/7JOMTLgd2BquI277pl0S7VCoRtLIc= Received: from prgdevlinuxpatch01.amust.local (172.24.14.5) by prgmbx01.amust.local (172.24.0.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.721.2; Tue, 23 Mar 2021 12:49:00 +0100 From: Sergei Shtepa To: Jens Axboe , , CC: , Subject: [PATCH 0/1] block: fix potential infinite loop in the negative branch in __submit_bio_noacct_mq() Date: Tue, 23 Mar 2021 14:48:35 +0300 Message-ID: <1616500116-3411-1-git-send-email-sergei.shtepa@veeam.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.24.14.5] X-ClientProxiedBy: prgmbx01.amust.local (172.24.0.171) To prgmbx01.amust.local (172.24.0.171) X-EsetResult: clean, is OK X-EsetId: 37303A29D2A50B586D7D62 X-Veeam-MMEX: True Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all. It seems to me that the __submit_bio_noacct_mq() function incorrectly processes the return code of the blk_crypto_bio_prep() function. If the blk_crypto_bio_prep() function returns false, it means that the processing of the bio request was completed with an error and further processing of the request is unnecessary. But in the code, in case of an error when executing the blk_crypto_bio_prep() function, an attempt is made to repeat the execution of this function. This can lead to an infinite loop. In addition, since the function __blk_crypto_bio_prep calls bio_endio(), it is likely to access the freed data or access the null pointer. At the same time, the implementation of the negative branch of the blk_crypto_bio_prep() function implemented correctly in the __submit_bio_noacct() and __submit_bio() functions. Sergei Shtepa (1): block: fix potential infinite loop in the negative branch in __submit_bio_noacct_mq() block/blk-core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- 2.20.1