Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1406263 > unrolled thread

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

Started bySudeep Holla <sudeep.holla@arm.com>
First post2016-05-24 18:20 +0200
Last post2016-05-24 18:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] mailbox: mailbox-test: set tdev->signal to NULL after freeing Sudeep Holla <sudeep.holla@arm.com> - 2016-05-24 18:20 +0200

#1406263 — [PATCH] mailbox: mailbox-test: set tdev->signal to NULL after freeing

FromSudeep Holla <sudeep.holla@arm.com>
Date2016-05-24 18:20 +0200
Subject[PATCH] mailbox: mailbox-test: set tdev->signal to NULL after freeing
Message-ID<rCndL-5Ak-9@gated-at.bofh.it>
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.

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Jassi Brar <jassisinghbrar@gmail.com>
Fixes: d1c2f87c9a8f ("mailbox: mailbox-test: Prevent memory leak")
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/mailbox/mailbox-test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c
index 58d04726cdd7..9ca96e9db6bf 100644
--- a/drivers/mailbox/mailbox-test.c
+++ b/drivers/mailbox/mailbox-test.c
@@ -133,6 +133,7 @@ static ssize_t mbox_test_message_write(struct file *filp,
 out:
 	kfree(tdev->signal);
 	kfree(tdev->message);
+	tdev->signal = NULL;

 	return ret < 0 ? ret : count;
 }
--
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web