aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-07-04 15:28:41 +0000
committerFelix Fietkau <nbd@openwrt.org>2010-07-04 15:28:41 +0000
commit3e247784cdc43b06eed54babe01c59f2d310e425 (patch)
treeb809f58595ffbcb88868271f2a2d2fb5d0507f07 /target/linux
parente12c89f6375a753d0785b022eef179f7b00c30fc (diff)
downloadupstream-3e247784cdc43b06eed54babe01c59f2d310e425.tar.gz
upstream-3e247784cdc43b06eed54babe01c59f2d310e425.tar.bz2
upstream-3e247784cdc43b06eed54babe01c59f2d310e425.zip
mini_fo: add error pointer checks after dentry lookups to fix various crash bugs (fixes #7277, #7207, #7259)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@22057 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/generic/patches-2.6.32/217-mini_fo_dentry_check.patch48
-rw-r--r--target/linux/generic/patches-2.6.33/217-mini_fo_dentry_check.patch48
-rw-r--r--target/linux/generic/patches-2.6.34/217-mini_fo_dentry_check.patch48
-rw-r--r--target/linux/generic/patches-2.6.35/218-mini_fo_dentry_check.patch48
4 files changed, 192 insertions, 0 deletions
diff --git a/target/linux/generic/patches-2.6.32/217-mini_fo_dentry_check.patch b/target/linux/generic/patches-2.6.32/217-mini_fo_dentry_check.patch
new file mode 100644
index 0000000000..cf53e4826f
--- /dev/null
+++ b/target/linux/generic/patches-2.6.32/217-mini_fo_dentry_check.patch
@@ -0,0 +1,48 @@
+--- a/fs/mini_fo/meta.c
++++ b/fs/mini_fo/meta.c
+@@ -48,6 +48,9 @@ int meta_build_lists(dentry_t *dentry)
+ dtohd2(dentry),
+ strlen(META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ goto out_ok;
++
+ if(!meta_dentry->d_inode) {
+ dput(meta_dentry);
+ goto out_ok;
+@@ -433,6 +436,8 @@ int meta_write_d_entry(dentry_t *dentry,
+ meta_dentry = lookup_one_len(META_FILENAME,
+ dtohd2(dentry), strlen (META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ return PTR_ERR(meta_dentry);
+
+ /* We need to create a META-file */
+ if(!meta_dentry->d_inode) {
+@@ -538,6 +543,8 @@ int meta_write_r_entry(dentry_t *dentry,
+ dtohd2(dentry),
+ strlen (META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ return PTR_ERR(meta_dentry);
+
+ if(!meta_dentry->d_inode) {
+ /* We need to create a META-file */
+@@ -656,6 +663,8 @@ int meta_sync_d_list(dentry_t *dentry, i
+ dtohd2(dentry),
+ strlen(META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ return PTR_ERR(meta_dentry);
+
+ if(!meta_dentry->d_inode) {
+ /* We need to create a META-file */
+@@ -803,6 +812,8 @@ int meta_sync_r_list(dentry_t *dentry, i
+ dtohd2(dentry),
+ strlen(META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ return PTR_ERR(meta_dentry);
+
+ if(!meta_dentry->d_inode) {
+ /* We need to create a META-file */
diff --git a/target/linux/generic/patches-2.6.33/217-mini_fo_dentry_check.patch b/target/linux/generic/patches-2.6.33/217-mini_fo_dentry_check.patch
new file mode 100644
index 0000000000..cf53e4826f
--- /dev/null
+++ b/target/linux/generic/patches-2.6.33/217-mini_fo_dentry_check.patch
@@ -0,0 +1,48 @@
+--- a/fs/mini_fo/meta.c
++++ b/fs/mini_fo/meta.c
+@@ -48,6 +48,9 @@ int meta_build_lists(dentry_t *dentry)
+ dtohd2(dentry),
+ strlen(META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ goto out_ok;
++
+ if(!meta_dentry->d_inode) {
+ dput(meta_dentry);
+ goto out_ok;
+@@ -433,6 +436,8 @@ int meta_write_d_entry(dentry_t *dentry,
+ meta_dentry = lookup_one_len(META_FILENAME,
+ dtohd2(dentry), strlen (META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ return PTR_ERR(meta_dentry);
+
+ /* We need to create a META-file */
+ if(!meta_dentry->d_inode) {
+@@ -538,6 +543,8 @@ int meta_write_r_entry(dentry_t *dentry,
+ dtohd2(dentry),
+ strlen (META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ return PTR_ERR(meta_dentry);
+
+ if(!meta_dentry->d_inode) {
+ /* We need to create a META-file */
+@@ -656,6 +663,8 @@ int meta_sync_d_list(dentry_t *dentry, i
+ dtohd2(dentry),
+ strlen(META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ return PTR_ERR(meta_dentry);
+
+ if(!meta_dentry->d_inode) {
+ /* We need to create a META-file */
+@@ -803,6 +812,8 @@ int meta_sync_r_list(dentry_t *dentry, i
+ dtohd2(dentry),
+ strlen(META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ return PTR_ERR(meta_dentry);
+
+ if(!meta_dentry->d_inode) {
+ /* We need to create a META-file */
diff --git a/target/linux/generic/patches-2.6.34/217-mini_fo_dentry_check.patch b/target/linux/generic/patches-2.6.34/217-mini_fo_dentry_check.patch
new file mode 100644
index 0000000000..cf53e4826f
--- /dev/null
+++ b/target/linux/generic/patches-2.6.34/217-mini_fo_dentry_check.patch
@@ -0,0 +1,48 @@
+--- a/fs/mini_fo/meta.c
++++ b/fs/mini_fo/meta.c
+@@ -48,6 +48,9 @@ int meta_build_lists(dentry_t *dentry)
+ dtohd2(dentry),
+ strlen(META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ goto out_ok;
++
+ if(!meta_dentry->d_inode) {
+ dput(meta_dentry);
+ goto out_ok;
+@@ -433,6 +436,8 @@ int meta_write_d_entry(dentry_t *dentry,
+ meta_dentry = lookup_one_len(META_FILENAME,
+ dtohd2(dentry), strlen (META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ return PTR_ERR(meta_dentry);
+
+ /* We need to create a META-file */
+ if(!meta_dentry->d_inode) {
+@@ -538,6 +543,8 @@ int meta_write_r_entry(dentry_t *dentry,
+ dtohd2(dentry),
+ strlen (META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ return PTR_ERR(meta_dentry);
+
+ if(!meta_dentry->d_inode) {
+ /* We need to create a META-file */
+@@ -656,6 +663,8 @@ int meta_sync_d_list(dentry_t *dentry, i
+ dtohd2(dentry),
+ strlen(META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ return PTR_ERR(meta_dentry);
+
+ if(!meta_dentry->d_inode) {
+ /* We need to create a META-file */
+@@ -803,6 +812,8 @@ int meta_sync_r_list(dentry_t *dentry, i
+ dtohd2(dentry),
+ strlen(META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ return PTR_ERR(meta_dentry);
+
+ if(!meta_dentry->d_inode) {
+ /* We need to create a META-file */
diff --git a/target/linux/generic/patches-2.6.35/218-mini_fo_dentry_check.patch b/target/linux/generic/patches-2.6.35/218-mini_fo_dentry_check.patch
new file mode 100644
index 0000000000..cf53e4826f
--- /dev/null
+++ b/target/linux/generic/patches-2.6.35/218-mini_fo_dentry_check.patch
@@ -0,0 +1,48 @@
+--- a/fs/mini_fo/meta.c
++++ b/fs/mini_fo/meta.c
+@@ -48,6 +48,9 @@ int meta_build_lists(dentry_t *dentry)
+ dtohd2(dentry),
+ strlen(META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ goto out_ok;
++
+ if(!meta_dentry->d_inode) {
+ dput(meta_dentry);
+ goto out_ok;
+@@ -433,6 +436,8 @@ int meta_write_d_entry(dentry_t *dentry,
+ meta_dentry = lookup_one_len(META_FILENAME,
+ dtohd2(dentry), strlen (META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ return PTR_ERR(meta_dentry);
+
+ /* We need to create a META-file */
+ if(!meta_dentry->d_inode) {
+@@ -538,6 +543,8 @@ int meta_write_r_entry(dentry_t *dentry,
+ dtohd2(dentry),
+ strlen (META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ return PTR_ERR(meta_dentry);
+
+ if(!meta_dentry->d_inode) {
+ /* We need to create a META-file */
+@@ -656,6 +663,8 @@ int meta_sync_d_list(dentry_t *dentry, i
+ dtohd2(dentry),
+ strlen(META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ return PTR_ERR(meta_dentry);
+
+ if(!meta_dentry->d_inode) {
+ /* We need to create a META-file */
+@@ -803,6 +812,8 @@ int meta_sync_r_list(dentry_t *dentry, i
+ dtohd2(dentry),
+ strlen(META_FILENAME));
+ mutex_unlock(&dtohd2(dentry)->d_inode->i_mutex);
++ if (IS_ERR(meta_dentry))
++ return PTR_ERR(meta_dentry);
+
+ if(!meta_dentry->d_inode) {
+ /* We need to create a META-file */