From: qx@shire.math.columbia.edu (Qi Xia) Subject: Bug fix of xiafs-0.7 Date: Mon, 15 Feb 1993 15:00:41 GMT
A bug in the kernel part of xiafs was found yesterday.
This bug may trush multi-block directory if you delete and
create files many times.
The following is the fix. Upgrade is strongly recommanded.
move this file to linux/fs/xiafs dir to apply the patch.
-Frank Xia Mon Feb 15, 1993
=========================================================================
diff -cr namei.c~ namei.c
*** namei.c~ Sun Feb 14 22:54:34 1993
--- namei.c Sun Feb 14 22:17:37 1993
***************
*** 20,26 ****
#include "xfs_mac.h"
! #define RNDUP4(x) (((x) + 3) & ~3)
/*
* ok, we cannot use strncmp, as the name is not in our data space.
* Thus we'll have to use xfs_match. No big problem. Match also makes
--- 20,26 ----
#include "xfs_mac.h"
! #define RNDUP4(x) ((3+(u_long)(x)) & ~3)
/*
* ok, we cannot use strncmp, as the name is not in our data space.
* Thus we'll have to use xfs_match. No big problem. Match also makes
***************
*** 206,212 ****
brelse(bh);
return NULL;
}
! if (RNDUP4(de->d_name_len)+RNDUP4(namelen)+16<=de->d_rec_len) {
i=RNDUP4(de->d_name_len)+8;
de2=(struct xfs_direct *)(i+(u_char *)de);
de2->d_ino=0;
--- 206,213 ----
brelse(bh);
return NULL;
}
! if (de->d_ino &&
! RNDUP4(de->d_name_len)+RNDUP4(namelen)+16<=de->d_rec_len) {
i=RNDUP4(de->d_name_len)+8;
de2=(struct xfs_direct *)(i+(u_char *)de);
de2->d_ino=0;
***************
*** 215,221 ****
de=de2;
}
}
! if (!de->d_ino) {
dir->i_mtime = CURRENT_TIME;
dir->i_dirt = 1;
memcpy(de->d_name, name_buffer, namelen);
--- 216,222 ----
de=de2;
}
}
! if (!de->d_ino && (RNDUP4(namelen)+8 <= de->d_rec_len)) {
dir->i_mtime = CURRENT_TIME;
dir->i_dirt = 1;
memcpy(de->d_name, name_buffer, namelen);