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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220112013154.1210480-1-kai.heng.feng@canonical.com>
Date:   Wed, 12 Jan 2022 09:31:54 +0800
From:   Kai-Heng Feng <kai.heng.feng@...onical.com>
To:     kbusch@...nel.org, axboe@...com, hch@....de, sagi@...mberg.me
Cc:     Kai-Heng Feng <kai.heng.feng@...onical.com>,
        Rajat Jain <rajatja@...gle.com>,
        linux-nvme@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] nvme: Mark external NVMe devices as removable

Commit c037b6c818c3 ("PCI: Add sysfs "removable" attribute") can mark
entire Thunderbolt hierarchy as removable, if system firmware provides
correct attribute.

So apply GENHD_FL_REMOVABLE for NVMe if removable bit is set, to make
userspace daemon like Udisks knows it can be automount.

Cc: Rajat Jain <rajatja@...gle.com>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@...onical.com>
---
 drivers/nvme/host/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 1af8a4513708a..1c3b04883965f 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3851,6 +3851,9 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid,
 	ns->disk = disk;
 	ns->queue = disk->queue;
 
+	if (dev_is_removable(ctrl->dev))
+		ns->disk->flags |= GENHD_FL_REMOVABLE;
+
 	if (ctrl->opts && ctrl->opts->data_digest)
 		blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, ns->queue);
 
-- 
2.33.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ