sysctl net: Keep tcp_syn_retries inside the boundary
[pandora-kernel.git] / fs / hfsplus / dir.c
index 25b2443..5adb740 100644 (file)
@@ -150,6 +150,11 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
                filp->f_pos++;
                /* fall through */
        case 1:
+               if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) {
+                       err = -EIO;
+                       goto out;
+               }
+
                hfs_bnode_read(fd.bnode, &entry, fd.entryoffset,
                        fd.entrylength);
                if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) {
@@ -181,6 +186,12 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
                        err = -EIO;
                        goto out;
                }
+
+               if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) {
+                       err = -EIO;
+                       goto out;
+               }
+
                hfs_bnode_read(fd.bnode, &entry, fd.entryoffset,
                        fd.entrylength);
                type = be16_to_cpu(entry.type);
@@ -415,7 +426,7 @@ static int hfsplus_symlink(struct inode *dir, struct dentry *dentry,
        goto out;
 
 out_err:
-       inode->i_nlink = 0;
+       clear_nlink(inode);
        hfsplus_delete_inode(inode);
        iput(inode);
 out:
@@ -440,7 +451,7 @@ static int hfsplus_mknod(struct inode *dir, struct dentry *dentry,
 
        res = hfsplus_create_cat(inode->i_ino, dir, &dentry->d_name, inode);
        if (res) {
-               inode->i_nlink = 0;
+               clear_nlink(inode);
                hfsplus_delete_inode(inode);
                iput(inode);
                goto out;