linux-mips
[Top] [All Lists]

[Memory leak]: memory leak in apply_r_mips_lo16_rel

To: ralf@linux-mips.org
Subject: [Memory leak]: memory leak in apply_r_mips_lo16_rel
From: Akhilesh Kumar <akhilesh.lxr@gmail.com>
Date: Sat, 4 Aug 2012 03:59:50 +0530
Cc: paul.gortmaker@windriver.com, linux-mips@linux-mips.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=hEa2fdtreexOJGzcnSPEwr5bvMhPe4q6tybK0MLqOZ8=; b=TrmAIoXHjWns3jlGA8b1VKkw+j33n7dgcfonzIpBDqWnp6luYNkVIH/D2oDurl/0Dp rDXHdQX4DNXVkUaL77IkNs0L7RWa6+3jqxyL9vyKfnyERWW9MfYuCIEbbvhL8g+WqkHq Shr49Rms7qqGlmBJ3ZlVJHZ0KNbJ3Szs8MuVVI5mmW/jmSb2tlW1yMXxeZkuvGkkmKWc uh3ScHmXQGKfuzwYPSbKkrKyBLvO9dIE9/+YFkYF0G4wbUmQjPZQ/A7WBQcRiOmM/6ms gdv+RAk7z0VT2Z1rj46C4MsXtJ48ChhBncMHhzljDsUeZUCj1Scpn44ON7mkfovijJUU O7NA==
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Sender: linux-mips-bounce@linux-mips.org
Hi Ralf,

I found some memory leak in
arch/mips/kernel/module.c file 

Please review below patch and share your review comments,

Thanks,
Akhilesh 


From 77b8cae374a95000a1fd7e75bcda6694b8180fe9 Mon Sep 17 00:00:00 2001
From: Akhilesh Kumar <akhilesh.lxr@gmail.com>
Date: Sat, 4 Aug 2012 03:34:06 +0530
Subject:  [Memory leak]: memory leak in  apply_r_mips_lo16_rel
 module.c

if (v != l->value)
             goto out_danger ;
out_danger:
  pr_err("module %s: dangerous R_MIPS_LO16 REL relocation\n", me->name);
  return -ENOEXEC;

in case goto_out_danger kfree(l) is missing

Signed-off-by: Akhilesh Kumar <akhilesh.lxr@gmail.com>
---
 arch/mips/kernel/module.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/mips/kernel/module.c b/arch/mips/kernel/module.c
index a5066b1..b1dce44 100644
--- a/arch/mips/kernel/module.c
+++ b/arch/mips/kernel/module.c
@@ -202,7 +202,7 @@ static int apply_r_mips_lo16_rel(struct module *me, u32 *location, Elf_Addr v)
 
 out_danger:
  pr_err("module %s: dangerous R_MIPS_LO16 REL relocation\n", me->name);
-
+ kfree(l);
  return -ENOEXEC;
 }
 
-- 
1.7.8.4
<Prev in Thread] Current Thread [Next in Thread>