Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp116349pxj; Mon, 17 May 2021 22:37:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNA65zaO1c/shHok4Q0y5rGIzPUewPMKBZqPvhtb3eLIUuPs7HB4LwcOgKocN0Y/80mkAg X-Received: by 2002:a9d:7315:: with SMTP id e21mr2826859otk.288.1621316279671; Mon, 17 May 2021 22:37:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621316279; cv=none; d=google.com; s=arc-20160816; b=lXqXepo3k+vtnF7jB31uqgyQ/xYATSvFobI5JcjhUK+2IsI7QPawlXjoyAHoGPB1Bw P8GeOfuwWILP79tMLnNIarx/yGj12ccxuWH44kdOACL6cZD5ILoOVh4r7iZMTE06qqto GyjLT1KetxSaSYCsBz/qwX+CBzvFlT5RsTE2sBBBTturtKxbhjpX2+6WygC1ZZ2AIkmh 9Rx9+CZZe7Jlag+S8w04iHVCQJLQy0+jSi45yD9dUUx/hlGksvWNs4ooO8eNrtUJksVH pYxR1s9EMXUkLy9iAQQVBoeWfmMPDaA7rF4dueO49F/L02twWY7J6bzFUQqFXgl68Fcj MF4w== 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=W+KG/27lPCmqZsAiUkgUwM7uAPDTr6rS/pnKUkYlrqo=; b=PT1pet4eb8PkNTLXJ6LB5px0lVDMyDLDUAlkEfGmGGbgIX5LLVhSESB3PhtSBeCdQo 2PN/kc73Tr1VJ4+62uweJu75lRw9+oZ7Dob+cBv+wG/iV0Rzu99TtzDbJqmdmbpbb9Kc 9Oul9sVck3YMX2hESoSLnDs9M1JKLx3+YZLIYQxXQQdFUd8p0A7LlZtxPTB4ing2rHa2 3mQKqyI0hrqllV5Oa2oP8Dkkrzs2eNbUZMDdAX40aZng4xKFXk2gZL6YCh1r0JgerJbh 77+6zWihrHFtWtf/Q30VJEAnRTiI85ZPWZh3o/d4seq2uDX7I97BGUB2cPA/bdbz74XK jLdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k2eIrzAG; 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 l21si23917777iow.25.2021.05.17.22.37.47; Mon, 17 May 2021 22:37:59 -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=k2eIrzAG; 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 S241171AbhEQOrk (ORCPT + 99 others); Mon, 17 May 2021 10:47:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:34044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241055AbhEQOjW (ORCPT ); Mon, 17 May 2021 10:39:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DF17961360; Mon, 17 May 2021 14:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621261113; bh=whOO/qEGOEz7yoV6ZAmhRiWRqssU/z4LEZFhx831jh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k2eIrzAGF/uVsynyYpml9qiwgELG5xf1+whDI6Issq+LztFTdR85r+Tjxc8GLbiLE ifF0PgV/tUxBht+Epmrz0SoxkNtHvSGCZor7tSmrvkCjKAZ89eDGttqNMogtBb5sbC Ezr02tAslDbQun4JvTjHRvcWleoox8ZgpOlFAxk8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miao-chen Chou , Daniel Winkler , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.11 049/329] Bluetooth: Do not set cur_adv_instance in adv param MGMT request Date: Mon, 17 May 2021 15:59:20 +0200 Message-Id: <20210517140303.711455823@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.043055203@linuxfoundation.org> References: <20210517140302.043055203@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: Daniel Winkler [ Upstream commit b6f1b79deabd32f89adbf24ef7b30f82d029808a ] We set hdev->cur_adv_instance in the adv param MGMT request to allow the callback to the hci param request to set the tx power to the correct instance. Now that the callbacks use the advertising handle from the hci request (as they should), this workaround is no longer necessary. Furthermore, this change resolves a race condition that is more prevalent when using the extended advertising MGMT calls - if hdev->cur_adv_instance is set in the params request, then when the data request is called, we believe our new instance is already active. This treats it as an update and immediately schedules the instance with the controller, which has a potential race with the software rotation adv update. By not setting hdev->cur_adv_instance too early, the new instance is queued as it should be, to be used when the rotation comes around again. This change is tested on harrison peak to confirm that it resolves the race condition on registration, and that there is no regression in single- and multi-advertising automated tests. Reviewed-by: Miao-chen Chou Signed-off-by: Daniel Winkler Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- net/bluetooth/mgmt.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index fa0f7a4a1d2f..01e143c2bbc0 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -7768,7 +7768,6 @@ static int add_ext_adv_params(struct sock *sk, struct hci_dev *hdev, goto unlock; } - hdev->cur_adv_instance = cp->instance; /* Submit request for advertising params if ext adv available */ if (ext_adv_capable(hdev)) { hci_req_init(&req, hdev); -- 2.30.2