From: Christian Gromm Date: Tue, 28 Jul 2015 15:16:10 +0000 (+0200) Subject: Staging: most: fix dereferencing freed memory X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2e4c30458e31e5f6487d1393254f2ab347cfb02c;p=linux-beck.git Staging: most: fix dereferencing freed memory This patch fixes the dereferencing of freed memory. Reported-by: Dan Carpenter Signed-off-by: Christian Gromm Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c index d5fb4a0e0818..cfc32dff6512 100644 --- a/drivers/staging/most/aim-cdev/cdev.c +++ b/drivers/staging/most/aim-cdev/cdev.c @@ -124,9 +124,9 @@ static int aim_close(struct inode *inode, struct file *filp) cdev_del(&channel->cdev); kfifo_free(&channel->fifo); list_del(&channel->list); - kfree(channel); ida_simple_remove(&minor_id, MINOR(channel->devno)); wake_up_interruptible(&channel->wq); + kfree(channel); return 0; } mutex_unlock(&channel->io_mutex);