Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1045301pxv; Thu, 1 Jul 2021 15:53:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfoqG+HlKTxymaddoE+7147QFWZZC4fdhlK8l9R7c/kBTko53iP6B4nFFX0+FMwhoE1dEm X-Received: by 2002:a05:6402:42cc:: with SMTP id i12mr2806638edc.88.1625180031141; Thu, 01 Jul 2021 15:53:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625180031; cv=none; d=google.com; s=arc-20160816; b=S3OhXNAjbYa4J1YIpadWP/MNXo1FT+wobQem28xe/H405UOGKWmx6GNuLiO5xx3DJD hbX7DG4A+kau/QOx9LmgRNODDUH2E7rtRmgHJeAdMBWi9dA7lqlIesKUOLUmiNM2Vxu/ F62R4sIkwGbT+0SXCOgkmqN7LooCRBKkh7Y/SEWkxlClIZrQjiRWZ8hDAZGTdRJFtNTZ 1XJUopkaa8fNci7NGd1ZAVcQ18fLHV8FvYwubR0y0Ui+cJVTDB49ZVQcMKRP4TLzVaI9 OA7sU+urExV72uxxSb798pZTNh5HfmuJwRKOd1wLx3uGiAhHwUuSevUtgb0zUc1+sxOD fDqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=9VFyQcYYvFG3wwO4gx9lxF3Zs7HMjQdIXDTXQZ6iPTA=; b=hRB3l1xq5YESwDyKih7hZ8swVSLYDRH/NVoQMw7UVbb/07PqS4uOxYTW36zLAkvS+W 9b/3qRv9WT7LVHYifHBk/nAy40Un4ZQEJz4XI752RYfJSVirf+mCHqfc9vEN7yaKXrMN JlTmg9f66ZXnRpxmCceH5CDmFkMDthiu2lSbTtCb6gKAor4AVogmyJH01F1m5uh3TcqJ kgF+pJHUJTFoUntbgBR53IBbgRR+vrWJcGHvb5I0F4reeLClXPhru3Jf9BaQn1qeuNYD t1uemTgbS8Gg0HpD6HcjvbOT+c+UWA1KPmb/jxDGXQ6v18VsPuBuR7snu4uR378IEV+L KuMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=l9MQv5Mn; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n22si1078061edd.43.2021.07.01.15.53.09; Thu, 01 Jul 2021 15:53:51 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=l9MQv5Mn; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233882AbhGAWxQ (ORCPT + 99 others); Thu, 1 Jul 2021 18:53:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232807AbhGAWxQ (ORCPT ); Thu, 1 Jul 2021 18:53:16 -0400 Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83949C061762 for ; Thu, 1 Jul 2021 15:50:44 -0700 (PDT) Received: by mail-yb1-xb2c.google.com with SMTP id m9so13439362ybo.5 for ; Thu, 01 Jul 2021 15:50:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=9VFyQcYYvFG3wwO4gx9lxF3Zs7HMjQdIXDTXQZ6iPTA=; b=l9MQv5MnUaXCNTmt7CtSijc/DcsO7LHsX1l/Wi0PQ4noBmwDerDP5EGrGRhyoHbAP5 AqMKRWPCDWR367Rut3kyXSuj44atwSW0FPDP/+fvyPlzRaBfWfbEg0OMOkGqmBgGOhBy zfRHrVbBUJ34BJ7tB6esPsVzIUMpSCksY2gOQIUfbxFGcq1sQi65sKXB+jp9zoqSo7YS cSG426tf2P0dSECDSllMVeUrYTjNksmtst0G1NFjgf6kPvKsFe0zWVGFbgqfqZnp5V25 1YDuNy2W09sHg9KNbgf9kK+410C4wTH08UM2XwMVzrqNMPzfSCKRfboC4OV0PvMHerBK hB4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=9VFyQcYYvFG3wwO4gx9lxF3Zs7HMjQdIXDTXQZ6iPTA=; b=HhWx3PPqutDy6SHQESWZrjVniCfKUc/WguuoT7tsmGHxaSRJU7APvghwnNAeT7cNEU 7yodcgycGjqgIDJI3SF83p1dyMT4tffmH7LTX6u5LXGQ4limo4b9RTTsT7EkJ702/lEw OWq7xNCMvB3Av/3ADqPVfekfdkie+7NjDrII8CCgOmxOOA8GRHg/hz34A+YlBzCNc5mV D6uo8KyUk+JAjpqbJ+tJdd4i3awBUFM7m0PrvmMO9ppmJTR2nFgbD9fEsgKTKk+qPyDy /LnUF9iKJjttD+CNFt5UEkya3hFgN+KnFsVzK5vMaPIClIf+PuonLLcjACi4McBUcxA/ IYsQ== X-Gm-Message-State: AOAM530QlkBFbr3JlHPJxTlgovD7GFqlUEkRnUbyLmBD+KAwI86CRize RXq5Qr1g5J9+EoYkWMMYNnWvQwo6CHq4Xf9kez4= X-Received: by 2002:a25:7647:: with SMTP id r68mr2838440ybc.432.1625179843693; Thu, 01 Jul 2021 15:50:43 -0700 (PDT) MIME-Version: 1.0 References: <20210611020728.15233-1-jprvita@endlessos.org> In-Reply-To: From: Luiz Augusto von Dentz Date: Thu, 1 Jul 2021 15:50:32 -0700 Message-ID: Subject: Re: [PATCH BlueZ] profile: Fail RegisterProfile if UUID already exists To: =?UTF-8?Q?Jo=C3=A3o_Paulo_Rechi_Vita?= Cc: "linux-bluetooth@vger.kernel.org" , =?UTF-8?Q?Jo=C3=A3o_Paulo_Rechi_Vita?= , linux@endlessos.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Jo=C3=A3o, On Tue, Jun 29, 2021 at 4:52 PM Jo=C3=A3o Paulo Rechi Vita wrote: > > On Thu, Jun 10, 2021 at 7:07 PM Jo=C3=A3o Paulo Rechi Vita wrote: > > > > From: Jo=C3=A3o Paulo Rechi Vita > > > > If a process tries to register a profile implementation that is already > > registered, RegisterProfile should fail. > > > > This should help address issues when two instances of PulseAudio are > > running at the same time, and the second instance tries to register an > > audio profile implementation that has already been registered by the > > first instance. Two situations where this may happen is when more than > > one user is logged in, or during the transition between the GDM session > > and the user session, when PulseAudio gets started on the new session > > before the old session has been fully terminated. > > > > https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/303 > > https://gitlab.gnome.org/GNOME/gdm/-/issues/486 > > Any feedback on these changes? I have > https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/593 > on the PulseAudio side, and we have been shipping these changes on > Endless OS to address the case where PulseAudio gets started on the > user session before PulseAudio on the GDM session has finished. > > Thanks, > > Jo=C3=A3o Paulo. > > > --- > > src/profile.c | 30 ++++++++++++++++++++++++++++++ > > 1 file changed, 30 insertions(+) > > > > diff --git a/src/profile.c b/src/profile.c > > index 5e460b639..60d17b6ae 100644 > > --- a/src/profile.c > > +++ b/src/profile.c > > @@ -749,6 +749,30 @@ void btd_profile_foreach(void (*func)(struct btd_p= rofile *p, void *data), > > } > > } > > > > +static struct btd_profile *btd_profile_find_uuid(const char *uuid) > > +{ > > + GSList *l, *next; > > + > > + for (l =3D profiles; l !=3D NULL; l =3D next) { > > + struct btd_profile *p =3D l->data; > > + > > + if (!g_strcmp0(p->local_uuid, uuid)) > > + return p; > > + next =3D g_slist_next(l); > > + } > > + > > + for (l =3D ext_profiles; l !=3D NULL; l =3D next) { > > + struct ext_profile *ext =3D l->data; > > + struct btd_profile *p =3D &ext->p; > > + > > + if (!g_strcmp0(p->local_uuid, uuid)) > > + return p; > > + next =3D g_slist_next(l); > > + } > > + > > + return NULL; > > +} > > + > > int btd_profile_register(struct btd_profile *profile) > > { > > profiles =3D g_slist_append(profiles, profile); > > @@ -2441,6 +2465,12 @@ static DBusMessage *register_profile(DBusConnect= ion *conn, > > dbus_message_iter_get_basic(&args, &uuid); > > dbus_message_iter_next(&args); > > > > + if (btd_profile_find_uuid(uuid)) { > > + warn("%s tried to register %s which is already register= ed", > > + sender,= uuid); > > + return btd_error_not_permitted(msg, "UUID already regis= tered"); > > + } > > + > > if (dbus_message_iter_get_arg_type(&args) !=3D DBUS_TYPE_ARRAY) > > return btd_error_invalid_args(msg); > > > > -- > > 2.20.1 > > Applied, thanks. --=20 Luiz Augusto von Dentz