Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2273821pxb; Thu, 11 Feb 2021 08:24:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZj6EN4ROjfxoAak1DCT+RtSlaVM9d5eP1xO59KbqByIGgFSVkNkOwmlcvboUAHbxZjgsJ X-Received: by 2002:a50:fe04:: with SMTP id f4mr9102450edt.63.1613060689655; Thu, 11 Feb 2021 08:24:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613060689; cv=none; d=google.com; s=arc-20160816; b=CsE0VwYlMSJGD4Ye8kp3fMd06MHIa/TRIOnbt75k7Gd8cUcRn0s1qG9dpsQrOgBofI k2UeIkVVhpv1X4cq+JMQ7RpHxDB0iJWJAuLJZ1IWwqctwcTFX7jgrz1XXHHm2yy+6qDy 6dFmrOYs4nPrIi1nnGCjqEQpvM+dyqHf/oxueXSd5fldNy6tENwBcMBr0j7kGegwou0E yTUqLHRvv5NRgGhc8mYyGJJHTkYUWUUVRwJjz/a0qxKjiapdYq+KYDc6PloztTLveIYM ZTjh5TuB862LlI3b8sDh8BT3caTDg17hXrQDtgymKwo1kTJWThUqEZcL6vEfwole8Kej 4Zsg== 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=kzho4/sLvCeeS/qcu81FzE6oaTx1BulZBBgmcvoPgpM=; b=TPFwWGfpN+xTnLMioQYiZPwehAtgmrTSjyrtJWrlbUb43xogKTO/H2CfUqD/7N8QI9 FY+EYMWX8cXyTXI2ahTVZWhgoQ75hk2d8KGWQq0MvWLW1atmBIYNk+B8xXTJCAXtNrmS 9AhOR1x/qaUcR1cqk2G+VHYe+2IMqThamw8Y/ebSGmtetcE2VgBq1X+/Lf8gg5UzmgB3 1vy/FAofvIDM10Z8fzpki5hy3/fzjj0NzMjWMjwRrj6exkk/ebZER7kbNcEgd5prN6XH CrGkrLxVfRCJpBmnCMbwXnrlkStcrDLJ1g3/6PLmUeVW1/Gc2kP7VQD6b3IVi7U+LEId Njuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oP+152q9; 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 dh7si1431069edb.459.2021.02.11.08.24.26; Thu, 11 Feb 2021 08:24:49 -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=oP+152q9; 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 S231934AbhBKQX1 (ORCPT + 99 others); Thu, 11 Feb 2021 11:23:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:53524 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231150AbhBKPYy (ORCPT ); Thu, 11 Feb 2021 10:24:54 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6A3DC64ED6; Thu, 11 Feb 2021 15:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613055835; bh=ECBiNusZ6x2h9HYHwiSqB6jmDGduRAqvrEGM7641/rk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oP+152q9bCj59ToDlPjvr0jMbPEZrrqOkJV6UgpTz3GFtj1AL7165FAZt7b0GDwh9 4RQ3Nc5acuQPhihqpUmq+xxBhfrDO0X/X4lbMwbpMO8u8ieg8F3iNvIso+qRTfEBe9 LkAq5YT1/oZZNLyw+vTtMaf01nXYwRcBN/UYnzXY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pan Bian , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 25/54] chtls: Fix potential resource leak Date: Thu, 11 Feb 2021 16:02:09 +0100 Message-Id: <20210211150153.975475316@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210211150152.885701259@linuxfoundation.org> References: <20210211150152.885701259@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: Pan Bian [ Upstream commit b6011966ac6f402847eb5326beee8da3a80405c7 ] The dst entry should be released if no neighbour is found. Goto label free_dst to fix the issue. Besides, the check of ndev against NULL is redundant. Signed-off-by: Pan Bian Link: https://lore.kernel.org/r/20210121145738.51091-1-bianpan2016@163.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- .../net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c index 5beec901713fb..a262c949ed76b 100644 --- a/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c +++ b/drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c @@ -1158,11 +1158,9 @@ static struct sock *chtls_recv_sock(struct sock *lsk, #endif } if (!n || !n->dev) - goto free_sk; + goto free_dst; ndev = n->dev; - if (!ndev) - goto free_dst; if (is_vlan_dev(ndev)) ndev = vlan_dev_real_dev(ndev); @@ -1249,7 +1247,8 @@ static struct sock *chtls_recv_sock(struct sock *lsk, free_csk: chtls_sock_release(&csk->kref); free_dst: - neigh_release(n); + if (n) + neigh_release(n); dst_release(dst); free_sk: inet_csk_prepare_forced_close(newsk); -- 2.27.0