diff options
Diffstat (limited to 'fs/configfs/file.c')
-rw-r--r-- | fs/configfs/file.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/configfs/file.c b/fs/configfs/file.c index e6d5754a715e..cf33fac68c84 100644 --- a/fs/configfs/file.c +++ b/fs/configfs/file.c | |||
@@ -275,13 +275,14 @@ static int check_perm(struct inode * inode, struct file * file) | |||
275 | * it in file->private_data for easy access. | 275 | * it in file->private_data for easy access. |
276 | */ | 276 | */ |
277 | buffer = kzalloc(sizeof(struct configfs_buffer),GFP_KERNEL); | 277 | buffer = kzalloc(sizeof(struct configfs_buffer),GFP_KERNEL); |
278 | if (buffer) { | 278 | if (!buffer) { |
279 | init_MUTEX(&buffer->sem); | ||
280 | buffer->needs_read_fill = 1; | ||
281 | buffer->ops = ops; | ||
282 | file->private_data = buffer; | ||
283 | } else | ||
284 | error = -ENOMEM; | 279 | error = -ENOMEM; |
280 | goto Enomem; | ||
281 | } | ||
282 | init_MUTEX(&buffer->sem); | ||
283 | buffer->needs_read_fill = 1; | ||
284 | buffer->ops = ops; | ||
285 | file->private_data = buffer; | ||
285 | goto Done; | 286 | goto Done; |
286 | 287 | ||
287 | Einval: | 288 | Einval: |
@@ -289,6 +290,7 @@ static int check_perm(struct inode * inode, struct file * file) | |||
289 | goto Done; | 290 | goto Done; |
290 | Eaccess: | 291 | Eaccess: |
291 | error = -EACCES; | 292 | error = -EACCES; |
293 | Enomem: | ||
292 | module_put(attr->ca_owner); | 294 | module_put(attr->ca_owner); |
293 | Done: | 295 | Done: |
294 | if (error && item) | 296 | if (error && item) |