Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3528378pxf; Mon, 15 Mar 2021 11:33:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTMFTSte2jlbSIPy5VIKoyOs2gzwQEKoir0YrhBPH4mWX6pnC2qzkm7iCBkAiH7R8thXRA X-Received: by 2002:a17:906:d8d3:: with SMTP id re19mr25400185ejb.440.1615833234904; Mon, 15 Mar 2021 11:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833234; cv=none; d=google.com; s=arc-20160816; b=W53JVDwZzITmvuIwqf59xkxd1s0CfLeVIE84qFK5b0kOhCgTJVRwFvdP3XV39iZHDG 7GNODU3vw+4DvJLknpKf98EeG7SwRxEt8LhSw9S4Buii0Ba55uRty6vfRjb9UoX7bfO7 K7wwqD/cGc6cC4GGt0237aMlLK26BveZ0KtNvUGi9OnlXyvlPAsHQxkbEke2lcBcIz6+ +b7rTdvWl88Mwma3XeyeqXtJyds7WlQXlPapfaq2PCy63j/yuVsrKDaZcYyDWPV6zKTP NA7bHRv/Y5b7LpKoChqzPV33Ew15ecPoo+c/q1qlHv+MzTBHMoLMkIjYmUSOzhxJFJCD w7RQ== 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=QmSXyKzZox5JrvwICNvl2ebJFlUSiXzz8ql4jQAf2WE=; b=0vh92kaShcUNNRkas7cmXSLfL2DvVZBS1yriSkTm3ArCHTUUnzVRdx3k4rsFzXBI5a 2qSVWkzE9XnQlxyzkiIF5P32UqJ0fbYwmAcqZWPCmz2dhTTGMH+nR3CYpI1dd/RzB8OS cNqZQNJIUEy+VLrSc1+iaOwpEgTlaPFjRla/ueFkRpUcC13ujxzzsQgxUdXus8H71s1t /Jonnt20Hts7jvriYvZjB0/YjXdEjqABaaMXFeKdVNPLO55fzNPkKfv3MwGVCIW9njxb C7iWcYvF8m7Ie2QNJvQZHRl4lXL1QBf8JnVNdqAeAMc6zHrWZOq1HtcvYyObm/5l0C5h wxGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qEFWn9K8; 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 r25si11355025ejs.195.2021.03.15.11.33.31; Mon, 15 Mar 2021 11:33:54 -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=qEFWn9K8; 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 S237938AbhCOOnX (ORCPT + 99 others); Mon, 15 Mar 2021 10:43:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:49810 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229868AbhCOODa (ORCPT ); Mon, 15 Mar 2021 10:03:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5601264E83; Mon, 15 Mar 2021 14:03:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615817009; bh=dnOEBefTkEQGovmqEsF2IJREFw23MOB2niidlyjTGZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qEFWn9K8k1eOze1yADrE3e0j9N3kpCzoXzquRx8PAgWZzuoLtoWBf99y20IYy+Jig oLOj6FrccR2xXBRnxvZgHsdfgVarqaEqdtRVGffDS4A4thZ+mNGQ+foZ0zPuW7j9J/ 1zKZodbsdHPraGp/MlmFOrTLvaWFhQKwJT2zRzuM= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Mat Martineau , "David S. Miller" , Sasha Levin Subject: [PATCH 5.11 258/306] mptcp: put subflow sock on connect error Date: Mon, 15 Mar 2021 14:55:21 +0100 Message-Id: <20210315135516.368742595@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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: Greg Kroah-Hartman From: Florian Westphal [ Upstream commit f07157792c633b528de5fc1dbe2e4ea54f8e09d4 ] mptcp_add_pending_subflow() performs a sock_hold() on the subflow, then adds the subflow to the join list. Without a sock_put the subflow sk won't be freed in case connect() fails. unreferenced object 0xffff88810c03b100 (size 3000): [..] sk_prot_alloc.isra.0+0x2f/0x110 sk_alloc+0x5d/0xc20 inet6_create+0x2b7/0xd30 __sock_create+0x17f/0x410 mptcp_subflow_create_socket+0xff/0x9c0 __mptcp_subflow_connect+0x1da/0xaf0 mptcp_pm_nl_work+0x6e0/0x1120 mptcp_worker+0x508/0x9a0 Fixes: 5b950ff4331ddda ("mptcp: link MPC subflow into msk only after accept") Signed-off-by: Florian Westphal Signed-off-by: Mat Martineau Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/mptcp/subflow.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 81b7be67d288..c3090003a17b 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1174,6 +1174,7 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, spin_lock_bh(&msk->join_list_lock); list_del(&subflow->node); spin_unlock_bh(&msk->join_list_lock); + sock_put(mptcp_subflow_tcp_sock(subflow)); failed: subflow->disposable = 1; -- 2.30.1