Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1076939rwb; Thu, 6 Oct 2022 08:11:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7wbzc0xE+/Xao59/5/eOHsojg+m7fYmn4czsmO4SzwmgrWnqT6WeG0cEtLlJfPtV8jKLMS X-Received: by 2002:a17:906:db02:b0:780:24e:cf9 with SMTP id xj2-20020a170906db0200b00780024e0cf9mr279829ejb.460.1665069095039; Thu, 06 Oct 2022 08:11:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665069095; cv=none; d=google.com; s=arc-20160816; b=WxlxPlpsBEGoPLoCJisYQFwllHhz6643cn+kjnV4bnBwUmsJ4OXsxifeldg8H10QJd 7N3LHUPsra3Or3F8IUsdFu8nIzm5gsGUwsHOTDvI2JaFgjOjuFLx72sqnEf5CgZ9fYDL hlBYA1gLjfRGvFEsz/UYDB3YYcV0kIhUwuCwybgPKGn8HTECWcxhYOQbAhKeGp9EvrZl vJA8MJphmgqZcP9FxacKT/l8/TW0VOMGFgS45ngALUuwGnF6gCsKug97K8JKLYtDBxkg P2aRZJkSp19t8UgOtiZMIT9ARosW1egAHAP/eqPndDVgfKEAOLmzvSaFRoScta9L/iNU H/FQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=qUnKEhT63F/iTIUWfBiUMyr6hZVjQ16bcvr9v3T+NPk=; b=urtBb2pVf7ymBpxZQHsXgdax4oi+ccsrqpQf5EiRSJed1om9we9mLmhe2qSS4tIW3n tT1nTIB4hc7t+BE/HXa0TQQYKVzLNWXReKqvraSD+OyhaGBmJgwkenSg1+xxG+Hb7GLj pwAUAV9fKx7/72L+LDsDlh+8J3ijlTSDKATroAGkDbqsS46MB1UliDS5ot7mQvc67JRa EciwVdDEJ04ofgbHVq7K7+C7gTMGmQyILNPXozDjdNW56tC9gwpgCDuSvN8NGdIR7WdN 8HOF9M7optIBLx8NJFXGa/zqCGcp47pWlIabp3vQvh87q6UYEqWHXiBI8GBvrw6kJ2rg 50jQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e19-20020a056402149300b00458cba4c78bsi12488722edv.416.2022.10.06.08.10.58; Thu, 06 Oct 2022 08:11:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231803AbiJFPAH (ORCPT + 99 others); Thu, 6 Oct 2022 11:00:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229496AbiJFO77 (ORCPT ); Thu, 6 Oct 2022 10:59:59 -0400 Received: from voyager.loytec.com (voyager.loytec.com [88.198.4.4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C72711C40F for ; Thu, 6 Oct 2022 07:59:54 -0700 (PDT) Received: from 212-17-98-152.static.upcbusiness.at ([212.17.98.152] helo=lexx.office.loytec.com) by voyager.loytec.com with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ogSLo-0006re-2Y for linux-bluetooth@vger.kernel.org; Thu, 06 Oct 2022 16:59:52 +0200 Received: from loytec-dev-vm.delta.corp ([10.101.25.21]) by lexx.office.loytec.com (8.15.2/8.15.2/Some OS 1.2.3-4.5) with ESMTP id 296ExnRI4163430; Thu, 6 Oct 2022 16:59:49 +0200 From: Isak Westin To: linux-bluetooth@vger.kernel.org Cc: Isak Westin Subject: [PATCH BlueZ 6/6] mesh: Fix msg cache ring buffer Date: Thu, 6 Oct 2022 16:59:27 +0200 Message-Id: <20221006145927.32731-7-isak.westin@loytec.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20221006145927.32731-1-isak.westin@loytec.com> References: <20221006145927.32731-1-isak.westin@loytec.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 212.17.98.152 X-SA-Exim-Mail-From: isak.westin@loytec.com X-SA-Exim-Scanned: No (on voyager.loytec.com); SAEximRunCond expanded to false X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org The message cache should be a strict ring buffer, suppressed message should not move to the front of the queue. --- mesh/net.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mesh/net.c b/mesh/net.c index e95ae5114..8be45e61a 100644 --- a/mesh/net.c +++ b/mesh/net.c @@ -1028,12 +1028,11 @@ static bool msg_in_cache(struct mesh_net *net, uint16_t src, uint32_t seq, .mic = mic, }; - msg = l_queue_remove_if(net->msg_cache, match_cache, &tst); + msg = l_queue_find(net->msg_cache, match_cache, &tst); if (msg) { l_debug("Supressing duplicate %4.4x + %6.6x + %8.8x", src, seq, mic); - l_queue_push_head(net->msg_cache, msg); return true; } -- 2.20.1