Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp9982pxf; Wed, 24 Mar 2021 19:10:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJprMzhQwep2wbiTrcnxKFtlDd8T32pgytvRlyXlfsXGyJCUfqOlbQxCVMUwpkOPFEgtUP X-Received: by 2002:a05:6402:35cd:: with SMTP id z13mr6586534edc.21.1616638223037; Wed, 24 Mar 2021 19:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616638223; cv=none; d=google.com; s=arc-20160816; b=fOsDVqmoPav7baOgvsRXH7p9KPXW83znOWL9SMQqGkio/B/NX2RGlYnT39pF7wmtlW LyYN5Sv+nUpq4N27IYkB3PwlqWnGTZaTKN1H30DORYNzSuP9l8byfyrqZopCkw93cjAQ 1tw6zmyL6Z8RuK3dd3n77kXkp/MqakH+Qg7N163lzLZ3NFPtd3EKYnl2SIcyp8EcXltb zdW23UPXYCPazZ4qMsQlNHLp+2ianAP+VVhiyEyKr7+KmMa0Ye9N/m4z3BaQJJEjgJ9E V1oFvZwKdhYQwAp0wQIcFf9piCiqxMXMIjF6Ph7scmQ8SkWqysHdJwoES1YBa3HWX4JN +isQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=V14CuJCS8jf4PY4lIsE0QUVpZ8DnJUaA8DLkhMpjMEM=; b=S7eWJxLHZnfUq7DbuORGCParWNC4PtzGPdM1tH/jsYlGn7tSTCtSfrENLP6Yvw/mGb EArb/sTesmV1olW6pIS00u+g3AHNizjcEdc4zVxmzwmdmtq0/93IXezYhd0huyLRccXz qF/TFUbUfzorU9SFPtjGKPNwtz/Baq94MckDtaehviJPYI2eYboOxvpSHGunZEzKbsCb osaETlVYsk9nDQUn93Mkq1hAdrd8sV91UC5O7IXdEAP/R34jedqQJuPh+OFQvFkbNddQ +Ahkj/k5oCnGrc5GsAXGd5iw4Lg4JuBucgNG6RDJzuGzT4GZxbyA4DfYOoi+xlXlFTAW bnGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=i4zoxqCz; 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 y101si3143225ede.101.2021.03.24.19.09.59; Wed, 24 Mar 2021 19:10:23 -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=i4zoxqCz; 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 S234615AbhCXJWn (ORCPT + 99 others); Wed, 24 Mar 2021 05:22:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:55670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232017AbhCXJWd (ORCPT ); Wed, 24 Mar 2021 05:22:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 075F261A01; Wed, 24 Mar 2021 09:22:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1616577752; bh=b5iYeKxA+aYQvuo870CFsq/4+8Vj0GkQdOuTKFBvDrI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=i4zoxqCz5HRrve8irtOkADbzDGYRu13ICJmV+WhqHyIN3RzGaDzjfIPAEP5lGGxu8 um5NLZGdWt2jVuAf+gu9wNsvrl4e6dM3RdqOoLB6fbjLvTTzfzVSiTnbIa4XpFARXk QhAwNr++cEbZcz6YOUqOT8zxN31OYHptSxae5irI= Date: Wed, 24 Mar 2021 10:22:29 +0100 From: Greg Kroah-Hartman To: Florian Westphal Cc: Naresh Kamboju , "David S. Miller" , open list , linux-stable , Mat Martineau , Sasha Levin , Anders Roxell , lkft-triage@lists.linaro.org, Netdev , Arnd Bergmann Subject: Re: [PATCH 5.10 104/157] mptcp: put subflow sock on connect error Message-ID: References: <20210322121933.746237845@linuxfoundation.org> <20210322121937.071435221@linuxfoundation.org> <20210324090412.GB27244@breakpoint.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210324090412.GB27244@breakpoint.cc> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 24, 2021 at 10:04:12AM +0100, Florian Westphal wrote: > Naresh Kamboju wrote: > > On Mon, 22 Mar 2021 at 18:15, Greg Kroah-Hartman > > wrote: > > > > > > 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") > > I don't see this change in 5.10, so why is this fix queued up? > > > I have reported the following warnings and kernel crash on 5.10.26-rc2 [1] > > The bisect reported that issue pointing out to this commit. > > > > commit 460916534896e6d4f80a37152e0948db33376873 > > mptcp: put subflow sock on connect error > > > > This problem is specific to 5.10.26-rc2. > > > > Warning: > > -------- > > [ 1040.114695] refcount_t: addition on 0; use-after-free. > > [ 1040.119857] WARNING: CPU: 3 PID: 31925 at > > /usr/src/kernel/lib/refcount.c:25 refcount_warn_saturate+0xd7/0x100 > > [ 1040.129769] Modules linked in: act_mirred cls_u32 sch_netem sch_etf > > ip6table_nat xt_nat iptable_nat nf_nat ip6table_filter xt_conntrack > > nf_conntrack nf_defrag_ipv4 libcrc32c ip6_tables nf_defrag_ipv6 sch_fq > > iptable_filter xt_mark ip_tables cls_bpf sch_ingress algif_hash > > x86_pkg_temp_thermal fuse [last unloaded: test_blackhole_dev] > > [ 1040.159030] CPU: 3 PID: 31925 Comm: mptcp_connect Tainted: G > > W K 5.10.26-rc2 #1 > > [ 1040.167459] Hardware name: Supermicro SYS-5019S-ML/X11SSH-F, BIOS > > 2.2 05/23/2018 > > [ 1040.174851] RIP: 0010:refcount_warn_saturate+0xd7/0x100 > > > > And > > > > Kernel Panic: > > ------------- > > [ 1069.557485] BUG: kernel NULL pointer dereference, address: 0000000000000010 > > [ 1069.564446] #PF: supervisor read access in kernel mode > > [ 1069.569583] #PF: error_code(0x0000) - not-present page > > [ 1069.574714] PGD 0 P4D 0 > > [ 1069.577246] Oops: 0000 [#1] SMP PTI > > > index 16adba172fb9..591546d0953f 100644 > > > --- a/net/mptcp/subflow.c > > > +++ b/net/mptcp/subflow.c > > > @@ -1133,6 +1133,7 @@ int __mptcp_subflow_connect(struct sock *sk, const struct mptcp_addr_info *loc, > > > spin_lock_bh(&msk->join_list_lock); > > > list_add_tail(&subflow->node, &msk->join_list); > > > spin_unlock_bh(&msk->join_list_lock); > > > + sock_put(mptcp_subflow_tcp_sock(subflow)); > > > > > > return err; > > Crash is not surprising, the backport puts the socket in the 'success' path > (list_add_tail). > > I don't see why this is in -stable, the faulty commit is not there? > > The upstream patch is: > list_del(&subflow->node); > spin_unlock_bh(&msk->join_list_lock); > + sock_put(mptcp_subflow_tcp_sock(subflow)); > > [ Note the 'list_del', this is in the error unwind path ] Odd, I think something went wrong with Sasha's scripts. I've dropped this, and the other two mptcp patches, from the 5.10 queue and let's see if that helps. I'll do a new -rc now as well after my build tests finish... thanks, greg k-h