From nobody Thu Sep 07 19:25:03 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RhThw2xt4z4sG2h; Thu, 7 Sep 2023 19:25:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RhThv4bm8z3dTH; Thu, 7 Sep 2023 19:25:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694114703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rh8ZnuaCdLpk3JTaHpRE1/Y+2IrgS6RGqEvIe/bzoJo=; b=fzV+5LUxpDVRv/IDMsh7/GZ39vKDA7pJCwdQuqpYwlNsAriI1Z6Rhn7Szb+UdZxkEoOU8e eS51WZq/S7bgKcKjic9Rmf8s8/u1LcIaz+H4s/cQmI7I4SX1zKt6kwhbxTicu8DIb7XYKQ MYuONeaozOBYnmXIlGRd7ujn2r+dVCpOWgmvuxKyb3WwXE8C1IU0MWtkqLhsQZYtGQqlw1 31pn823bYbCUL4OIKQTTq9S6Cn5C72X+Ya2yaf2UatoL/XanIY0RN93rsy2qWrfqYAgBSu mIWaE1g72VSfpOu5FZci6AsJskiZ8GuWr1v4TyueqKgIhKC2Fz4PYwSpec5Lmg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694114703; a=rsa-sha256; cv=none; b=C2yJV7LMX1C3ky7AM/XAF887kubqj6Ozpgg7HL4nUgB+TrIXBVyTh2g2CeUa0Hu/A+9n83 dqy91nx6CQf1NO57PYGHL6SsA5+yDPYCza6QSik5r29hJaiqD+qOeQpgm6GDzWaNi+IcpW nLaceBrKu+RFDHMwwD8NlcZaDJ/jJ0jbzDeyEGto2FDM8WHyxV0RWXyCmVXFHThFrBfmmg YNP2Bw5o0vinAiRXpB1Y5aZ2Anwozagle1QOpBKcnyM0WaqEJKez2A/5+pHbB9gQ/AMaAF pDmyqpkKYmlD5xB0g0LERsg0tgj4Qv8ai1cIOA12dZzu0ph5jLgZJvyclyESKg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694114703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=rh8ZnuaCdLpk3JTaHpRE1/Y+2IrgS6RGqEvIe/bzoJo=; b=Ne95aIM3Xtz7j2VQDnl74xklGwKeJElzOExjCxITUbfLqWnjFuWQAKcL4g+0BWKoMfoHiU C/AOf42e5Y45ofuYaMzCsZJRRugoTaCle6Xfb1IY/OBjOUYj7Dv5hKMLMo1O+Q4PyTmDL1 DQHUfNhf7ohVdpZzJnmyMKxgoZ/++Yl4QylYCvoc7aHRabcQg8c4b6U3S39hBeSFvBQe2g S4ebGa9oozoBy6fT2yvICxl7GQ5KSgPvcmDDYT00ststtwvCyjV9RUj9WX6ZbP5V1y3clT id2ZTlSb+gNPnX0a16lzTG3Oz+9fze7Z79IsA+4+wBSHssMexrKg4QqO38rDJw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RhThv37Ngz1BN2; Thu, 7 Sep 2023 19:25:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 387JP3iu064782; Thu, 7 Sep 2023 19:25:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 387JP39d064779; Thu, 7 Sep 2023 19:25:03 GMT (envelope-from git) Date: Thu, 7 Sep 2023 19:25:03 GMT Message-Id: <202309071925.387JP39d064779@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 55be69175311 - stable/13 - mcast: fix memory leak in imf_purge() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 55be6917531157259d273cc5e698e797865dd0b4 Auto-Submitted: auto-generated The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=55be6917531157259d273cc5e698e797865dd0b4 commit 55be6917531157259d273cc5e698e797865dd0b4 Author: Kristof Provost AuthorDate: 2023-08-29 09:33:17 +0000 Commit: Kristof Provost CommitDate: 2023-09-07 19:23:07 +0000 mcast: fix memory leak in imf_purge() The IGMP code buffers packets in the imf_inm->inm_scq mbufq, but does not clear this queue when struct in_mfilter is freed by imf_purge(). This can cause memory leaks if IGMPv3 is used. Purge the mbufq on imf_purge(). MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D41629 (cherry picked from commit fa03d37432caf17d56a931a9e6f5d9b06f102c5b) --- sys/netinet/in_mcast.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c index da5a23541c17..a78363da43e0 100644 --- a/sys/netinet/in_mcast.c +++ b/sys/netinet/in_mcast.c @@ -920,6 +920,8 @@ imf_purge(struct in_mfilter *imf) imf->imf_st[0] = imf->imf_st[1] = MCAST_UNDEFINED; KASSERT(RB_EMPTY(&imf->imf_sources), ("%s: imf_sources not empty", __func__)); + if (imf->imf_inm != NULL) + mbufq_drain(&imf->imf_inm->inm_scq); } /*