diff options
| author | Ulf Hansson <ulf.hansson@stericsson.com> | 2011-09-19 15:40:54 +0200 |
|---|---|---|
| committer | Ulf Hansson <ulf.hansson@stericsson.com> | 2011-09-19 15:40:54 +0200 |
| commit | 9ab67899804448f2bea4087bb6e9e4d952a79258 (patch) | |
| tree | 29ca9054d473e57f6d79638d1d3982f1ffcffcca /net/bluetooth/af_bluetooth.c | |
| parent | 0de20dc0be1f147959b10903c76f2f41139f417a (diff) | |
| parent | f5968c8833f0985b76d38593892acd6558bab149 (diff) | |
Merge linux-linaro-3.0-2011.07-1-android-1 into..
..linux-linaro-3.0-2011.07-1_glk3.0
Conflicts:
arch/arm/common/Makefile
drivers/misc/Kconfig
drivers/misc/Makefile
kernel/printk.c
Change-Id: I126f34edb1879981909072beefb2738cad26f951
Diffstat (limited to 'net/bluetooth/af_bluetooth.c')
| -rw-r--r-- | net/bluetooth/af_bluetooth.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index 8add9b49991..e87d15da882 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c @@ -40,6 +40,15 @@ #include <net/bluetooth/bluetooth.h> +#ifdef CONFIG_ANDROID_PARANOID_NETWORK +#include <linux/android_aid.h> +#endif + +#ifndef CONFIG_BT_SOCK_DEBUG +#undef BT_DBG +#define BT_DBG(D...) +#endif + #define VERSION "2.16" /* Bluetooth sockets */ @@ -125,11 +134,40 @@ int bt_sock_unregister(int proto) } EXPORT_SYMBOL(bt_sock_unregister); +#ifdef CONFIG_ANDROID_PARANOID_NETWORK +static inline int current_has_bt_admin(void) +{ + return (!current_euid() || in_egroup_p(AID_NET_BT_ADMIN)); +} + +static inline int current_has_bt(void) +{ + return (current_has_bt_admin() || in_egroup_p(AID_NET_BT)); +} +# else +static inline int current_has_bt_admin(void) +{ + return 1; +} + +static inline int current_has_bt(void) +{ + return 1; +} +#endif + static int bt_sock_create(struct net *net, struct socket *sock, int proto, int kern) { int err; + if (proto == BTPROTO_RFCOMM || proto == BTPROTO_SCO || + proto == BTPROTO_L2CAP) { + if (!current_has_bt()) + return -EPERM; + } else if (!current_has_bt_admin()) + return -EPERM; + if (net != &init_net) return -EAFNOSUPPORT; |
