aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-08-01 13:26:23 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-08-01 13:26:23 -0400
commita0e881b7c189fa2bd76c024dbff91e79511c971d (patch)
tree0c801918565b08921d21aceee5b326f64d998f5f /drivers/staging
parenteff0d13f3823f35d70228cd151d2a2c89288ff32 (diff)
parentdbc6e0222d79e78925fe20733844a796a4b72cf9 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull second vfs pile from Al Viro: "The stuff in there: fsfreeze deadlock fixes by Jan (essentially, the deadlock reproduced by xfstests 068), symlink and hardlink restriction patches, plus assorted cleanups and fixes. Note that another fsfreeze deadlock (emergency thaw one) is *not* dealt with - the series by Fernando conflicts a lot with Jan's, breaks userland ABI (FIFREEZE semantics gets changed) and trades the deadlock for massive vfsmount leak; this is going to be handled next cycle. There probably will be another pull request, but that stuff won't be in it." Fix up trivial conflicts due to unrelated changes next to each other in drivers/{staging/gdm72xx/usb_boot.c, usb/gadget/storage_common.c} * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (54 commits) delousing target_core_file a bit Documentation: Correct s_umount state for freeze_fs/unfreeze_fs fs: Remove old freezing mechanism ext2: Implement freezing btrfs: Convert to new freezing mechanism nilfs2: Convert to new freezing mechanism ntfs: Convert to new freezing mechanism fuse: Convert to new freezing mechanism gfs2: Convert to new freezing mechanism ocfs2: Convert to new freezing mechanism xfs: Convert to new freezing code ext4: Convert to new freezing mechanism fs: Protect write paths by sb_start_write - sb_end_write fs: Skip atime update on frozen filesystem fs: Add freezing handling to mnt_want_write() / mnt_drop_write() fs: Improve filesystem freezing handling switch the protection of percpu_counter list to spinlock nfsd: Push mnt_want_write() outside of i_mutex btrfs: Push mnt_want_write() outside of i_mutex fat: Push mnt_want_write() outside of i_mutex ...
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/bcm/Misc.c31
-rw-r--r--drivers/staging/gdm72xx/sdio_boot.c7
-rw-r--r--drivers/staging/gdm72xx/usb_boot.c22
3 files changed, 17 insertions, 43 deletions
diff --git a/drivers/staging/bcm/Misc.c b/drivers/staging/bcm/Misc.c
index 9a60d4cd218..f545716c666 100644
--- a/drivers/staging/bcm/Misc.c
+++ b/drivers/staging/bcm/Misc.c
@@ -157,12 +157,7 @@ static int create_worker_threads(struct bcm_mini_adapter *psAdapter)
157 157
158static struct file *open_firmware_file(struct bcm_mini_adapter *Adapter, const char *path) 158static struct file *open_firmware_file(struct bcm_mini_adapter *Adapter, const char *path)
159{ 159{
160 struct file *flp = NULL; 160 struct file *flp = filp_open(path, O_RDONLY, S_IRWXU);
161 mm_segment_t oldfs;
162 oldfs = get_fs();
163 set_fs(get_ds());
164 flp = filp_open(path, O_RDONLY, S_IRWXU);
165 set_fs(oldfs);
166 if (IS_ERR(flp)) { 161 if (IS_ERR(flp)) {
167 pr_err(DRV_NAME "Unable To Open File %s, err %ld", path, PTR_ERR(flp)); 162 pr_err(DRV_NAME "Unable To Open File %s, err %ld", path, PTR_ERR(flp));
168 flp = NULL; 163 flp = NULL;
@@ -183,14 +178,12 @@ static int BcmFileDownload(struct bcm_mini_adapter *Adapter, const char *path, u
183{ 178{
184 int errorno = 0; 179 int errorno = 0;
185 struct file *flp = NULL; 180 struct file *flp = NULL;
186 mm_segment_t oldfs;
187 struct timeval tv = {0}; 181 struct timeval tv = {0};
188 182
189 flp = open_firmware_file(Adapter, path); 183 flp = open_firmware_file(Adapter, path);
190 if (!flp) { 184 if (!flp) {
191 errorno = -ENOENT;
192 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Unable to Open %s\n", path); 185 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Unable to Open %s\n", path);
193 goto exit_download; 186 return -ENOENT;
194 } 187 }
195 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Opened file is = %s and length =0x%lx to be downloaded at =0x%x", path, (unsigned long)flp->f_dentry->d_inode->i_size, loc); 188 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Opened file is = %s and length =0x%lx to be downloaded at =0x%x", path, (unsigned long)flp->f_dentry->d_inode->i_size, loc);
196 do_gettimeofday(&tv); 189 do_gettimeofday(&tv);
@@ -201,10 +194,7 @@ static int BcmFileDownload(struct bcm_mini_adapter *Adapter, const char *path, u
201 errorno = -EIO; 194 errorno = -EIO;
202 goto exit_download; 195 goto exit_download;
203 } 196 }
204 oldfs = get_fs();
205 set_fs(get_ds());
206 vfs_llseek(flp, 0, 0); 197 vfs_llseek(flp, 0, 0);
207 set_fs(oldfs);
208 if (Adapter->bcm_file_readback_from_chip(Adapter->pvInterfaceAdapter, flp, loc)) { 198 if (Adapter->bcm_file_readback_from_chip(Adapter->pvInterfaceAdapter, flp, loc)) {
209 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Failed to read back firmware!"); 199 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Failed to read back firmware!");
210 errorno = -EIO; 200 errorno = -EIO;
@@ -212,12 +202,7 @@ static int BcmFileDownload(struct bcm_mini_adapter *Adapter, const char *path, u
212 } 202 }
213 203
214exit_download: 204exit_download:
215 oldfs = get_fs(); 205 filp_close(flp, NULL);
216 set_fs(get_ds());
217 if (flp && !(IS_ERR(flp)))
218 filp_close(flp, current->files);
219 set_fs(oldfs);
220
221 return errorno; 206 return errorno;
222} 207}
223 208
@@ -1056,10 +1041,8 @@ OUT:
1056static int bcm_parse_target_params(struct bcm_mini_adapter *Adapter) 1041static int bcm_parse_target_params(struct bcm_mini_adapter *Adapter)
1057{ 1042{
1058 struct file *flp = NULL; 1043 struct file *flp = NULL;
1059 mm_segment_t oldfs = {0};
1060 char *buff; 1044 char *buff;
1061 int len = 0; 1045 int len = 0;
1062 loff_t pos = 0;
1063 1046
1064 buff = kmalloc(BUFFER_1K, GFP_KERNEL); 1047 buff = kmalloc(BUFFER_1K, GFP_KERNEL);
1065 if (!buff) 1048 if (!buff)
@@ -1079,20 +1062,16 @@ static int bcm_parse_target_params(struct bcm_mini_adapter *Adapter)
1079 Adapter->pstargetparams = NULL; 1062 Adapter->pstargetparams = NULL;
1080 return -ENOENT; 1063 return -ENOENT;
1081 } 1064 }
1082 oldfs = get_fs(); 1065 len = kernel_read(flp, 0, buff, BUFFER_1K);
1083 set_fs(get_ds()); 1066 filp_close(flp, NULL);
1084 len = vfs_read(flp, (void __user __force *)buff, BUFFER_1K, &pos);
1085 set_fs(oldfs);
1086 1067
1087 if (len != sizeof(STARGETPARAMS)) { 1068 if (len != sizeof(STARGETPARAMS)) {
1088 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Mismatch in Target Param Structure!\n"); 1069 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_INITEXIT, MP_INIT, DBG_LVL_ALL, "Mismatch in Target Param Structure!\n");
1089 kfree(buff); 1070 kfree(buff);
1090 kfree(Adapter->pstargetparams); 1071 kfree(Adapter->pstargetparams);
1091 Adapter->pstargetparams = NULL; 1072 Adapter->pstargetparams = NULL;
1092 filp_close(flp, current->files);
1093 return -ENOENT; 1073 return -ENOENT;
1094 } 1074 }
1095 filp_close(flp, current->files);
1096 1075
1097 /* Check for autolink in config params */ 1076 /* Check for autolink in config params */
1098 /* 1077 /*
diff --git a/drivers/staging/gdm72xx/sdio_boot.c b/drivers/staging/gdm72xx/sdio_boot.c
index 760efee23d4..65624bca8b3 100644
--- a/drivers/staging/gdm72xx/sdio_boot.c
+++ b/drivers/staging/gdm72xx/sdio_boot.c
@@ -66,9 +66,8 @@ static int download_image(struct sdio_func *func, char *img_name)
66 return -ENOENT; 66 return -ENOENT;
67 } 67 }
68 68
69 if (filp->f_dentry) 69 inode = filp->f_dentry->d_inode;
70 inode = filp->f_dentry->d_inode; 70 if (!S_ISREG(inode->i_mode)) {
71 if (!inode || !S_ISREG(inode->i_mode)) {
72 printk(KERN_ERR "Invalid file type: %s\n", img_name); 71 printk(KERN_ERR "Invalid file type: %s\n", img_name);
73 ret = -EINVAL; 72 ret = -EINVAL;
74 goto out; 73 goto out;
@@ -123,7 +122,7 @@ static int download_image(struct sdio_func *func, char *img_name)
123 pno++; 122 pno++;
124 } 123 }
125out: 124out:
126 filp_close(filp, current->files); 125 filp_close(filp, NULL);
127 return ret; 126 return ret;
128} 127}
129 128
diff --git a/drivers/staging/gdm72xx/usb_boot.c b/drivers/staging/gdm72xx/usb_boot.c
index fef290c38db..e3dbd5a552c 100644
--- a/drivers/staging/gdm72xx/usb_boot.c
+++ b/drivers/staging/gdm72xx/usb_boot.c
@@ -173,14 +173,12 @@ int usb_boot(struct usb_device *usbdev, u16 pid)
173 filp = filp_open(img_name, O_RDONLY | O_LARGEFILE, 0); 173 filp = filp_open(img_name, O_RDONLY | O_LARGEFILE, 0);
174 if (IS_ERR(filp)) { 174 if (IS_ERR(filp)) {
175 printk(KERN_ERR "Can't find %s.\n", img_name); 175 printk(KERN_ERR "Can't find %s.\n", img_name);
176 set_fs(fs);
177 ret = PTR_ERR(filp); 176 ret = PTR_ERR(filp);
178 goto restore_fs; 177 goto restore_fs;
179 } 178 }
180 179
181 if (filp->f_dentry) 180 inode = filp->f_dentry->d_inode;
182 inode = filp->f_dentry->d_inode; 181 if (!S_ISREG(inode->i_mode)) {
183 if (!inode || !S_ISREG(inode->i_mode)) {
184 printk(KERN_ERR "Invalid file type: %s\n", img_name); 182 printk(KERN_ERR "Invalid file type: %s\n", img_name);
185 ret = -EINVAL; 183 ret = -EINVAL;
186 goto out; 184 goto out;
@@ -262,7 +260,7 @@ int usb_boot(struct usb_device *usbdev, u16 pid)
262 ret = -EINVAL; 260 ret = -EINVAL;
263 } 261 }
264out: 262out:
265 filp_close(filp, current->files); 263 filp_close(filp, NULL);
266 264
267restore_fs: 265restore_fs:
268 set_fs(fs); 266 set_fs(fs);
@@ -322,13 +320,11 @@ static int em_download_image(struct usb_device *usbdev, char *path,
322 goto restore_fs; 320 goto restore_fs;
323 } 321 }
324 322
325 if (filp->f_dentry) { 323 inode = filp->f_dentry->d_inode;
326 inode = filp->f_dentry->d_inode; 324 if (!S_ISREG(inode->i_mode)) {
327 if (!inode || !S_ISREG(inode->i_mode)) { 325 printk(KERN_ERR "Invalid file type: %s\n", path);
328 printk(KERN_ERR "Invalid file type: %s\n", path); 326 ret = -EINVAL;
329 ret = -EINVAL; 327 goto out;
330 goto out;
331 }
332 } 328 }
333 329
334 buf = kmalloc(DOWNLOAD_CHUCK + pad_size, GFP_KERNEL); 330 buf = kmalloc(DOWNLOAD_CHUCK + pad_size, GFP_KERNEL);
@@ -364,7 +360,7 @@ static int em_download_image(struct usb_device *usbdev, char *path,
364 goto out; 360 goto out;
365 361
366out: 362out:
367 filp_close(filp, current->files); 363 filp_close(filp, NULL);
368 364
369restore_fs: 365restore_fs:
370 set_fs(fs); 366 set_fs(fs);