[PATCH] s390: fix memory leak in vmcp
authorChristian Borntraeger <cborntra@de.ibm.com>
Mon, 7 Nov 2005 08:59:12 +0000 (00:59 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 7 Nov 2005 15:53:34 +0000 (07:53 -0800)
If vmcp is interrupted by a signal the vmcp command buffer is not freed.
Found by Pete Zaitcev.

Signed-off-by: Christian Borntraeger <cborntra@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/s390/char/vmcp.c

index 8990d8076e7da0733d7c8bb0a8b32fa55908af2d..19762f3476aadd22289d4ddb4a44d82985465bf4 100644 (file)
@@ -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,