Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp205283imj; Thu, 14 Feb 2019 18:39:25 -0800 (PST) X-Google-Smtp-Source: AHgI3IZO0cwBp1+mL9TqxLE2ah2+4wMbz51fLWKFsc2MBuM6qb1Q3eNVZqI1WyUuZoxlW/46E2a2 X-Received: by 2002:a63:db02:: with SMTP id e2mr3142973pgg.419.1550198365163; Thu, 14 Feb 2019 18:39:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550198365; cv=none; d=google.com; s=arc-20160816; b=rLfuFomTCyauDCugMP6eAVS0rO5H4t2t5TtV6i6v1l63LeNwErlC28CjqYOg6QYhDa LyEXeU8STLSmfN3YRkFu5XbgyXnJxCg2+bebmv4dN7qFs9aVaXfR6Hr94wl1Bt1MlXSY a28xfSA1iNccgz64Waw2S27I5bGikYIj/Drn55mMN/crpLbNrhxy0ePz7ARM5KMJErAc uWjAWvjbVwyVB2DRVjZC2ikGNX2kn/3nWOZziQZzQXPMzsRZkZJjQLvgDi0qGWN/5tl3 5QvxTudqckHQVIsFlN/RVw+O+PtCO1kLcxWs3A+MUeFhA9mZc5d9x50iTcKPeWFegmCv Km5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=B7bH7Scq1G0YLZC8F01iNpCMTfT+XHwzd3VZCtjXx/Y=; b=BXM4CnXgd0CfsiOoC+0s08BcaV4b8tLjuuk+XXLRS6tkxANwznU8rt1w33O14lDEsO pbOHEBWHcKDUIMa+wkfebvhDqO68d0RMkY0mcyn6ZLoHUkU1fgVJO/ilgBuPkr24wqIr DoYet0D8CDfnMzKLGI0jUWcP63GndOEx5ZmC3Mw5zZ+GHDT0y/QAJnmNh04vgnWEnbiS ZNaerkzX5S4t8If0kvHFIE3moIUO5dmVlnCi7zDAtnZ7aDhkxa5pGXrBaooLBtlzgdMf 00u+9mW+YyI/IQsDfsCqpSaLNAa8lLG2jwZbblDKz9RwgYaoIJHIAnAkZX/KWvgIXYAM QanA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GtEdaNB5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l22si4134303pfg.275.2019.02.14.18.39.09; Thu, 14 Feb 2019 18:39:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GtEdaNB5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732267AbfBOCLX (ORCPT + 99 others); Thu, 14 Feb 2019 21:11:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:51368 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732214AbfBOCLV (ORCPT ); Thu, 14 Feb 2019 21:11:21 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0AABC21934; Fri, 15 Feb 2019 02:11:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550196680; bh=NcKvf8oMC4u7b0tkGEoBYhxO1MaBw/KKt+vj3llO5zI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GtEdaNB5zDdRgXiwZ0+lgdwz8xfb0jvqz+gLAm8RnfwOQibEqdgfJLcv7xf4L89ST 1PIbfT+PcxmJV3JbjnZcqoJQ6CSHMqL5WM9TJYoxN8lakgMG0k9idj6Wd6x5a2OWU/ 5NSi+EdxM1mLfVHGjJ//xTPwu/AQVgIYTiDZPFFQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jens Axboe , Sasha Levin , linux-block@vger.kernel.org Subject: [PATCH AUTOSEL 4.20 77/77] Revert "block: cover another queue enter recursion via BIO_QUEUE_ENTERED" Date: Thu, 14 Feb 2019 21:08:55 -0500 Message-Id: <20190215020855.176727-77-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190215020855.176727-1-sashal@kernel.org> References: <20190215020855.176727-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jens Axboe [ Upstream commit 947b7ac135b16aa60f9141ff72bd494eda0edb5e ] We can't touch a bio after ->make_request_fn(), for all we know it could already have been completed by the time this function returns. This reverts commit 698cef173983b086977e633e46476e0f925ca01e. Reported-by: syzbot+4df6ca820108fd248943@syzkaller.appspotmail.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/blk-core.c | 11 ----------- block/blk-merge.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 22260339f66f..deb56932f8c4 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -2449,18 +2449,7 @@ blk_qc_t generic_make_request(struct bio *bio) /* Create a fresh bio_list for all subordinate requests */ bio_list_on_stack[1] = bio_list_on_stack[0]; bio_list_init(&bio_list_on_stack[0]); - - /* - * Since we're recursing into make_request here, ensure - * that we mark this bio as already having entered the queue. - * If not, and the queue is going away, we can get stuck - * forever on waiting for the queue reference to drop. But - * that will never happen, as we're already holding a - * reference to it. - */ - bio_set_flag(bio, BIO_QUEUE_ENTERED); ret = q->make_request_fn(q, bio); - bio_clear_flag(bio, BIO_QUEUE_ENTERED); /* sort new bios into those for a lower level * and those for the same level diff --git a/block/blk-merge.c b/block/blk-merge.c index adfe835ab258..7695034f4b87 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -272,6 +272,16 @@ void blk_queue_split(struct request_queue *q, struct bio **bio) /* there isn't chance to merge the splitted bio */ split->bi_opf |= REQ_NOMERGE; + /* + * Since we're recursing into make_request here, ensure + * that we mark this bio as already having entered the queue. + * If not, and the queue is going away, we can get stuck + * forever on waiting for the queue reference to drop. But + * that will never happen, as we're already holding a + * reference to it. + */ + bio_set_flag(*bio, BIO_QUEUE_ENTERED); + bio_chain(split, *bio); trace_block_split(q, split, (*bio)->bi_iter.bi_sector); generic_make_request(*bio); -- 2.19.1