Re: [PATCH][SELinux] Let us not leak memory in SELinux : security_netlbl_cache_add()
On Sat, 21 Jul 2007, Jesper Juhl wrote: > Hi, > > Leaking memory is a bad idea, so let's not do it, in > security/selinux/ss/services.c::security_netlbl_cache_add(). > > Note: The Coverity checker gets credit for spotting this one. > Note: Patch has only been compile tested. Thanks! Verified and applied to: git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6.git#for-linus - James -- James Morris <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH][SELinux] Let us not leak memory in SELinux : security_netlbl_cache_add()
Hi, Leaking memory is a bad idea, so let's not do it, in security/selinux/ss/services.c::security_netlbl_cache_add(). Note: The Coverity checker gets credit for spotting this one. Note: Patch has only been compile tested. Signed-off-by: Jesper Juhl <[EMAIL PROTECTED]> --- security/selinux/ss/services.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index b5f017f..0ae032f 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -2417,8 +2417,10 @@ static void security_netlbl_cache_add(struct netlbl_lsm_secattr *secattr, cache->type = NETLBL_CACHE_T_MLS; if (ebitmap_cpy(>data.mls_label.level[0].cat, - >range.level[0].cat) != 0) + >range.level[0].cat) != 0) { + kfree(cache); return; + } cache->data.mls_label.level[1].cat.highbit = cache->data.mls_label.level[0].cat.highbit; cache->data.mls_label.level[1].cat.node = - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH][SELinux] Let us not leak memory in SELinux : security_netlbl_cache_add()
Hi, Leaking memory is a bad idea, so let's not do it, in security/selinux/ss/services.c::security_netlbl_cache_add(). Note: The Coverity checker gets credit for spotting this one. Note: Patch has only been compile tested. Signed-off-by: Jesper Juhl [EMAIL PROTECTED] --- security/selinux/ss/services.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index b5f017f..0ae032f 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -2417,8 +2417,10 @@ static void security_netlbl_cache_add(struct netlbl_lsm_secattr *secattr, cache-type = NETLBL_CACHE_T_MLS; if (ebitmap_cpy(cache-data.mls_label.level[0].cat, - ctx-range.level[0].cat) != 0) + ctx-range.level[0].cat) != 0) { + kfree(cache); return; + } cache-data.mls_label.level[1].cat.highbit = cache-data.mls_label.level[0].cat.highbit; cache-data.mls_label.level[1].cat.node = - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH][SELinux] Let us not leak memory in SELinux : security_netlbl_cache_add()
On Sat, 21 Jul 2007, Jesper Juhl wrote: Hi, Leaking memory is a bad idea, so let's not do it, in security/selinux/ss/services.c::security_netlbl_cache_add(). Note: The Coverity checker gets credit for spotting this one. Note: Patch has only been compile tested. Thanks! Verified and applied to: git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6.git#for-linus - James -- James Morris [EMAIL PROTECTED] - To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/