From nobody Thu Sep 07 19:27: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 4RhTlD0Jf5z4sGdx; Thu, 7 Sep 2023 19:27: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 4RhTlC6pcxz3g2k; Thu, 7 Sep 2023 19:27:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694114824; 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=P0cmaCma/cxQMWQsZPWfpPa8AMFlFUzYZu0Okc4hQRI=; b=vK9LBegglYF6h3gz9i78fIg/OEpFKKS8ndWflfbynCIDtW3w8IOUVMJdiPknGU90W+RnC4 di2wsx5cNLqmzjHG0NaaL5lxRSy2EG4O079ktqyEcWRir5XTvKUtlAtu4u87NoXc1gYzCF +ZfoNoIF3uOEuOBDZuO1r/pn/PpNKXX8AaBwtynTQmezAEDvFX8IqMCz6agJxEAIuu/5d0 Yu0Lxo6IDq8FPIn7ebt5lyIrHW50PK2muFMqQ+DdvGKssrxwwQWD9PJcwgJPTawYnzjLbN ycKOj6E9MLba4dHUC9Ar7dksI6d9OD6OxSJYJJHGwMntnwqpRiljwv0OFRtaUA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694114824; a=rsa-sha256; cv=none; b=iGjFz7Vj3ZhTXkJM4eI4uZj0s/7UryPMPXACGU2h9Cies9G6HS/IK0zdgs5x9XOMt+6ErS sKYNxuUe5864cfAJiCVykPYYBmG+rx9DuaJ1GUzSYdLuTcQB6+behAtyYBGTSRe635J2rY Dztex84Ho688ZYJKN2sJsyV0benUmlM7ZR8O5V9ISDlBOQPdwYopourxUxk5BCiYUsLDrp ZP9vn2Fv45OgLxPPD1de9zPPsaduuNCPeahAxgVfcp+VD+htGAuZO4ieB4ny5N1Kdo6Rwc 3f8Hy5P/OECsnLfh3IWX+1kOjMiscC1UvaFTQnJEGTWRkkSi5F3apaKaLRamvQ== 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=1694114824; 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=P0cmaCma/cxQMWQsZPWfpPa8AMFlFUzYZu0Okc4hQRI=; b=q4HVoJkpyzPBf9MiEGnlg8tbFLvRCbcxXl5G1ThBNB3ztQ8E7dpO+ELIPjHjBts3JLzwaG jhEFaHyLe34Elq81jruRowzPnmg8agzQ/8Uy4LHjx3BZZjPfnFtmOQ/Il9q+D5ui/x5r/u tjO4uQAPy30DwUMesVd5BJpG3ouYEgfBZrk7BW2F9c4XrtbbM9X9NfeqAoBlN2A9XKnT0b Lv3fHPlInU92GzzZhipTc63GSmRQcRZAMSANVtTtZUYtCbSlGx65pAMJk768v7VOQr5MFU MVNLNmz+TMjr7O5sFn5pEVwEXdXF/JrszSDjcTkstVNNRfLrsP5i5ILbLTYFRQ== 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 4RhTlC5kZjz1BYX; Thu, 7 Sep 2023 19:27: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 387JR3BY065323; Thu, 7 Sep 2023 19:27:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 387JR3kU065320; Thu, 7 Sep 2023 19:27:03 GMT (envelope-from git) Date: Thu, 7 Sep 2023 19:27:03 GMT Message-Id: <202309071927.387JR3kU065320@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: 70fbe797c0f6 - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 70fbe797c0f6806d51708a9ef96ee02cb0c6d10d Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=70fbe797c0f6806d51708a9ef96ee02cb0c6d10d commit 70fbe797c0f6806d51708a9ef96ee02cb0c6d10d Author: Kristof Provost AuthorDate: 2023-08-29 09:33:17 +0000 Commit: Kristof Provost CommitDate: 2023-09-07 19:26: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 Approved by: re (gjb) 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 827b8f96b07e..362e3f25115c 100644 --- a/sys/netinet/in_mcast.c +++ b/sys/netinet/in_mcast.c @@ -915,6 +915,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); } /*