Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1600635rwd; Tue, 13 Jun 2023 11:17:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4VCalgTN83ZH7tsqfYQljMfyUawxD/Rl76hOr+AG8CdgEydL6w8QRj6XpEFxvzekWkajxI X-Received: by 2002:a05:6a20:a123:b0:10a:b812:bcc7 with SMTP id q35-20020a056a20a12300b0010ab812bcc7mr15366382pzk.17.1686680222276; Tue, 13 Jun 2023 11:17:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686680222; cv=pass; d=google.com; s=arc-20160816; b=NuwrhW6NiOeCAMtzb68lwYe/EPHzGovV4QFq5DG1cD3uKce+9+VP0ynn0dfHp06U3J ua3H3ktj6u/sPudtH1QRiCayoYsg4Vc8l3055lGfayu8FNO8cJStRKwnyYvSGxzdtUD2 qNhzTpJUEMjjrM4iMSmWs97ic8q9NNX1yn0cSljDu7htzjVFQhmyPWA4yYQSjCix+Imu hQ9st6A6IiG8EuafhEiCLvOCdWtzynG0Tgs19cYSp3TNL1uS2HULbdX3f8b9atzjHsnd 0cJ8oaJI9/Xe8e0+3RtLegF1I8Nn8h/jNHYClcfz1u3cLr4GXZKn2TUp3Y0BT8y5qLtW 3cHA== ARC-Message-Signature: i=2; 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:cc:to:from:dkim-signature; bh=y+NAgyxen7eId9gMkPBhizWri1SMI0z/15SuxX1GiM0=; b=I9KvQt++pbLYoQdaItKr5Koa4JmaWASbnTH471KxTSgvUYZWsAkyrfUvXnC5rKo/Z4 tRwldDlUxc8v2Tel54Vp/iCyT4lillFavpwCixFmf7Xxq6G5kEBCsAvUaq/QrXwy4W/C 5sdufsPRUNuzS+dZ0F12wPsC+vOx8hLLyGR2AcZbxe+cEOtLoOR5M8CbTWgrYZDRO5rC vcj3TyMeSbPlo4uDtoKF+igjQSE26gP4Kd2xJk6Aww2HY6XNO0SsmbUxmhXtyTypeBhN +aOgu2xzE8zYXfzWzgsKODStvO8Zvss0iPNVE1wbjdtyuSNqANlSYHoKqACfCeR0/wvD OldQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@iki.fi header.s=meesny header.b=i85ufTrA; arc=pass (i=1); 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 y4-20020aa793c4000000b0064d2c1fb45dsi9340245pff.154.2023.06.13.11.16.34; Tue, 13 Jun 2023 11:17:02 -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; dkim=pass header.i=@iki.fi header.s=meesny header.b=i85ufTrA; arc=pass (i=1); 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 S231289AbjFMSGQ (ORCPT + 99 others); Tue, 13 Jun 2023 14:06:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229998AbjFMSGP (ORCPT ); Tue, 13 Jun 2023 14:06:15 -0400 Received: from meesny.iki.fi (meesny.iki.fi [195.140.195.201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFEA319A7 for ; Tue, 13 Jun 2023 11:06:10 -0700 (PDT) Received: from monolith.lan (91-152-120-101.elisa-laajakaista.fi [91.152.120.101]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pav) by meesny.iki.fi (Postfix) with ESMTPSA id 4Qgc1W5WJXzyR6; Tue, 13 Jun 2023 21:06:07 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1686679567; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=y+NAgyxen7eId9gMkPBhizWri1SMI0z/15SuxX1GiM0=; b=i85ufTrAu6D5RpP2Lht7lkGdfYa6h8C5vOG5fU5ErMROmjd90ovknWALSJauOHGousPHH+ jV5hkbDXBU2ibUBtR0Yo9GFVQ37/Zz2zjssteo0v2O/szKcOXSbnDqsJUSz/ZVZsTBMf9j FrL0mbM4lqXmF3TooFQwNUGr5aShOV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1686679567; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=y+NAgyxen7eId9gMkPBhizWri1SMI0z/15SuxX1GiM0=; b=EMF2vuO1JXyQnk/VCKnDWTIEiTm3oPF+osC00brzpYL837Z4xGkCgsHJYCDaDQhZcTI5fN MWmoD8sSn7C7YzyqGDYmIdYvhcrGbsw/Kj3jOtOR9G4GIl3xLdOefqpWLylBXRnGVVmG/E Sf7VR1TY+z2Uk0sTJWWb2ncngP0PQsY= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=pav smtp.mailfrom=pav@iki.fi ARC-Seal: i=1; s=meesny; d=iki.fi; t=1686679567; a=rsa-sha256; cv=none; b=BK+kqM5bHgJRLEDnqHSwMMZzoUdSwhY0bsuBuYa/X0uLeY/SZEaOIWeHN9sKz7SMWlHX3L H1h5CGbdHSd10dsJB5yanDi77rCti+FZGWxjS8gomVJ3jeEwjKreWTV4cmw2IhzEbWlf7N F6jH5WkeqagAxUs2fdN0sNNvAgh9Lxk= From: Pauli Virtanen To: linux-bluetooth@vger.kernel.org Cc: Pauli Virtanen Subject: [PATCH v2 0/3] Bluetooth: ISO-related concurrency fixes Date: Tue, 13 Jun 2023 21:06:01 +0300 Message-Id: X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 This series addresses some concurrency issues (NULL / GPF) in ISO sockets or related. v2: - Use RCU for the pend_le_* lists, avoid using hci_dev_lock. - Always call disconn_cfm before hci_conn_del (L2CAP also needs it). These were found while testing patches that make hci_le_set_cig_params check the validity of the configuration and return false if incorrect. This causes dropping of hci_conn just created, which apparently makes hitting race conditions easier. The test setup was primitive while true; do bluetoothctl power on; sleep 12; bluetoothctl power off; sleep 1.5; bluetoothctl power off; sleep 2.5; done; while true; do sudo systemctl restart bluetooth; sleep 110; done while true; do systemctl --user restart pipewire wireplumber pipewire-pulse; sleep 91; done while true; do paplay sample.flac & sleep 2; kill %1; sleep 0.7; done and equivalent operations manually, on VM + connect to TWS earbuds. This eventually hit the NULL / GFP errors here, but they are hard to reproduce aside from the first one that appears in iso-tester. Pauli Virtanen (3): Bluetooth: use RCU for hci_conn_params and iterate safely in hci_sync Bluetooth: hci_event: call disconnect callback before deleting conn Bluetooth: ISO: fix iso_conn related locking and validity issues include/net/bluetooth/hci_core.h | 5 ++ net/bluetooth/hci_conn.c | 9 ++-- net/bluetooth/hci_core.c | 34 +++++++++--- net/bluetooth/hci_event.c | 15 +++--- net/bluetooth/hci_sync.c | 93 ++++++++++++++++++++++++++++---- net/bluetooth/iso.c | 53 ++++++++++-------- net/bluetooth/mgmt.c | 30 +++++------ 7 files changed, 175 insertions(+), 64 deletions(-) -- 2.40.1