summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManoj Prabhu B <bmanoj@codeaurora.org>2016-11-15 19:01:54 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2016-11-22 20:22:39 -0800
commita9a910d7d067292cbf321b4f3359d03c9fc2791a (patch)
treef2ea2e13122f29bf5b7d3d66ec1fe53a3b47dd25
parent9febdfdde008c8d7875b5186a4a37cb515cb924d (diff)
diag: Fix possible access to freed variable
Mdlog structure member - hdlc timer is being accessed after mdlog session is terminated. This patch prevents the access to freed variable by providing session_lock protection. Change-Id: I1701e57fb4bbb751b76a4f24dc936ac22524e26c Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
-rw-r--r--drivers/char/diag/diagfwd.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/char/diag/diagfwd.c b/drivers/char/diag/diagfwd.c
index 0111b02634c8..876b455624b2 100644
--- a/drivers/char/diag/diagfwd.c
+++ b/drivers/char/diag/diagfwd.c
@@ -1275,6 +1275,7 @@ static uint8_t hdlc_reset;
static void hdlc_reset_timer_start(struct diag_md_session_t *info)
{
+ mutex_lock(&driver->md_session_lock);
if (!hdlc_timer_in_progress) {
hdlc_timer_in_progress = 1;
if (info)
@@ -1284,6 +1285,7 @@ static void hdlc_reset_timer_start(struct diag_md_session_t *info)
mod_timer(&driver->hdlc_reset_timer,
jiffies + msecs_to_jiffies(200));
}
+ mutex_unlock(&driver->md_session_lock);
}
static void hdlc_reset_timer_func(unsigned long data)