Skip to contentSkip to conversation

NTFS null dereference x2

PATCH Dave Jones 1 participant 1 message Apr 16, 2004 NTFS filesystem

lore
Share & tools
lore

Dave Jones

author
#0 lore raw

if vol is NULL, everything falls apart..

Dave

fs/ntfs/attrib.c renamed from fs/ntfs/attrib.c~ +5 -2
@@ -1235,16 +1235,19 @@
 	u8 *al_end = al + initialized_size;
 	run_list_element *rl;
 	struct buffer_head *bh;
-	struct super_block *sb = vol->sb;
+	struct super_block *sb;
 	unsigned long block_size = sb->s_blocksize;
 	unsigned long block, max_block;
 	int err = 0;
-	unsigned char block_size_bits = sb->s_blocksize_bits;
+	unsigned char block_size_bits;
 
 	ntfs_debug("Entering.");
 	if (!vol || !run_list || !al || size <= 0 || initialized_size < 0 ||
 			initialized_size > size)
 		return -EINVAL;
+	sb = vol->sb;
+	block_size_bits = sb->s_blocksize_bits;
+
 	if (!initialized_size) {
 		memset(al, 0, size);
 		return 0;