aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-07-03 17:50:41 -0400
committerDavid S. Miller <davem@davemloft.net>2013-07-03 17:55:13 -0400
commit0c1072ae0242fbdffd9a0bba36e7a7033d287f9c (patch)
treee0f4dbdbf5078d4a707911177e7bdc17a70bdce5 /net/core
parentc50cd357887acf9fd7af3a5d492911bd825555a2 (diff)
parent8bb495e3f02401ee6f76d1b1d77f3ac9f079e376 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/ethernet/freescale/fec_main.c drivers/net/ethernet/renesas/sh_eth.c net/ipv4/gre.c The GRE conflict is between a bug fix (kfree_skb --> kfree_skb_list) and the splitting of the gre.c code into seperate files. The FEC conflict was two sets of changes adding ethtool support code in an "!CONFIG_M5272" CPP protected block. Finally the sh_eth.c conflict was between one commit add bits set in the .eesr_err_check mask whilst another commit removed the .tx_error_check member and assignments. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c34
-rw-r--r--net/core/dev_ioctl.c19
-rw-r--r--net/core/skbuff.c20
-rw-r--r--net/core/sock.c17
4 files changed, 52 insertions, 38 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 6a93cd8cd264..560dafd83adf 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -800,6 +800,40 @@ struct net_device *dev_get_by_index(struct net *net, int ifindex)
800EXPORT_SYMBOL(dev_get_by_index); 800EXPORT_SYMBOL(dev_get_by_index);
801 801
802/** 802/**
803 * netdev_get_name - get a netdevice name, knowing its ifindex.
804 * @net: network namespace
805 * @name: a pointer to the buffer where the name will be stored.
806 * @ifindex: the ifindex of the interface to get the name from.
807 *
808 * The use of raw_seqcount_begin() and cond_resched() before
809 * retrying is required as we want to give the writers a chance
810 * to complete when CONFIG_PREEMPT is not set.
811 */
812int netdev_get_name(struct net *net, char *name, int ifindex)
813{
814 struct net_device *dev;
815 unsigned int seq;
816
817retry:
818 seq = raw_seqcount_begin(&devnet_rename_seq);
819 rcu_read_lock();
820 dev = dev_get_by_index_rcu(net, ifindex);
821 if (!dev) {
822 rcu_read_unlock();
823 return -ENODEV;
824 }
825
826 strcpy(name, dev->name);
827 rcu_read_unlock();
828 if (read_seqcount_retry(&devnet_rename_seq, seq)) {
829 cond_resched();
830 goto retry;
831 }
832
833 return 0;
834}
835
836/**
803 * dev_getbyhwaddr_rcu - find a device by its hardware address 837 * dev_getbyhwaddr_rcu - find a device by its hardware address
804 * @net: the applicable net namespace 838 * @net: the applicable net namespace
805 * @type: media type of device 839 * @type: media type of device
diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
index 6cc0481faade..5b7d0e1d0664 100644
--- a/net/core/dev_ioctl.c
+++ b/net/core/dev_ioctl.c
@@ -19,9 +19,8 @@
19 19
20static int dev_ifname(struct net *net, struct ifreq __user *arg) 20static int dev_ifname(struct net *net, struct ifreq __user *arg)
21{ 21{
22 struct net_device *dev;
23 struct ifreq ifr; 22 struct ifreq ifr;
24 unsigned seq; 23 int error;
25 24
26 /* 25 /*
27 * Fetch the caller's info block. 26 * Fetch the caller's info block.
@@ -30,19 +29,9 @@ static int dev_ifname(struct net *net, struct ifreq __user *arg)
30 if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) 29 if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
31 return -EFAULT; 30 return -EFAULT;
32 31
33retry: 32 error = netdev_get_name(net, ifr.ifr_name, ifr.ifr_ifindex);
34 seq = read_seqcount_begin(&devnet_rename_seq); 33 if (error)
35 rcu_read_lock(); 34 return error;
36 dev = dev_get_by_index_rcu(net, ifr.ifr_ifindex);
37 if (!dev) {
38 rcu_read_unlock();
39 return -ENODEV;
40 }
41
42 strcpy(ifr.ifr_name, dev->name);
43 rcu_read_unlock();
44 if (read_seqcount_retry(&devnet_rename_seq, seq))
45 goto retry;
46 35
47 if (copy_to_user(arg, &ifr, sizeof(struct ifreq))) 36 if (copy_to_user(arg, &ifr, sizeof(struct ifreq)))
48 return -EFAULT; 37 return -EFAULT;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index b1fcb8727e56..77971a35d6e1 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -477,15 +477,8 @@ EXPORT_SYMBOL(skb_add_rx_frag);
477 477
478static void skb_drop_list(struct sk_buff **listp) 478static void skb_drop_list(struct sk_buff **listp)
479{ 479{
480 struct sk_buff *list = *listp; 480 kfree_skb_list(*listp);
481
482 *listp = NULL; 481 *listp = NULL;
483
484 do {
485 struct sk_buff *this = list;
486 list = list->next;
487 kfree_skb(this);
488 } while (list);
489} 482}
490 483
491static inline void skb_drop_fraglist(struct sk_buff *skb) 484static inline void skb_drop_fraglist(struct sk_buff *skb)
@@ -645,6 +638,17 @@ void kfree_skb(struct sk_buff *skb)
645} 638}
646EXPORT_SYMBOL(kfree_skb); 639EXPORT_SYMBOL(kfree_skb);
647 640
641void kfree_skb_list(struct sk_buff *segs)
642{
643 while (segs) {
644 struct sk_buff *next = segs->next;
645
646 kfree_skb(segs);
647 segs = next;
648 }
649}
650EXPORT_SYMBOL(kfree_skb_list);
651
648/** 652/**
649 * skb_tx_error - report an sk_buff xmit error 653 * skb_tx_error - report an sk_buff xmit error
650 * @skb: buffer that triggered an error 654 * @skb: buffer that triggered an error
diff --git a/net/core/sock.c b/net/core/sock.c
index b6c619f4d47b..ab06b719f5b1 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -573,9 +573,7 @@ static int sock_getbindtodevice(struct sock *sk, char __user *optval,
573 int ret = -ENOPROTOOPT; 573 int ret = -ENOPROTOOPT;
574#ifdef CONFIG_NETDEVICES 574#ifdef CONFIG_NETDEVICES
575 struct net *net = sock_net(sk); 575 struct net *net = sock_net(sk);
576 struct net_device *dev;
577 char devname[IFNAMSIZ]; 576 char devname[IFNAMSIZ];
578 unsigned seq;
579 577
580 if (sk->sk_bound_dev_if == 0) { 578 if (sk->sk_bound_dev_if == 0) {
581 len = 0; 579 len = 0;
@@ -586,20 +584,9 @@ static int sock_getbindtodevice(struct sock *sk, char __user *optval,
586 if (len < IFNAMSIZ) 584 if (len < IFNAMSIZ)
587 goto out; 585 goto out;
588 586
589retry: 587 ret = netdev_get_name(net, devname, sk->sk_bound_dev_if);
590 seq = read_seqcount_begin(&devnet_rename_seq); 588 if (ret)
591 rcu_read_lock();
592 dev = dev_get_by_index_rcu(net, sk->sk_bound_dev_if);
593 ret = -ENODEV;
594 if (!dev) {
595 rcu_read_unlock();
596 goto out; 589 goto out;
597 }
598
599 strcpy(devname, dev->name);
600 rcu_read_unlock();
601 if (read_seqcount_retry(&devnet_rename_seq, seq))
602 goto retry;
603 590
604 len = strlen(devname) + 1; 591 len = strlen(devname) + 1;
605 592