Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1693652pxm; Thu, 24 Feb 2022 07:45:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJwhDmqSnn8zyIEwyKm46UgceYP98nqwxTiJ31zX0lmYh/H76L7Qtjh6MqD0vUh3j1VjjpCd X-Received: by 2002:a17:906:8244:b0:6ce:7070:b485 with SMTP id f4-20020a170906824400b006ce7070b485mr2766245ejx.347.1645717527394; Thu, 24 Feb 2022 07:45:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645717527; cv=none; d=google.com; s=arc-20160816; b=xb3/QbUFSeDbe42zHwf43ZaCxMhsOKSN9fBlsOBAJJ3Pv8FzItjyfFWux1ZuLErbyi Hk/2zqvHh6XK0g66ew1qwl/eIwncwbO0I9fb1zYMbf1LsWwwOiIRUBq51a0zh6uRv7zj xf0ESFqRkngMxAnpCkw+JYtTOLMNj5cPmyu0t2qaOPS3626FN/Desv0u1j1OxnemL3Fu lbuBH8y6XFatjTElwSZQX+WKOEVN5F3nzXbAYNRJJgESy8niVzvzzgragDZF0WguT9sA T9KlQhH3bpmhtAOdlRSjQI1hVrY7jrvm77QY9C6HsJQQN2OrNy/tYTtFAXMf47XDutQ9 RkUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=RDh0L+2x81G5kCtNhzDMsI4ztK2YB/ueAnFHNn5k2aU=; b=TLhfovbUos51icKEoh8gowuEYmzIdeEw5t9RO0Q458Dl3BYVH4Y+xPi5raPpc3ZVFq X4P1kdy3jzKhCuNeVfIpZD/OU8GrdHjQpokL5kZ2nGmhAO77Y6HgqbrfIJaNQdChVQ27 3001MpU3wf8arI74s1XtsSIKBvWry530DOn9fbs7HMURR+EnGLnoyd8R7ZVtnW0dzZda nvebWmMl5jh3m3LXx4zsF6puAZ7Rpb3IPGHH2gZt3BidtMFaYOgZQTCuutbmS+DQkUKT +WDaIe9DT/u0wg8PiAmVmoS1QXvXfiBJ50kuk9OOChwuOKsFG06HSlhbhDjwyryNLfZD Yb0Q== 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 qo14si1684671ejb.870.2022.02.24.07.44.49; Thu, 24 Feb 2022 07:45: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; 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 S233464AbiBXN2m convert rfc822-to-8bit (ORCPT + 99 others); Thu, 24 Feb 2022 08:28:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231328AbiBXN2m (ORCPT ); Thu, 24 Feb 2022 08:28:42 -0500 Received: from mail.holtmann.org (coyote.holtmann.net [212.227.132.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CD3AEB0E85 for ; Thu, 24 Feb 2022 05:28:10 -0800 (PST) Received: from smtpclient.apple (p4fefc101.dip0.t-ipconnect.de [79.239.193.1]) by mail.holtmann.org (Postfix) with ESMTPSA id C2D79CED15; Thu, 24 Feb 2022 14:28:09 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.60.0.1.1\)) Subject: Re: [PATCH] Bluetooth: fix incorrect nonblock bitmask in bt_sock_wait_ready() From: Marcel Holtmann In-Reply-To: <20220224100641.2449550-1-gavin@matician.com> Date: Thu, 24 Feb 2022 14:28:09 +0100 Cc: Johan Hedberg , Luiz Augusto von Dentz , linux-bluetooth@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: <71D25C8F-67D1-4EC0-9160-5F61C832F0AF@holtmann.org> References: <20220224100641.2449550-1-gavin@matician.com> To: gavin@matician.com X-Mailer: Apple Mail (2.3693.60.0.1.1) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 Hi Gavin, > 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) can we then also do s/flags/msg_flags/ then. > { > 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); Since sock_sndtimeo() is taking a bool. This might be better !!(flags & MSG_DONTWAIT). Regards Marcel