From nobody Thu Aug 31 10:22:19 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 4Rbxzv6l8Pz4s1S8; Thu, 31 Aug 2023 10:22:19 +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 4Rbxzv6J4Cz3Fvf; Thu, 31 Aug 2023 10:22:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693477339; 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=JbDHjdwqhbXFNY+TP4HoFfELISmFfhbJUjN9lUO3pnI=; b=b6g5pi68bgfHD1/QaDXESCW6KIPckK/XJM78mzxKCt6xhuzHADiQ+O1EtVjIgEfMfwpRxn ArCzPzWPtJgFuqlLbdYmHe+ETptX30Z93rA9KRDt4Vk7EN87D1joP/mggKvZ2fcpAgFQFG OAPbH3syeD48JmpAecwzL5J+iVjfxMavF9A0SgeiVTeAYjSCrQSaIUirzQ9BXyK/apX9fp PCLCS7N1cd4jcJwPdTMv5cN2j/RFbrVgpBLWZofV0SsT6GfYa+COLJGm7/qCJCtbphe5o6 zBoukp+p74xbcb8D+Em20DlV9EyEPR5VqzAPHJIyPfo96qgAOkgagVgUrNoW8g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1693477339; a=rsa-sha256; cv=none; b=wW7kR8q2o2fi5qilHGswd5QyDcBZClfpfJ29XFBqLgKVQ6AtUvhmeNmvYaI3fnrKtepM62 vxdi3VGCQfeVwfaJto6r9YwhpUAnq4utiXbmDiY5Ow/Dex35Y7GWJu2Qitxg8vHi6aHXQ+ dbReiG2vFlmg5pbUiRKurTZMAFBReJwr7BgNbqK3pKiCUG2koxZv35N5+NLnaQIKv7//Ne ntRotrjk0pskMDsAMrGk27Qh0LcuLb6taaev+msidnTQhzPHUYiUmU4ShRnR2a6hVhYXQ4 RNm0tB5O3T3K6mschxqnRf2dIvwUApR/QFHpsYbCzubyW1ssHaysa5Oyq1xPqg== 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=1693477339; 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=JbDHjdwqhbXFNY+TP4HoFfELISmFfhbJUjN9lUO3pnI=; b=WBgOd27ULdCdMQYgOavvpNFn8oLoTcad25u/tNfB794Vnv92mB6eYyNAufmEYjl9xIds9/ 7U/WwktuwYvfGNnJpSPVBwcGhCkefyz8nw9JH6FKqh8uUwZfyo1f8ok8qwK0Q+eh4CwkaH xGw/MLp8DnQL66kisULqSen2S+3Re5Froh++I8k5I9cd/B7SgqyBJEVZ8xgR5NJvRs5HF6 pn3Z6kMG1xjBsHNrGn8QqaUZOQd0cehS3015aeIZ8YHC5wrW1NKngztkOicA8pCn1exhjm WNYwOjbAhbvlbZZ6jT/LJ4QfVmMwvsRJfmDMXtnoQe2Nzzhpy0X9K07aWxk0pA== 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 4Rbxzv5Lf0z1Cvf; Thu, 31 Aug 2023 10:22:19 +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 37VAMJY3034344; Thu, 31 Aug 2023 10:22:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37VAMJLY034341; Thu, 31 Aug 2023 10:22:19 GMT (envelope-from git) Date: Thu, 31 Aug 2023 10:22:19 GMT Message-Id: <202308311022.37VAMJLY034341@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: fa03d37432ca - main - 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/main X-Git-Reftype: branch X-Git-Commit: fa03d37432caf17d56a931a9e6f5d9b06f102c5b Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fa03d37432caf17d56a931a9e6f5d9b06f102c5b commit fa03d37432caf17d56a931a9e6f5d9b06f102c5b Author: Kristof Provost AuthorDate: 2023-08-29 09:33:17 +0000 Commit: Kristof Provost CommitDate: 2023-08-31 10:16:20 +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 --- 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); } /*