Skip to content

Commit

Permalink
dlm: add missing kfrees
Browse files Browse the repository at this point in the history
A couple of unlikely error conditions were missing a kfree on the error
exit path.

Reported-by: Juha Leppanen <[email protected]>
Signed-off-by: David Teigland <[email protected]>
  • Loading branch information
teigland committed Aug 13, 2008
1 parent 30a2f3c commit cb980d9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions fs/dlm/user.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,10 @@ static ssize_t device_write(struct file *file, const char __user *buf,
k32buf = (struct dlm_write_request32 *)kbuf;
kbuf = kmalloc(count + 1 + (sizeof(struct dlm_write_request) -
sizeof(struct dlm_write_request32)), GFP_KERNEL);
if (!kbuf)
if (!kbuf) {
kfree(k32buf);
return -ENOMEM;
}

if (proc)
set_bit(DLM_PROC_FLAGS_COMPAT, &proc->flags);
Expand All @@ -539,8 +541,10 @@ static ssize_t device_write(struct file *file, const char __user *buf,

/* do we really need this? can a write happen after a close? */
if ((kbuf->cmd == DLM_USER_LOCK || kbuf->cmd == DLM_USER_UNLOCK) &&
(proc && test_bit(DLM_PROC_FLAGS_CLOSING, &proc->flags)))
return -EINVAL;
(proc && test_bit(DLM_PROC_FLAGS_CLOSING, &proc->flags))) {
error = -EINVAL;
goto out_free;
}

sigfillset(&allsigs);
sigprocmask(SIG_BLOCK, &allsigs, &tmpsig);
Expand Down

0 comments on commit cb980d9

Please sign in to comment.