diff options
| -rw-r--r-- | fs/fat/dir.c | 20 | ||||
| -rw-r--r-- | fs/vfat/namei.c | 10 |
2 files changed, 14 insertions, 16 deletions
diff --git a/fs/fat/dir.c b/fs/fat/dir.c index 7b62ffb663f6..486725ee99ae 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c | |||
| @@ -247,7 +247,7 @@ static int fat_parse_long(struct inode *dir, loff_t *pos, | |||
| 247 | unsigned char id, slot, slots, alias_checksum; | 247 | unsigned char id, slot, slots, alias_checksum; |
| 248 | 248 | ||
| 249 | if (!*unicode) { | 249 | if (!*unicode) { |
| 250 | *unicode = (wchar_t *)__get_free_page(GFP_KERNEL); | 250 | *unicode = __getname(); |
| 251 | if (!*unicode) { | 251 | if (!*unicode) { |
| 252 | brelse(*bh); | 252 | brelse(*bh); |
| 253 | return -ENOMEM; | 253 | return -ENOMEM; |
| @@ -327,7 +327,7 @@ int fat_search_long(struct inode *inode, const unsigned char *name, | |||
| 327 | loff_t cpos = 0; | 327 | loff_t cpos = 0; |
| 328 | int chl, i, j, last_u, err; | 328 | int chl, i, j, last_u, err; |
| 329 | 329 | ||
| 330 | bufname = (unsigned char*)__get_free_page(GFP_KERNEL); | 330 | bufname = __getname(); |
| 331 | if (!bufname) | 331 | if (!bufname) |
| 332 | return -ENOMEM; | 332 | return -ENOMEM; |
| 333 | 333 | ||
| @@ -396,8 +396,8 @@ parse_record: | |||
| 396 | 396 | ||
| 397 | bufuname[last_u] = 0x0000; | 397 | bufuname[last_u] = 0x0000; |
| 398 | xlate_len = utf8 | 398 | xlate_len = utf8 |
| 399 | ?utf8_wcstombs(bufname, bufuname, PAGE_SIZE) | 399 | ?utf8_wcstombs(bufname, bufuname, PATH_MAX) |
| 400 | :uni16_to_x8(bufname, bufuname, PAGE_SIZE, uni_xlate, nls_io); | 400 | :uni16_to_x8(bufname, bufuname, PATH_MAX, uni_xlate, nls_io); |
| 401 | if (xlate_len == name_len) | 401 | if (xlate_len == name_len) |
| 402 | if ((!anycase && !memcmp(name, bufname, xlate_len)) || | 402 | if ((!anycase && !memcmp(name, bufname, xlate_len)) || |
| 403 | (anycase && !nls_strnicmp(nls_io, name, bufname, | 403 | (anycase && !nls_strnicmp(nls_io, name, bufname, |
| @@ -406,8 +406,8 @@ parse_record: | |||
| 406 | 406 | ||
| 407 | if (nr_slots) { | 407 | if (nr_slots) { |
| 408 | xlate_len = utf8 | 408 | xlate_len = utf8 |
| 409 | ?utf8_wcstombs(bufname, unicode, PAGE_SIZE) | 409 | ?utf8_wcstombs(bufname, unicode, PATH_MAX) |
| 410 | :uni16_to_x8(bufname, unicode, PAGE_SIZE, uni_xlate, nls_io); | 410 | :uni16_to_x8(bufname, unicode, PATH_MAX, uni_xlate, nls_io); |
| 411 | if (xlate_len != name_len) | 411 | if (xlate_len != name_len) |
| 412 | continue; | 412 | continue; |
| 413 | if ((!anycase && !memcmp(name, bufname, xlate_len)) || | 413 | if ((!anycase && !memcmp(name, bufname, xlate_len)) || |
| @@ -427,9 +427,9 @@ Found: | |||
| 427 | err = 0; | 427 | err = 0; |
| 428 | EODir: | 428 | EODir: |
| 429 | if (bufname) | 429 | if (bufname) |
| 430 | free_page((unsigned long)bufname); | 430 | __putname(bufname); |
| 431 | if (unicode) | 431 | if (unicode) |
| 432 | free_page((unsigned long)unicode); | 432 | __putname(unicode); |
| 433 | 433 | ||
| 434 | return err; | 434 | return err; |
| 435 | } | 435 | } |
| @@ -619,7 +619,7 @@ parse_record: | |||
| 619 | /* convert the unicode long name. 261 is maximum size | 619 | /* convert the unicode long name. 261 is maximum size |
| 620 | * of unicode buffer. (13 * slots + nul) */ | 620 | * of unicode buffer. (13 * slots + nul) */ |
| 621 | void *longname = unicode + 261; | 621 | void *longname = unicode + 261; |
| 622 | int buf_size = PAGE_SIZE - (261 * sizeof(unicode[0])); | 622 | int buf_size = PATH_MAX - (261 * sizeof(unicode[0])); |
| 623 | int long_len = utf8 | 623 | int long_len = utf8 |
| 624 | ? utf8_wcstombs(longname, unicode, buf_size) | 624 | ? utf8_wcstombs(longname, unicode, buf_size) |
| 625 | : uni16_to_x8(longname, unicode, buf_size, uni_xlate, nls_io); | 625 | : uni16_to_x8(longname, unicode, buf_size, uni_xlate, nls_io); |
| @@ -652,7 +652,7 @@ EODir: | |||
| 652 | FillFailed: | 652 | FillFailed: |
| 653 | brelse(bh); | 653 | brelse(bh); |
| 654 | if (unicode) | 654 | if (unicode) |
| 655 | free_page((unsigned long)unicode); | 655 | __putname(unicode); |
| 656 | out: | 656 | out: |
| 657 | unlock_kernel(); | 657 | unlock_kernel(); |
| 658 | return ret; | 658 | return ret; |
diff --git a/fs/vfat/namei.c b/fs/vfat/namei.c index ab4f3da770f0..5b66162d0747 100644 --- a/fs/vfat/namei.c +++ b/fs/vfat/namei.c | |||
| @@ -472,7 +472,7 @@ xlate_to_uni(const unsigned char *name, int len, unsigned char *outname, | |||
| 472 | if (utf8) { | 472 | if (utf8) { |
| 473 | int name_len = strlen(name); | 473 | int name_len = strlen(name); |
| 474 | 474 | ||
| 475 | *outlen = utf8_mbstowcs((wchar_t *)outname, name, PAGE_SIZE); | 475 | *outlen = utf8_mbstowcs((wchar_t *)outname, name, PATH_MAX); |
| 476 | 476 | ||
| 477 | /* | 477 | /* |
| 478 | * We stripped '.'s before and set len appropriately, | 478 | * We stripped '.'s before and set len appropriately, |
| @@ -565,7 +565,6 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name, | |||
| 565 | struct fat_mount_options *opts = &sbi->options; | 565 | struct fat_mount_options *opts = &sbi->options; |
| 566 | struct msdos_dir_slot *ps; | 566 | struct msdos_dir_slot *ps; |
| 567 | struct msdos_dir_entry *de; | 567 | struct msdos_dir_entry *de; |
| 568 | unsigned long page; | ||
| 569 | unsigned char cksum, lcase; | 568 | unsigned char cksum, lcase; |
| 570 | unsigned char msdos_name[MSDOS_NAME]; | 569 | unsigned char msdos_name[MSDOS_NAME]; |
| 571 | wchar_t *uname; | 570 | wchar_t *uname; |
| @@ -575,11 +574,10 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name, | |||
| 575 | 574 | ||
| 576 | *nr_slots = 0; | 575 | *nr_slots = 0; |
| 577 | 576 | ||
| 578 | page = __get_free_page(GFP_KERNEL); | 577 | uname = __getname(); |
| 579 | if (!page) | 578 | if (!uname) |
| 580 | return -ENOMEM; | 579 | return -ENOMEM; |
| 581 | 580 | ||
| 582 | uname = (wchar_t *)page; | ||
| 583 | err = xlate_to_uni(name, len, (unsigned char *)uname, &ulen, &usize, | 581 | err = xlate_to_uni(name, len, (unsigned char *)uname, &ulen, &usize, |
| 584 | opts->unicode_xlate, opts->utf8, sbi->nls_io); | 582 | opts->unicode_xlate, opts->utf8, sbi->nls_io); |
| 585 | if (err) | 583 | if (err) |
| @@ -631,7 +629,7 @@ shortname: | |||
| 631 | de->starthi = cpu_to_le16(cluster >> 16); | 629 | de->starthi = cpu_to_le16(cluster >> 16); |
| 632 | de->size = 0; | 630 | de->size = 0; |
| 633 | out_free: | 631 | out_free: |
| 634 | free_page(page); | 632 | __putname(uname); |
| 635 | return err; | 633 | return err; |
| 636 | } | 634 | } |
| 637 | 635 | ||
