From: Christian Borntraeger Date: Mon, 7 Nov 2005 08:59:12 +0000 (-0800) Subject: [PATCH] s390: fix memory leak in vmcp X-Git-Tag: v2.6.15-rc1~638 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5da866fe0272db6b664d4c790ad98320bf2feb6;p=linux-2.6 [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 --- 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,