Skip to contentSkip to conversation

Fix incorrect Mt Rainier detection

PATCH In review Peter Osterlund 2 participants 2 messages Oct 25, 2004 – Oct 26, 2004 Uniform cdrom driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix incorrect Mt Rainier detection

cdrom_is_mrw() can incorrectly think that a drive is Mt Rainier capable, because if forgets to check if the "GET CONFIGURATION" command returns the MRW feature number. According to the MMC spec, the drive shall return all feature numbers >= the starting feature number, so even if the drive doesn't support Mt Rainier, it can return some data that makes cdrom_is_mrw() incorrectly think the drive is MRW capable.

This problem stops me from mounting DVD+RW discs in R/W mode on my laptop, because it makes cdrom_open_write() call cdrom_mrw_open_write() which fails because the drive isn't really MRW capable.

The fix is to make sure the returned feature number is the correct one for Mt Rainier.

---

 linux-petero/drivers/cdrom/cdrom.c |    2 ++
 1 files changed, 2 insertions(+)
drivers/cdrom/cdrom.c renamed from drivers/cdrom/cdrom.c~mrw-fix +2 -0
diff -puN drivers/cdrom/cdrom.c~mrw-fix drivers/cdrom/cdrom.c
@@ -546,6 +546,8 @@ int cdrom_is_mrw(struct cdrom_device_inf
 		return ret;
 
 	mfd = (struct mrw_feature_desc *)&buffer[sizeof(struct feature_header)];
+	if (be16_to_cpu(mfd->feature_code) != CDF_MRW)
+		return 1;
 	*write = mfd->write;
 
 	if ((ret = cdrom_mrw_probe_pc(cdi))) {

_

Signature · 2 lines
Peter Osterlund - [email protected]
http://w1.894.telia.com/~u89404340
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Peter Osterlund

cdrom_is_mrw() can incorrectly think that a drive is Mt Rainier capable, because if forgets to check if the "GET CONFIGURATION" command returns the MRW feature number. According to the MMC spec, the drive shall return all feature numbers >= the starting feature number, so even if the drive doesn't support Mt Rainier, it can return some data that makes cdrom_is_mrw() incorrectly think the drive is MRW capable.

This problem stops me from mounting DVD+RW discs in R/W mode on my laptop, because it makes cdrom_open_write() call cdrom_mrw_open_write() which fails because the drive isn't really MRW capable.

Quoted 4 lines

The fix is to make sure the returned feature number is the correct one for Mt Rainier.

Quoted 23 lines

---

 linux-petero/drivers/cdrom/cdrom.c |    2 ++
 1 files changed, 2 insertions(+)

diff -puN drivers/cdrom/cdrom.c~mrw-fix drivers/cdrom/cdrom.c

drivers/cdrom/cdrom.c renamed from drivers/cdrom/cdrom.c~mrw-fix +2 -0
@@ -546,6 +546,8 @@ int cdrom_is_mrw(struct cdrom_device_inf
 		return ret;
 
 	mfd = (struct mrw_feature_desc *)&buffer[sizeof(struct feature_header)];
+	if (be16_to_cpu(mfd->feature_code) != CDF_MRW)
+		return 1;
 	*write = mfd->write;
 
 	if ((ret = cdrom_mrw_probe_pc(cdi))) {

_

Signature · 2 lines
Peter Osterlund - [email protected]
http://w1.894.telia.com/~u89404340
Signature · 1 line
Jens Axboe