Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Browse files Browse the repository at this point in the history
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (25 commits)
  [Bluetooth] Use work queue to trigger URB submission
  [Bluetooth] Add locking for bt_proto array manipulation
  [Bluetooth] Check if DLC is still attached to the TTY
  [Bluetooth] Fix reference count when connection lookup fails
  [Bluetooth] Disconnect HID interrupt channel first
  [Bluetooth] Support concurrent connect requests
  [Bluetooth] Make use of virtual devices tree
  [Bluetooth] Handle return values from driver core functions
  [Bluetooth] Fix compat ioctl for BNEP, CMTP and HIDP
  [IPV6] sit: Add missing MODULE_LICENSE
  [IPV6]: Remove bogus WARN_ON in Proxy-NA handling.
  [IPv6] rules: Use RT6_LOOKUP_F_HAS_SADDR and fix source based selectors
  [XFRM]: Fix xfrm_state_num going negative.
  [NET]: reduce sizeof(struct inet_peer), cleanup, change in peer_check_expire()
  NetLabel: the CIPSOv4 passthrough mapping does not pass categories correctly
  NetLabel: better error handling involving mls_export_cat()
  NetLabel: only deref the CIPSOv4 standard map fields when using standard mapping
  [BRIDGE]: flush forwarding table when device carrier off
  [NETFILTER]: ctnetlink: Remove debugging messages
  [NETFILTER]: Update MAINTAINERS entry
  ...
  • Loading branch information
Linus Torvalds committed Oct 16, 2006
2 parents 29da7eb + 3f53069 commit 5206a79
Show file tree
Hide file tree
Showing 42 changed files with 405 additions and 282 deletions.
8 changes: 5 additions & 3 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2049,11 +2049,13 @@ P: Marc Boucher
P: James Morris
P: Harald Welte
P: Jozsef Kadlecsik
M: [email protected]
P: Patrick McHardy
M: [email protected]
L: [email protected]
L: [email protected]
L: [email protected]
W: http://www.netfilter.org/
W: http://www.iptables.org/
L: [email protected]
L: [email protected]
S: Supported

NETLABEL
Expand Down
17 changes: 7 additions & 10 deletions drivers/bluetooth/bcm203x.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/timer.h>

#include <linux/device.h>
#include <linux/firmware.h>
Expand All @@ -43,7 +42,7 @@
#define BT_DBG(D...)
#endif

#define VERSION "1.0"
#define VERSION "1.1"

static int ignore = 0;

Expand Down Expand Up @@ -72,7 +71,7 @@ struct bcm203x_data {

unsigned long state;

struct timer_list timer;
struct work_struct work;

struct urb *urb;
unsigned char *buffer;
Expand Down Expand Up @@ -105,7 +104,7 @@ static void bcm203x_complete(struct urb *urb)

data->state = BCM203X_SELECT_MEMORY;

mod_timer(&data->timer, jiffies + (HZ / 10));
schedule_work(&data->work);
break;

case BCM203X_SELECT_MEMORY:
Expand Down Expand Up @@ -158,9 +157,9 @@ static void bcm203x_complete(struct urb *urb)
}
}

static void bcm203x_timer(unsigned long user_data)
static void bcm203x_work(void *user_data)
{
struct bcm203x_data *data = (struct bcm203x_data *) user_data;
struct bcm203x_data *data = user_data;

if (usb_submit_urb(data->urb, GFP_ATOMIC) < 0)
BT_ERR("Can't submit URB");
Expand Down Expand Up @@ -247,13 +246,11 @@ static int bcm203x_probe(struct usb_interface *intf, const struct usb_device_id

release_firmware(firmware);

init_timer(&data->timer);
data->timer.function = bcm203x_timer;
data->timer.data = (unsigned long) data;
INIT_WORK(&data->work, bcm203x_work, (void *) data);

usb_set_intfdata(intf, data);

mod_timer(&data->timer, jiffies + HZ);
schedule_work(&data->work);

return 0;
}
Expand Down
17 changes: 17 additions & 0 deletions include/net/bluetooth/hci_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ struct hci_conn {
__u8 mode;
__u8 type;
__u8 out;
__u8 attempt;
__u8 dev_class[3];
__u8 features[8];
__u16 interval;
Expand Down Expand Up @@ -289,6 +290,22 @@ static inline struct hci_conn *hci_conn_hash_lookup_ba(struct hci_dev *hdev,
return NULL;
}

static inline struct hci_conn *hci_conn_hash_lookup_state(struct hci_dev *hdev,
__u8 type, __u16 state)
{
struct hci_conn_hash *h = &hdev->conn_hash;
struct list_head *p;
struct hci_conn *c;

list_for_each(p, &h->list) {
c = list_entry(p, struct hci_conn, list);
if (c->type == type && c->state == state)
return c;
}
return NULL;
}

void hci_acl_connect(struct hci_conn *conn);
void hci_acl_disconn(struct hci_conn *conn, __u8 reason);
void hci_add_sco(struct hci_conn *conn, __u16 handle);

Expand Down
17 changes: 2 additions & 15 deletions include/net/inetpeer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct inet_peer
{
struct inet_peer *avl_left, *avl_right;
struct inet_peer *unused_next, **unused_prevp;
unsigned long dtime; /* the time of last use of not
__u32 dtime; /* the time of last use of not
* referenced entries */
atomic_t refcnt;
__be32 v4daddr; /* peer's address */
Expand All @@ -35,21 +35,8 @@ void inet_initpeers(void) __init;
/* can be called with or without local BH being disabled */
struct inet_peer *inet_getpeer(__be32 daddr, int create);

extern spinlock_t inet_peer_unused_lock;
extern struct inet_peer **inet_peer_unused_tailp;
/* can be called from BH context or outside */
static inline void inet_putpeer(struct inet_peer *p)
{
spin_lock_bh(&inet_peer_unused_lock);
if (atomic_dec_and_test(&p->refcnt)) {
p->unused_prevp = inet_peer_unused_tailp;
p->unused_next = NULL;
*inet_peer_unused_tailp = p;
inet_peer_unused_tailp = &p->unused_next;
p->dtime = jiffies;
}
spin_unlock_bh(&inet_peer_unused_lock);
}
extern void inet_putpeer(struct inet_peer *p);

extern spinlock_t inet_peer_idlock;
/* can be called with or without local BH being disabled */
Expand Down
38 changes: 30 additions & 8 deletions net/bluetooth/af_bluetooth.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,41 +48,56 @@
#define BT_DBG(D...)
#endif

#define VERSION "2.10"
#define VERSION "2.11"

/* Bluetooth sockets */
#define BT_MAX_PROTO 8
static struct net_proto_family *bt_proto[BT_MAX_PROTO];
static DEFINE_RWLOCK(bt_proto_lock);

int bt_sock_register(int proto, struct net_proto_family *ops)
{
int err = 0;

if (proto < 0 || proto >= BT_MAX_PROTO)
return -EINVAL;

write_lock(&bt_proto_lock);

if (bt_proto[proto])
return -EEXIST;
err = -EEXIST;
else
bt_proto[proto] = ops;

bt_proto[proto] = ops;
return 0;
write_unlock(&bt_proto_lock);

return err;
}
EXPORT_SYMBOL(bt_sock_register);

int bt_sock_unregister(int proto)
{
int err = 0;

if (proto < 0 || proto >= BT_MAX_PROTO)
return -EINVAL;

write_lock(&bt_proto_lock);

if (!bt_proto[proto])
return -ENOENT;
err = -ENOENT;
else
bt_proto[proto] = NULL;

bt_proto[proto] = NULL;
return 0;
write_unlock(&bt_proto_lock);

return err;
}
EXPORT_SYMBOL(bt_sock_unregister);

static int bt_sock_create(struct socket *sock, int proto)
{
int err = 0;
int err;

if (proto < 0 || proto >= BT_MAX_PROTO)
return -EINVAL;
Expand All @@ -92,11 +107,18 @@ static int bt_sock_create(struct socket *sock, int proto)
request_module("bt-proto-%d", proto);
}
#endif

err = -EPROTONOSUPPORT;

read_lock(&bt_proto_lock);

if (bt_proto[proto] && try_module_get(bt_proto[proto]->owner)) {
err = bt_proto[proto]->create(sock, proto);
module_put(bt_proto[proto]->owner);
}

read_unlock(&bt_proto_lock);

return err;
}

Expand Down
4 changes: 1 addition & 3 deletions net/bluetooth/bnep/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,12 +528,10 @@ static struct device *bnep_get_device(struct bnep_session *session)
return NULL;

conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, dst);
if (!conn)
return NULL;

hci_dev_put(hdev);

return &conn->dev;
return conn ? &conn->dev : NULL;
}

int bnep_add_connection(struct bnep_connadd_req *req, struct socket *sock)
Expand Down
69 changes: 51 additions & 18 deletions net/bluetooth/bnep/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <linux/ioctl.h>
#include <linux/file.h>
#include <linux/init.h>
#include <linux/compat.h>
#include <net/sock.h>

#include <asm/system.h>
Expand Down Expand Up @@ -146,24 +147,56 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
return 0;
}

#ifdef CONFIG_COMPAT
static int bnep_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{
if (cmd == BNEPGETCONNLIST) {
struct bnep_connlist_req cl;
uint32_t uci;
int err;

if (get_user(cl.cnum, (uint32_t __user *) arg) ||
get_user(uci, (u32 __user *) (arg + 4)))
return -EFAULT;

cl.ci = compat_ptr(uci);

if (cl.cnum <= 0)
return -EINVAL;

err = bnep_get_connlist(&cl);

if (!err && put_user(cl.cnum, (uint32_t __user *) arg))
err = -EFAULT;

return err;
}

return bnep_sock_ioctl(sock, cmd, arg);
}
#endif

static const struct proto_ops bnep_sock_ops = {
.family = PF_BLUETOOTH,
.owner = THIS_MODULE,
.release = bnep_sock_release,
.ioctl = bnep_sock_ioctl,
.bind = sock_no_bind,
.getname = sock_no_getname,
.sendmsg = sock_no_sendmsg,
.recvmsg = sock_no_recvmsg,
.poll = sock_no_poll,
.listen = sock_no_listen,
.shutdown = sock_no_shutdown,
.setsockopt = sock_no_setsockopt,
.getsockopt = sock_no_getsockopt,
.connect = sock_no_connect,
.socketpair = sock_no_socketpair,
.accept = sock_no_accept,
.mmap = sock_no_mmap
.family = PF_BLUETOOTH,
.owner = THIS_MODULE,
.release = bnep_sock_release,
.ioctl = bnep_sock_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = bnep_sock_compat_ioctl,
#endif
.bind = sock_no_bind,
.getname = sock_no_getname,
.sendmsg = sock_no_sendmsg,
.recvmsg = sock_no_recvmsg,
.poll = sock_no_poll,
.listen = sock_no_listen,
.shutdown = sock_no_shutdown,
.setsockopt = sock_no_setsockopt,
.getsockopt = sock_no_getsockopt,
.connect = sock_no_connect,
.socketpair = sock_no_socketpair,
.accept = sock_no_accept,
.mmap = sock_no_mmap
};

static struct proto bnep_proto = {
Expand All @@ -181,7 +214,7 @@ static int bnep_sock_create(struct socket *sock, int protocol)
if (sock->type != SOCK_RAW)
return -ESOCKTNOSUPPORT;

sk = sk_alloc(PF_BLUETOOTH, GFP_KERNEL, &bnep_proto, 1);
sk = sk_alloc(PF_BLUETOOTH, GFP_ATOMIC, &bnep_proto, 1);
if (!sk)
return -ENOMEM;

Expand Down
35 changes: 34 additions & 1 deletion net/bluetooth/cmtp/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <linux/socket.h>
#include <linux/ioctl.h>
#include <linux/file.h>
#include <linux/compat.h>
#include <net/sock.h>

#include <linux/isdn/capilli.h>
Expand Down Expand Up @@ -137,11 +138,43 @@ static int cmtp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
return -EINVAL;
}

#ifdef CONFIG_COMPAT
static int cmtp_sock_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{
if (cmd == CMTPGETCONNLIST) {
struct cmtp_connlist_req cl;
uint32_t uci;
int err;

if (get_user(cl.cnum, (uint32_t __user *) arg) ||
get_user(uci, (u32 __user *) (arg + 4)))
return -EFAULT;

cl.ci = compat_ptr(uci);

if (cl.cnum <= 0)
return -EINVAL;

err = cmtp_get_connlist(&cl);

if (!err && put_user(cl.cnum, (uint32_t __user *) arg))
err = -EFAULT;

return err;
}

return cmtp_sock_ioctl(sock, cmd, arg);
}
#endif

static const struct proto_ops cmtp_sock_ops = {
.family = PF_BLUETOOTH,
.owner = THIS_MODULE,
.release = cmtp_sock_release,
.ioctl = cmtp_sock_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = cmtp_sock_compat_ioctl,
#endif
.bind = sock_no_bind,
.getname = sock_no_getname,
.sendmsg = sock_no_sendmsg,
Expand Down Expand Up @@ -172,7 +205,7 @@ static int cmtp_sock_create(struct socket *sock, int protocol)
if (sock->type != SOCK_RAW)
return -ESOCKTNOSUPPORT;

sk = sk_alloc(PF_BLUETOOTH, GFP_KERNEL, &cmtp_proto, 1);
sk = sk_alloc(PF_BLUETOOTH, GFP_ATOMIC, &cmtp_proto, 1);
if (!sk)
return -ENOMEM;

Expand Down
Loading

0 comments on commit 5206a79

Please sign in to comment.