Skip to content

Commit

Permalink
isdn: gigaset: use after free
Browse files Browse the repository at this point in the history
I moved the kfree(cb) below the dereferences.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Aug 8, 2010
1 parent 7e27a0a commit 8bcfbd0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/isdn/gigaset/bas-gigaset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1914,11 +1914,13 @@ static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb)
* The next command will reopen the AT channel automatically.
*/
if (cb->len == 3 && !memcmp(cb->buf, "+++", 3)) {
kfree(cb);
rc = req_submit(cs->bcs, HD_CLOSE_ATCHANNEL, 0, BAS_TIMEOUT);
if (cb->wake_tasklet)
tasklet_schedule(cb->wake_tasklet);
return rc < 0 ? rc : cb->len;
if (!rc)
rc = cb->len;
kfree(cb);
return rc;
}

spin_lock_irqsave(&cs->cmdlock, flags);
Expand Down

0 comments on commit 8bcfbd0

Please sign in to comment.