Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 90d5ffc7 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (46 commits)
  cnic: Fix NETDEV_UP event processing.
  uvesafb/connector: Disallow unpliviged users to send netlink packets
  pohmelfs/connector: Disallow unpliviged users to configure pohmelfs
  dst/connector: Disallow unpliviged users to configure dst
  dm/connector: Only process connector packages from privileged processes
  connector: Removed the destruct_data callback since it is always kfree_skb()
  connector/dm: Fixed a compilation warning
  connector: Provide the sender's credentials to the callback
  connector: Keep the skb in cn_callback_data
  e1000e/igb/ixgbe: Don't report an error if devices don't support AER
  net: Fix wrong sizeof
  net: splice() from tcp to pipe should take into account O_NONBLOCK
  net: Use sk_mark for routing lookup in more places
  sky2: irqname based on pci address
  skge: use unique IRQ name
  IPv4 TCP fails to send window scale option when window scale is zero
  net/ipv4/tcp.c: fix min() type mismatch warning
  Kconfig: STRIP: Remove stale bits of STRIP help text
  NET: mkiss: Fix typo
  tg3: Remove prev_vlan_tag from struct tx_ring_info
  ...
parents 0efe5e32 6053bbf7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ static char cn_test_name[] = "cn_test";
static struct sock *nls;
static struct timer_list cn_test_timer;

static void cn_test_callback(struct cn_msg *msg)
static void cn_test_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
{
	pr_info("%s: %lu: idx=%x, val=%x, seq=%u, ack=%u, len=%d: %s.\n",
	        __func__, jiffies, msg->id.idx, msg->id.val,
+4 −4
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ handling, etc... The Connector driver allows any kernelspace agents to use
netlink based networking for inter-process communication in a significantly
easier way:

int cn_add_callback(struct cb_id *id, char *name, void (*callback) (void *));
int cn_add_callback(struct cb_id *id, char *name, void (*callback) (struct cn_msg *, struct netlink_skb_parms *));
void cn_netlink_send(struct cn_msg *msg, u32 __group, int gfp_mask);

struct cb_id
@@ -53,15 +53,15 @@ struct cn_msg
Connector interfaces.
/*****************************************/

int cn_add_callback(struct cb_id *id, char *name, void (*callback) (void *));
int cn_add_callback(struct cb_id *id, char *name, void (*callback) (struct cn_msg *, struct netlink_skb_parms *));

 Registers new callback with connector core.

 struct cb_id *id		- unique connector's user identifier.
				  It must be registered in connector.h for legal in-kernel users.
 char *name			- connector's callback symbolic name.
 void (*callback) (void *)	- connector's callback.
				  Argument must be dereferenced to struct cn_msg *.
 void (*callback) (struct cn..)	- connector's callback.
				  cn_msg and the sender's credentials


void cn_del_callback(struct cb_id *id);
+1 −1
Original line number Diff line number Diff line
@@ -381,7 +381,7 @@ int main(int argc, char **argv)
	memset(&hwtstamp, 0, sizeof(hwtstamp));
	strncpy(hwtstamp.ifr_name, interface, sizeof(hwtstamp.ifr_name));
	hwtstamp.ifr_data = (void *)&hwconfig;
	memset(&hwconfig, 0, sizeof(&hwconfig));
	memset(&hwconfig, 0, sizeof(hwconfig));
	hwconfig.tx_type =
		(so_timestamping_flags & SOF_TIMESTAMPING_TX_HARDWARE) ?
		HWTSTAMP_TX_ON : HWTSTAMP_TX_OFF;
+7 −5
Original line number Diff line number Diff line
@@ -78,18 +78,20 @@ void cn_queue_wrapper(struct work_struct *work)
	struct cn_callback_entry *cbq =
		container_of(work, struct cn_callback_entry, work);
	struct cn_callback_data *d = &cbq->data;
	struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(d->skb));
	struct netlink_skb_parms *nsp = &NETLINK_CB(d->skb);

	d->callback(d->callback_priv);
	d->callback(msg, nsp);

	d->destruct_data(d->ddata);
	d->ddata = NULL;
	kfree_skb(d->skb);
	d->skb = NULL;

	kfree(d->free);
}

static struct cn_callback_entry *
cn_queue_alloc_callback_entry(char *name, struct cb_id *id,
			      void (*callback)(struct cn_msg *))
			      void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
{
	struct cn_callback_entry *cbq;

@@ -123,7 +125,7 @@ int cn_cb_equal(struct cb_id *i1, struct cb_id *i2)
}

int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id,
			  void (*callback)(struct cn_msg *))
			  void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
{
	struct cn_callback_entry *cbq, *__cbq;
	int found = 0;
+8 −14
Original line number Diff line number Diff line
@@ -129,21 +129,19 @@ EXPORT_SYMBOL_GPL(cn_netlink_send);
/*
 * Callback helper - queues work and setup destructor for given data.
 */
static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), void *data)
static int cn_call_callback(struct sk_buff *skb)
{
	struct cn_callback_entry *__cbq, *__new_cbq;
	struct cn_dev *dev = &cdev;
	struct cn_msg *msg = NLMSG_DATA(nlmsg_hdr(skb));
	int err = -ENODEV;

	spin_lock_bh(&dev->cbdev->queue_lock);
	list_for_each_entry(__cbq, &dev->cbdev->queue_list, callback_entry) {
		if (cn_cb_equal(&__cbq->id.id, &msg->id)) {
			if (likely(!work_pending(&__cbq->work) &&
					__cbq->data.ddata == NULL)) {
				__cbq->data.callback_priv = msg;

				__cbq->data.ddata = data;
				__cbq->data.destruct_data = destruct_data;
					__cbq->data.skb == NULL)) {
				__cbq->data.skb = skb;

				if (queue_cn_work(__cbq, &__cbq->work))
					err = 0;
@@ -156,10 +154,8 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v
				__new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC);
				if (__new_cbq) {
					d = &__new_cbq->data;
					d->callback_priv = msg;
					d->skb = skb;
					d->callback = __cbq->data.callback;
					d->ddata = data;
					d->destruct_data = destruct_data;
					d->free = __new_cbq;

					__new_cbq->pdev = __cbq->pdev;
@@ -191,7 +187,6 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v
 */
static void cn_rx_skb(struct sk_buff *__skb)
{
	struct cn_msg *msg;
	struct nlmsghdr *nlh;
	int err;
	struct sk_buff *skb;
@@ -208,8 +203,7 @@ static void cn_rx_skb(struct sk_buff *__skb)
			return;
		}

		msg = NLMSG_DATA(nlh);
		err = cn_call_callback(msg, (void (*)(void *))kfree_skb, skb);
		err = cn_call_callback(skb);
		if (err < 0)
			kfree_skb(skb);
	}
@@ -270,7 +264,7 @@ static void cn_notify(struct cb_id *id, u32 notify_event)
 * May sleep.
 */
int cn_add_callback(struct cb_id *id, char *name,
		    void (*callback)(struct cn_msg *))
		    void (*callback)(struct cn_msg *, struct netlink_skb_parms *))
{
	int err;
	struct cn_dev *dev = &cdev;
@@ -352,7 +346,7 @@ static int cn_ctl_msg_equals(struct cn_ctl_msg *m1, struct cn_ctl_msg *m2)
 *
 * Used for notification of a request's processing.
 */
static void cn_callback(struct cn_msg *msg)
static void cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
{
	struct cn_ctl_msg *ctl;
	struct cn_ctl_entry *ent;
Loading