patch-2.4.27 linux-2.4.27/net/bluetooth/rfcomm/tty.c

Next file: linux-2.4.27/net/bridge/br.c
Previous file: linux-2.4.27/net/bluetooth/l2cap.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.26/net/bluetooth/rfcomm/tty.c linux-2.4.27/net/bluetooth/rfcomm/tty.c
@@ -338,12 +338,14 @@
 
 	BT_DBG("dev_id %id flags 0x%x", req.dev_id, req.flags);
 
-	if (!capable(CAP_NET_ADMIN))
-		return -EPERM;
-
 	if (!(dev = rfcomm_dev_get(req.dev_id)))
 		return -ENODEV;
 
+	if (dev->flags != NOCAP_FLAGS && !capable(CAP_NET_ADMIN)) {
+		rfcomm_dev_put(dev);
+		return -EPERM;
+	}
+
 	if (req.flags & (1 << RFCOMM_HANGUP_NOW))
 		rfcomm_dlc_close(dev->dlc, 0);
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)