Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2149106rdb; Tue, 3 Oct 2023 11:42:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBTrs0LwB/oWHV6g8y2p7h25ySWOBS5UhPvNCnFLP6WMnksE06QsOieyHpi7Nr0cpqWcB6 X-Received: by 2002:a17:903:2442:b0:1c4:1cd3:8068 with SMTP id l2-20020a170903244200b001c41cd38068mr5719793pls.5.1696358562090; Tue, 03 Oct 2023 11:42:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696358562; cv=none; d=google.com; s=arc-20160816; b=QsK9f7BIh058GH1KYepM6gKHqnn1UTZim2nxDQr3YqxU6oMc/j2A9TC+cEEWqDyyhf 59xUlNuwNh01l9A157J8I9aKrwNgrRThqEQIi0uk/tq9+L5XkfWuDFDVB0s44adwx4Bz xmZ+0Tn1V+Dyqia0J6VtLWTOXO8tlNqwiTi6ShNpD+kmuH56ZyihF+tEJO7SA7GnEMXz 9GivVUQBdJCZVKv3J1DB3ZrE/hNWAUqbaFmT1torDYF1faQTxUlTwvcZMYt9PPGg0L/R ZbPpqe4EyC/S6MOLr6FSCEcl6EJ+sEgcHPd7zxuVKXPgm6VO031T5Y/r4TaX3nfBqlyv P2Xw== 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 :message-id:date:subject:to:from:dkim-signature; bh=GO3ja3uFisK+FzEXEk75vV1dEsOVFg1hwNYC0RSfqq4=; fh=4lGQI6056MBa4/oovMyIYaKLn+Wz/24RGvUivMmQP8E=; b=wGCrlIsm0Vf4hKtHG/NAz5YJaatT1MzWSJZ4+3XeVRbElOhmy9VvFjZ5EVEpGkE8xj N9SqWlNENU+xC88VRkSL079IyJKwSMH2QnX2zR/n82sWvstNsCaKPyl2JKZFFZgDB/Jt I+i1hH/qH2koteIxuoRaxa8lEBuvxRPlC9N0EdEObo34+C6aqr2SBYqrzhIYk/Z9GPgO gU/lUCKPAh93ithbO4XCDnOxrD07UOZlKw6uUqHdSA1FPHlYx8PXHIIc4pha/2rSqHo5 Dkr6NMCfFr/XbzgLpMpRHr28KM2CElzc5d1YbyWvNqGXACFL1uwAN3AqOTNjFdy4P8Eu ci8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jobn2hhL; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id d11-20020a170902cecb00b001b8a67f1c10si2218082plg.468.2023.10.03.11.42.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 11:42:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jobn2hhL; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 280D281972E3; Tue, 3 Oct 2023 11:42:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231534AbjJCSm3 (ORCPT + 99 others); Tue, 3 Oct 2023 14:42:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231467AbjJCSm2 (ORCPT ); Tue, 3 Oct 2023 14:42:28 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA82E83 for ; Tue, 3 Oct 2023 11:42:25 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-692d2e8c003so88464b3a.1 for ; Tue, 03 Oct 2023 11:42:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696358544; x=1696963344; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=GO3ja3uFisK+FzEXEk75vV1dEsOVFg1hwNYC0RSfqq4=; b=jobn2hhLwG30cFFBHlJC97cgE0R3PI6RAuxgwEVlpBIwQCuwsLc+Ci4yQEfhiXyYob cg38M5ak4/zcBLzsChCYulzW2UbzcFRKAtfiBqAGJkmOppFQ3YiWG5dHSZkGP+0OnXyb iyYn4mwKxDFJO1rz1pW8y+I13/oVo7c9OBg+yQCoa2aeJwLWp1Doc14/A0gbr4J8rCgB 8WNH8fKqEKBoPZleuCSX/HOOLZn4a/637kmixZKoY3VAgQwmK7sQJ+b+SPXtWlrr4Mhr KoSKi+jwqqO7GFPKQ+6H+vp5aghsbU1U4zr1HOe9QxQU0B11IGn6avFjakJsn0+AgEFv 7NWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696358544; x=1696963344; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GO3ja3uFisK+FzEXEk75vV1dEsOVFg1hwNYC0RSfqq4=; b=p3uwiUvcfSsCFpdpwDhQUL27nCN6ZcU+gpuCfhQwbdtep3Yjk2MtJPs0iC0RIPs4pf gnNyuO2w04vIVe/uH4aJAF/Y7RG+7MY5YF9xgJSXuyq1LGPztnk8Pa7rWARsNA6e8yX7 27dke31qf6sD8vSgcBfOrN6Jm6Kgm69U1P7TW6Xprjc6Ue7JFO+Rqvw3BaENX00BzyDi XAaH89d3P3m0ZlStqR4yUT4LUdXIAOxLhaUCTA6FZSlYGQwSM6KdHamNMIpjBiF83URd tBvxCq1KRdXSh2ZYLldO2o8gw7O9b00bhrY80oQ4UwPfXxs9zUXMS0q8abSC/zQS818t tKlw== X-Gm-Message-State: AOJu0YyNw5tN1yvU+M+nYlYBETX+VbhTV+pxql9CsSNBcVd+SiuqSQ2H 00pFOSxlcKw2pgCSuCx+Qz+yff70SBA8GQdc X-Received: by 2002:a05:6a20:12d6:b0:13e:90aa:8c8b with SMTP id v22-20020a056a2012d600b0013e90aa8c8bmr193400pzg.4.1696358544391; Tue, 03 Oct 2023 11:42:24 -0700 (PDT) Received: from lvondent-mobl4.. (c-98-232-221-87.hsd1.or.comcast.net. [98.232.221.87]) by smtp.gmail.com with ESMTPSA id p18-20020a62ab12000000b006926a2c9eb7sm1696219pff.119.2023.10.03.11.42.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 11:42:23 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ] shared/att: Don't keep retrying the same operation Date: Tue, 3 Oct 2023 11:42:22 -0700 Message-ID: <20231003184222.3273301-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 03 Oct 2023 11:42:38 -0700 (PDT) From: Luiz Augusto von Dentz If an operation has been retried already don't attempt to change the security again. --- src/shared/att.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/shared/att.c b/src/shared/att.c index 85feead77d0f..62c884b65721 100644 --- a/src/shared/att.c +++ b/src/shared/att.c @@ -193,6 +193,7 @@ struct att_send_op { uint8_t opcode; void *pdu; uint16_t len; + bool retry; bt_att_response_func_t callback; bt_att_destroy_func_t destroy; void *user_data; @@ -785,6 +786,12 @@ static bool handle_error_rsp(struct bt_att_chan *chan, uint8_t *pdu, *opcode = rsp->opcode; + /* If operation has already been marked as retry don't attempt to change + * the security again. + */ + if (op->retry) + return false; + /* Attempt to change security */ if (!change_security(chan, rsp->ecode)) return false; @@ -798,6 +805,7 @@ static bool handle_error_rsp(struct bt_att_chan *chan, uint8_t *pdu, DBG(att, "(chan %p) Retrying operation %p", chan, op); chan->pending_req = NULL; + op->retry = true; /* Push operation back to channel queue */ return queue_push_head(chan->queue, op); -- 2.41.0