Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2498377imm; Mon, 24 Sep 2018 05:30:15 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb7mLBPXj2b4/2gPBzzT5ZZNFOo+g5Cy1ExMF8y3/4rYuEaDG1q0ossp8asX+uLD/mBRZ/k X-Received: by 2002:a62:9b46:: with SMTP id r67-v6mr10125653pfd.105.1537792215609; Mon, 24 Sep 2018 05:30:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792215; cv=none; d=google.com; s=arc-20160816; b=IL520UQ8FXQfitcIjuBtRtiheRvCEgT89v94Uf8SAPL1xaJ8Mf0e8JU0PFd9/ib2zh orLqfF+v0Gc2Smai4DMomDGmhMctsMJb8NjJlQBJ/kLNyVpnReo9yx1P+DBbblCk8YI1 bO1d2hLIVu0UzwWfQcozhdlJmQ9e/w7Nu82nyfqqTOWozK6crg3SK/AOOiRFgX0ja3/F 7clxMfkOmfHSiHabELXdvjYa6UilaSS/Twa0ws1D/+zSV7LZnB2gyms4fXhs5SDkqzwl MIASCXxso89ycnzNOqPm9MD+px2xwEhUBD2VCYhaiv4S8kLsMU6KlwPgfVNuQbz7Ck7W U4VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=aoOtWbB7XaTXxKlysPKrNjQK6rBbyXYeJJAKTc6DFr8=; b=KySsDxQnPTt/8I9ILMkroMFCsGE5vt0KaQmf49HCaQCvbH0xgAqstcp1W7DSxTohm/ JpDg7bz+DdOtrvJUDyQEwkiGYcL3oVPMVcjqtdvPiukAKmEuU7lj1TfQClyUeEFc4nSb lxgrU2Z90VMQrHCY69vYKT9rwrnI7sonleEmzUQvsbA4iMv2rynorBykFTamrHHPFB4w iiGxAUBDn2z1lXFV5EQ8NA/KfYxMLDdfwpBZ2Hi8yp0T3UYSiEh4foVMRaTFZLPmNRiO +UsUn/eTTjwuMksy55wbteRMV69Uh+ZFzVUaFFL77j19Ub+1QbFwsHq26ztebmRoGewb xR3Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g26-v6si34704654pgb.349.2018.09.24.05.30.00; Mon, 24 Sep 2018 05:30:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387642AbeIXSax (ORCPT + 99 others); Mon, 24 Sep 2018 14:30:53 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57540 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731929AbeIXSaw (ORCPT ); Mon, 24 Sep 2018 14:30:52 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 8BEEA1018; Mon, 24 Sep 2018 12:28:58 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jon Maloy , Ying Xue , Cong Wang , "David S. Miller" Subject: [PATCH 4.18 005/235] tipc: orphan sock in tipc_release() Date: Mon, 24 Sep 2018 13:49:51 +0200 Message-Id: <20180924113104.776291653@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Cong Wang [ Upstream commit 0a3b8b2b215f9e84b82ae97df71292ccfd92b1e7 ] Before we unlock the sock in tipc_release(), we have to detach sk->sk_socket from sk, otherwise a parallel tipc_sk_fill_sock_diag() could stil read it after we free this socket. Fixes: c30b70deb5f4 ("tipc: implement socket diagnostics for AF_TIPC") Reported-and-tested-by: syzbot+48804b87c16588ad491d@syzkaller.appspotmail.com Cc: Jon Maloy Cc: Ying Xue Signed-off-by: Cong Wang Acked-by: Ying Xue Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/tipc/socket.c | 1 + 1 file changed, 1 insertion(+) --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -578,6 +578,7 @@ static int tipc_release(struct socket *s sk_stop_timer(sk, &sk->sk_timer); tipc_sk_remove(tsk); + sock_orphan(sk); /* Reject any messages that accumulated in backlog queue */ release_sock(sk); tipc_dest_list_purge(&tsk->cong_links);