Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

preadv/pwritev: switch compat readv/preadv/writev/pwritev from fget to fget_light

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: <linux-api@vger.kernel.org>
Cc: <linux-arch@vger.kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Gerd Hoffmann and committed by
Linus Torvalds
10c7db27 ddd9e91b

+12 -8
+12 -8
fs/compat.c
··· 1222 1222 unsigned long vlen) 1223 1223 { 1224 1224 struct file *file; 1225 + int fput_needed; 1225 1226 ssize_t ret; 1226 1227 1227 - file = fget(fd); 1228 + file = fget_light(fd, &fput_needed); 1228 1229 if (!file) 1229 1230 return -EBADF; 1230 1231 ret = compat_readv(file, vec, vlen, &file->f_pos); 1231 - fput(file); 1232 + fput_light(file, fput_needed); 1232 1233 return ret; 1233 1234 } 1234 1235 ··· 1239 1238 { 1240 1239 loff_t pos = ((loff_t)pos_high << 32) | pos_low; 1241 1240 struct file *file; 1241 + int fput_needed; 1242 1242 ssize_t ret; 1243 1243 1244 1244 if (pos < 0) 1245 1245 return -EINVAL; 1246 - file = fget(fd); 1246 + file = fget_light(fd, &fput_needed); 1247 1247 if (!file) 1248 1248 return -EBADF; 1249 1249 ret = compat_readv(file, vec, vlen, &pos); 1250 - fput(file); 1250 + fput_light(file, fput_needed); 1251 1251 return ret; 1252 1252 } 1253 1253 ··· 1279 1277 unsigned long vlen) 1280 1278 { 1281 1279 struct file *file; 1280 + int fput_needed; 1282 1281 ssize_t ret; 1283 1282 1284 - file = fget(fd); 1283 + file = fget_light(fd, &fput_needed); 1285 1284 if (!file) 1286 1285 return -EBADF; 1287 1286 ret = compat_writev(file, vec, vlen, &file->f_pos); 1288 - fput(file); 1287 + fput_light(file, fput_needed); 1289 1288 return ret; 1290 1289 } 1291 1290 ··· 1296 1293 { 1297 1294 loff_t pos = ((loff_t)pos_high << 32) | pos_low; 1298 1295 struct file *file; 1296 + int fput_needed; 1299 1297 ssize_t ret; 1300 1298 1301 1299 if (pos < 0) 1302 1300 return -EINVAL; 1303 - file = fget(fd); 1301 + file = fget_light(fd, &fput_needed); 1304 1302 if (!file) 1305 1303 return -EBADF; 1306 1304 ret = compat_writev(file, vec, vlen, &pos); 1307 - fput(file); 1305 + fput_light(file, fput_needed); 1308 1306 return ret; 1309 1307 } 1310 1308