From patchwork Mon Feb 26 03:14:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Nan X-Patchwork-Id: 206196 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1846036dyb; Sun, 25 Feb 2024 19:21:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWtOynSt0kaqjK+DCrzUKxDkZ0go3YzVUTdwkKMSG8vA3wpIMp8yd+ixRkEXc/jROvrcQweG+BGZZQGgudBu48emcsMhw== X-Google-Smtp-Source: AGHT+IGtSidMn0okX+YRcZpPforLJN4VMIaU5cujdUYXXBVxvczFrPcgL+IavgnojZ9TVVCGZZM4 X-Received: by 2002:a05:6214:c45:b0:68f:8ddd:aadc with SMTP id r5-20020a0562140c4500b0068f8dddaadcmr8182568qvj.36.1708917680744; Sun, 25 Feb 2024 19:21:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708917680; cv=pass; d=google.com; s=arc-20160816; b=tTMtCdq4gid/V8dqTd7khMk8vmfheNoS7ezBrBPsDKmvgiVOHUBj+NCz36LbKW3P+w Ln8xhJqPm26KspBlXk3Kzt8mYmNztPwrslMO5JKV/mRZwxpTswwvG+0bgIowmRwxnW65 5Xx0Vk7+PQd1fJGx0NYbB9LjDxYxlqiKMYca90DLt+Rp58pZWvZRWd2hUFtseh/sSmJq FBmIGLY8LxoXacpxnt673Ib7c1KnSKS8WhFCPkp/W3ljvNGLNNqHyNtvBaFWCICRz7NO FTRKgCOt7QUmjMe/fPfTTBxzGBvDwGVIsuJhiKQQYoS6M2rnookaNrlOE+LLcjC5ppFP nVZg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=rijASTBR5DCKOT+A4CRHTxvSVBRrekrJo07oNPRFeXI=; fh=0dNtsen0Y4Fayp56GvNYBSuoU/QTeuYBQcKGxWKzWhY=; b=UbNTCBw4r65w075Dbv950HCUhU2s27Uo82t/F0QrBMnCWskq31mSrOWAEJAgptjLjy oIF/1IA9QhESt1PqIHIhH/P8U2fPSnVBYpl0C41xxqWOPaxzhjOwT9RlzgGsCF4Ib/WT eazxYOHwfZRIvhtGqbkJfNlzh5ZkZUvujMqLjAGvPUXDkQ16JsHCNi0KqLhq3QBl7U5n zxpmkZgscmT1AVyveSHbQK7/Wf7UCi3EqNnz5TTOmCpmE2+6A8WQ4li/VtpbL3DK3Unu X/L9bu8doPklWBzVufEpxMrErM3dI/Kygk7NIVEDw3/Ojt/A5afYrgsnT6lUlh7UeBdx kX+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-80457-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80457-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i12-20020ad45c6c000000b0068fe19a8a87si4276885qvh.206.2024.02.25.19.21.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 19:21:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80457-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-80457-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80457-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 88E581C214ED for ; Mon, 26 Feb 2024 03:21:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BFF71172C; Mon, 26 Feb 2024 03:20:42 +0000 (UTC) Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7736611CAB; Mon, 26 Feb 2024 03:20:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708917640; cv=none; b=OE83DTkzldqCBSnvJbxpzJlP1mpVbrD3qtnJK3YgJ+Ch5UteBovp3dl7MplrLT7QHWj/MsI6r+q9enAj4l79N+JCirmfr/J2AyxNd3WUIhXA3alzzELnn2d3ZOrgUJe2jQlwrUuE33Bv8a/1HEBcvbpzmx6OdK0eSe1GFqptq7M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708917640; c=relaxed/simple; bh=pxbFmkBdix9JKfIxZWHMTwSQIocehJ/A6dyD2Is1R30=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mPIS2Yb2+uNZi/HEiXB0FqP8nYsZqL/W5+mhwQTR0ZCQ3OXmyHUiLh2lcnYdVF1D79DYrFikySeAfUcs5CUrC1wgf/czTkSL3xQ8r3RhfZYPrpjGAayPFSXY3EiivpnAHkbFuEH0jDNgrNQm0MxJwEiF+oXg8EjPjyrTfFsdpW4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4Tjm8X0YLxz4f3mHb; Mon, 26 Feb 2024 11:20:28 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 554BE1A016E; Mon, 26 Feb 2024 11:20:35 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgAX5g5_A9xl7gKzFA--.13921S7; Mon, 26 Feb 2024 11:20:35 +0800 (CST) From: linan666@huaweicloud.com To: song@kernel.org, shli@fb.com, neilb@suse.com Cc: mariusz.tkaczyk@linux.intel.com, linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, linan666@huaweicloud.com, yukuai3@huawei.com, yi.zhang@huawei.com, houtao1@huawei.com, yangerkun@huawei.com Subject: [PATCH v7 3/9] md: clean up invalid BUG_ON in md_ioctl Date: Mon, 26 Feb 2024 11:14:38 +0800 Message-Id: <20240226031444.3606764-4-linan666@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240226031444.3606764-1-linan666@huaweicloud.com> References: <20240226031444.3606764-1-linan666@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: cCh0CgAX5g5_A9xl7gKzFA--.13921S7 X-Coremail-Antispam: 1UD129KBjvdXoWrKry5WFy5tFykWw43Kr4UJwb_yoW3tFc_Ca yFvF9rXryxuF9Fkw1Utw13Zry0yF1kWrn7ZF1a9r15Zry7X348GFZYgws8Wa1ruFW7uryq vF1ayrs0yr42gjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbBkFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUWwA2048vs2IY02 0Ec7CjxVAFwI0_Xr0E3s1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM2 8EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0DM2vY z4IE04k24VAvwVAKI4IrM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c 02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE 4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4 IIrI8v6xkF7I0E8cxan2IY04v7M4kE6xkIj40Ew7xC0wCF04k20xvY0x0EwIxGrwCFx2Iq xVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r 106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AK xVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7 xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_ Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JU9Z23UUUUU= X-CM-SenderInfo: polqt0awwwqx5xdzvxpfor3voofrz/ X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791930066215774344 X-GMAIL-MSGID: 1791930066215774344 From: Li Nan 'disk->private_data' is set to mddev in md_alloc() and never set to NULL, and users need to open mddev before submitting ioctl. So mddev must not have been freed during ioctl, and there is no need to check mddev here. Clean up it. Signed-off-by: Li Nan Reviewed-by: Yu Kuai --- drivers/md/md.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index b783a64765a7..6432bdbddb1c 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -7621,11 +7621,6 @@ static int md_ioctl(struct block_device *bdev, blk_mode_t mode, mddev = bdev->bd_disk->private_data; - if (!mddev) { - BUG(); - goto out; - } - /* Some actions do not requires the mutex */ switch (cmd) { case GET_ARRAY_INFO: