mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 15:27:29 +00:00
Bluetooth: Verify dlci not in use before rfcomm_dev create
Only one session/channel combination may be in use at any one time. However, the failure does not occur until the tty is opened (in rfcomm_dlc_open()). Because these settings are actually bound at rfcomm device creation (via RFCOMMCREATEDEV ioctl), validate and fail before creating the rfcomm tty device. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Tested-By: Alexander Holler <holler@ahsoftware.de> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
c949c224cf
commit
c10a848cea
3 changed files with 34 additions and 1 deletions
|
@ -385,6 +385,14 @@ static int rfcomm_create_dev(struct sock *sk, void __user *arg)
|
|||
dlc = rfcomm_pi(sk)->dlc;
|
||||
rfcomm_dlc_hold(dlc);
|
||||
} else {
|
||||
/* Validate the channel is unused */
|
||||
dlc = rfcomm_dlc_exists(&req.src, &req.dst, req.channel);
|
||||
if (IS_ERR(dlc))
|
||||
return PTR_ERR(dlc);
|
||||
else if (dlc) {
|
||||
rfcomm_dlc_put(dlc);
|
||||
return -EBUSY;
|
||||
}
|
||||
dlc = rfcomm_dlc_alloc(GFP_KERNEL);
|
||||
if (!dlc)
|
||||
return -ENOMEM;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue