Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp841548pxu; Mon, 23 Nov 2020 05:39:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdOTXsnesr0HYik56ppWywBCUDR3y5GgyLiMk+tLatcGSEjHjqYEKtKeoDB8vvfip8+UWK X-Received: by 2002:a05:6402:114b:: with SMTP id g11mr11644370edw.228.1606138747143; Mon, 23 Nov 2020 05:39:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606138747; cv=none; d=google.com; s=arc-20160816; b=bExs6sK0B9YT7oe4KmW/nfO77d6Q4irz0DpglUBZqoX+lSmnjcDe5TMa8aRusvcJHm jxvxxLwwulHs41z2vjZ7x6ojhwMBWci4BveD7DdzDQJRp+ph43nFUrtU6iZTIbuiWyab CHvg1mCkORFrsfE6ivA0aWEBIjRVWoOua0MLxOGNc+dTp1w92kpFXez0gGOEDEAEBHzp VVm5w1RjiRusrajpB7Qtz7XG/CkvpVcl5g+uT2teGhSqj+kTbgOcnW5q/Uupc7+NcGb8 sHGYTmWA2c6K48SzPSsFK/7c/i0wuhK1sMEcJPh2b41huU4c2OEjxIGCCO2f/pd7Nuej Rysw== 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=VohpiJHw87mV0v96sS5MaM+R+9bOlb+1K4Exqkq+m28=; b=YFP8YWVermVsnl7YpNDeplQHoYc31RQDTpkpeTpoxNrUMsE7m6TXjIOVIYGsHiAhrC nOUehLNs1TncrGpnLpn3et1vJEweTDP1Zx03Rbm5ha3ocPGogxBF/bWKqm84/L0u1t4v AnhiLPpFk8AjJc0l13I6dS2ae9JatWirvXIqEDbuybLTTAVEC3RIPqLUE+xy3K+mwCBn Yg1K/fg68ECQecADPDUSmuDK6ttrihtu3frWFoTmD85BCLKH8a5BGOm20T6pJMSrdTtO HIEwntjW07cU3airJLQiw0GWvtKoz/q5LTpaTwo0zEshFiQmGmVL4fsQCJblGib9Plhi ENug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="eZEn/FwA"; 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 gr13si6437607ejb.428.2020.11.23.05.38.44; Mon, 23 Nov 2020 05:39:07 -0800 (PST) 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="eZEn/FwA"; 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 S1729537AbgKWMXH (ORCPT + 99 others); Mon, 23 Nov 2020 07:23:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:60112 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729339AbgKWMXE (ORCPT ); Mon, 23 Nov 2020 07:23:04 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 047A820781; Mon, 23 Nov 2020 12:23:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134183; bh=Gov2K5TH7IZ2L7sr2SbSBoAUkGxSVm9oRr2PGKW6BXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eZEn/FwAGpf93uEIl/zV3XoXO1+WSh/h7TQL9H2UOiaZRwmLkJNbVwhCLGTxHS2VX sfVkPp6T5o3Hqusf1hd5Gfh8E4pGHGw5M4lLjcBwdPU6nKisyZP/uqQcRj6LB6yTX+ uogcZ1mRN388knxurI5Hm6bpnqQwWZV5ManMRg0w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Schiller , Xie He , Jakub Kicinski Subject: [PATCH 4.4 08/38] net: x25: Increase refcnt of "struct x25_neigh" in x25_rx_call_request Date: Mon, 23 Nov 2020 13:21:54 +0100 Message-Id: <20201123121804.716824334@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121804.306030358@linuxfoundation.org> References: <20201123121804.306030358@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: Xie He [ Upstream commit 4ee18c179e5e815fa5575e0d2db0c05795a804ee ] The x25_disconnect function in x25_subr.c would decrease the refcount of "x25->neighbour" (struct x25_neigh) and reset this pointer to NULL. However, the x25_rx_call_request function in af_x25.c, which is called when we receive a connection request, does not increase the refcount when it assigns the pointer. Fix this issue by increasing the refcount of "struct x25_neigh" in x25_rx_call_request. This patch fixes frequent kernel crashes when using AF_X25 sockets. Fixes: 4becb7ee5b3d ("net/x25: Fix x25_neigh refcnt leak when x25 disconnect") Cc: Martin Schiller Signed-off-by: Xie He Link: https://lore.kernel.org/r/20201112103506.5875-1-xie.he.0141@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/x25/af_x25.c | 1 + 1 file changed, 1 insertion(+) --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -1047,6 +1047,7 @@ int x25_rx_call_request(struct sk_buff * makex25->lci = lci; makex25->dest_addr = dest_addr; makex25->source_addr = source_addr; + x25_neigh_hold(nb); makex25->neighbour = nb; makex25->facilities = facilities; makex25->dte_facilities= dte_facilities;