2005-10-28 14:11:41

by Martin Schwidefsky

[permalink] [raw]
Subject: [patch 14/14] s390: fix memory leak in vmcp.

From: Christian Borntraeger <[email protected]>

[patch 14/14] s390: fix memory leak in vmcp.

If vmcp is interrupted by a signal the vmcp command buffer is not
freed. Found by Pete Zaitcev.

Signed-off-by: Christian Borntraeger <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
---

drivers/s390/char/vmcp.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)

diff -urpN linux-2.6/drivers/s390/char/vmcp.c linux-2.6-patched/drivers/s390/char/vmcp.c
--- linux-2.6/drivers/s390/char/vmcp.c 2005-10-28 02:02:08.000000000 +0200
+++ linux-2.6-patched/drivers/s390/char/vmcp.c 2005-10-28 14:04:56.000000000 +0200
@@ -103,8 +103,10 @@ vmcp_write(struct file *file, const char
}
cmd[count] = '\0';
session = (struct vmcp_session *)file->private_data;
- if (down_interruptible(&session->mutex))
+ if (down_interruptible(&session->mutex)) {
+ kfree(cmd);
return -ERESTARTSYS;
+ }
if (!session->response)
session->response = (char *)__get_free_pages(GFP_KERNEL
| __GFP_REPEAT | GFP_DMA,