[svn-commits] sruffell: linux/trunk r8460 - in /linux/trunk/drivers/dahdi: voicebus/ wctdm2...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Apr 3 12:50:30 CDT 2010


Author: sruffell
Date: Sat Apr  3 12:50:28 2010
New Revision: 8460

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8460
Log:
wcte12xp, wctdm24xxp: Close a memory leak when processing VPM commands.

Closes a memory leak when processing the VPM write commands introduced in
r8454.


Modified:
    linux/trunk/drivers/dahdi/voicebus/GpakCust.h
    linux/trunk/drivers/dahdi/wctdm24xxp/base.c
    linux/trunk/drivers/dahdi/wcte12xp/base.c

Modified: linux/trunk/drivers/dahdi/voicebus/GpakCust.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/voicebus/GpakCust.h?view=diff&rev=8460&r1=8459&r2=8460
==============================================================================
--- linux/trunk/drivers/dahdi/voicebus/GpakCust.h (original)
+++ linux/trunk/drivers/dahdi/voicebus/GpakCust.h Sat Apr  3 12:50:28 2010
@@ -149,6 +149,11 @@
 struct GpakEcanParms;
 void vpmadt032_get_default_parameters(struct GpakEcanParms *p);
 
+static inline int is_cmd_write(const struct vpmadt032_cmd *cmd)
+{
+	return (cmd->desc & __VPM150M_WR) != 0;
+}
+
 /* If there is a command ready to go to the VPMADT032, return it, otherwise NULL */
 static inline struct vpmadt032_cmd *vpmadt032_get_ready_cmd(struct vpmadt032 *vpm)
 {
@@ -161,7 +166,7 @@
 		return NULL;
 	}
 	cmd = list_entry(vpm->pending_cmds.next, struct vpmadt032_cmd, node);
-	if (cmd->desc & __VPM150M_WR)
+	if (!is_cmd_write(cmd))
 		list_move_tail(&cmd->node, &vpm->active_cmds);
 	else
 		list_del_init(&cmd->node);

Modified: linux/trunk/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=8460&r1=8459&r2=8460
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Sat Apr  3 12:50:28 2010
@@ -592,6 +592,9 @@
 			writechunk[CMD_BYTE(27, 1, 0)] = 0;
 			writechunk[CMD_BYTE(27, 2, 0)] = 0;
 		}
+		if (is_cmd_write(curcmd))
+			kfree(curcmd);
+
 	} else if (test_and_clear_bit(VPM150M_SWRESET, &vpmadt032->control)) {
 		for (x = 24; x < 28; x++) {
 			if (x == 24)
@@ -785,7 +788,7 @@
 	cmd->data = (0xff & readchunk[CMD_BYTE(25, 1, 0)]) << 8;
 	cmd->data |= readchunk[CMD_BYTE(25, 2, 0)];
 	if (cmd->desc & __VPM150M_WR) {
-		kfree(&cmd->node);
+		kfree(cmd);
 	} else {
 		cmd->desc |= __VPM150M_FIN;
 		complete(&cmd->complete);

Modified: linux/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=8460&r1=8459&r2=8460
==============================================================================
--- linux/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcte12xp/base.c Sat Apr  3 12:50:28 2010
@@ -259,7 +259,7 @@
 	cmd->data  = (0xff & readchunk[CMD_BYTE(2, 1, 1)]) << 8;
 	cmd->data |= readchunk[CMD_BYTE(2, 2, 1)];
 	if (cmd->desc & __VPM150M_WR) {
-		kfree(&cmd->node);
+		kfree(cmd);
 	} else {
 		cmd->desc |= __VPM150M_FIN;
 		complete(&cmd->complete);
@@ -503,6 +503,9 @@
 			writechunk[CMD_BYTE(4, 1, 1)] = 0;
 			writechunk[CMD_BYTE(4, 2, 1)] = 0;
 		}
+		if (is_cmd_write(cmd))
+			kfree(cmd);
+
 	} else if (test_and_clear_bit(VPM150M_SWRESET, &vpm->control)) {
 		for (x = 0; x < 7; x++) {
 			if (0 == x)  {




More information about the svn-commits mailing list