Commit 609442ec authored by Sudeep Holla's avatar Sudeep Holla Committed by Greg Kroah-Hartman

mailbox: mailbox-test: set tdev->signal to NULL after freeing

commit 9ef3c511 upstream.

tdev->signal is not set NULL after it's freed. This will cause random
exceptions when the stale pointer is accessed after tdev->signal is
freed. Also, since tdev->signal allocation is skipped the next time
it's written, this leads to continuous fault finally leading to the
total death of the system.

Fixes: d1c2f87c ("mailbox: mailbox-test: Prevent memory leak")
Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
Acked-by: default avatarLee Jones <lee.jones@linaro.org>
Signed-off-by: default avatarJassi Brar <jaswinder.singh@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b2c866c3
...@@ -133,6 +133,7 @@ static ssize_t mbox_test_message_write(struct file *filp, ...@@ -133,6 +133,7 @@ static ssize_t mbox_test_message_write(struct file *filp,
out: out:
kfree(tdev->signal); kfree(tdev->signal);
kfree(tdev->message); kfree(tdev->message);
tdev->signal = NULL;
return ret < 0 ? ret : count; return ret < 0 ? ret : count;
} }
......
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