Commit 8a742f78 authored by Christian Gromm's avatar Christian Gromm Committed by Greg Kroah-Hartman

staging: most: fix mbo leak

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: default avatarChristian Gromm <christian.gromm@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e6d6cbe3
...@@ -237,6 +237,7 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset) ...@@ -237,6 +237,7 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset)
(!channel->dev)))) (!channel->dev))))
return -ERESTARTSYS; return -ERESTARTSYS;
} }
channel->stacked_mbo = mbo;
start_copy: start_copy:
/* make sure we don't submit to gone devices */ /* make sure we don't submit to gone devices */
...@@ -258,7 +259,6 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset) ...@@ -258,7 +259,6 @@ aim_read(struct file *filp, char __user *buf, size_t count, loff_t *offset)
if (count < mbo->processed_length) { if (count < mbo->processed_length) {
channel->mbo_offs = copied; channel->mbo_offs = copied;
channel->stacked_mbo = mbo;
} else { } else {
most_put_mbo(mbo); most_put_mbo(mbo);
channel->mbo_offs = 0; channel->mbo_offs = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment