Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3764262pxb; Tue, 17 Nov 2020 03:00:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMNC2fF4A4TAzlUhYd+DzMpd+FTwUR0bZtFliR6I9NQXaFMXUFzsoSR6XXVhDBcNHe2SRe X-Received: by 2002:aa7:d48d:: with SMTP id b13mr19644967edr.264.1605610818430; Tue, 17 Nov 2020 03:00:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605610818; cv=none; d=google.com; s=arc-20160816; b=SqgYHOOfqd8n8AjEP7/CJslDDVBQgNLRqVH5XFvERFEIYvN1yJMXkqxALGl3M9Ykmw XUSBFGi34cFA1fCYvJq1j9GEyPKYuyTpinZvcymwUAtWHJ3O/1sOgUPtgMtId5FsfHiT YdUfjx5xJCAqShJSCTImHy1I+SMK6mM0i3nY2Zjob/x9XbVfPfTpj673vEWdVKtEbVxX 7TOKgoqxDXvX4Xu8WPTeJOwSQna864sqaIT/bKcwgrjyBildTCiE5l9hMf0hQyI3mb97 RKDks62n7idGRe5OLCfkiEZBMTnc81k8KDrO9bB4cSb4wOhAd6n3iGRz6v3jCPoDWIHE yInQ== 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=9LaALuj6x4QgcIQVDQ+w0kOGkJNDO4kZPs9vf+y083Y=; b=Yte40jK/qWHh4Lfy7Ua6XQke4ZYZWuo+cIlPflwf+jyIw1WIw/OwlA/ceXV37Splun vstNzd2r7/cmc/sfBGyyPc+DySG+kaymySrrjSjl/mOY5on+bz8r1/4gUVrLNV3QCiVg +MDgL3ye2MY19GscYfdtVd8510LruV+xcgAGzLQmHcdxdZfVtT9HD3OUb+Wg7+kPNTDr lM5NgqjZ5m4i3TLXnChda1vxd+sgqVOpiEeWKEnKj30Uv8kNtE9WOOaWe5LmDJdJdhOW ktx2UCFV8b91UqedJFbdSIXSJA/WI+y4kM1XN4z3z9ENU5yZV93UT69QERL1DjSzlC1Z PfFw== 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 a15si4353474edr.228.2020.11.17.02.59.37; Tue, 17 Nov 2020 03:00:18 -0800 (PST) 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 S1725355AbgKQK7g (ORCPT + 99 others); Tue, 17 Nov 2020 05:59:36 -0500 Received: from mslow2.mail.gandi.net ([217.70.178.242]:34028 "EHLO mslow2.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725774AbgKQK7g (ORCPT ); Tue, 17 Nov 2020 05:59:36 -0500 Received: from relay9-d.mail.gandi.net (unknown [217.70.183.199]) by mslow2.mail.gandi.net (Postfix) with ESMTP id 237353B5425 for ; Tue, 17 Nov 2020 10:51:57 +0000 (UTC) X-Originating-IP: 82.255.60.242 Received: from [192.168.0.28] (lns-bzn-39-82-255-60-242.adsl.proxad.net [82.255.60.242]) (Authenticated sender: hadess@hadess.net) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 26AC7FF812; Tue, 17 Nov 2020 10:51:34 +0000 (UTC) Message-ID: Subject: Re: [PATCH BlueZ v2 7/7] battery: Implement Battery Provider API From: Bastien Nocera To: Sonny Sasaka , linux-bluetooth@vger.kernel.org Cc: Miao-chen Chou Date: Tue, 17 Nov 2020 11:51:34 +0100 In-Reply-To: <20201111011745.2016-7-sonnysasaka@chromium.org> References: <20201111011745.2016-1-sonnysasaka@chromium.org> <20201111011745.2016-7-sonnysasaka@chromium.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.1 (3.38.1-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hey Sonny, On Tue, 2020-11-10 at 17:17 -0800, Sonny Sasaka wrote: > This patch implements the BatteryProvider1 and > BatteryProviderManager1 > API. This is a means for external clients to feed battery information > to > BlueZ if they handle some profile and can decode battery reporting. > > The battery information is then exposed externally via the existing > Battery1 interface. UI components can consume this API to display > Bluetooth peripherals' battery via a unified BlueZ API. Was this patch reviewed for potential security problems? From the top of my head, the possible problems would be: - I don't see any filters on which user could register battery providers, so on a multi user system, you could have a user logged in via SSH squatting all the battery providers, while the user "at the console" can't have their own providers. Also, what happens if the user at the console changes (fast user switching)? - It looks like battery providers don't check for paired, trusted or even connected devices, so I would be able to create nearly unbound number of battery providers depending on how big the cache for "seen" devices is. Given that the interface between upower and bluez is supposedly trusted, it might be good to ensure that there are no fuzzing problems on the bluez API side that could translate to causing problems in upower itself. I didn't review the code in depth, but, having written this mechanism for Bluetooth battery reporting, I think that this is the right way to go to allow daemons like pulseaudio to report battery status. Cheers