summaryrefslogtreecommitdiffstats
path: root/fs/cachefiles/xattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cachefiles/xattr.c')
-rw-r--r--fs/cachefiles/xattr.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/fs/cachefiles/xattr.c b/fs/cachefiles/xattr.c
index 34c88b83e39f..12b0eef84183 100644
--- a/fs/cachefiles/xattr.c
+++ b/fs/cachefiles/xattr.c
@@ -162,8 +162,9 @@ int cachefiles_update_object_xattr(struct cachefiles_object *object,
162int cachefiles_check_auxdata(struct cachefiles_object *object) 162int cachefiles_check_auxdata(struct cachefiles_object *object)
163{ 163{
164 struct cachefiles_xattr *auxbuf; 164 struct cachefiles_xattr *auxbuf;
165 enum fscache_checkaux validity;
165 struct dentry *dentry = object->dentry; 166 struct dentry *dentry = object->dentry;
166 unsigned int dlen; 167 ssize_t xlen;
167 int ret; 168 int ret;
168 169
169 ASSERT(dentry); 170 ASSERT(dentry);
@@ -174,22 +175,22 @@ int cachefiles_check_auxdata(struct cachefiles_object *object)
174 if (!auxbuf) 175 if (!auxbuf)
175 return -ENOMEM; 176 return -ENOMEM;
176 177
177 auxbuf->len = vfs_getxattr(dentry, cachefiles_xattr_cache, 178 xlen = vfs_getxattr(dentry, cachefiles_xattr_cache,
178 &auxbuf->type, 512 + 1); 179 &auxbuf->type, 512 + 1);
179 if (auxbuf->len < 1) 180 ret = -ESTALE;
180 return -ESTALE; 181 if (xlen < 1 ||
181 182 auxbuf->type != object->fscache.cookie->def->type)
182 if (auxbuf->type != object->fscache.cookie->def->type) 183 goto error;
183 return -ESTALE;
184 184
185 dlen = auxbuf->len - 1; 185 xlen--;
186 ret = fscache_check_aux(&object->fscache, &auxbuf->data, dlen); 186 validity = fscache_check_aux(&object->fscache, &auxbuf->data, xlen);
187 if (validity != FSCACHE_CHECKAUX_OKAY)
188 goto error;
187 189
190 ret = 0;
191error:
188 kfree(auxbuf); 192 kfree(auxbuf);
189 if (ret != FSCACHE_CHECKAUX_OKAY) 193 return ret;
190 return -ESTALE;
191
192 return 0;
193} 194}
194 195
195/* 196/*