aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-09-14 21:13:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-14 21:13:32 -0400
commit581bfce969cbfc7ce43ee92273be9cb7c3fdfa61 (patch)
tree0a693778ce39c49b9b7d93d0d6795c576896f5cf /drivers
parentcc73fee0bae2d66594d1fa2df92bbd783aa98e04 (diff)
parent9725d4cef62229b4ec4c912e0db0761e7d400650 (diff)
Merge branch 'work.set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull more set_fs removal from Al Viro: "Christoph's 'use kernel_read and friends rather than open-coding set_fs()' series" * 'work.set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fs: unexport vfs_readv and vfs_writev fs: unexport vfs_read and vfs_write fs: unexport __vfs_read/__vfs_write lustre: switch to kernel_write gadget/f_mass_storage: stop messing with the address limit mconsole: switch to kernel_read btrfs: switch write_buf to kernel_write net/9p: switch p9_fd_read to kernel_write mm/nommu: switch do_mmap_private to kernel_read serial2002: switch serial2002_tty_write to kernel_{read/write} fs: make the buf argument to __kernel_write a void pointer fs: fix kernel_write prototype fs: fix kernel_read prototype fs: move kernel_read to fs/read_write.c fs: move kernel_write to fs/read_write.c autofs4: switch autofs4_write to __kernel_write ashmem: switch to ->read_iter
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/pci/cx25821/cx25821-audio-upstream.c13
-rw-r--r--drivers/mtd/nand/nandsim.c4
-rw-r--r--drivers/staging/android/ashmem.c29
-rw-r--r--drivers/staging/comedi/drivers/serial2002.c24
-rw-r--r--drivers/staging/lustre/lnet/libcfs/tracefile.c10
-rw-r--r--drivers/staging/lustre/lustre/obdclass/kernelcomm.c7
-rw-r--r--drivers/target/target_core_alua.c3
-rw-r--r--drivers/target/target_core_file.c2
-rw-r--r--drivers/target/target_core_pr.c3
-rw-r--r--drivers/usb/gadget/function/f_mass_storage.c21
10 files changed, 34 insertions, 82 deletions
diff --git a/drivers/media/pci/cx25821/cx25821-audio-upstream.c b/drivers/media/pci/cx25821/cx25821-audio-upstream.c
index b94eb1c0023d..ada26d4acfb4 100644
--- a/drivers/media/pci/cx25821/cx25821-audio-upstream.c
+++ b/drivers/media/pci/cx25821/cx25821-audio-upstream.c
@@ -277,7 +277,7 @@ static int cx25821_get_audio_data(struct cx25821_dev *dev,
277 p = (char *)dev->_audiodata_buf_virt_addr + frame_offset; 277 p = (char *)dev->_audiodata_buf_virt_addr + frame_offset;
278 278
279 for (i = 0; i < dev->_audio_lines_count; i++) { 279 for (i = 0; i < dev->_audio_lines_count; i++) {
280 int n = kernel_read(file, file_offset, mybuf, AUDIO_LINE_SIZE); 280 int n = kernel_read(file, mybuf, AUDIO_LINE_SIZE, &file_offset);
281 if (n < AUDIO_LINE_SIZE) { 281 if (n < AUDIO_LINE_SIZE) {
282 pr_info("Done: exit %s() since no more bytes to read from Audio file\n", 282 pr_info("Done: exit %s() since no more bytes to read from Audio file\n",
283 __func__); 283 __func__);
@@ -290,7 +290,6 @@ static int cx25821_get_audio_data(struct cx25821_dev *dev,
290 memcpy(p, mybuf, n); 290 memcpy(p, mybuf, n);
291 p += n; 291 p += n;
292 } 292 }
293 file_offset += n;
294 } 293 }
295 dev->_audioframe_count++; 294 dev->_audioframe_count++;
296 fput(file); 295 fput(file);
@@ -318,7 +317,7 @@ static int cx25821_openfile_audio(struct cx25821_dev *dev,
318{ 317{
319 char *p = (void *)dev->_audiodata_buf_virt_addr; 318 char *p = (void *)dev->_audiodata_buf_virt_addr;
320 struct file *file; 319 struct file *file;
321 loff_t offset; 320 loff_t file_offset = 0;
322 int i, j; 321 int i, j;
323 322
324 file = filp_open(dev->_audiofilename, O_RDONLY | O_LARGEFILE, 0); 323 file = filp_open(dev->_audiofilename, O_RDONLY | O_LARGEFILE, 0);
@@ -328,11 +327,11 @@ static int cx25821_openfile_audio(struct cx25821_dev *dev,
328 return PTR_ERR(file); 327 return PTR_ERR(file);
329 } 328 }
330 329
331 for (j = 0, offset = 0; j < NUM_AUDIO_FRAMES; j++) { 330 for (j = 0; j < NUM_AUDIO_FRAMES; j++) {
332 for (i = 0; i < dev->_audio_lines_count; i++) { 331 for (i = 0; i < dev->_audio_lines_count; i++) {
333 char buf[AUDIO_LINE_SIZE]; 332 char buf[AUDIO_LINE_SIZE];
334 int n = kernel_read(file, offset, buf, 333 loff_t offset = file_offset;
335 AUDIO_LINE_SIZE); 334 int n = kernel_read(file, buf, AUDIO_LINE_SIZE, &file_offset);
336 335
337 if (n < AUDIO_LINE_SIZE) { 336 if (n < AUDIO_LINE_SIZE) {
338 pr_info("Done: exit %s() since no more bytes to read from Audio file\n", 337 pr_info("Done: exit %s() since no more bytes to read from Audio file\n",
@@ -344,8 +343,6 @@ static int cx25821_openfile_audio(struct cx25821_dev *dev,
344 343
345 if (p) 344 if (p)
346 memcpy(p + offset, buf, n); 345 memcpy(p + offset, buf, n);
347
348 offset += n;
349 } 346 }
350 dev->_audioframe_count++; 347 dev->_audioframe_count++;
351 } 348 }
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index fec613221958..246b4393118e 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -1356,7 +1356,7 @@ static ssize_t read_file(struct nandsim *ns, struct file *file, void *buf, size_
1356 if (err) 1356 if (err)
1357 return err; 1357 return err;
1358 noreclaim_flag = memalloc_noreclaim_save(); 1358 noreclaim_flag = memalloc_noreclaim_save();
1359 tx = kernel_read(file, pos, buf, count); 1359 tx = kernel_read(file, buf, count, &pos);
1360 memalloc_noreclaim_restore(noreclaim_flag); 1360 memalloc_noreclaim_restore(noreclaim_flag);
1361 put_pages(ns); 1361 put_pages(ns);
1362 return tx; 1362 return tx;
@@ -1372,7 +1372,7 @@ static ssize_t write_file(struct nandsim *ns, struct file *file, void *buf, size
1372 if (err) 1372 if (err)
1373 return err; 1373 return err;
1374 noreclaim_flag = memalloc_noreclaim_save(); 1374 noreclaim_flag = memalloc_noreclaim_save();
1375 tx = kernel_write(file, buf, count, pos); 1375 tx = kernel_write(file, buf, count, &pos);
1376 memalloc_noreclaim_restore(noreclaim_flag); 1376 memalloc_noreclaim_restore(noreclaim_flag);
1377 put_pages(ns); 1377 put_pages(ns);
1378 return tx; 1378 return tx;
diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index 6ba270e0494d..0f695df14c9d 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -294,19 +294,9 @@ static int ashmem_release(struct inode *ignored, struct file *file)
294 return 0; 294 return 0;
295} 295}
296 296
297/** 297static ssize_t ashmem_read_iter(struct kiocb *iocb, struct iov_iter *iter)
298 * ashmem_read() - Reads a set of bytes from an Ashmem-enabled file
299 * @file: The associated backing file.
300 * @buf: The buffer of data being written to
301 * @len: The number of bytes being read
302 * @pos: The position of the first byte to read.
303 *
304 * Return: 0 if successful, or another return code if not.
305 */
306static ssize_t ashmem_read(struct file *file, char __user *buf,
307 size_t len, loff_t *pos)
308{ 298{
309 struct ashmem_area *asma = file->private_data; 299 struct ashmem_area *asma = iocb->ki_filp->private_data;
310 int ret = 0; 300 int ret = 0;
311 301
312 mutex_lock(&ashmem_mutex); 302 mutex_lock(&ashmem_mutex);
@@ -320,20 +310,17 @@ static ssize_t ashmem_read(struct file *file, char __user *buf,
320 goto out_unlock; 310 goto out_unlock;
321 } 311 }
322 312
323 mutex_unlock(&ashmem_mutex);
324
325 /* 313 /*
326 * asma and asma->file are used outside the lock here. We assume 314 * asma and asma->file are used outside the lock here. We assume
327 * once asma->file is set it will never be changed, and will not 315 * once asma->file is set it will never be changed, and will not
328 * be destroyed until all references to the file are dropped and 316 * be destroyed until all references to the file are dropped and
329 * ashmem_release is called. 317 * ashmem_release is called.
330 */ 318 */
331 ret = __vfs_read(asma->file, buf, len, pos); 319 mutex_unlock(&ashmem_mutex);
332 if (ret >= 0) 320 ret = vfs_iter_read(asma->file, iter, &iocb->ki_pos, 0);
333 /** Update backing file pos, since f_ops->read() doesn't */ 321 mutex_lock(&ashmem_mutex);
334 asma->file->f_pos = *pos; 322 if (ret > 0)
335 return ret; 323 asma->file->f_pos = iocb->ki_pos;
336
337out_unlock: 324out_unlock:
338 mutex_unlock(&ashmem_mutex); 325 mutex_unlock(&ashmem_mutex);
339 return ret; 326 return ret;
@@ -834,7 +821,7 @@ static const struct file_operations ashmem_fops = {
834 .owner = THIS_MODULE, 821 .owner = THIS_MODULE,
835 .open = ashmem_open, 822 .open = ashmem_open,
836 .release = ashmem_release, 823 .release = ashmem_release,
837 .read = ashmem_read, 824 .read_iter = ashmem_read_iter,
838 .llseek = ashmem_llseek, 825 .llseek = ashmem_llseek,
839 .mmap = ashmem_mmap, 826 .mmap = ashmem_mmap,
840 .unlocked_ioctl = ashmem_ioctl, 827 .unlocked_ioctl = ashmem_ioctl,
diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c
index 0d33e520f635..cc18e25103ca 100644
--- a/drivers/staging/comedi/drivers/serial2002.c
+++ b/drivers/staging/comedi/drivers/serial2002.c
@@ -106,16 +106,8 @@ static long serial2002_tty_ioctl(struct file *f, unsigned int op,
106 106
107static int serial2002_tty_write(struct file *f, unsigned char *buf, int count) 107static int serial2002_tty_write(struct file *f, unsigned char *buf, int count)
108{ 108{
109 const char __user *p = (__force const char __user *)buf; 109 loff_t pos = 0;
110 int result; 110 return kernel_write(f, buf, count, &pos);
111 loff_t offset = 0;
112 mm_segment_t oldfs;
113
114 oldfs = get_fs();
115 set_fs(KERNEL_DS);
116 result = __vfs_write(f, p, count, &offset);
117 set_fs(oldfs);
118 return result;
119} 111}
120 112
121static void serial2002_tty_read_poll_wait(struct file *f, int timeout) 113static void serial2002_tty_read_poll_wait(struct file *f, int timeout)
@@ -148,19 +140,14 @@ static int serial2002_tty_read(struct file *f, int timeout)
148{ 140{
149 unsigned char ch; 141 unsigned char ch;
150 int result; 142 int result;
143 loff_t pos = 0;
151 144
152 result = -1; 145 result = -1;
153 if (!IS_ERR(f)) { 146 if (!IS_ERR(f)) {
154 mm_segment_t oldfs;
155 char __user *p = (__force char __user *)&ch;
156 loff_t offset = 0;
157
158 oldfs = get_fs();
159 set_fs(KERNEL_DS);
160 if (f->f_op->poll) { 147 if (f->f_op->poll) {
161 serial2002_tty_read_poll_wait(f, timeout); 148 serial2002_tty_read_poll_wait(f, timeout);
162 149
163 if (__vfs_read(f, p, 1, &offset) == 1) 150 if (kernel_read(f, &ch, 1, &pos) == 1)
164 result = ch; 151 result = ch;
165 } else { 152 } else {
166 /* Device does not support poll, busy wait */ 153 /* Device does not support poll, busy wait */
@@ -171,14 +158,13 @@ static int serial2002_tty_read(struct file *f, int timeout)
171 if (retries >= timeout) 158 if (retries >= timeout)
172 break; 159 break;
173 160
174 if (__vfs_read(f, p, 1, &offset) == 1) { 161 if (kernel_read(f, &ch, 1, &pos) == 1) {
175 result = ch; 162 result = ch;
176 break; 163 break;
177 } 164 }
178 usleep_range(100, 1000); 165 usleep_range(100, 1000);
179 } 166 }
180 } 167 }
181 set_fs(oldfs);
182 } 168 }
183 return result; 169 return result;
184} 170}
diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.c b/drivers/staging/lustre/lnet/libcfs/tracefile.c
index 68f283a2744c..f916b475e767 100644
--- a/drivers/staging/lustre/lnet/libcfs/tracefile.c
+++ b/drivers/staging/lustre/lnet/libcfs/tracefile.c
@@ -731,8 +731,7 @@ int cfs_tracefile_dump_all_pages(char *filename)
731 __LASSERT_TAGE_INVARIANT(tage); 731 __LASSERT_TAGE_INVARIANT(tage);
732 732
733 buf = kmap(tage->page); 733 buf = kmap(tage->page);
734 rc = vfs_write(filp, (__force const char __user *)buf, 734 rc = kernel_write(filp, buf, tage->used, &filp->f_pos);
735 tage->used, &filp->f_pos);
736 kunmap(tage->page); 735 kunmap(tage->page);
737 736
738 if (rc != (int)tage->used) { 737 if (rc != (int)tage->used) {
@@ -976,7 +975,6 @@ static int tracefiled(void *arg)
976 struct tracefiled_ctl *tctl = arg; 975 struct tracefiled_ctl *tctl = arg;
977 struct cfs_trace_page *tage; 976 struct cfs_trace_page *tage;
978 struct cfs_trace_page *tmp; 977 struct cfs_trace_page *tmp;
979 mm_segment_t __oldfs;
980 struct file *filp; 978 struct file *filp;
981 char *buf; 979 char *buf;
982 int last_loop = 0; 980 int last_loop = 0;
@@ -1014,8 +1012,6 @@ static int tracefiled(void *arg)
1014 __LASSERT(list_empty(&pc.pc_pages)); 1012 __LASSERT(list_empty(&pc.pc_pages));
1015 goto end_loop; 1013 goto end_loop;
1016 } 1014 }
1017 __oldfs = get_fs();
1018 set_fs(get_ds());
1019 1015
1020 list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) { 1016 list_for_each_entry_safe(tage, tmp, &pc.pc_pages, linkage) {
1021 static loff_t f_pos; 1017 static loff_t f_pos;
@@ -1028,8 +1024,7 @@ static int tracefiled(void *arg)
1028 f_pos = i_size_read(file_inode(filp)); 1024 f_pos = i_size_read(file_inode(filp));
1029 1025
1030 buf = kmap(tage->page); 1026 buf = kmap(tage->page);
1031 rc = vfs_write(filp, (__force const char __user *)buf, 1027 rc = kernel_write(filp, buf, tage->used, &f_pos);
1032 tage->used, &f_pos);
1033 kunmap(tage->page); 1028 kunmap(tage->page);
1034 1029
1035 if (rc != (int)tage->used) { 1030 if (rc != (int)tage->used) {
@@ -1040,7 +1035,6 @@ static int tracefiled(void *arg)
1040 break; 1035 break;
1041 } 1036 }
1042 } 1037 }
1043 set_fs(__oldfs);
1044 1038
1045 filp_close(filp, NULL); 1039 filp_close(filp, NULL);
1046 put_pages_on_daemon_list(&pc); 1040 put_pages_on_daemon_list(&pc);
diff --git a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
index 8f0707a27a83..4f0a42633d5a 100644
--- a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
+++ b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
@@ -52,7 +52,6 @@ int libcfs_kkuc_msg_put(struct file *filp, void *payload)
52 struct kuc_hdr *kuch = (struct kuc_hdr *)payload; 52 struct kuc_hdr *kuch = (struct kuc_hdr *)payload;
53 ssize_t count = kuch->kuc_msglen; 53 ssize_t count = kuch->kuc_msglen;
54 loff_t offset = 0; 54 loff_t offset = 0;
55 mm_segment_t fs;
56 int rc = -ENXIO; 55 int rc = -ENXIO;
57 56
58 if (IS_ERR_OR_NULL(filp)) 57 if (IS_ERR_OR_NULL(filp))
@@ -63,18 +62,14 @@ int libcfs_kkuc_msg_put(struct file *filp, void *payload)
63 return rc; 62 return rc;
64 } 63 }
65 64
66 fs = get_fs();
67 set_fs(KERNEL_DS);
68 while (count > 0) { 65 while (count > 0) {
69 rc = vfs_write(filp, (void __force __user *)payload, 66 rc = kernel_write(filp, payload, count, &offset);
70 count, &offset);
71 if (rc < 0) 67 if (rc < 0)
72 break; 68 break;
73 count -= rc; 69 count -= rc;
74 payload += rc; 70 payload += rc;
75 rc = 0; 71 rc = 0;
76 } 72 }
77 set_fs(fs);
78 73
79 if (rc < 0) 74 if (rc < 0)
80 CWARN("message send failed (%d)\n", rc); 75 CWARN("message send failed (%d)\n", rc);
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
index a91b7c25ffd4..928127642574 100644
--- a/drivers/target/target_core_alua.c
+++ b/drivers/target/target_core_alua.c
@@ -896,13 +896,14 @@ static int core_alua_write_tpg_metadata(
896 u32 md_buf_len) 896 u32 md_buf_len)
897{ 897{
898 struct file *file = filp_open(path, O_RDWR | O_CREAT | O_TRUNC, 0600); 898 struct file *file = filp_open(path, O_RDWR | O_CREAT | O_TRUNC, 0600);
899 loff_t pos = 0;
899 int ret; 900 int ret;
900 901
901 if (IS_ERR(file)) { 902 if (IS_ERR(file)) {
902 pr_err("filp_open(%s) for ALUA metadata failed\n", path); 903 pr_err("filp_open(%s) for ALUA metadata failed\n", path);
903 return -ENODEV; 904 return -ENODEV;
904 } 905 }
905 ret = kernel_write(file, md_buf, md_buf_len, 0); 906 ret = kernel_write(file, md_buf, md_buf_len, &pos);
906 if (ret < 0) 907 if (ret < 0)
907 pr_err("Error writing ALUA metadata file: %s\n", path); 908 pr_err("Error writing ALUA metadata file: %s\n", path);
908 fput(file); 909 fput(file);
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
index 24cf11d9e50a..c629817a8854 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -443,7 +443,7 @@ fd_do_prot_fill(struct se_device *se_dev, sector_t lba, sector_t nolb,
443 443
444 for (prot = 0; prot < prot_length;) { 444 for (prot = 0; prot < prot_length;) {
445 sector_t len = min_t(sector_t, bufsize, prot_length - prot); 445 sector_t len = min_t(sector_t, bufsize, prot_length - prot);
446 ssize_t ret = kernel_write(prot_fd, buf, len, pos + prot); 446 ssize_t ret = kernel_write(prot_fd, buf, len, &pos);
447 447
448 if (ret != len) { 448 if (ret != len) {
449 pr_err("vfs_write to prot file failed: %zd\n", ret); 449 pr_err("vfs_write to prot file failed: %zd\n", ret);
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
index 6d5def64db61..dd2cd8048582 100644
--- a/drivers/target/target_core_pr.c
+++ b/drivers/target/target_core_pr.c
@@ -1974,6 +1974,7 @@ static int __core_scsi3_write_aptpl_to_file(
1974 char path[512]; 1974 char path[512];
1975 u32 pr_aptpl_buf_len; 1975 u32 pr_aptpl_buf_len;
1976 int ret; 1976 int ret;
1977 loff_t pos = 0;
1977 1978
1978 memset(path, 0, 512); 1979 memset(path, 0, 512);
1979 1980
@@ -1993,7 +1994,7 @@ static int __core_scsi3_write_aptpl_to_file(
1993 1994
1994 pr_aptpl_buf_len = (strlen(buf) + 1); /* Add extra for NULL */ 1995 pr_aptpl_buf_len = (strlen(buf) + 1); /* Add extra for NULL */
1995 1996
1996 ret = kernel_write(file, buf, pr_aptpl_buf_len, 0); 1997 ret = kernel_write(file, buf, pr_aptpl_buf_len, &pos);
1997 1998
1998 if (ret < 0) 1999 if (ret < 0)
1999 pr_debug("Error writing APTPL metadata file: %s\n", path); 2000 pr_debug("Error writing APTPL metadata file: %s\n", path);
diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c
index f95bddd6513f..d6bd0244b008 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -686,9 +686,8 @@ static int do_read(struct fsg_common *common)
686 686
687 /* Perform the read */ 687 /* Perform the read */
688 file_offset_tmp = file_offset; 688 file_offset_tmp = file_offset;
689 nread = vfs_read(curlun->filp, 689 nread = kernel_read(curlun->filp, bh->buf, amount,
690 (char __user *)bh->buf, 690 &file_offset_tmp);
691 amount, &file_offset_tmp);
692 VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, 691 VLDBG(curlun, "file read %u @ %llu -> %d\n", amount,
693 (unsigned long long)file_offset, (int)nread); 692 (unsigned long long)file_offset, (int)nread);
694 if (signal_pending(current)) 693 if (signal_pending(current))
@@ -883,8 +882,8 @@ static int do_write(struct fsg_common *common)
883 882
884 /* Perform the write */ 883 /* Perform the write */
885 file_offset_tmp = file_offset; 884 file_offset_tmp = file_offset;
886 nwritten = vfs_write(curlun->filp, (char __user *)bh->buf, 885 nwritten = kernel_write(curlun->filp, bh->buf, amount,
887 amount, &file_offset_tmp); 886 &file_offset_tmp);
888 VLDBG(curlun, "file write %u @ %llu -> %d\n", amount, 887 VLDBG(curlun, "file write %u @ %llu -> %d\n", amount,
889 (unsigned long long)file_offset, (int)nwritten); 888 (unsigned long long)file_offset, (int)nwritten);
890 if (signal_pending(current)) 889 if (signal_pending(current))
@@ -1021,9 +1020,8 @@ static int do_verify(struct fsg_common *common)
1021 1020
1022 /* Perform the read */ 1021 /* Perform the read */
1023 file_offset_tmp = file_offset; 1022 file_offset_tmp = file_offset;
1024 nread = vfs_read(curlun->filp, 1023 nread = kernel_read(curlun->filp, bh->buf, amount,
1025 (char __user *) bh->buf, 1024 &file_offset_tmp);
1026 amount, &file_offset_tmp);
1027 VLDBG(curlun, "file read %u @ %llu -> %d\n", amount, 1025 VLDBG(curlun, "file read %u @ %llu -> %d\n", amount,
1028 (unsigned long long) file_offset, 1026 (unsigned long long) file_offset,
1029 (int) nread); 1027 (int) nread);
@@ -2453,13 +2451,6 @@ static int fsg_main_thread(void *common_)
2453 /* Allow the thread to be frozen */ 2451 /* Allow the thread to be frozen */
2454 set_freezable(); 2452 set_freezable();
2455 2453
2456 /*
2457 * Arrange for userspace references to be interpreted as kernel
2458 * pointers. That way we can pass a kernel pointer to a routine
2459 * that expects a __user pointer and it will work okay.
2460 */
2461 set_fs(get_ds());
2462
2463 /* The main loop */ 2454 /* The main loop */
2464 while (common->state != FSG_STATE_TERMINATED) { 2455 while (common->state != FSG_STATE_TERMINATED) {
2465 if (exception_in_progress(common) || signal_pending(current)) { 2456 if (exception_in_progress(common) || signal_pending(current)) {