summaryrefslogtreecommitdiff
path: root/security/loadpin
diff options
context:
space:
mode:
authorBaegjae Sung <baegjae@gmail.com>2018-02-28 10:06:04 +0300
committerKeith Busch <keith.busch@intel.com>2018-02-28 12:46:48 +0300
commit9bd82b1a4418d9b7db000bf557ed608f2872b7c9 (patch)
tree357d0433ac48f7970204567569d55d09cec94d5e /security/loadpin
parentf25a2dfc20e3a3ed8fe6618c331799dd7bd01190 (diff)
downloadlinux-9bd82b1a4418d9b7db000bf557ed608f2872b7c9.tar.xz
nvme-multipath: fix sysfs dangerously created links
If multipathing is enabled, each NVMe subsystem creates a head namespace (e.g., nvme0n1) and multiple private namespaces (e.g., nvme0c0n1 and nvme0c1n1) in sysfs. When creating links for private namespaces, links of head namespace are used, so the namespace creation order must be followed (e.g., nvme0n1 -> nvme0c1n1). If the order is not followed, links of sysfs will be incomplete or kernel panic will occur. The kernel panic was: kernel BUG at fs/sysfs/symlink.c:27! Call Trace: nvme_mpath_add_disk_links+0x5d/0x80 [nvme_core] nvme_validate_ns+0x5c2/0x850 [nvme_core] nvme_scan_work+0x1af/0x2d0 [nvme_core] Correct order Context A Context B nvme0n1 nvme0c0n1 nvme0c1n1 Incorrect order Context A Context B nvme0c1n1 nvme0n1 nvme0c0n1 The nvme_mpath_add_disk (for creating head namespace) is called just before the nvme_mpath_add_disk_links (for creating private namespaces). In nvme_mpath_add_disk, the first context acquires the lock of subsystem and creates a head namespace, and other contexts do nothing by checking GENHD_FL_UP of a head namespace after waiting to acquire the lock. We verified the code with or without multipathing using three vendors of dual-port NVMe SSDs. Signed-off-by: Baegjae Sung <baegjae@gmail.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Keith Busch <keith.busch@intel.com>
Diffstat (limited to 'security/loadpin')
0 files changed, 0 insertions, 0 deletions