From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1AC54C43217 for ; Mon, 17 Jan 2022 17:09:18 +0000 (UTC) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-237-gdWE9nZiOA2XeMxR4IBKOA-1; Mon, 17 Jan 2022 12:09:14 -0500 X-MC-Unique: gdWE9nZiOA2XeMxR4IBKOA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CBFE7801B0B; Mon, 17 Jan 2022 17:09:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 84AAE7E66D; Mon, 17 Jan 2022 17:09:08 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1524D4BB7C; Mon, 17 Jan 2022 17:09:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20HH7M7l013507 for ; Mon, 17 Jan 2022 12:07:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id CCF4B492CAE; Mon, 17 Jan 2022 17:07:22 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast08.extmail.prod.ext.rdu2.redhat.com [10.11.55.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C9440492C3B for ; Mon, 17 Jan 2022 17:07:22 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ADFAC381D597 for ; Mon, 17 Jan 2022 17:07:22 +0000 (UTC) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-660-oWfbsMYRM2SNpawrhDCkKQ-1; Mon, 17 Jan 2022 12:07:21 -0500 X-MC-Unique: oWfbsMYRM2SNpawrhDCkKQ-1 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E1DE0B81055; Mon, 17 Jan 2022 16:59:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB90BC36AE3; Mon, 17 Jan 2022 16:59:34 +0000 (UTC) From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Date: Mon, 17 Jan 2022 11:58:19 -0500 Message-Id: <20220117165853.1470420-18-sashal@kernel.org> In-Reply-To: <20220117165853.1470420-1-sashal@kernel.org> References: <20220117165853.1470420-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 20HH7M7l013507 X-loop: dm-devel@redhat.com Cc: Sasha Levin , snitzer@redhat.com, dm-devel@redhat.com, Dan Williams , Christoph Hellwig , agk@redhat.com Subject: [dm-devel] [PATCH AUTOSEL 5.16 18/52] dm: fix alloc_dax error handling in alloc_dev X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit From: Christoph Hellwig [ Upstream commit d751939235b9b7bc4af15f90a3e99288a8b844a7 ] Make sure ->dax_dev is NULL on error so that the cleanup path doesn't trip over an ERR_PTR. Reported-by: Dan Williams Signed-off-by: Christoph Hellwig Link: https://lore.kernel.org/r/20211129102203.2243509-2-hch@lst.de Signed-off-by: Dan Williams Signed-off-by: Sasha Levin --- drivers/md/dm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 662742a310cbb..acc84dc1bded5 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1786,8 +1786,10 @@ static struct mapped_device *alloc_dev(int minor) if (IS_ENABLED(CONFIG_DAX_DRIVER)) { md->dax_dev = alloc_dax(md, md->disk->disk_name, &dm_dax_ops, 0); - if (IS_ERR(md->dax_dev)) + if (IS_ERR(md->dax_dev)) { + md->dax_dev = NULL; goto bad; + } } format_dev_t(md->name, MKDEV(_major, minor)); -- 2.34.1 -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 246EEC4167B for ; Mon, 17 Jan 2022 16:59:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241449AbiAQQ74 (ORCPT ); Mon, 17 Jan 2022 11:59:56 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:48928 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241382AbiAQQ7g (ORCPT ); Mon, 17 Jan 2022 11:59:36 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 435CC60EDB; Mon, 17 Jan 2022 16:59:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB90BC36AE3; Mon, 17 Jan 2022 16:59:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642438775; bh=3Efeav5/jfwkBywK9Tb1QYQGO5lWAXrOAFpR3Rex+s8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BnHnkdMMmQtfe2/7BvRmMgIEhUGe9AZ/zOjU4AWEWn8OCWrVVZDONCU2TNfhC10fi 67hmusa57rjp8KSvjVx0ZyLsCjhu+4YXO9K2lnOXSpEB7deNd2QQdgNJP26vZBqlHt jI59Aglj4hFQ6lFXTxRInsoujgdc+a88SAiN3vfhF64zOXqIrz8O/gOSUEqyp/MkXi piKcmfaXOpbRX2lj81KB1X7DshJ8zmHJAG+Kebnn4yWYdyjgcp1Ceg5552/bbZMbW1 2zzdmodwHKAR+HOPCx4oAmkQTDDCw7CyadGX7jcrRsjBMJSgpSmYYtE3gTpvc3EI9j 9vXh5YXmhhzEQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christoph Hellwig , Dan Williams , Sasha Levin , agk@redhat.com, snitzer@redhat.com, dm-devel@redhat.com Subject: [PATCH AUTOSEL 5.16 18/52] dm: fix alloc_dax error handling in alloc_dev Date: Mon, 17 Jan 2022 11:58:19 -0500 Message-Id: <20220117165853.1470420-18-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220117165853.1470420-1-sashal@kernel.org> References: <20220117165853.1470420-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christoph Hellwig [ Upstream commit d751939235b9b7bc4af15f90a3e99288a8b844a7 ] Make sure ->dax_dev is NULL on error so that the cleanup path doesn't trip over an ERR_PTR. Reported-by: Dan Williams Signed-off-by: Christoph Hellwig Link: https://lore.kernel.org/r/20211129102203.2243509-2-hch@lst.de Signed-off-by: Dan Williams Signed-off-by: Sasha Levin --- drivers/md/dm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 662742a310cbb..acc84dc1bded5 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -1786,8 +1786,10 @@ static struct mapped_device *alloc_dev(int minor) if (IS_ENABLED(CONFIG_DAX_DRIVER)) { md->dax_dev = alloc_dax(md, md->disk->disk_name, &dm_dax_ops, 0); - if (IS_ERR(md->dax_dev)) + if (IS_ERR(md->dax_dev)) { + md->dax_dev = NULL; goto bad; + } } format_dev_t(md->name, MKDEV(_major, minor)); -- 2.34.1