Patch "apparmor: fix a memleak in multi_transaction_new()" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    apparmor: fix a memleak in multi_transaction_new()

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     apparmor-fix-a-memleak-in-multi_transaction_new.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 06b8aa5cb1d37e9e21f120ce7727df61876bd3ea
Author: Gaosheng Cui <cuigaosheng1@xxxxxxxxxx>
Date:   Tue Aug 23 09:15:03 2022 +0800

    apparmor: fix a memleak in multi_transaction_new()
    
    [ Upstream commit c73275cf6834787ca090317f1d20dbfa3b7f05aa ]
    
    In multi_transaction_new(), the variable t is not freed or passed out
    on the failure of copy_from_user(t->data, buf, size), which could lead
    to a memleak.
    
    Fix this bug by adding a put_multi_transaction(t) in the error path.
    
    Fixes: 1dea3b41e84c5 ("apparmor: speed up transactional queries")
    Signed-off-by: Gaosheng Cui <cuigaosheng1@xxxxxxxxxx>
    Signed-off-by: John Johansen <john.johansen@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index 8868c475205f..80012d21f038 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -869,8 +869,10 @@ static struct multi_transaction *multi_transaction_new(struct file *file,
 	if (!t)
 		return ERR_PTR(-ENOMEM);
 	kref_init(&t->count);
-	if (copy_from_user(t->data, buf, size))
+	if (copy_from_user(t->data, buf, size)) {
+		put_multi_transaction(t);
 		return ERR_PTR(-EFAULT);
+	}
 
 	return t;
 }



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux