[PATCH 06/28] staging: most: fix mbo leak

Christian Gromm christian.gromm at microchip.com
Tue Dec 22 09:52:47 UTC 2015


This patch fixes a potential MBO leak in case function aim_read()
exits right after the MBO has been fetched from kfifo and before
it has been saved to the variable stacked_mbo.

Signed-off-by: Christian Gromm <christian.gromm at microchip.com>
---
This patch has been resent on behalf of Greg Kroah-Hartman <gregkh at linuxfoundation.org>

 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 6ee4eb2..86194ce 100644
--- a/drivers/staging/most/aim-cdev/cdev.c
+++ b/drivers/staging/most/aim-cdev/cdev.c
@@ -237,6 +237,7 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset)
 					      (!channel->dev))))
 			return -ERESTARTSYS;
 	}
+	channel->stacked_mbo = mbo;
 
 start_copy:
 	/* make sure we don't submit to gone devices */
@@ -258,7 +259,6 @@ start_copy:
 
 	if (count < mbo->processed_length) {
 		channel->mbo_offs = copied;
-		channel->stacked_mbo = mbo;
 	} else {
 		most_put_mbo(mbo);
 		channel->mbo_offs = 0;
-- 
1.7.9.5



More information about the devel mailing list