dlm: add missing kfrees
A couple of unlikely error conditions were missing a kfree on the error exit path. Reported-by: Juha Leppanen <juha_motorsportcom@luukku.com> Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
parent
30a2f3c60a
commit
cb980d9a3e
1 changed files with 7 additions and 3 deletions
|
@ -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);
|
||||
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue