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.
Signed-off-by: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
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;
if (!(lsep && rsep))
return -EINVAL;
+ if (lsep->stream)
+ return -EBUSY;
+
DBG("%p: int_seid=%u, acp_seid=%u", session,
lsep->info.seid, rsep->seid);