Module Name:    src
Committed By:   bouyer
Date:           Wed May 21 21:49:49 UTC 2014

Modified Files:
        src/sys/fs/cd9660 [netbsd-5-1]: cd9660_node.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1904):
        sys/fs/cd9660/cd9660_node.c: revision 1.31
PR kern/48787: inode calculation from ISO9660 block offset might get
truncated to 32bit - force the whole expression to be evaluated as ino_t.
Patch from Thomas Schmitt, with minor modifications (and reworded comment).


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.24.1 src/sys/fs/cd9660/cd9660_node.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/fs/cd9660/cd9660_node.c
diff -u src/sys/fs/cd9660/cd9660_node.c:1.24 src/sys/fs/cd9660/cd9660_node.c:1.24.24.1
--- src/sys/fs/cd9660/cd9660_node.c:1.24	Mon May  5 17:11:16 2008
+++ src/sys/fs/cd9660/cd9660_node.c	Wed May 21 21:49:49 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660_node.c,v 1.24 2008/05/05 17:11:16 ad Exp $	*/
+/*	$NetBSD: cd9660_node.c,v 1.24.24.1 2014/05/21 21:49:49 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1994
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd9660_node.c,v 1.24 2008/05/05 17:11:16 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd9660_node.c,v 1.24.24.1 2014/05/21 21:49:49 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -439,7 +439,14 @@ isodirino(struct iso_directory_record *i
 {
 	ino_t ino;
 
-	ino = (isonum_733(isodir->extent) + isonum_711(isodir->ext_attr_length))
-	      << imp->im_bshift;
-	return (ino);
+	/*
+	 * Note there is an inverse calculation in
+	 * cd9660_vfsops.c:cd9660_vget_internal():
+	 *   ip->iso_start = ino >> imp->im_bshift;
+	 * and also a calculation of the isodir pointer
+	 * from an inode in cd9660_vnops.c:cd9660_readlink()
+	 */
+	ino = ((ino_t)isonum_733(isodir->extent) +
+		isonum_711(isodir->ext_attr_length)) << imp->im_bshift;
+	return ino;
 }

Reply via email to