lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230328143442.2684167-2-yebin@huaweicloud.com>
Date:   Tue, 28 Mar 2023 22:34:40 +0800
From:   Ye Bin <yebin@...weicloud.com>
To:     jejb@...ux.ibm.com, martin.petersen@...cle.com,
        linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     Ye Bin <yebin10@...wei.com>
Subject: [PATCH v2 1/3] scsi: forbid to set scsi host state by sysfs

From: Ye Bin <yebin10@...wei.com>

Actually, set scsi host state by sysfs may lead to functional issues.
So forbid to set scsi host state.

Signed-off-by: Ye Bin <yebin10@...wei.com>
---
 drivers/scsi/scsi_sysfs.c | 26 +-------------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index ee28f73af4d4..903aa9de46e5 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -195,30 +195,6 @@ store_scan(struct device *dev, struct device_attribute *attr,
 };
 static DEVICE_ATTR(scan, S_IWUSR, NULL, store_scan);
 
-static ssize_t
-store_shost_state(struct device *dev, struct device_attribute *attr,
-		  const char *buf, size_t count)
-{
-	int i;
-	struct Scsi_Host *shost = class_to_shost(dev);
-	enum scsi_host_state state = 0;
-
-	for (i = 0; i < ARRAY_SIZE(shost_states); i++) {
-		const int len = strlen(shost_states[i].name);
-		if (strncmp(shost_states[i].name, buf, len) == 0 &&
-		   buf[len] == '\n') {
-			state = shost_states[i].value;
-			break;
-		}
-	}
-	if (!state)
-		return -EINVAL;
-
-	if (scsi_host_set_state(shost, state))
-		return -EINVAL;
-	return count;
-}
-
 static ssize_t
 show_shost_state(struct device *dev, struct device_attribute *attr, char *buf)
 {
@@ -233,7 +209,7 @@ show_shost_state(struct device *dev, struct device_attribute *attr, char *buf)
 
 /* DEVICE_ATTR(state) clashes with dev_attr_state for sdev */
 static struct device_attribute dev_attr_hstate =
-	__ATTR(state, S_IRUGO | S_IWUSR, show_shost_state, store_shost_state);
+	__ATTR(state, S_IRUGO, show_shost_state, NULL);
 
 static ssize_t
 show_shost_mode(unsigned int mode, char *buf)
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ