]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/cifs/cifsfs.c
CIFS: Fix a malicious redirect problem in the DNS lookup code
[net-next-2.6.git] / fs / cifs / cifsfs.c
index 78c02eb4cb1f107f6c2503acc4f6d56f7e1b1524..2cb1a70214d7298070266840bb97ad7bf2c98a57 100644 (file)
@@ -473,14 +473,24 @@ static int cifs_remount(struct super_block *sb, int *flags, char *data)
        return 0;
 }
 
+void cifs_drop_inode(struct inode *inode)
+{
+       struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
+
+       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)
+               return generic_drop_inode(inode);
+
+       return generic_delete_inode(inode);
+}
+
 static const struct super_operations cifs_super_ops = {
        .put_super = cifs_put_super,
        .statfs = cifs_statfs,
        .alloc_inode = cifs_alloc_inode,
        .destroy_inode = cifs_destroy_inode,
-/*     .drop_inode         = generic_delete_inode,
-       .delete_inode   = cifs_delete_inode,  */  /* Do not need above two
-       functions unless later we add lazy close of inodes or unless the
+       .drop_inode     = cifs_drop_inode,
+/*     .delete_inode   = cifs_delete_inode,  */  /* Do not need above
+       function unless later we add lazy close of inodes or unless the
        kernel forgets to call us with the same number of releases (closes)
        as opens */
        .show_options = cifs_show_options,
@@ -913,7 +923,7 @@ init_cifs(void)
                goto out_unregister_filesystem;
 #endif
 #ifdef CONFIG_CIFS_DFS_UPCALL
-       rc = register_key_type(&key_type_dns_resolver);
+       rc = cifs_init_dns_resolver();
        if (rc)
                goto out_unregister_key_type;
 #endif
@@ -925,7 +935,7 @@ init_cifs(void)
 
  out_unregister_resolver_key:
 #ifdef CONFIG_CIFS_DFS_UPCALL
-       unregister_key_type(&key_type_dns_resolver);
+       cifs_exit_dns_resolver();
  out_unregister_key_type:
 #endif
 #ifdef CONFIG_CIFS_UPCALL
@@ -951,7 +961,7 @@ exit_cifs(void)
        cifs_proc_clean();
 #ifdef CONFIG_CIFS_DFS_UPCALL
        cifs_dfs_release_automount_timer();
-       unregister_key_type(&key_type_dns_resolver);
+       cifs_exit_dns_resolver();
 #endif
 #ifdef CONFIG_CIFS_UPCALL
        unregister_key_type(&cifs_spnego_key_type);