Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2875139pxu; Sat, 19 Dec 2020 05:02:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyIlMk39znxrSqc4XsBp7rDLIvqIvVzqbvBKPeXEh4rxEzs50hDmPKLdgqMH9qDZtO/WuAM X-Received: by 2002:a17:906:4348:: with SMTP id z8mr3216703ejm.371.1608382940812; Sat, 19 Dec 2020 05:02:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608382940; cv=none; d=google.com; s=arc-20160816; b=IggjHXNEHsCQcKjM6A9iLQVpXjlJgEtnCdk+X6qBrUNaBnk2j4EHhspPckOlohnxTz /VwyZxGnXRQ7ZxIrYmG9c9UnxWCErYgv+G28QzdLuHuXSOGjknl7WMyZeeJ6qCQpMo9d V1qCRN7iRcuJoz0cstQZTD9vHV1lGYx9P/ztHlUQIVPbbPOMiLoMzb1LHM3eHK97Dsfb ziYFRkEwaNIpnfc8Vc58/b+k35pdWTrdzp+i530M9FMc1tQEFWyR6VmpiPSzZXC1B+yW 6hb4ACAYM0xGT4sIMK7c0jm20gvFsfGhg+gQOQfmzJkcfjPLFrmBu3kzBve68fCTw07Q NoEg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=41pYwIbLxf8BkWwPQdlHlQXGET6NZBoTZhnq+bzkfqw=; b=py5XuFbFnJ39DtuVOM+vy9ey9wiQFIWX5NOufsTWMe+qSB5mV7x1FCemGPDl9mqWb7 dD8gPDCnf3epHGuaCBMvA8q1x/Xa4gV+sbGgsdHfQMV22RxQ6M0y8zAdvW3ty8vHK8MD tthFgEcasupeTl4pWS6smBkm4PrHWjT0/5a1Bb/WMVQtMbk3JO+eqJYlGOy+BoibW+UN Ngaaq5AYO7NgdSZgYMk5qtJOdq7Bv0C050qZcVeBQRXYTeaN9OxGP7Yf8Q5Ro2xo8EfK 0sPP9GWNwql4O0fjBfh0EqjKlTrkDZWWPHOcUbSyd/DT27adTubzkwvfCmZmTVyxswdJ PK2A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v21si7766034edx.3.2020.12.19.05.01.58; Sat, 19 Dec 2020 05:02:20 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728142AbgLSM70 (ORCPT + 99 others); Sat, 19 Dec 2020 07:59:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:45570 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727908AbgLSM6z (ORCPT ); Sat, 19 Dec 2020 07:58:55 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso , Chris Mi , Roi Dayan Subject: [PATCH 5.9 24/49] net: flow_offload: Fix memory leak for indirect flow block Date: Sat, 19 Dec 2020 13:58:28 +0100 Message-Id: <20201219125345.861105375@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201219125344.671832095@linuxfoundation.org> References: <20201219125344.671832095@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chris Mi [ Upstream commit 5137d303659d8c324e67814b1cc2e1bc0c0d9836 ] The offending commit introduces a cleanup callback that is invoked when the driver module is removed to clean up the tunnel device flow block. But it returns on the first iteration of the for loop. The remaining indirect flow blocks will never be freed. Fixes: 1fac52da5942 ("net: flow_offload: consolidate indirect flow_block infrastructure") CC: Pablo Neira Ayuso Signed-off-by: Chris Mi Reviewed-by: Roi Dayan Signed-off-by: Greg Kroah-Hartman --- net/core/flow_offload.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/net/core/flow_offload.c +++ b/net/core/flow_offload.c @@ -381,10 +381,8 @@ static void __flow_block_indr_cleanup(vo list_for_each_entry_safe(this, next, &flow_block_indr_list, indr.list) { if (this->release == release && - this->indr.cb_priv == cb_priv) { + this->indr.cb_priv == cb_priv) list_move(&this->indr.list, cleanup_list); - return; - } } }