[PATCH 3/4] Staging: most: fix dereferencing freed memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fixes the dereferencing of freed memory.

Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Signed-off-by: Christian Gromm <christian.gromm@xxxxxxxxxxxxx>
---
 drivers/staging/most/aim-cdev/cdev.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c
index d5fb4a0..cfc32df 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);
-- 
1.7.9.5

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux