]> git.baikalelectronics.ru Git - kernel.git/commit
CRED: Fix double free in prepare_usermodehelper_creds() error handling
authorDavid Howells <dhowells@redhat.com>
Tue, 20 Apr 2010 21:41:18 +0000 (22:41 +0100)
committerJames Morris <jmorris@namei.org>
Tue, 20 Apr 2010 23:20:35 +0000 (09:20 +1000)
commit70ecc9e07cea689592bf1e0d78a728be9310ff16
tree6ae631c2fa01174a24da347b68fc25f0c350bc2b
parent2b72a1aae286603f96b635a3c6c07a50ad542497
CRED: Fix double free in prepare_usermodehelper_creds() error handling

Patch 3ed25e16dfc77ffe5ba82edc3b6343ac9c4945c1:

Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date:   Tue Mar 30 00:04:00 2010 +0100
Subject: CRED: Fix memory leak in error handling

attempts to fix a memory leak in the error handling by making the offending
return statement into a jump down to the bottom of the function where a
kfree(tgcred) is inserted.

This is, however, incorrect, as it does a kfree() after doing put_cred() if
security_prepare_creds() fails.  That will result in a double free if 'error'
is jumped to as put_cred() will also attempt to free the new tgcred record by
virtue of it being pointed to by the new cred record.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <jmorris@namei.org>
kernel/cred.c