Commit 47227f5d authored by Luca Tettamanti's avatar Luca Tettamanti Committed by Linus Torvalds

[PATCH] ide-cd: Unable to read multisession DVDs

cdrom_read_toc (ide-cd.c) always reads the TOC using MSF format.  If the
last session of the disk starts beyond block 1152000 (LBA) there's an
overflow in the MSF format and kernel complains:

Unable to identify CD-ROM format.

I reported this bug a while ago (see bug #1930 on bugzilla) and Andy
Polyakov tracked it down.

Read the multi-session TOC in LBA format in order to avoid an overflow
in MSF format when the last session starts beyond block 1152000 (LBA).
Signed-off-by: default avatarLuca Tettamanti <kronos@kronoz.cjb.net>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d2dc1db0
...@@ -2359,24 +2359,30 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense) ...@@ -2359,24 +2359,30 @@ static int cdrom_read_toc(ide_drive_t *drive, struct request_sense *sense)
/* Read the multisession information. */ /* Read the multisession information. */
if (toc->hdr.first_track != CDROM_LEADOUT) { if (toc->hdr.first_track != CDROM_LEADOUT) {
/* Read the multisession information. */ /* Read the multisession information. */
stat = cdrom_read_tocentry(drive, 0, 1, 1, (char *)&ms_tmp, stat = cdrom_read_tocentry(drive, 0, 0, 1, (char *)&ms_tmp,
sizeof(ms_tmp), sense); sizeof(ms_tmp), sense);
if (stat) return stat; if (stat) return stat;
toc->last_session_lba = be32_to_cpu(ms_tmp.ent.addr.lba);
} else { } else {
ms_tmp.ent.addr.msf.minute = 0;
ms_tmp.ent.addr.msf.second = 2;
ms_tmp.ent.addr.msf.frame = 0;
ms_tmp.hdr.first_track = ms_tmp.hdr.last_track = CDROM_LEADOUT; ms_tmp.hdr.first_track = ms_tmp.hdr.last_track = CDROM_LEADOUT;
toc->last_session_lba = msf_to_lba(0, 2, 0); /* 0m 2s 0f */
} }
#if ! STANDARD_ATAPI #if ! STANDARD_ATAPI
if (CDROM_CONFIG_FLAGS(drive)->tocaddr_as_bcd) if (CDROM_CONFIG_FLAGS(drive)->tocaddr_as_bcd) {
msf_from_bcd (&ms_tmp.ent.addr.msf); /* Re-read multisession information using MSF format */
#endif /* not STANDARD_ATAPI */ stat = cdrom_read_tocentry(drive, 0, 1, 1, (char *)&ms_tmp,
sizeof(ms_tmp), sense);
if (stat)
return stat;
toc->last_session_lba = msf_to_lba (ms_tmp.ent.addr.msf.minute, msf_from_bcd (&ms_tmp.ent.addr.msf);
toc->last_session_lba = msf_to_lba(ms_tmp.ent.addr.msf.minute,
ms_tmp.ent.addr.msf.second, ms_tmp.ent.addr.msf.second,
ms_tmp.ent.addr.msf.frame); ms_tmp.ent.addr.msf.frame);
}
#endif /* not STANDARD_ATAPI */
toc->xa_flag = (ms_tmp.hdr.first_track != ms_tmp.hdr.last_track); toc->xa_flag = (ms_tmp.hdr.first_track != ms_tmp.hdr.last_track);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment