summaryrefslogtreecommitdiff
path: root/profiles/audio
diff options
context:
space:
mode:
authorPauli Virtanen <pav@iki.fi>2022-06-05 15:29:26 +0300
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-06-13 10:52:26 -0700
commit5f9d9a9a0b38d7fdbd591c859b9bf9e437fb1b39 (patch)
tree2cd843c7a75750fd910894c196199bfde73178ae /profiles/audio
parent25dd5613d549010952550df4f6bd435e2bd5d101 (diff)
downloadbluez-5f9d9a9a0b38d7fdbd591c859b9bf9e437fb1b39.tar.gz
a2dp: disallow multiple SetConfiguration to same local SEP
Using the remote SEP SetConfiguration DBus API, it's possible to make multiple remote endpoints use the same local SEP, if they are endpoints from different connected devices. This is invalid: successful configuration shall prevent a different device configuring the same SEP (AVDTP v1.3 Sec. 5.3). Moreover, this breaks the assumption in the AVDTP code that each SEP has at most a single stream, and causes misbehavior later on (subsequent transport acquires fail with EPERM). Fix this by first checking the SEP is free before proceeding in the DBus API call. Also add a sanity check in avdtp_set_configuration, to reject configuring an already configured SEP similarly as in avdtp_setconf_cmd.
Diffstat (limited to 'profiles/audio')
-rw-r--r--profiles/audio/a2dp.c5
-rw-r--r--profiles/audio/avdtp.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index 6f5b13711..f3e2cdd9e 100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -1843,6 +1843,11 @@ static int a2dp_reconfig(struct a2dp_channel *chan, const char *sender,
GSList *l;
int err;
+ /* Check SEP not used by a different session */
+ if (lsep->stream && chan->session &&
+ !avdtp_has_stream(chan->session, lsep->stream))
+ return -EBUSY;
+
setup = a2dp_setup_get(chan->session);
if (!setup)
return -ENOMEM;
diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index da4114e0f..bc7afad81 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -3523,6 +3523,9 @@ int avdtp_set_configuration(struct avdtp *session,
if (!(lsep && rsep))
return -EINVAL;
+ if (lsep->stream)
+ return -EBUSY;
+
DBG("%p: int_seid=%u, acp_seid=%u", session,
lsep->info.seid, rsep->seid);