diff options
-rw-r--r-- | fs/coda/inode.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/fs/coda/inode.c b/fs/coda/inode.c index f1813120d753..bd2313d106e5 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c | |||
@@ -109,41 +109,39 @@ static int get_device_index(struct coda_mount_data *data) | |||
109 | { | 109 | { |
110 | struct file *file; | 110 | struct file *file; |
111 | struct inode *inode; | 111 | struct inode *inode; |
112 | int idx; | 112 | int idx, fput_needed; |
113 | 113 | ||
114 | if(data == NULL) { | 114 | if (data == NULL) { |
115 | printk("coda_read_super: Bad mount data\n"); | 115 | printk("coda_read_super: Bad mount data\n"); |
116 | return -1; | 116 | return -1; |
117 | } | 117 | } |
118 | 118 | ||
119 | if(data->version != CODA_MOUNT_VERSION) { | 119 | if (data->version != CODA_MOUNT_VERSION) { |
120 | printk("coda_read_super: Bad mount version\n"); | 120 | printk("coda_read_super: Bad mount version\n"); |
121 | return -1; | 121 | return -1; |
122 | } | 122 | } |
123 | 123 | ||
124 | file = fget(data->fd); | 124 | file = fget_light(data->fd, &fput_needed); |
125 | inode = NULL; | 125 | if (!file) |
126 | if(file) | 126 | goto Ebadf; |
127 | inode = file->f_path.dentry->d_inode; | 127 | inode = file->f_path.dentry->d_inode; |
128 | 128 | if (!S_ISCHR(inode->i_mode) || imajor(inode) != CODA_PSDEV_MAJOR) { | |
129 | if(!inode || !S_ISCHR(inode->i_mode) || | 129 | fput_light(file, fput_needed); |
130 | imajor(inode) != CODA_PSDEV_MAJOR) { | 130 | goto Ebadf; |
131 | if(file) | ||
132 | fput(file); | ||
133 | |||
134 | printk("coda_read_super: Bad file\n"); | ||
135 | return -1; | ||
136 | } | 131 | } |
137 | 132 | ||
138 | idx = iminor(inode); | 133 | idx = iminor(inode); |
139 | fput(file); | 134 | fput_light(file, fput_needed); |
140 | 135 | ||
141 | if(idx < 0 || idx >= MAX_CODADEVS) { | 136 | if (idx < 0 || idx >= MAX_CODADEVS) { |
142 | printk("coda_read_super: Bad minor number\n"); | 137 | printk("coda_read_super: Bad minor number\n"); |
143 | return -1; | 138 | return -1; |
144 | } | 139 | } |
145 | 140 | ||
146 | return idx; | 141 | return idx; |
142 | Ebadf: | ||
143 | printk("coda_read_super: Bad file\n"); | ||
144 | return -1; | ||
147 | } | 145 | } |
148 | 146 | ||
149 | static int coda_fill_super(struct super_block *sb, void *data, int silent) | 147 | static int coda_fill_super(struct super_block *sb, void *data, int silent) |