From patchwork Thu May 20 09:18:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 445743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7047C433B4 for ; Thu, 20 May 2021 09:52:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 84BB2614A7 for ; Thu, 20 May 2021 09:52:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234586AbhETJxW (ORCPT ); Thu, 20 May 2021 05:53:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:55098 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234201AbhETJvV (ORCPT ); Thu, 20 May 2021 05:51:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 171BF614A7; Thu, 20 May 2021 09:35:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503347; bh=PfdXGmhqVBBrByarCnCERALL2lUqO4JI4vzhzeQQ4Ck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PzYNg2WF2m3uSSq0rQm8lJyN6c8ul96w6GADP8UOOvxBbCdgInrzG2qgmf11WTwqW v44SXynlcSDP0nFd833gP4J3U9KfIyC19em/YfGbV1tqfT32lfq2nYjW1mLnEG0r+z BoXAFgwK6qzDG90M3y38Us/Fvg3NslzcmsVQNylM= 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.19 146/425] cfg80211: scan: drop entry from hidden_list on overflow Date: Thu, 20 May 2021 11:18:35 +0200 Message-Id: <20210520092136.224100000@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@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 @@ -1036,6 +1036,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; }