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-next>] [day] [month] [year] [list]
Message-ID: <adaljtjog90.fsf@cisco.com>
Date:	Fri, 09 Jan 2009 21:57:15 -0800
From:	Roland Dreier <rdreier@...co.com>
To:	Jens Axboe <jens.axboe@...cle.com>
Cc:	Kay Sievers <kay.sievers@...y.org>,
	Greg Kroah-Hartman <gregkh@...e.de>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] block: Fix register_disk() when name has '/' in it

Commit 3ada8b7e ("block: struct device - replace bus_id with dev_name(),
dev_set_name()") deleted the code in register_disk() that changed a '/'
to a '!' in the device name when registering a disk.  This leads to
amusing problems with disks that have '/' in their names -- for example
a failure to boot with the root partition on a cciss device, even though
the kernel says it knows about the root device:

    VFS: Cannot open root device "cciss/c0d0p6" or unknown-block(0,0)
    Please append a correct "root=" boot option; here are the available partitions:
    6800        71652960 cciss/c0d0 driver: cciss
      6802               1 cciss/c0d0p2
      6805         2931831 cciss/c0d0p5
      6806        34354908 cciss/c0d0p6
    6810        71652960 cciss/c0d1 driver: cciss

Fix this by bringing back the code to change '/' to '!' in disk names
when registering a disk.

Signed-off-by: Roland Dreier <rolandd@...co.com>
---
 fs/partitions/check.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 6d72024..474d73e 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -448,11 +448,19 @@ void register_disk(struct gendisk *disk)
 	struct block_device *bdev;
 	struct disk_part_iter piter;
 	struct hd_struct *part;
+	char dname[DISK_NAME_LEN];
+	char *s;
 	int err;
 
 	ddev->parent = disk->driverfs_dev;
 
-	dev_set_name(ddev, disk->disk_name);
+	/* ewww... some of these buggers have / in the name... */
+	strcpy(dname, disk->disk_name);
+	s = strchr(dname, '/');
+	if (s)
+		*s = '!';
+
+	dev_set_name(ddev, dname);
 
 	/* delay uevents, until we scanned partition table */
 	ddev->uevent_suppress = 1;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ