Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2110958lkv; Thu, 20 May 2021 03:40:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztG/LEm11Z5rmMfI2mZxtrKJfSvWsSCA0xOyujg7I3vg4z10k8o8zln0tX4D/BnNPQhllY X-Received: by 2002:a05:6602:2f0f:: with SMTP id q15mr4913720iow.75.1621507222511; Thu, 20 May 2021 03:40:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621507222; cv=none; d=google.com; s=arc-20160816; b=SnlPVplgNq6U1rAFtoDUYre18HPo24Dt31rIOPPXJpgB3MIuMts0cHrF1I2jldB9TA RSCrDuTcGPaB74YtkTvtkJRnEidUvBVv6jHL0dshzz8UKsukvdTppyVNuiMIEK8nP/yb 52svzkvT92gBQwER3olPTNmSL1bTj9UMiPoRR89spx5qp80GkUBT56mwYMrueZnZZAko mvUzQzCd0sEkDF/1JNI7R4+X4JM0b6HNL+oM1UhQsqlnzlYhuF7rHVmcq4Hw/EGxGQqv Hb1qayvcojptVNnE/YemYcSDBOQy/aIlJiYHxFyoGJkBMTS0JjbIdlztlhU38PsP0TIB tkbA== 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:dkim-signature; bh=qI1GS3bnuPkI7vrA09MyqGj8McnLN5uhFCWr/5KNYJg=; b=gGpHGdNBEkn49Wrk3lkZ93mjq9Ox/PlFt++w/oS7gw1XiQxfrDGiR1dvsX2/lyhbhh 8JdT7jvsTEDNFFUdrlNG4B7W2XOZ5hWNF5GrMLAoJONSADTSYvlaAdzJ1Mi7VWmDFOPE ApEhN4zNVhsuU4I1pKE6RWBeRS6jYin/BRLz+23xfqCfsdAUB7v1Oj93RfEak8D9w8kN 3Ion8Ekz60Gx+EIeId0TzKWfDanH32+bFJHRIM5uWFDUxst+O1IrBNveLfOdbgpldeyS 8HajiqEZeWMsCRMLO2yxjGcv9i7iI7ZCP12nBopUM4tQvjJd9GvP5PjrKj3Cxx8GUVFn +gOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zgqJDaFY; 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=pass (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 q3si2781365ilu.88.2021.05.20.03.39.58; Thu, 20 May 2021 03:40:22 -0700 (PDT) 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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zgqJDaFY; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236345AbhETKkF (ORCPT + 99 others); Thu, 20 May 2021 06:40:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:55262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236878AbhETKYq (ORCPT ); Thu, 20 May 2021 06:24:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 711C361C20; Thu, 20 May 2021 09:49:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504177; bh=2OFEFhZvvKtVnblOzPMYqZpF2THEz+RSlttyH2tDJH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zgqJDaFY3M/ENITSNP4p8DIh0MglxV4ZkO5ZDXwCLPoqd4sb+M5ufkwZyToT4Am9i YX8RryFe8HC6B1flp28Deji0Bc67kayMjeiZtvWXsKP1sy4bl4sQjYGuVkUgekdnhM 8EZ+XhBIRblGFkoyii2+/Nx2xeox4ZfBGODa2zn0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Johannes Berg Subject: [PATCH 4.14 126/323] cfg80211: scan: drop entry from hidden_list on overflow Date: Thu, 20 May 2021 11:20:18 +0200 Message-Id: <20210520092124.423228575@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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: Johannes Berg commit 010bfbe768f7ecc876ffba92db30432de4997e2a upstream. If we overflow the maximum number of BSS entries and free the new entry, drop it from any hidden_list that it may have been added to in the code above or in cfg80211_combine_bsses(). Reported-by: Dan Carpenter Link: https://lore.kernel.org/r/20210416094212.5de7d1676ad7.Ied283b0bc5f504845e7d6ab90626bdfa68bb3dc0@changeid Cc: stable@vger.kernel.org Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- net/wireless/scan.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -1033,6 +1033,8 @@ cfg80211_bss_update(struct cfg80211_regi if (rdev->bss_entries >= bss_entries_limit && !cfg80211_bss_expire_oldest(rdev)) { + if (!list_empty(&new->hidden_list)) + list_del(&new->hidden_list); kfree(new); goto drop; }