Skip to content

Commit 34363c0

Browse files
committed
isofs: Fix off-by-one in 'session' mount option parsing
According to ECMA-130 standard maximum valid track number is 99. Since 'session' mount option starts indexing at 0 (and we add 1 to the passed number), we should refuse value 99. Also the condition in isofs_get_last_session() unnecessarily repeats the check - remove it. Reported-by: David Howells <[email protected]> Signed-off-by: Jan Kara <[email protected]>
1 parent fcea8ae commit 34363c0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fs/isofs/inode.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,11 @@ static int parse_options(char *options, struct iso9660_options *popt)
410410
if (match_int(&args[0], &option))
411411
return 0;
412412
n = option;
413-
if (n > 99)
413+
/*
414+
* Track numbers are supposed to be in range 1-99, the
415+
* mount option starts indexing at 0.
416+
*/
417+
if (n >= 99)
414418
return 0;
415419
popt->session = n + 1;
416420
break;
@@ -543,7 +547,7 @@ static unsigned int isofs_get_last_session(struct super_block *sb, s32 session)
543547

544548
vol_desc_start=0;
545549
ms_info.addr_format=CDROM_LBA;
546-
if(session >= 0 && session <= 99) {
550+
if (session > 0) {
547551
struct cdrom_tocentry Te;
548552
Te.cdte_track=session;
549553
Te.cdte_format=CDROM_LBA;

0 commit comments

Comments
 (0)