Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1978506pxm; Thu, 24 Feb 2022 13:28:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQvl1hUGXI84TAGlZ/bnDC4rhmMWaMGTFUi7R6QeNPJfQoSCi8h3L4uvUxnMT8PzaLhvLQ X-Received: by 2002:a17:903:2406:b0:14d:6447:990c with SMTP id e6-20020a170903240600b0014d6447990cmr4516239plo.22.1645738091807; Thu, 24 Feb 2022 13:28:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645738091; cv=none; d=google.com; s=arc-20160816; b=EF5/+5COWosAsGu77oN0mFmmgpFwbh196yOn5vunxJyFoyQUhIEPw43JknWZvquZkS fxUtVqbNWWLcVin/pSRJeKbzfb9k+AQzBn8JTW/auYBRvAcXPuXOAU9A9tMxIHlSER36 5duFElbcj2LZ4kX20cm3wqzpZ7JPnffYOg7GbHz0lw5Ag7wEtnPfBDNcR7gVHF7iBxV2 TRL5N2YPhaTOIbNg9/jMP3R+srkdOIHJGL1Q+6tPW10x9P0aQQPnaf4f2di1JyssQ/Dk quZHSc4eyFn/WbVLGSfp+JchPL2xULkvXdU+WC6ScrOu63+bfdoC4kTTGfv1L0dbbYPD grTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Ua7RwfBUFGFrHt0GqPZjdl1EgU4M6MJALSN7vO8VXDw=; b=vosiXL/vGFgpTM3Qh2awcFgIoTYU40eWK5F4kIxNcTC55dON4n9fttWbHOYPNbMdHf Lxi2thx7dbLexo6hOpR/nNy5zvRs7wNRA0iFBEU59fwOGlxOOVGnKuK0L/nwiIIgm9h0 PlQPIo9exELsMiBlEayP8cGXNZPRWq1U6bnpu8t6uGGBgki9vluqwhJ3wBMNewzP8lSF D/TsS4wW7IRVQe6KHj6goDzhmRK5sSHM8V4KsJUNHky4oGMJjIcXNQjRgSG99RHsGY+g QAC+v4rNVNYIygrjuBiI3UDyrV5+lyftGayi1i7M9t/ZerK3G7mXTWbc7AVLpgIBKiLe C+Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@matician-com.20210112.gappssmtp.com header.s=20210112 header.b=OmbCixYt; 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-20020a056a00180400b004e1be9083afsi235415pfa.360.2022.02.24.13.27.38; Thu, 24 Feb 2022 13:28:11 -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=OmbCixYt; 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 S229962AbiBXU52 (ORCPT + 99 others); Thu, 24 Feb 2022 15:57:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232174AbiBXU51 (ORCPT ); Thu, 24 Feb 2022 15:57:27 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C06756D3AD for ; Thu, 24 Feb 2022 12:56:51 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id ay5so96135plb.1 for ; Thu, 24 Feb 2022 12:56:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=matician-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ua7RwfBUFGFrHt0GqPZjdl1EgU4M6MJALSN7vO8VXDw=; b=OmbCixYtk/da6/VEEnh8RrOLQG8h9T9yRj1NDOU9K+3GZohxl3eqlaDolJnyik95I5 KolpljAJ1YlpUPiDWt1BloVzC7fIP/TF+7iShOVEyYV/Pps3rPcDdY4quDkIPdPa6QYB i7qHp84123VDRfeZtgITq3QVvJCM2CMuOTc58y/uqHbtJ2IiN9Y/T/UefUkWMG5qKorg ESaAXSK90l+x6Fqxmrzwx4cNkeA3Oa6/xVsA7nx3FVFDnZZSzDkCF/07qLjJqdMo0C89 wZeNbUduw4Lyh4njRdGmFzxOUcGOn4Xtp1rXgdQYsF7O6ILLEtSvwa7bFlFW0uUm4KOn D97A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ua7RwfBUFGFrHt0GqPZjdl1EgU4M6MJALSN7vO8VXDw=; b=yBrPBpaOeplZa4/0n+4h+3LHzIehDppW+SNkomwdtXae3MbMUa2B9HkCXp81jM+M/R DWmkgupS50wgSMpPe9bagB2UUx8QFRif5FIu34lAaY7Z/mLeJnjo0jT+a75E45Tj7qPo Ga33BCa7U8bnuzuQiJ8zOY96/bEs5AtWs3zPJJAy2LKCZnRg4PADEH7mi9l2nNkGDF/6 JFCr7KXkTN4NJOyokZzNUfTc1z4ac//LJ08cwZIeAZLGsfkgwWpo6lPJDZp1AC8uFK5/ mHHHXVTJ0465FcvgH8i5k/A2iyCXGoTkqkLVOzjA3vJlfbxHqTCx3gr0uo9xsWpx4whF J8JA== X-Gm-Message-State: AOAM532ZrLuAq/aQi6rgd4DAebmhzEvOv5m/FAtVrHLK4ax3Elb6uh/U gcdd7AScnTP0EA6ahNu09akg4AKFi9D4hnZwWe15WMkyJoS80A== X-Received: by 2002:a17:902:f782:b0:14b:63db:9bc1 with SMTP id q2-20020a170902f78200b0014b63db9bc1mr4222362pln.60.1645736211087; Thu, 24 Feb 2022 12:56:51 -0800 (PST) MIME-Version: 1.0 References: <20220224100641.2449550-1-gavin@matician.com> <71D25C8F-67D1-4EC0-9160-5F61C832F0AF@holtmann.org> In-Reply-To: <71D25C8F-67D1-4EC0-9160-5F61C832F0AF@holtmann.org> From: Gavin Li Date: Thu, 24 Feb 2022 12:56:39 -0800 Message-ID: Subject: Re: [PATCH] Bluetooth: fix incorrect nonblock bitmask in bt_sock_wait_ready() To: Marcel Holtmann Cc: Johan Hedberg , Luiz Augusto von Dentz , linux-bluetooth@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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 Hi Marcel, Thanks for reviewing this quickly. > > 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. I prefer keeping it as flags because all other net code also uses flags, msg_flags only appears in msg->msg_flags. > > @@ -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). It appears to be well-known in the net code that sock_sndtimeo takes a bool, since no other uses of it do the "!!" conversion. Let me know what you think. I can make the changes if needed but I was just trying my best to match the currently existing convention. Best, Gavin