dccp: don't duplicate ccid when cloning dccp sock
authorLin, Zhenpeng <zplin@psu.edu>
Wed, 8 Sep 2021 03:40:59 +0000 (03:40 +0000)
committerDom Cobley <popcornmix@gmail.com>
Thu, 14 Oct 2021 11:32:55 +0000 (12:32 +0100)
commit41974b3872dc43b29ed56ffdc78417556f4e47f5
tree8c42144f82faabc67e06de86e1f96d29b6e9bece
parentd0315ad7356546f5893897678f82da46c2ba6ba4
dccp: don't duplicate ccid when cloning dccp sock

commit d9ea761fdd197351890418acd462c51f241014a7 upstream.

Commit 2677d2067731 ("dccp: don't free ccid2_hc_tx_sock ...") fixed
a UAF but reintroduced CVE-2017-6074.

When the sock is cloned, two dccps_hc_tx_ccid will reference to the
same ccid. So one can free the ccid object twice from two socks after
cloning.

This issue was found by "Hadar Manor" as well and assigned with
CVE-2020-16119, which was fixed in Ubuntu's kernel. So here I port
the patch from Ubuntu to fix it.

The patch prevents cloned socks from referencing the same ccid.

Fixes: 2677d2067731410 ("dccp: don't free ccid2_hc_tx_sock ...")
Signed-off-by: Zhenpeng Lin <zplin@psu.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/dccp/minisocks.c