Patch "apparmor: fix a memleak in multi_transaction_new()" has been added to the 6.0-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 6.0-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-6.0 subdirectory.

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



commit 84c4f473da89d69f1b5a8cac5ec808f943459b79
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 d066ccc219e2..7160e7aa58b9 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -868,8 +868,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