Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1610519pxm; Thu, 24 Feb 2022 06:25:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzW1pywhRBlOvtbjRV+jksjh7oztG9D5kF36bHdjAzfE9pKdHuQNKaMylii2a7aJuJ6ibob X-Received: by 2002:a17:902:ccc8:b0:14e:e89c:c688 with SMTP id z8-20020a170902ccc800b0014ee89cc688mr3068082ple.121.1645712727691; Thu, 24 Feb 2022 06:25:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645712727; cv=none; d=google.com; s=arc-20160816; b=uoZKGxFDMQZoktNIauZ5J4rrmblrBNoc19Pv7OUjELtsXYQ7x/gZ7CnhnLBOrAQcIy ahu5CMEg097zoVv4e5UUjdYMHBwO6GtW4eNwPWi3lPh9zGfQ6fU5KYPInYetp2A4E3I0 e4vb2RkY7uriDftItIT0lEQ9dh19bIh3hrtGVA/YMVE5mnmHFU4GwKGWzznL+0Bh7A5S EwDI54R0cymlxLpvfV3hXmmG8HizaAZnmdRP48kc2PKDKPJr7ZLeX18kkkSU7jEMXoqV hF5HKqqifgR7407OP80xH+mLqbJc+cKCu26ucuqkMgM4WiWpg1gh1o6hG8Uy4cwT7eTP yCgQ== 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:cc:to:from:dkim-signature; bh=xBqvho+whDOFUprZBfh/FlTaGfzYbzGv44LqXg6OZyk=; b=KWWr1eI+ynFZx8zA85glRYQzCWhI2733AbtibmgI75Khbfobhd0To2xoC/rtYfuG0u czMNaeEFaqr9m5zMtE99a2SsDzJE7x7VAWFH/DZSc1lYHQb4g7sGk+qpK1pvXCVaQDZJ LuEhBjhqd6By0G4LENCUxaDMDWZfOKbSQwBIubpH9kj4nN/6g9YFXDnvej3Er5RvuCE7 NbE75qgk4g5OTstnDyMuW5ReqL4nWvJpXc4DsEWo8FciDG6LYxmSV88LZRUxNE0vxNHX 3UL6nMzVNL1b4E0vVrneT2/cYMzSbbAa0ypW46w74iTuL6ig7e2j6AI0DKahDrpIYlA0 kO+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@matician-com.20210112.gappssmtp.com header.s=20210112 header.b=ZxWBiVHY; 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 y10si2530625plp.102.2022.02.24.06.24.48; Thu, 24 Feb 2022 06:25:27 -0800 (PST) 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=@matician-com.20210112.gappssmtp.com header.s=20210112 header.b=ZxWBiVHY; 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 S233169AbiBXKHW (ORCPT + 99 others); Thu, 24 Feb 2022 05:07:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233157AbiBXKHN (ORCPT ); Thu, 24 Feb 2022 05:07:13 -0500 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 809182FFFB for ; Thu, 24 Feb 2022 02:06:43 -0800 (PST) Received: by mail-pf1-x433.google.com with SMTP id d17so1479692pfl.0 for ; Thu, 24 Feb 2022 02:06:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=matician-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xBqvho+whDOFUprZBfh/FlTaGfzYbzGv44LqXg6OZyk=; b=ZxWBiVHYP3wHFTlORGloxO3rJ0vVgDUEVkz7sOzMBkV5egX/c+uuWF4iI7OGSgYqkY X9W4UmsM7VZyHgsEuKSJ/vXS9Fm+GzOHplH0QDr8udnwrNYuZrAq8xXTRPe8WReEyJLc /6Dw5bD/PjpX9VMChyZHNPFBae8oDUXe7Q9uw792NdQbXhWD3K0yzP/rGDlVvFAwzWJv 3wpZ7TUoMe1NUPVsaoHVR/h/Bmb+D6P1hGbCszZ256sCAnY6NxEz8QSMJk6tz11fJtQz EVVgYXAQIPy5W8m8nHCtsSQ8U0JVSiH3+nQNE5+D+ZwiQc5/l9Y3ZmfKWcnAvDUbhb7U xkcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xBqvho+whDOFUprZBfh/FlTaGfzYbzGv44LqXg6OZyk=; b=oZtxvkrunC52VxHqCCovFK7N2SU+mMH1kl/TQCG8gqOlVJOvXl8Z4ihxCUWadJo67v FMYQavQTK5ORgJArWlENY9cscHE6g27toN8nSg2bnTH3+nqM7pO/ohQveOAx6P/tCokS BCBwII4XWCCzTf7CYZgFYlgsn6gHSZnr8jO/v5iRu9Bw8kATMR/1T8HzsDKWxkH5cR1i dG67q+BZBMu+JEfrKCCD6Uf8/vSjipqKMQdoefWhNdiOTj5G6tBo+GBkpKXQPNyZqdbP LnZlgjEDypeX8Ov+6bMaymXnLUahpB+H/IL2cHeIeNQTpYzkNMUuaRxf7RWkdxZxFxTV Ey/A== X-Gm-Message-State: AOAM531PjP7geglxA11lmLgbgt5v7B69qFhP/7DJ7uI90iBAoiC6mQPo FRn0W9RJsbJsa5BqPIIGkz6Uxg== X-Received: by 2002:a63:9dc3:0:b0:373:5fac:6063 with SMTP id i186-20020a639dc3000000b003735fac6063mr1678845pgd.531.1645697202960; Thu, 24 Feb 2022 02:06:42 -0800 (PST) Received: from mtgav.corp.matician.com ([38.88.246.146]) by smtp.gmail.com with ESMTPSA id u18sm834613pge.91.2022.02.24.02.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 02:06:42 -0800 (PST) From: gavin@matician.com To: Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Cc: linux-bluetooth@vger.kernel.org, Gavin Li Subject: [PATCH] Bluetooth: fix incorrect nonblock bitmask in bt_sock_wait_ready() Date: Thu, 24 Feb 2022 02:06:41 -0800 Message-Id: <20220224100641.2449550-1-gavin@matician.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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 From: Gavin Li Callers pass msg->msg_flags as flags, which contains MSG_DONTWAIT instead of O_NONBLOCK. Signed-off-by: Gavin Li --- include/net/bluetooth/bluetooth.h | 2 +- net/bluetooth/af_bluetooth.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index a647e5fabdbd6..87f0bba39b0f7 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h @@ -343,7 +343,7 @@ int bt_sock_stream_recvmsg(struct socket *sock, struct msghdr *msg, __poll_t bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait); int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo); -int bt_sock_wait_ready(struct sock *sk, unsigned long flags); +int bt_sock_wait_ready(struct sock *sk, unsigned int flags); void bt_accept_enqueue(struct sock *parent, struct sock *sk, bool bh); void bt_accept_unlink(struct sock *sk); diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index ee319779781e6..69374321130e4 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c @@ -568,7 +568,7 @@ int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo) EXPORT_SYMBOL(bt_sock_wait_state); /* This function expects the sk lock to be held when called */ -int bt_sock_wait_ready(struct sock *sk, unsigned long flags) +int bt_sock_wait_ready(struct sock *sk, unsigned int flags) { DECLARE_WAITQUEUE(wait, current); unsigned long timeo; @@ -576,7 +576,7 @@ int bt_sock_wait_ready(struct sock *sk, unsigned long flags) BT_DBG("sk %p", sk); - timeo = sock_sndtimeo(sk, flags & O_NONBLOCK); + timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); add_wait_queue(sk_sleep(sk), &wait); set_current_state(TASK_INTERRUPTIBLE); -- 2.34.1