Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp489518pxj; Thu, 10 Jun 2021 05:53:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxScq4jbDEtJqaDB0m0Ek1J43xwaH7UakkmQteJJgT2ZtA4ABL70oC7MTcCLRH14RIDwm9f X-Received: by 2002:a17:906:1704:: with SMTP id c4mr4477296eje.182.1623329592503; Thu, 10 Jun 2021 05:53:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623329592; cv=none; d=google.com; s=arc-20160816; b=GVMlSf2fIZUTsp6AFrZSC8niU3ScMx99EWbBV7t74szm1sxSVjX6Plax3pco1h0vk/ JCEWnLg1weTkrEb1DgzwtoKFHLDWWFawjUtYFcTw+44DrBJuc5ortdSaKIbkIVbnrNDU oIYSrVQQaHZWQBWosIyhcPxqTcwqDcwdiqn6/1m3GlJCOvWrdWgxvQAYTVO1FyaQO4f0 f/SARcdKkFbIrbkD2lqm3baMij/lJ9W9duwPEzSjWwkdC0jq51QURvNU+9Y2B8w0gSE4 pLH6zMc4pqYJmXBvarDbNtoYfS19PE5F0XJr/cCGdn+Be3HBJishD7QJOat+mtkagPA5 syog== 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:date:cc:to:from:subject :message-id; bh=tS9uovRU9JxWRTNHJFTMXKOjd27dkCH2fbUQSBpV32w=; b=esX6nv1cgpxvuwG6e1ao8sVJc35D1RMAgx9KdIKgpXXetohNS5GSxjTUW5/v0E3RQa j8U6MPca8fw0AHTAl4fdd1iWPXx3Fyp+U1REVW6jz+OyZ60ezbhEtBT4AUAYBMZzVoHf 2ACNkZl916Q58EKm9Q/5FfWc0BQ3NJUDn5aN6EUxYjvVT9n/yzheZJgLH/xfWCWpbEnO A1jyvRpJJ1rwHCxl4kAVvZWdCt3XEq7Arh1inS0z6pCD66hyMSkDWH9eY/veuPVLx8aS bWJe8u5PE6xlwdJ4ulje9TgSkX5MlF29irI/dWBZ6iL57u2SDMjkfePO08/DnSH3ipnK JSQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id la17si2213298ejc.402.2021.06.10.05.52.47; Thu, 10 Jun 2021 05:53:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230161AbhFJMxs (ORCPT + 99 others); Thu, 10 Jun 2021 08:53:48 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:42339 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230136AbhFJMxr (ORCPT ); Thu, 10 Jun 2021 08:53:47 -0400 Received: (Authenticated sender: hadess@hadess.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 1A948E0018; Thu, 10 Jun 2021 12:51:49 +0000 (UTC) Message-ID: Subject: Re: [PATCH] rfkill: Fix reading from rfkill socket From: Bastien Nocera To: Benjamin Berg , linux-bluetooth@vger.kernel.org Cc: Benjamin Berg Date: Thu, 10 Jun 2021 14:51:49 +0200 In-Reply-To: References: <20210503131210.90066-1-benjamin@sipsolutions.net> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.1 (3.40.1-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Thu, 2021-06-10 at 14:45 +0200, Bastien Nocera wrote: > On Mon, 2021-05-03 at 15:12 +0200, Benjamin Berg wrote: > > From: Benjamin Berg > > > > The kernel will always send exactly one event, but the size of the > > passed struct will depend on the length of the submitted read() and > > the > > kernel version. i.e. the interface can be extended and we need to > > expect > > for a read to be longer than expected if we ask for it. > > > > Fix this by only requesting the needed length and explicitly check > > the > > length against the V1 version of the structure to make the code a bit > > more future proof in case the internal copy of the struct is updated > > to > > contain new fields. > > This fixes a bug in GNOME where to enable Bluetooth, we removed a soft > rfkill block on the Bluetooth interface. > > Without this, the bluetooth rfkill gets unblocked, but bluetoothd > doesn't see it as unblocked so never powers it on, causing the UI to > appear broken, as we expect Bluetooth devices to be either blocked > through rfkill, or powered on. > > The equivalent gnome-settings-daemon fix (which deals with rfkill) was > reviewed by Hans de Goede: > https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/merge_requests/234 > > Benjamin, it might be worth resending this with a better commit message > explaining exactly what it fixes and referencing the gnome-bluetooth > bug: > https://gitlab.gnome.org/GNOME/gnome-bluetooth/-/issues/38 > It's also been pushed to Fedora rawhide and Fedora 34: https://bodhi.fedoraproject.org/updates/FEDORA-2021-2cd83da751