]> git.pld-linux.org Git - packages/kernel.git/blob - kernel-autofs4-2.6.27-v5-update-20081027.patch
- 2.6.27.8 [CVE-2008-5300]
[packages/kernel.git] / kernel-autofs4-2.6.27-v5-update-20081027.patch
1 Index: linux-2.6.27/fs/autofs4/autofs_i.h
2 ===================================================================
3 --- linux-2.6.27.orig/fs/autofs4/autofs_i.h
4 +++ linux-2.6.27/fs/autofs4/autofs_i.h
5 @@ -21,6 +21,8 @@
6  #define AUTOFS_IOC_FIRST     AUTOFS_IOC_READY
7  #define AUTOFS_IOC_COUNT     32
8  
9 +#define AUTOFS_TYPE_TRIGGER    (AUTOFS_TYPE_DIRECT|AUTOFS_TYPE_OFFSET)
10 +
11  #include <linux/kernel.h>
12  #include <linux/slab.h>
13  #include <linux/time.h>
14 @@ -92,10 +94,6 @@ struct autofs_wait_queue {
15  
16  #define AUTOFS_SBI_MAGIC 0x6d4a556d
17  
18 -#define AUTOFS_TYPE_INDIRECT     0x0001
19 -#define AUTOFS_TYPE_DIRECT       0x0002
20 -#define AUTOFS_TYPE_OFFSET       0x0004
21 -
22  struct autofs_sb_info {
23         u32 magic;
24         int pipefd;
25 Index: linux-2.6.27/fs/autofs4/expire.c
26 ===================================================================
27 --- linux-2.6.27.orig/fs/autofs4/expire.c
28 +++ linux-2.6.27/fs/autofs4/expire.c
29 @@ -56,12 +56,23 @@ static int autofs4_mount_busy(struct vfs
30         mntget(mnt);
31         dget(dentry);
32  
33 -       if (!autofs4_follow_mount(&mnt, &dentry))
34 +       if (!follow_down(&mnt, &dentry))
35                 goto done;
36  
37 -       /* This is an autofs submount, we can't expire it */
38 -       if (is_autofs4_dentry(dentry))
39 -               goto done;
40 +       if (is_autofs4_dentry(dentry)) {
41 +               struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
42 +
43 +               /* This is an autofs submount, we can't expire it */
44 +               if (sbi->type == AUTOFS_TYPE_INDIRECT)
45 +                       goto done;
46 +
47 +               /*
48 +                * Otherwise it's an offset mount and we need to check
49 +                * if we can umount its mount, if there is one.
50 +                */
51 +               if (!d_mountpoint(dentry))
52 +                       goto done;
53 +       }
54  
55         /* Update the expiry counter if fs is busy */
56         if (!may_umount_tree(mnt)) {
57 @@ -479,7 +490,7 @@ int autofs4_expire_multi(struct super_bl
58         if (arg && get_user(do_now, arg))
59                 return -EFAULT;
60  
61 -       if (sbi->type & AUTOFS_TYPE_DIRECT)
62 +       if (sbi->type & AUTOFS_TYPE_TRIGGER)
63                 dentry = autofs4_expire_direct(sb, mnt, sbi, do_now);
64         else
65                 dentry = autofs4_expire_indirect(sb, mnt, sbi, do_now);
66 Index: linux-2.6.27/fs/autofs4/inode.c
67 ===================================================================
68 --- linux-2.6.27.orig/fs/autofs4/inode.c
69 +++ linux-2.6.27/fs/autofs4/inode.c
70 @@ -288,7 +288,7 @@ static int parse_options(char *options, 
71                         *type = AUTOFS_TYPE_DIRECT;
72                         break;
73                 case Opt_offset:
74 -                       *type = AUTOFS_TYPE_DIRECT | AUTOFS_TYPE_OFFSET;
75 +                       *type = AUTOFS_TYPE_OFFSET;
76                         break;
77                 default:
78                         return 1;
79 @@ -336,7 +336,7 @@ int autofs4_fill_super(struct super_bloc
80         sbi->sb = s;
81         sbi->version = 0;
82         sbi->sub_version = 0;
83 -       sbi->type = 0;
84 +       sbi->type = AUTOFS_TYPE_INDIRECT;
85         sbi->min_proto = 0;
86         sbi->max_proto = 0;
87         mutex_init(&sbi->wq_mutex);
88 @@ -378,7 +378,7 @@ int autofs4_fill_super(struct super_bloc
89         }
90  
91         root_inode->i_fop = &autofs4_root_operations;
92 -       root_inode->i_op = sbi->type & AUTOFS_TYPE_DIRECT ?
93 +       root_inode->i_op = sbi->type & AUTOFS_TYPE_TRIGGER ?
94                         &autofs4_direct_root_inode_operations :
95                         &autofs4_indirect_root_inode_operations;
96  
97 Index: linux-2.6.27/fs/autofs4/waitq.c
98 ===================================================================
99 --- linux-2.6.27.orig/fs/autofs4/waitq.c
100 +++ linux-2.6.27/fs/autofs4/waitq.c
101 @@ -337,7 +337,7 @@ int autofs4_wait(struct autofs_sb_info *
102                  * is very similar for indirect mounts except only dentrys
103                  * in the root of the autofs file system may be negative.
104                  */
105 -               if (sbi->type & (AUTOFS_TYPE_DIRECT|AUTOFS_TYPE_OFFSET))
106 +               if (sbi->type & AUTOFS_TYPE_TRIGGER)
107                         return -ENOENT;
108                 else if (!IS_ROOT(dentry->d_parent))
109                         return -ENOENT;
110 @@ -348,7 +348,7 @@ int autofs4_wait(struct autofs_sb_info *
111                 return -ENOMEM;
112  
113         /* If this is a direct mount request create a dummy name */
114 -       if (IS_ROOT(dentry) && (sbi->type & AUTOFS_TYPE_DIRECT))
115 +       if (IS_ROOT(dentry) && sbi->type & AUTOFS_TYPE_TRIGGER)
116                 qstr.len = sprintf(name, "%p", dentry);
117         else {
118                 qstr.len = autofs4_getpath(sbi, dentry, &name);
119 @@ -406,11 +406,11 @@ int autofs4_wait(struct autofs_sb_info *
120                                 type = autofs_ptype_expire_multi;
121                 } else {
122                         if (notify == NFY_MOUNT)
123 -                               type = (sbi->type & AUTOFS_TYPE_DIRECT) ?
124 +                               type = (sbi->type & AUTOFS_TYPE_TRIGGER) ?
125                                         autofs_ptype_missing_direct :
126                                          autofs_ptype_missing_indirect;
127                         else
128 -                               type = (sbi->type & AUTOFS_TYPE_DIRECT) ?
129 +                               type = (sbi->type & AUTOFS_TYPE_TRIGGER) ?
130                                         autofs_ptype_expire_direct :
131                                         autofs_ptype_expire_indirect;
132                 }
133 Index: linux-2.6.27/include/linux/auto_fs4.h
134 ===================================================================
135 --- linux-2.6.27.orig/include/linux/auto_fs4.h
136 +++ linux-2.6.27/include/linux/auto_fs4.h
137 @@ -29,6 +29,11 @@
138  #define AUTOFS_EXP_IMMEDIATE           1
139  #define AUTOFS_EXP_LEAVES              2
140  
141 +#define AUTOFS_TYPE_ANY                        0x0000
142 +#define AUTOFS_TYPE_INDIRECT           0x0001
143 +#define AUTOFS_TYPE_DIRECT             0x0002
144 +#define AUTOFS_TYPE_OFFSET             0x0004
145 +
146  /* Daemon notification packet types */
147  enum autofs_notify {
148         NFY_NONE,
This page took 0.099419 seconds and 3 git commands to generate.