lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <66ebd7b1-8798-4d1c-925e-0822c9b466d1@linux.dev>
Date: Sat, 23 Nov 2024 17:30:07 -0800
From: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
To: Kuniyuki Iwashima <kuniyu@...zon.com>,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
Cc: Kuniyuki Iwashima <kuni1840@...il.com>, netdev@...r.kernel.org,
 Liu Jian <liujian56@...wei.com>
Subject: Re: [PATCH v1 net] tcp: Fix use-after-free of nreq in
 reqsk_timer_handler().

On 23/11/2024 09:42, Kuniyuki Iwashima wrote:
> 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@...wei.com>
> Closes: https://lore.kernel.org/netdev/1284490f-9525-42ee-b7b8-ccadf6606f6d@huawei.com/
> Signed-off-by: Kuniyuki Iwashima <kuniyu@...zon.com>
> ---
>   net/ipv4/inet_connection_sock.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
> index 491c2c6b683e..6872b5aff73e 100644
> --- a/net/ipv4/inet_connection_sock.c
> +++ b/net/ipv4/inet_connection_sock.c
> @@ -1191,7 +1191,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,

That indeed fixes the fix :)

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@...ux.dev>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ