Message ID | 20240201063404.772797-4-linan666@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-47700-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:106:209c:c626 with SMTP id mn5csp251054dyc; Wed, 31 Jan 2024 22:40:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IFidLo5Ww7Fte1cDQaZcwAs0nQQMzhHvezAo+sKw7UX5KWlpTM9wGW+jOuXNirAaMB1kyn4 X-Received: by 2002:a17:90b:2406:b0:295:cf9f:a1de with SMTP id nr6-20020a17090b240600b00295cf9fa1demr4082000pjb.12.1706769615274; Wed, 31 Jan 2024 22:40:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706769615; cv=pass; d=google.com; s=arc-20160816; b=MQh6oHMAR8p57LmP8G8OuX0KQ6hGg/yk75Sbj4Rnbj/u7SSQOqY93+vc2sqrwXV+1J WknKbFBHq7+T9dvEHRNcbQpU/DXqQK3dhzWP/Sc74ztW3S0+l7v1uWRLb/JqTxEHi4SU iVonwx9xPeloqU8KKOofVnSfnc3iekq/nhrLxIcILbwCic+mkGqY293/HuFda6p7qoV+ kSS7TKZKH1CsY8o/mVN8DU9y54WISHs1bUCp5i0xevgP5Ah89sHrWBLGhityqjSJy09s rMUeRSQhW8Ptm7v/JVWd436doWThRrl+kMwv5ByQwZ6WuGHv8vTNzA/1N5DZXuEl1rgQ ShKA== 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=Whml/PAOlxd/cENwjfSSTSdWHx1DxRJ4muI8MuoYA+4=; fh=BUEmfciNitkzR4Nw7N1H7bRcalBCxGmMBgYjxt7waiQ=; b=nRcD4ttcDtERJLbNdYbQxWz+UDbDhjpSFElGW7vdleiwxRa+iNSR2UpLhUfebFG47u QrIaiVVDIDxRwNSTNXx3d/bbGiYhh6svi1lPSR3MymM/Rhf7S6bI/HYKrhXg4btLe2BH /eHltmubZher+MLJCcmltTFPN0ZfHsX4oQwVvJkAFnASllCd401GUEZ8JJimBbo8oBgz G7MzL9cbA32DMZn1dMoHa75NnacWNIAkmPIdwxOJTxKc0GHlLA/iTLlcvmbRK4dHZ/RW LLhwORznKUlYFIK+wOKMamIAQVN2zv1aTvQ4Y5TE5v+8uN4LVwcD76wHdIryFpNvfKNF 3KOA==; 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-47700-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47700-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCUpvul+NFnTMNRqaihJXnZH55n78FNwW7l4jn2dcJowzuhE0GWWAucE/B957uAUZ0L17PNgi9lHiFrE62ayhUh20VvlIQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x3-20020a17090aa38300b00290cd0b42fasi2962926pjp.146.2024.01.31.22.40.15 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 22:40:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47700-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-47700-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47700-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1600F29527F for <ouuuleilei@gmail.com>; Thu, 1 Feb 2024 06:40:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 382E715A4BE; Thu, 1 Feb 2024 06:38:37 +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 60F6D15703D; Thu, 1 Feb 2024 06:38:33 +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=1706769515; cv=none; b=prnX3Ox/VOnio8kpr+xwAjWQffpveHaG5N01oQLB46gIc9oFXMthLvqvhT8TyTkzES+e0EL5TG5bZEYApCzaaVAZN6P6LNVRiu26ISjXYVlR1d/7km1J4xvM6t6DpNypFpAg5booozGk0yt3RkMSXy1WYedVq3yTfMMPolNmpS4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706769515; c=relaxed/simple; bh=4UplcmqoWJJbQGP8ptq+EBVCRp0y/SiN1WKG7ZyYRV0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tbBKxvybh2ZyWRK2RJIQRbH34FYqiIClrsljnAin0Vf7NjCQ2cwOJlgEYp4FPbo7Vggmw3SjWV0VCY/YxufQx4o9Qsmy46lgmLhgWUUPomWNa+As3k4VroBB2jdIXpkYCmSIPOY0bXdU+lY9/y3Bq0HI7oNE1lkcyfOVuerdK8Q= 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.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4TQTkR1GPWz4f3lfx; Thu, 1 Feb 2024 14:38:23 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id AE6C01A027B; Thu, 1 Feb 2024 14:38:29 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgAX5g5iPLtllCl+Cg--.15155S7; Thu, 01 Feb 2024 14:38:29 +0800 (CST) From: linan666@huaweicloud.com To: song@kernel.org, neilb@suse.com, mariusz.tkaczyk@linux.intel.com, shli@fb.com Cc: 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 v5 3/8] md: clean up invalid BUG_ON in md_ioctl Date: Thu, 1 Feb 2024 14:33:59 +0800 Message-Id: <20240201063404.772797-4-linan666@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240201063404.772797-1-linan666@huaweicloud.com> References: <20240201063404.772797-1-linan666@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: cCh0CgAX5g5iPLtllCl+Cg--.15155S7 X-Coremail-Antispam: 1UD129KBjvdXoWrKry5WFy5tFykWw43Kr4UJwb_yoW3AFX_ua yrZF9rXry7uF9Fkr17tw1fZF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awwwqx5xdzvxpfor3voofrz/ X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789677655791886418 X-GMAIL-MSGID: 1789677655791886418 |
Series |
bugfix of MD_CLOSING and clean up md_ioctl()
|
|
Commit Message
Li Nan
Feb. 1, 2024, 6:33 a.m. UTC
From: Li Nan <linan122@huawei.com> '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 <linan122@huawei.com> --- drivers/md/md.c | 5 ----- 1 file changed, 5 deletions(-)
Comments
在 2024/02/01 14:33, linan666@huaweicloud.com 写道: > From: Li Nan <linan122@huawei.com> > > '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 <linan122@huawei.com> > --- > drivers/md/md.c | 5 ----- > 1 file changed, 5 deletions(-) > > diff --git a/drivers/md/md.c b/drivers/md/md.c > index 3b4e0ef49675..656080086052 100644 > --- a/drivers/md/md.c > +++ b/drivers/md/md.c > @@ -7647,11 +7647,6 @@ static int md_ioctl(struct block_device *bdev, blk_mode_t mode, > > mddev = bdev->bd_disk->private_data; > > - if (!mddev) { > - BUG(); Given that this BUG() never triggered before. Reviewed-by: Yu Kuai <yukuai3@huawei.com> > - goto out; > - } > - > /* Some actions do not requires the mutex */ > switch (cmd) { > case GET_ARRAY_INFO: >
diff --git a/drivers/md/md.c b/drivers/md/md.c index 3b4e0ef49675..656080086052 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -7647,11 +7647,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: