netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Cong Wang <xiyou.wangcong@gmail.com>,
	Gengming Liu <l.dmxcsnsbh@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Sasha Levin <sashal@kernel.org>,
	netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.14 094/127] atm: fix a memory leak of vcc->user_back
Date: Thu, 17 Sep 2020 22:11:47 -0400	[thread overview]
Message-ID: <20200918021220.2066485-94-sashal@kernel.org> (raw)
In-Reply-To: <20200918021220.2066485-1-sashal@kernel.org>

From: Cong Wang <xiyou.wangcong@gmail.com>

[ 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 <l.dmxcsnsbh@gmail.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/atm/lec.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/atm/lec.c b/net/atm/lec.c
index 85ce89c8a35c9..0b0794b6a8149 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -1282,6 +1282,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


  parent reply	other threads:[~2020-09-18  2:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200918021220.2066485-1-sashal@kernel.org>
2020-09-18  2:10 ` [PATCH AUTOSEL 4.14 024/127] neigh_stat_seq_next() should increase position index Sasha Levin
2020-09-18  2:10 ` [PATCH AUTOSEL 4.14 025/127] rt_cpu_seq_next " Sasha Levin
2020-09-18  2:10 ` [PATCH AUTOSEL 4.14 034/127] ar5523: Add USB ID of SMCWUSBT-G2 wireless adapter Sasha Levin
2020-09-18  2:10 ` [PATCH AUTOSEL 4.14 037/127] Bluetooth: Fix refcount use-after-free issue Sasha Levin
2020-09-18  2:10 ` [PATCH AUTOSEL 4.14 039/127] Bluetooth: prefetch channel before killing sock Sasha Levin
2020-09-18  2:10 ` [PATCH AUTOSEL 4.14 042/127] skbuff: fix a data race in skb_queue_len() Sasha Levin
2020-09-18  2:11 ` [PATCH AUTOSEL 4.14 053/127] bpf: Remove recursion prevention from rcu free callback Sasha Levin
2020-09-18  2:11 ` [PATCH AUTOSEL 4.14 056/127] Bluetooth: guard against controllers sending zero'd events Sasha Levin
2020-09-18  2:11 ` [PATCH AUTOSEL 4.14 061/127] ath10k: use kzalloc to read for ath10k_sdio_hif_diag_read Sasha Levin
2020-09-18  2:11 ` [PATCH AUTOSEL 4.14 063/127] Bluetooth: L2CAP: handle l2cap config request during open state Sasha Levin
2020-09-18  2:11 ` [PATCH AUTOSEL 4.14 076/127] SUNRPC: Fix a potential buffer overflow in 'svc_print_xprts()' Sasha Levin
2020-09-18  2:11 ` [PATCH AUTOSEL 4.14 077/127] svcrdma: Fix leak of transport addresses Sasha Levin
2020-09-18  2:11 ` Sasha Levin [this message]
2020-09-18  2:11 ` [PATCH AUTOSEL 4.14 098/127] Bluetooth: Handle Inquiry Cancel error after Inquiry Complete Sasha Levin
2020-09-18  2:11 ` [PATCH AUTOSEL 4.14 106/127] e1000: Do not perform reset in reset_task if we are already down Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200918021220.2066485-94-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=davem@davemloft.net \
    --cc=l.dmxcsnsbh@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).