Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2565627lkm; Mon, 20 Sep 2021 18:52:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwN4lObnpCgS1aP7aCmYfe5uCLzMgPHddoKwgXy/hNBHc/xJL/cAidXaxCBruoUtNIhbmjL X-Received: by 2002:a05:6e02:1caf:: with SMTP id x15mr11187801ill.150.1632189002466; Mon, 20 Sep 2021 18:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632189002; cv=none; d=google.com; s=arc-20160816; b=W043A51h++e9jJd7rPLvBalhPiOo4kC47vdPFma65PIJSkoRxEnNp21YFObHzJFUWD +SvkyQTrbENIzrQMMITDiY0PIIxXqKJb+oAYNCiV1UsznH2TlJZJjj+jgQdynLZELmI4 r0RljE8iyiQZW0DMaXJrZT/qXfrDf9YeIg7MNegdFvopdtes9PQVNOZWknrX8G3877U9 Oh3qMLYrxSO7SO6VkTkGldsCVgX/y53jVr+KipRiWm+l5/xlWnRMdKA6rsoU/QFiwqPY Qs0gUlMXUwTyFeaVfQ95HX10ZX1SJuPl86+TQkzsa8VB1ZcVfcqX81ZhX4r2uJ4CiepP tjBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jRz0Sydg3yHmzuq3O57RR5pe98F756ObObcjEgxbKYw=; b=Oo0S6cnJPMbaPFTBaKUmdsNDo9y6UPsJjGWL+Vhk48daOpUREEW0Wg9bJL4ANERDJb CSKQLKysnkqzEiyhHxjb665nDlad9UO/frR/q82T5JLyGjNmZMXWBujGgWbSoyRfCfK5 Rxx6gTZ151tfGqXVKPtp8uLcRnEtOFqZaaF4dofmYccz6jfeAGy0iK+EtgOfIU+MwkmK hzDxEbXN9Z6DaWI9rBTKtSSiFqawQhkQhfSxnqeAciUloyyJZMwJTFX/9UB6CisXM7P+ WO8AW+TkzVdr+79lMfjzgck/h8LsUuP9CCKUrKjlCkMKuTgsiaIhKb+PzhY9vCLGqSkG z7NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VmCW2xfr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t6si13775382jaa.130.2021.09.20.18.49.51; Mon, 20 Sep 2021 18:50:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VmCW2xfr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347306AbhITSBT (ORCPT + 99 others); Mon, 20 Sep 2021 14:01:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:54626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355342AbhITRyk (ORCPT ); Mon, 20 Sep 2021 13:54:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ADC03619EA; Mon, 20 Sep 2021 17:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158023; bh=Mdf+Xl0GHfADmY1M5BhOFaJG7sBmJPf506QHXx1dJts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VmCW2xfr9WeWsKQdA3PZsMZWpsi8RgnZL1u+Ak6GDybxb1tZgMepGjrbZYEE3F/6x 9qv9mcbgGdfi3b18IKQgXJO1dBdJMDinGbDHoMyK6kKXLmvFII3MHDGgTrfxj4XsiO AvY7NFiGp/wBPxxNF5BABJPEZzpTrR1uj9KznkFc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhenpeng Lin , "David S. Miller" Subject: [PATCH 4.19 260/293] dccp: dont duplicate ccid when cloning dccp sock Date: Mon, 20 Sep 2021 18:43:42 +0200 Message-Id: <20210920163942.296149850@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163933.258815435@linuxfoundation.org> References: <20210920163933.258815435@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lin, Zhenpeng 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 Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/dccp/minisocks.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/dccp/minisocks.c +++ b/net/dccp/minisocks.c @@ -98,6 +98,8 @@ struct sock *dccp_create_openreq_child(c newdp->dccps_role = DCCP_ROLE_SERVER; newdp->dccps_hc_rx_ackvec = NULL; newdp->dccps_service_list = NULL; + newdp->dccps_hc_rx_ccid = NULL; + newdp->dccps_hc_tx_ccid = NULL; newdp->dccps_service = dreq->dreq_service; newdp->dccps_timestamp_echo = dreq->dreq_timestamp_echo; newdp->dccps_timestamp_time = dreq->dreq_timestamp_time;