Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1235262pxu; Mon, 23 Nov 2020 15:31:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJyO9fcHhCJ9Hencei/tR4f72SnjyVyXHUTfiRuyVnQl+JOy7vzvkDR8BTKCl5h3E48YRyyx X-Received: by 2002:a17:906:d41:: with SMTP id r1mr1736907ejh.383.1606174294332; Mon, 23 Nov 2020 15:31:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606174294; cv=none; d=google.com; s=arc-20160816; b=QSNVTF3A3/IXlyyla1WeCIWfCzEWuS8aJne3gbMmQGeu2dxxnCvhrCnXUTTmk4dcD0 sMUT14vWfCkX4a8KpGhPB2374t8NEiiy4f4j9xfIMJiZjWPW0s+Qq19o8T/7NAkY01kV gDd8BdZbqLwdtc6mgdaEilV3Im2KKBhET1nOSat55uhA5lUtPdFwXlDHR3N3Wjt9s0o2 OBLkHeX6onXT39iFtNW1h9gO8gA1YwTym2HgVAgK8SAYMnYDIbD22Phs1MMf1pBz2l+l vCeGfgLEVky5KMctR2+obgBe7+ysu81d6PAoEqnYzp+z7ANl04XOJBda4xDBcS+IyuV3 yX2A== 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=eVx9LdrE7xZ3k5LUTlQjAD4w/FQYauwRqbP84FTWn/+L8ZWLYMW1mtXW9LfS6cwVkg pvLR5x7+qF4/oMBjXYxYv309o8EMrhqMrEjfmaDY86U0XK8rEOZWACGaLGXxrBnsbHKu wLt+ly+yl7HpjRCpI4sFMSklcpP+TGkWr3mblRW9UHAckvDaRX+X1m0iWTk27+JyAaDT tKKV2LMnVxnavczmTmGgtUjZakTHbjyLQzhOekqBIEw4T7u0TpwFQcYlpLM1AFYCT+qM 72RURWvvCnzcDTDu6Y3aUV8jmDCSSYAlvRnfBZ+Jk9kqKZSzsAltcGXGmAmsa3JeFPzS OZWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rNt99gXV; 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 g24si7558970edj.168.2020.11.23.15.31.11; Mon, 23 Nov 2020 15:31:34 -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=rNt99gXV; 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 S1729850AbgKWMYm (ORCPT + 99 others); Mon, 23 Nov 2020 07:24:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:33996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729825AbgKWMYe (ORCPT ); Mon, 23 Nov 2020 07:24:34 -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 7777C20728; Mon, 23 Nov 2020 12:24:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606134274; bh=Gov2K5TH7IZ2L7sr2SbSBoAUkGxSVm9oRr2PGKW6BXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rNt99gXVVcdA7y4ypm+F5bqYmGA2qshA00u3lfcSWQ2vRHFCdCFWEG5tGYomsXBZk ko/sesJBz9AOHL9n8l+2jkkGpFYCl3v0urBn33d4NVQRc2J6HlnUdC5T093qd3TMVA 1kJrQm/kJD2mZeOIa847+Ksbyopl1nTbzxKDVpOI= 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.9 12/47] net: x25: Increase refcnt of "struct x25_neigh" in x25_rx_call_request Date: Mon, 23 Nov 2020 13:21:58 +0100 Message-Id: <20201123121806.137106005@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121805.530891002@linuxfoundation.org> References: <20201123121805.530891002@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;