From a5da866fe0272db6b664d4c790ad98320bf2feb6 Mon Sep 17 00:00:00 2001 From: Christian Borntraeger Date: Mon, 7 Nov 2005 00:59:12 -0800 Subject: [PATCH] [PATCH] 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 Signed-off-by: Martin Schwidefsky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/s390/char/vmcp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/s390/char/vmcp.c b/drivers/s390/char/vmcp.c index 8990d8076e..19762f3476 100644 --- a/drivers/s390/char/vmcp.c +++ b/drivers/s390/char/vmcp.c @@ -103,8 +103,10 @@ vmcp_write(struct file *file, const char __user * buff, size_t count, } 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, -- 2.39.5