Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 209921
b: refs/heads/master
c: 13334d4
h: refs/heads/master
i:
  209919: 9cf3cd8
v: v3
  • Loading branch information
Marek Lindner authored and Greg Kroah-Hartman committed Aug 24, 2010
1 parent 4aa30f5 commit 7df11e2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9abc10238e1df7ce81c58a441f65efd5e905b9e8
refs/heads/master: 13334d4875dbaeeb44e7905463f07e236f80311f
12 changes: 8 additions & 4 deletions trunk/drivers/staging/batman-adv/icmp_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ static int bat_socket_open(struct inode *inode, struct file *file)
INIT_LIST_HEAD(&socket_client->queue_list);
socket_client->queue_len = 0;
socket_client->index = i;
socket_client->bat_priv = inode->i_private;
spin_lock_init(&socket_client->lock);
init_waitqueue_head(&socket_client->queue_wait);

Expand Down Expand Up @@ -151,9 +152,8 @@ static ssize_t bat_socket_read(struct file *file, char __user *buf,
static ssize_t bat_socket_write(struct file *file, const char __user *buff,
size_t len, loff_t *off)
{
/* FIXME: each orig_node->batman_if will be attached to a softif */
struct bat_priv *bat_priv = netdev_priv(soft_device);
struct socket_client *socket_client = file->private_data;
struct bat_priv *bat_priv = socket_client->bat_priv;
struct icmp_packet_rr icmp_packet;
struct orig_node *orig_node;
struct batman_if *batman_if;
Expand All @@ -168,6 +168,9 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
return -EINVAL;
}

if (!bat_priv->primary_if)
return -EFAULT;

if (len >= sizeof(struct icmp_packet_rr))
packet_len = sizeof(struct icmp_packet_rr);

Expand Down Expand Up @@ -223,7 +226,8 @@ static ssize_t bat_socket_write(struct file *file, const char __user *buff,
if (batman_if->if_status != IF_ACTIVE)
goto dst_unreach;

memcpy(icmp_packet.orig, batman_if->net_dev->dev_addr, ETH_ALEN);
memcpy(icmp_packet.orig,
bat_priv->primary_if->net_dev->dev_addr, ETH_ALEN);

if (packet_len == sizeof(struct icmp_packet_rr))
memcpy(icmp_packet.rr, batman_if->net_dev->dev_addr, ETH_ALEN);
Expand Down Expand Up @@ -271,7 +275,7 @@ int bat_socket_setup(struct bat_priv *bat_priv)
goto err;

d = debugfs_create_file(ICMP_SOCKET, S_IFREG | S_IWUSR | S_IRUSR,
bat_priv->debug_dir, NULL, &fops);
bat_priv->debug_dir, bat_priv, &fops);
if (d)
goto err;

Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/staging/batman-adv/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ struct socket_client {
unsigned char index;
spinlock_t lock;
wait_queue_head_t queue_wait;
struct bat_priv *bat_priv;
};

struct socket_packet {
Expand Down

0 comments on commit 7df11e2

Please sign in to comment.