Skip to contentSkip to conversation

reiserfs fix for incorrect key comparison

PATCH New Oleg Drokin on behalf of Hans Reiser 1 participant 1 message Feb 5, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reiserfs fix for incorrect key comparison

Hello!

This is to fix certain cases where items may get its keys to be interpreted wrong and cause reiserfs to panic, or to be inserted into the tree in wrong order. This bug was only observed live on 2.5.3, though it is present in 2.4, too.

Bye,
Oleg

fs/reiserfs/stree.c renamed from fs/reiserfs/stree.c.orig +4 -4
@@ -126,19 +126,19 @@
   retval = comp_short_keys (le_key, cpu_key);
   if (retval)
       return retval;
-  if (le_key_k_offset (cpu_key->version, le_key) < cpu_key_k_offset (cpu_key))
+  if (le_key_k_offset (le_key_version(le_key), le_key) < cpu_key_k_offset (cpu_key))
       return -1;
-  if (le_key_k_offset (cpu_key->version, le_key) > cpu_key_k_offset (cpu_key))
+  if (le_key_k_offset (le_key_version(le_key), le_key) > cpu_key_k_offset (cpu_key))
       return 1;
 
   if (cpu_key->key_length == 3)
       return 0;
 
   /* this part is needed only when tail conversion is in progress */
-  if (le_key_k_type (cpu_key->version, le_key) < cpu_key_k_type (cpu_key))
+  if (le_key_k_type (le_key_version(le_key), le_key) < cpu_key_k_type (cpu_key))
     return -1;
 
-  if (le_key_k_type (cpu_key->version, le_key) > cpu_key_k_type (cpu_key))
+  if (le_key_k_type (le_key_version(le_key), le_key) > cpu_key_k_type (cpu_key))
     return 1;
 
   return 0;