Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp874987pxk; Thu, 17 Sep 2020 20:00:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjCrWx+ey36OMhpFSIuS1ezu8nYVUk3PRabPi7GVyl3qJQjJG6NecFmjyqZnCC2kDxnVLx X-Received: by 2002:a17:906:5008:: with SMTP id s8mr35620673ejj.408.1600398023614; Thu, 17 Sep 2020 20:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600398023; cv=none; d=google.com; s=arc-20160816; b=dzzA3jCoE948K6n5hOS2/2NRfyEet9X6V9HIVlS53JDCJYPTDOzQsXIjeqr/2XWu24 4BNgsHkSDNyDUp7gWyYdOdkTXq1bLvPUUig+3ZMrI9F+U6RmcqBwTHdem7DaFBDvJcZB bYBOyxJRajDb6aLXiE/3LJPHt2aYxx+Hwm7xevqcZLQpYUnREDYHfz20bB4U+WJl4RD7 8WZnaGqBgY0bVjgipZXu6srYcQWCHPRyDJCmNID7Oujj1oWnf71fFk+nzX2O4W12QHsa m/1P3EoPw466pfDaD5aTpJwR9ui+2r0jPeAGyE5GZkbPzxFy7EQ+L3m+NNo2eUZTOTi4 uewQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NyRpfCuR7IvesIJ3beCFNbxdoPQBpDTxsWawirOlDKw=; b=ew3FoP2Xs6dI6Px5QUvVawyYO+4ZFC8TYd191r5a73BDzOXYVl/aC8U1GNW8qy1hVj NKu35rWWLLq+fS0DeGet3zBrjpf7o5ssldSMXLkMtuVtI3ijWxpqlMnUSl2jJTOVlKbU bIgqIRD8bxEBaUQCZgXu9jrlcFot0PYpH4kLCLI271qT147XbZVQOvITm383BnSKpTfL 1anatK6VpgZiwpaS2e0AX7MsSWvaOoB44RKnJJlEjYORRWt5uhu8xfHx2dk+9DWMvMiy SqX/WFK4AqoPMe4RdGswJ6FIIpXskln/bZTwIaRfDGwvTgVODNYM0cDkFWhofrZ2qrTc Jo2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jBSzXRcT; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p26si1282332ejf.86.2020.09.17.20.00.00; Thu, 17 Sep 2020 20:00: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=@kernel.org header.s=default header.b=jBSzXRcT; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730397AbgIRC6F (ORCPT + 99 others); Thu, 17 Sep 2020 22:58:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:55594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726669AbgIRCGU (ORCPT ); Thu, 17 Sep 2020 22:06:20 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1F205238E6; Fri, 18 Sep 2020 02:06:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394779; bh=L8y+vhogEVvfm7O+1ESUJ6UPFy9sxfuBATpoB0bq7lY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jBSzXRcTEjb6IYzS2wPCnraRniOdYb6pgsXWEI8QKzsSPai8FltjLVzq5/sR/9kgC RS9+JBSunIOk5d95OVZaYfn7zOJ0xF8Z1l6mCiTy5JpYDwgTr1drBpxZBk7dHD6pow 4HjxhgywWGjhtm7Vn0GGN9l7I6Xc+tZzqnml7dSA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Cong Wang , Gengming Liu , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 253/330] atm: fix a memory leak of vcc->user_back Date: Thu, 17 Sep 2020 21:59:53 -0400 Message-Id: <20200918020110.2063155-253-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cong Wang [ Upstream commit 8d9f73c0ad2f20e9fed5380de0a3097825859d03 ] In lec_arp_clear_vccs() only entry->vcc is freed, but vcc could be installed on entry->recv_vcc too in lec_vcc_added(). This fixes the following memory leak: unreferenced object 0xffff8880d9266b90 (size 16): comm "atm2", pid 425, jiffies 4294907980 (age 23.488s) hex dump (first 16 bytes): 00 00 00 00 00 00 00 00 00 00 00 00 6b 6b 6b a5 ............kkk. backtrace: [<(____ptrval____)>] kmem_cache_alloc_trace+0x10e/0x151 [<(____ptrval____)>] lane_ioctl+0x4b3/0x569 [<(____ptrval____)>] do_vcc_ioctl+0x1ea/0x236 [<(____ptrval____)>] svc_ioctl+0x17d/0x198 [<(____ptrval____)>] sock_do_ioctl+0x47/0x12f [<(____ptrval____)>] sock_ioctl+0x2f9/0x322 [<(____ptrval____)>] vfs_ioctl+0x1e/0x2b [<(____ptrval____)>] ksys_ioctl+0x61/0x80 [<(____ptrval____)>] __x64_sys_ioctl+0x16/0x19 [<(____ptrval____)>] do_syscall_64+0x57/0x65 [<(____ptrval____)>] entry_SYSCALL_64_after_hwframe+0x49/0xb3 Cc: Gengming Liu Signed-off-by: Cong Wang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/atm/lec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/atm/lec.c b/net/atm/lec.c index 5a77c235a212f..3625a04a6c701 100644 --- a/net/atm/lec.c +++ b/net/atm/lec.c @@ -1269,6 +1269,12 @@ static void lec_arp_clear_vccs(struct lec_arp_table *entry) entry->vcc = NULL; } if (entry->recv_vcc) { + struct atm_vcc *vcc = entry->recv_vcc; + struct lec_vcc_priv *vpriv = LEC_VCC_PRIV(vcc); + + kfree(vpriv); + vcc->user_back = NULL; + entry->recv_vcc->push = entry->old_recv_push; vcc_release_async(entry->recv_vcc, -EPIPE); entry->recv_vcc = NULL; -- 2.25.1