diff options
Diffstat (limited to 'fs/ext4/symlink.c')
-rw-r--r-- | fs/ext4/symlink.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/ext4/symlink.c b/fs/ext4/symlink.c index 4264fb1e341a..afec475aaf5c 100644 --- a/fs/ext4/symlink.c +++ b/fs/ext4/symlink.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include "xattr.h" | 23 | #include "xattr.h" |
24 | 24 | ||
25 | #ifdef CONFIG_EXT4_FS_ENCRYPTION | 25 | #ifdef CONFIG_EXT4_FS_ENCRYPTION |
26 | static void *ext4_follow_link(struct dentry *dentry, struct nameidata *nd) | 26 | static const char *ext4_follow_link(struct dentry *dentry, void **cookie, struct nameidata *nd) |
27 | { | 27 | { |
28 | struct page *cpage = NULL; | 28 | struct page *cpage = NULL; |
29 | char *caddr, *paddr = NULL; | 29 | char *caddr, *paddr = NULL; |
@@ -37,7 +37,7 @@ static void *ext4_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
37 | 37 | ||
38 | ctx = ext4_get_fname_crypto_ctx(inode, inode->i_sb->s_blocksize); | 38 | ctx = ext4_get_fname_crypto_ctx(inode, inode->i_sb->s_blocksize); |
39 | if (IS_ERR(ctx)) | 39 | if (IS_ERR(ctx)) |
40 | return ctx; | 40 | return ERR_CAST(ctx); |
41 | 41 | ||
42 | if (ext4_inode_is_fast_symlink(inode)) { | 42 | if (ext4_inode_is_fast_symlink(inode)) { |
43 | caddr = (char *) EXT4_I(inode)->i_data; | 43 | caddr = (char *) EXT4_I(inode)->i_data; |
@@ -46,7 +46,7 @@ static void *ext4_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
46 | cpage = read_mapping_page(inode->i_mapping, 0, NULL); | 46 | cpage = read_mapping_page(inode->i_mapping, 0, NULL); |
47 | if (IS_ERR(cpage)) { | 47 | if (IS_ERR(cpage)) { |
48 | ext4_put_fname_crypto_ctx(&ctx); | 48 | ext4_put_fname_crypto_ctx(&ctx); |
49 | return cpage; | 49 | return ERR_CAST(cpage); |
50 | } | 50 | } |
51 | caddr = kmap(cpage); | 51 | caddr = kmap(cpage); |
52 | caddr[size] = 0; | 52 | caddr[size] = 0; |
@@ -77,13 +77,12 @@ static void *ext4_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
77 | /* Null-terminate the name */ | 77 | /* Null-terminate the name */ |
78 | if (res <= plen) | 78 | if (res <= plen) |
79 | paddr[res] = '\0'; | 79 | paddr[res] = '\0'; |
80 | nd_set_link(nd, paddr); | ||
81 | ext4_put_fname_crypto_ctx(&ctx); | 80 | ext4_put_fname_crypto_ctx(&ctx); |
82 | if (cpage) { | 81 | if (cpage) { |
83 | kunmap(cpage); | 82 | kunmap(cpage); |
84 | page_cache_release(cpage); | 83 | page_cache_release(cpage); |
85 | } | 84 | } |
86 | return NULL; | 85 | return *cookie = paddr; |
87 | errout: | 86 | errout: |
88 | ext4_put_fname_crypto_ctx(&ctx); | 87 | ext4_put_fname_crypto_ctx(&ctx); |
89 | if (cpage) { | 88 | if (cpage) { |