xattr.c (f419a2e3b64def707e1384ee38abb77f99af5f6d) | xattr.c (2d8f30380ab8c706f4e0a8f1aaa22b5886e9ac8a) |
---|---|
1/* 2 File: fs/xattr.c 3 4 Extended attribute handling. 5 6 Copyright (C) 2001 by Andreas Gruenbacher <a.gruenbacher@computer.org> 7 Copyright (C) 2001 SGI - Silicon Graphics, Inc <linux-xfs@oss.sgi.com> 8 Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com> --- 238 unchanged lines hidden (view full) --- 247 } 248 249 error = vfs_setxattr(d, kname, kvalue, size, flags); 250 kfree(kvalue); 251 return error; 252} 253 254asmlinkage long | 1/* 2 File: fs/xattr.c 3 4 Extended attribute handling. 5 6 Copyright (C) 2001 by Andreas Gruenbacher <a.gruenbacher@computer.org> 7 Copyright (C) 2001 SGI - Silicon Graphics, Inc <linux-xfs@oss.sgi.com> 8 Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com> --- 238 unchanged lines hidden (view full) --- 247 } 248 249 error = vfs_setxattr(d, kname, kvalue, size, flags); 250 kfree(kvalue); 251 return error; 252} 253 254asmlinkage long |
255sys_setxattr(const char __user *path, const char __user *name, | 255sys_setxattr(const char __user *pathname, const char __user *name, |
256 const void __user *value, size_t size, int flags) 257{ | 256 const void __user *value, size_t size, int flags) 257{ |
258 struct nameidata nd; | 258 struct path path; |
259 int error; 260 | 259 int error; 260 |
261 error = user_path_walk(path, &nd); | 261 error = user_path(pathname, &path); |
262 if (error) 263 return error; | 262 if (error) 263 return error; |
264 error = mnt_want_write(nd.path.mnt); | 264 error = mnt_want_write(path.mnt); |
265 if (!error) { | 265 if (!error) { |
266 error = setxattr(nd.path.dentry, name, value, size, flags); 267 mnt_drop_write(nd.path.mnt); | 266 error = setxattr(path.dentry, name, value, size, flags); 267 mnt_drop_write(path.mnt); |
268 } | 268 } |
269 path_put(&nd.path); | 269 path_put(&path); |
270 return error; 271} 272 273asmlinkage long | 270 return error; 271} 272 273asmlinkage long |
274sys_lsetxattr(const char __user *path, const char __user *name, | 274sys_lsetxattr(const char __user *pathname, const char __user *name, |
275 const void __user *value, size_t size, int flags) 276{ | 275 const void __user *value, size_t size, int flags) 276{ |
277 struct nameidata nd; | 277 struct path path; |
278 int error; 279 | 278 int error; 279 |
280 error = user_path_walk_link(path, &nd); | 280 error = user_lpath(pathname, &path); |
281 if (error) 282 return error; | 281 if (error) 282 return error; |
283 error = mnt_want_write(nd.path.mnt); | 283 error = mnt_want_write(path.mnt); |
284 if (!error) { | 284 if (!error) { |
285 error = setxattr(nd.path.dentry, name, value, size, flags); 286 mnt_drop_write(nd.path.mnt); | 285 error = setxattr(path.dentry, name, value, size, flags); 286 mnt_drop_write(path.mnt); |
287 } | 287 } |
288 path_put(&nd.path); | 288 path_put(&path); |
289 return error; 290} 291 292asmlinkage long 293sys_fsetxattr(int fd, const char __user *name, const void __user *value, 294 size_t size, int flags) 295{ 296 struct file *f; --- 48 unchanged lines hidden (view full) --- 345 than XATTR_SIZE_MAX bytes. Not possible. */ 346 error = -E2BIG; 347 } 348 kfree(kvalue); 349 return error; 350} 351 352asmlinkage ssize_t | 289 return error; 290} 291 292asmlinkage long 293sys_fsetxattr(int fd, const char __user *name, const void __user *value, 294 size_t size, int flags) 295{ 296 struct file *f; --- 48 unchanged lines hidden (view full) --- 345 than XATTR_SIZE_MAX bytes. Not possible. */ 346 error = -E2BIG; 347 } 348 kfree(kvalue); 349 return error; 350} 351 352asmlinkage ssize_t |
353sys_getxattr(const char __user *path, const char __user *name, | 353sys_getxattr(const char __user *pathname, const char __user *name, |
354 void __user *value, size_t size) 355{ | 354 void __user *value, size_t size) 355{ |
356 struct nameidata nd; | 356 struct path path; |
357 ssize_t error; 358 | 357 ssize_t error; 358 |
359 error = user_path_walk(path, &nd); | 359 error = user_path(pathname, &path); |
360 if (error) 361 return error; | 360 if (error) 361 return error; |
362 error = getxattr(nd.path.dentry, name, value, size); 363 path_put(&nd.path); | 362 error = getxattr(path.dentry, name, value, size); 363 path_put(&path); |
364 return error; 365} 366 367asmlinkage ssize_t | 364 return error; 365} 366 367asmlinkage ssize_t |
368sys_lgetxattr(const char __user *path, const char __user *name, void __user *value, | 368sys_lgetxattr(const char __user *pathname, const char __user *name, void __user *value, |
369 size_t size) 370{ | 369 size_t size) 370{ |
371 struct nameidata nd; | 371 struct path path; |
372 ssize_t error; 373 | 372 ssize_t error; 373 |
374 error = user_path_walk_link(path, &nd); | 374 error = user_lpath(pathname, &path); |
375 if (error) 376 return error; | 375 if (error) 376 return error; |
377 error = getxattr(nd.path.dentry, name, value, size); 378 path_put(&nd.path); | 377 error = getxattr(path.dentry, name, value, size); 378 path_put(&path); |
379 return error; 380} 381 382asmlinkage ssize_t 383sys_fgetxattr(int fd, const char __user *name, void __user *value, size_t size) 384{ 385 struct file *f; 386 ssize_t error = -EBADF; --- 33 unchanged lines hidden (view full) --- 420 than XATTR_LIST_MAX bytes. Not possible. */ 421 error = -E2BIG; 422 } 423 kfree(klist); 424 return error; 425} 426 427asmlinkage ssize_t | 379 return error; 380} 381 382asmlinkage ssize_t 383sys_fgetxattr(int fd, const char __user *name, void __user *value, size_t size) 384{ 385 struct file *f; 386 ssize_t error = -EBADF; --- 33 unchanged lines hidden (view full) --- 420 than XATTR_LIST_MAX bytes. Not possible. */ 421 error = -E2BIG; 422 } 423 kfree(klist); 424 return error; 425} 426 427asmlinkage ssize_t |
428sys_listxattr(const char __user *path, char __user *list, size_t size) | 428sys_listxattr(const char __user *pathname, char __user *list, size_t size) |
429{ | 429{ |
430 struct nameidata nd; | 430 struct path path; |
431 ssize_t error; 432 | 431 ssize_t error; 432 |
433 error = user_path_walk(path, &nd); | 433 error = user_path(pathname, &path); |
434 if (error) 435 return error; | 434 if (error) 435 return error; |
436 error = listxattr(nd.path.dentry, list, size); 437 path_put(&nd.path); | 436 error = listxattr(path.dentry, list, size); 437 path_put(&path); |
438 return error; 439} 440 441asmlinkage ssize_t | 438 return error; 439} 440 441asmlinkage ssize_t |
442sys_llistxattr(const char __user *path, char __user *list, size_t size) | 442sys_llistxattr(const char __user *pathname, char __user *list, size_t size) |
443{ | 443{ |
444 struct nameidata nd; | 444 struct path path; |
445 ssize_t error; 446 | 445 ssize_t error; 446 |
447 error = user_path_walk_link(path, &nd); | 447 error = user_lpath(pathname, &path); |
448 if (error) 449 return error; | 448 if (error) 449 return error; |
450 error = listxattr(nd.path.dentry, list, size); 451 path_put(&nd.path); | 450 error = listxattr(path.dentry, list, size); 451 path_put(&path); |
452 return error; 453} 454 455asmlinkage ssize_t 456sys_flistxattr(int fd, char __user *list, size_t size) 457{ 458 struct file *f; 459 ssize_t error = -EBADF; --- 21 unchanged lines hidden (view full) --- 481 error = -ERANGE; 482 if (error < 0) 483 return error; 484 485 return vfs_removexattr(d, kname); 486} 487 488asmlinkage long | 452 return error; 453} 454 455asmlinkage ssize_t 456sys_flistxattr(int fd, char __user *list, size_t size) 457{ 458 struct file *f; 459 ssize_t error = -EBADF; --- 21 unchanged lines hidden (view full) --- 481 error = -ERANGE; 482 if (error < 0) 483 return error; 484 485 return vfs_removexattr(d, kname); 486} 487 488asmlinkage long |
489sys_removexattr(const char __user *path, const char __user *name) | 489sys_removexattr(const char __user *pathname, const char __user *name) |
490{ | 490{ |
491 struct nameidata nd; | 491 struct path path; |
492 int error; 493 | 492 int error; 493 |
494 error = user_path_walk(path, &nd); | 494 error = user_path(pathname, &path); |
495 if (error) 496 return error; | 495 if (error) 496 return error; |
497 error = mnt_want_write(nd.path.mnt); | 497 error = mnt_want_write(path.mnt); |
498 if (!error) { | 498 if (!error) { |
499 error = removexattr(nd.path.dentry, name); 500 mnt_drop_write(nd.path.mnt); | 499 error = removexattr(path.dentry, name); 500 mnt_drop_write(path.mnt); |
501 } | 501 } |
502 path_put(&nd.path); | 502 path_put(&path); |
503 return error; 504} 505 506asmlinkage long | 503 return error; 504} 505 506asmlinkage long |
507sys_lremovexattr(const char __user *path, const char __user *name) | 507sys_lremovexattr(const char __user *pathname, const char __user *name) |
508{ | 508{ |
509 struct nameidata nd; | 509 struct path path; |
510 int error; 511 | 510 int error; 511 |
512 error = user_path_walk_link(path, &nd); | 512 error = user_lpath(pathname, &path); |
513 if (error) 514 return error; | 513 if (error) 514 return error; |
515 error = mnt_want_write(nd.path.mnt); | 515 error = mnt_want_write(path.mnt); |
516 if (!error) { | 516 if (!error) { |
517 error = removexattr(nd.path.dentry, name); 518 mnt_drop_write(nd.path.mnt); | 517 error = removexattr(path.dentry, name); 518 mnt_drop_write(path.mnt); |
519 } | 519 } |
520 path_put(&nd.path); | 520 path_put(&path); |
521 return error; 522} 523 524asmlinkage long 525sys_fremovexattr(int fd, const char __user *name) 526{ 527 struct file *f; 528 struct dentry *dentry; --- 143 unchanged lines hidden --- | 521 return error; 522} 523 524asmlinkage long 525sys_fremovexattr(int fd, const char __user *name) 526{ 527 struct file *f; 528 struct dentry *dentry; --- 143 unchanged lines hidden --- |