Patch "tcp: Fix use-after-free of nreq in reqsk_timer_handler()." has been added to the 5.15-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

    tcp: Fix use-after-free of nreq in reqsk_timer_handler().

to the 5.15-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:
     tcp-fix-use-after-free-of-nreq-in-reqsk_timer_handle.patch
and it can be found in the queue-5.15 subdirectory.

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



commit e97767f81ce70f2fd92c93c175016a5e3855d062
Author: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>
Date:   Sat Nov 23 09:42:36 2024 -0800

    tcp: Fix use-after-free of nreq in reqsk_timer_handler().
    
    [ Upstream commit c31e72d021db2714df03df6c42855a1db592716c ]
    
    The cited commit replaced inet_csk_reqsk_queue_drop_and_put() with
    __inet_csk_reqsk_queue_drop() and reqsk_put() in reqsk_timer_handler().
    
    Then, oreq should be passed to reqsk_put() instead of req; otherwise
    use-after-free of nreq could happen when reqsk is migrated but the
    retry attempt failed (e.g. due to timeout).
    
    Let's pass oreq to reqsk_put().
    
    Fixes: e8c526f2bdf1 ("tcp/dccp: Don't use timer_pending() in reqsk_queue_unlink().")
    Reported-by: Liu Jian <liujian56@xxxxxxxxxx>
    Closes: https://lore.kernel.org/netdev/1284490f-9525-42ee-b7b8-ccadf6606f6d@xxxxxxxxxx/
    Signed-off-by: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>
    Reviewed-by: Vadim Fedorenko <vadim.fedorenko@xxxxxxxxx>
    Reviewed-by: Liu Jian <liujian56@xxxxxxxxxx>
    Reviewed-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Reviewed-by: Martin KaFai Lau <martin.lau@xxxxxxxxxx>
    Link: https://patch.msgid.link/20241123174236.62438-1-kuniyu@xxxxxxxxxx
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index 63e5aa6d4b0bc..73ef8b4f57049 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -935,7 +935,7 @@ static void reqsk_timer_handler(struct timer_list *t)
 
 drop:
 	__inet_csk_reqsk_queue_drop(sk_listener, oreq, true);
-	reqsk_put(req);
+	reqsk_put(oreq);
 }
 
 static bool reqsk_queue_hash_req(struct request_sock *req,




[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