22 Nov, 2014

1 commit


16 Jul, 2014

1 commit

  • Extend alloc_netdev{,_mq{,s}}() to take name_assign_type as argument, and convert
    all users to pass NET_NAME_UNKNOWN.

    Coccinelle patch:

    @@
    expression sizeof_priv, name, setup, txqs, rxqs, count;
    @@

    (
    -alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs)
    +alloc_netdev_mqs(sizeof_priv, name, NET_NAME_UNKNOWN, setup, txqs, rxqs)
    |
    -alloc_netdev_mq(sizeof_priv, name, setup, count)
    +alloc_netdev_mq(sizeof_priv, name, NET_NAME_UNKNOWN, setup, count)
    |
    -alloc_netdev(sizeof_priv, name, setup)
    +alloc_netdev(sizeof_priv, name, NET_NAME_UNKNOWN, setup)
    )

    v9: move comments here from the wrong commit

    Signed-off-by: Tom Gundersen
    Reviewed-by: David Herrmann
    Signed-off-by: David S. Miller

    Tom Gundersen
     

03 Nov, 2012

1 commit

  • When creating an L2TPv3 Ethernet session, if register_netdev() should fail for
    any reason (for example, automatic naming for "l2tpeth%d" interfaces hits the
    32k-interface limit), the netdev is freed in the error path. However, the
    l2tp_eth_sess structure's dev pointer is left uncleared, and this results in
    l2tp_eth_delete() then attempting to unregister the same netdev later in the
    session teardown. This results in an oops.

    To avoid this, clear the session dev pointer in the error path.

    Signed-off-by: Tom Parkin
    Signed-off-by: David S. Miller

    Tom Parkin
     

15 Sep, 2012

1 commit

  • Conflicts:
    net/netfilter/nfnetlink_log.c
    net/netfilter/xt_LOG.c

    Rather easy conflict resolution, the 'net' tree had bug fixes to make
    sure we checked if a socket is a time-wait one or not and elide the
    logging code if so.

    Whereas on the 'net-next' side we are calculating the UID and GID from
    the creds using different interfaces due to the user namespace changes
    from Eric Biederman.

    Signed-off-by: David S. Miller

    David S. Miller
     

06 Sep, 2012

1 commit

  • It seems we need to provide ability for stacked devices
    to use specific lock_class_key for sch->busylock

    We could instead default l2tpeth tx_queue_len to 0 (no qdisc), but
    a user might use a qdisc anyway.

    (So same fixes are probably needed on non LLTX stacked drivers)

    Noticed while stressing L2TPV3 setup :

    ======================================================
    [ INFO: possible circular locking dependency detected ]
    3.6.0-rc3+ #788 Not tainted
    -------------------------------------------------------
    netperf/4660 is trying to acquire lock:
    (l2tpsock){+.-...}, at: [] l2tp_xmit_skb+0x172/0xa50 [l2tp_core]

    but task is already holding lock:
    (&(&sch->busylock)->rlock){+.-...}, at: [] dev_queue_xmit+0xd75/0xe00

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #1 (&(&sch->busylock)->rlock){+.-...}:
    [] lock_acquire+0x90/0x200
    [] _raw_spin_lock_irqsave+0x4c/0x60
    [] __wake_up+0x32/0x70
    [] tty_wakeup+0x3e/0x80
    [] pty_write+0x73/0x80
    [] tty_put_char+0x3c/0x40
    [] process_echoes+0x142/0x330
    [] n_tty_receive_buf+0x8fb/0x1230
    [] flush_to_ldisc+0x142/0x1c0
    [] process_one_work+0x198/0x760
    [] worker_thread+0x186/0x4b0
    [] kthread+0x93/0xa0
    [] kernel_thread_helper+0x4/0x10

    -> #0 (l2tpsock){+.-...}:
    [] __lock_acquire+0x1628/0x1b10
    [] lock_acquire+0x90/0x200
    [] _raw_spin_lock+0x41/0x50
    [] l2tp_xmit_skb+0x172/0xa50 [l2tp_core]
    [] l2tp_eth_dev_xmit+0x32/0x60 [l2tp_eth]
    [] dev_hard_start_xmit+0x502/0xa70
    [] sch_direct_xmit+0xfe/0x290
    [] dev_queue_xmit+0x1e5/0xe00
    [] ip_finish_output+0x3d0/0x890
    [] ip_output+0x59/0xf0
    [] ip_local_out+0x2d/0xa0
    [] ip_queue_xmit+0x1c3/0x680
    [] tcp_transmit_skb+0x402/0xa60
    [] tcp_write_xmit+0x1f4/0xa30
    [] tcp_push_one+0x30/0x40
    [] tcp_sendmsg+0xe82/0x1040
    [] inet_sendmsg+0x125/0x230
    [] sock_sendmsg+0xdc/0xf0
    [] sys_sendto+0xfe/0x130
    [] system_call_fastpath+0x16/0x1b
    Possible unsafe locking scenario:

    CPU0 CPU1
    ---- ----
    lock(&(&sch->busylock)->rlock);
    lock(l2tpsock);
    lock(&(&sch->busylock)->rlock);
    lock(l2tpsock);

    *** DEADLOCK ***

    5 locks held by netperf/4660:
    #0: (sk_lock-AF_INET){+.+.+.}, at: [] tcp_sendmsg+0x2c/0x1040
    #1: (rcu_read_lock){.+.+..}, at: [] ip_queue_xmit+0x0/0x680
    #2: (rcu_read_lock_bh){.+....}, at: [] ip_finish_output+0x135/0x890
    #3: (rcu_read_lock_bh){.+....}, at: [] dev_queue_xmit+0x0/0xe00
    #4: (&(&sch->busylock)->rlock){+.-...}, at: [] dev_queue_xmit+0xd75/0xe00

    stack backtrace:
    Pid: 4660, comm: netperf Not tainted 3.6.0-rc3+ #788
    Call Trace:
    [] print_circular_bug+0x1fb/0x20c
    [] __lock_acquire+0x1628/0x1b10
    [] ? check_usage+0x9b/0x4d0
    [] ? __lock_acquire+0x2e4/0x1b10
    [] lock_acquire+0x90/0x200
    [] ? l2tp_xmit_skb+0x172/0xa50 [l2tp_core]
    [] _raw_spin_lock+0x41/0x50
    [] ? l2tp_xmit_skb+0x172/0xa50 [l2tp_core]
    [] l2tp_xmit_skb+0x172/0xa50 [l2tp_core]
    [] l2tp_eth_dev_xmit+0x32/0x60 [l2tp_eth]
    [] dev_hard_start_xmit+0x502/0xa70
    [] ? dev_hard_start_xmit+0x5e/0xa70
    [] ? dev_queue_xmit+0x141/0xe00
    [] sch_direct_xmit+0xfe/0x290
    [] dev_queue_xmit+0x1e5/0xe00
    [] ? dev_hard_start_xmit+0xa70/0xa70
    [] ip_finish_output+0x3d0/0x890
    [] ? ip_finish_output+0x135/0x890
    [] ip_output+0x59/0xf0
    [] ip_local_out+0x2d/0xa0
    [] ip_queue_xmit+0x1c3/0x680
    [] ? ip_local_out+0xa0/0xa0
    [] tcp_transmit_skb+0x402/0xa60
    [] ? tcp_md5_do_lookup+0x18e/0x1a0
    [] tcp_write_xmit+0x1f4/0xa30
    [] tcp_push_one+0x30/0x40
    [] tcp_sendmsg+0xe82/0x1040
    [] inet_sendmsg+0x125/0x230
    [] ? inet_create+0x6b0/0x6b0
    [] ? sock_update_classid+0xc2/0x3b0
    [] ? sock_update_classid+0x130/0x3b0
    [] sock_sendmsg+0xdc/0xf0
    [] ? fget_light+0x3f9/0x4f0
    [] sys_sendto+0xfe/0x130
    [] ? trace_hardirqs_on+0xd/0x10
    [] ? _raw_spin_unlock_irq+0x30/0x50
    [] ? finish_task_switch+0x83/0xf0
    [] ? finish_task_switch+0x46/0xf0
    [] ? sysret_check+0x1b/0x56
    [] system_call_fastpath+0x16/0x1b

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

05 Sep, 2012

1 commit


29 Jun, 2012

1 commit

  • Change l2tp_xmit_skb() to return NET_XMIT_DROP in case skb is dropped.

    Use kfree_skb() instead dev_kfree_skb() for drop_monitor pleasure.

    Support tx_dropped counter for l2tp_eth

    Signed-off-by: Eric Dumazet
    Cc: James Chapman
    Signed-off-by: David S. Miller

    Eric Dumazet
     

27 Jun, 2012

1 commit

  • Denys Fedoryshchenko reported a LOCKDEP issue with l2tp code.

    [ 8683.927442] ======================================================
    [ 8683.927555] [ INFO: possible circular locking dependency detected ]
    [ 8683.927672] 3.4.1-build-0061 #14 Not tainted
    [ 8683.927782] -------------------------------------------------------
    [ 8683.927895] swapper/0/0 is trying to acquire lock:
    [ 8683.928007] (slock-AF_INET){+.-...}, at: []
    l2tp_xmit_skb+0x173/0x47e [l2tp_core]
    [ 8683.928121]
    [ 8683.928121] but task is already holding lock:
    [ 8683.928121] (_xmit_ETHER#2){+.-...}, at: []
    sch_direct_xmit+0x36/0x119
    [ 8683.928121]
    [ 8683.928121] which lock already depends on the new lock.
    [ 8683.928121]
    [ 8683.928121]
    [ 8683.928121] the existing dependency chain (in reverse order) is:
    [ 8683.928121]
    [ 8683.928121] -> #1 (_xmit_ETHER#2){+.-...}:
    [ 8683.928121] [] lock_acquire+0x71/0x85
    [ 8683.928121] [] _raw_spin_lock+0x33/0x40
    [ 8683.928121] [] ip_send_reply+0xf2/0x1ce
    [ 8683.928121] [] tcp_v4_send_reset+0x153/0x16f
    [ 8683.928121] [] tcp_v4_do_rcv+0x172/0x194
    [ 8683.928121] [] tcp_v4_rcv+0x387/0x5a0
    [ 8683.928121] [] ip_local_deliver_finish+0x13a/0x1e9
    [ 8683.928121] [] NF_HOOK.clone.11+0x46/0x4d
    [ 8683.928121] [] ip_local_deliver+0x41/0x45
    [ 8683.928121] [] ip_rcv_finish+0x31a/0x33c
    [ 8683.928121] [] NF_HOOK.clone.11+0x46/0x4d
    [ 8683.928121] [] ip_rcv+0x201/0x23d
    [ 8683.928121] [] __netif_receive_skb+0x329/0x378
    [ 8683.928121] [] netif_receive_skb+0x4e/0x7d
    [ 8683.928121] [] rtl8139_poll+0x243/0x33d [8139too]
    [ 8683.928121] [] net_rx_action+0x90/0x15d
    [ 8683.928121] [] __do_softirq+0x7b/0x118
    [ 8683.928121]
    [ 8683.928121] -> #0 (slock-AF_INET){+.-...}:
    [ 8683.928121] [] __lock_acquire+0x9a3/0xc27
    [ 8683.928121] [] lock_acquire+0x71/0x85
    [ 8683.928121] [] _raw_spin_lock+0x33/0x40
    [ 8683.928121] [] l2tp_xmit_skb+0x173/0x47e
    [l2tp_core]
    [ 8683.928121] [] l2tp_eth_dev_xmit+0x1a/0x2f
    [l2tp_eth]
    [ 8683.928121] [] dev_hard_start_xmit+0x333/0x3f2
    [ 8683.928121] [] sch_direct_xmit+0x55/0x119
    [ 8683.928121] [] dev_queue_xmit+0x282/0x418
    [ 8683.928121] [] NF_HOOK.clone.19+0x45/0x4c
    [ 8683.928121] [] arp_xmit+0x22/0x24
    [ 8683.928121] [] arp_send+0x41/0x48
    [ 8683.928121] [] arp_process+0x289/0x491
    [ 8683.928121] [] NF_HOOK.clone.19+0x45/0x4c
    [ 8683.928121] [] arp_rcv+0xb1/0xc3
    [ 8683.928121] [] __netif_receive_skb+0x329/0x378
    [ 8683.928121] [] process_backlog+0x69/0x130
    [ 8683.928121] [] net_rx_action+0x90/0x15d
    [ 8683.928121] [] __do_softirq+0x7b/0x118
    [ 8683.928121]
    [ 8683.928121] other info that might help us debug this:
    [ 8683.928121]
    [ 8683.928121] Possible unsafe locking scenario:
    [ 8683.928121]
    [ 8683.928121] CPU0 CPU1
    [ 8683.928121] ---- ----
    [ 8683.928121] lock(_xmit_ETHER#2);
    [ 8683.928121] lock(slock-AF_INET);
    [ 8683.928121] lock(_xmit_ETHER#2);
    [ 8683.928121] lock(slock-AF_INET);
    [ 8683.928121]
    [ 8683.928121] *** DEADLOCK ***
    [ 8683.928121]
    [ 8683.928121] 3 locks held by swapper/0/0:
    [ 8683.928121] #0: (rcu_read_lock){.+.+..}, at: []
    rcu_lock_acquire+0x0/0x30
    [ 8683.928121] #1: (rcu_read_lock_bh){.+....}, at: []
    rcu_lock_acquire+0x0/0x30
    [ 8683.928121] #2: (_xmit_ETHER#2){+.-...}, at: []
    sch_direct_xmit+0x36/0x119
    [ 8683.928121]
    [ 8683.928121] stack backtrace:
    [ 8683.928121] Pid: 0, comm: swapper/0 Not tainted 3.4.1-build-0061 #14
    [ 8683.928121] Call Trace:
    [ 8683.928121] [] ? printk+0x18/0x1a
    [ 8683.928121] [] print_circular_bug+0x1ac/0x1b6
    [ 8683.928121] [] __lock_acquire+0x9a3/0xc27
    [ 8683.928121] [] lock_acquire+0x71/0x85
    [ 8683.928121] [] ? l2tp_xmit_skb+0x173/0x47e [l2tp_core]
    [ 8683.928121] [] _raw_spin_lock+0x33/0x40
    [ 8683.928121] [] ? l2tp_xmit_skb+0x173/0x47e [l2tp_core]
    [ 8683.928121] [] l2tp_xmit_skb+0x173/0x47e [l2tp_core]
    [ 8683.928121] [] l2tp_eth_dev_xmit+0x1a/0x2f [l2tp_eth]
    [ 8683.928121] [] dev_hard_start_xmit+0x333/0x3f2
    [ 8683.928121] [] sch_direct_xmit+0x55/0x119
    [ 8683.928121] [] dev_queue_xmit+0x282/0x418
    [ 8683.928121] [] ? dev_hard_start_xmit+0x3f2/0x3f2
    [ 8683.928121] [] NF_HOOK.clone.19+0x45/0x4c
    [ 8683.928121] [] arp_xmit+0x22/0x24
    [ 8683.928121] [] ? dev_hard_start_xmit+0x3f2/0x3f2
    [ 8683.928121] [] arp_send+0x41/0x48
    [ 8683.928121] [] arp_process+0x289/0x491
    [ 8683.928121] [] ? __neigh_lookup.clone.20+0x42/0x42
    [ 8683.928121] [] NF_HOOK.clone.19+0x45/0x4c
    [ 8683.928121] [] arp_rcv+0xb1/0xc3
    [ 8683.928121] [] ? __neigh_lookup.clone.20+0x42/0x42
    [ 8683.928121] [] __netif_receive_skb+0x329/0x378
    [ 8683.928121] [] process_backlog+0x69/0x130
    [ 8683.928121] [] net_rx_action+0x90/0x15d
    [ 8683.928121] [] __do_softirq+0x7b/0x118
    [ 8683.928121] [] ? local_bh_enable+0xd/0xd
    [ 8683.928121] [] ? irq_exit+0x41/0x91
    [ 8683.928121] [] ? do_IRQ+0x79/0x8d
    [ 8683.928121] [] ? trace_hardirqs_off_caller+0x2e/0x86
    [ 8683.928121] [] ? common_interrupt+0x2e/0x34
    [ 8683.928121] [] ? default_idle+0x23/0x38
    [ 8683.928121] [] ? cpu_idle+0x55/0x6f
    [ 8683.928121] [] ? rest_init+0xa1/0xa7
    [ 8683.928121] [] ? __read_lock_failed+0x14/0x14
    [ 8683.928121] [] ? start_kernel+0x303/0x30a
    [ 8683.928121] [] ? repair_env_string+0x51/0x51
    [ 8683.928121] [] ? i386_start_kernel+0xa8/0xaf

    It appears that like most virtual devices, l2tp should be converted to
    LLTX mode.

    This patch takes care of statistics using atomic_long in both RX and TX
    paths, and fix a bug in l2tp_eth_dev_recv(), which was caching skb->data
    before a pskb_may_pull() call.

    Signed-off-by: Eric Dumazet
    Reported-by: Denys Fedoryshchenko
    Cc: James Chapman
    Cc: Hong zhi guo
    Cc: Francois Romieu
    Signed-off-by: David S. Miller

    Eric Dumazet
     

26 Jun, 2012

1 commit


08 Jun, 2012

1 commit


17 May, 2012

1 commit

  • Use more current logging styles.

    Add pr_fmt to prefix output appropriately.
    Convert printks to pr_.
    Convert PRINTK macros to new l2tp_ macros.
    Neaten some _refcount debugging macros.
    Use print_hex_dump_bytes instead of hand-coded loops.
    Coalesce formats and align arguments.

    Some KERN_DEBUG output is not now emitted unless
    dynamic_debugging is enabled.

    Signed-off-by: Joe Perches
    Signed-off-by: James Chapman
    Signed-off-by: David S. Miller

    Joe Perches
     

16 Feb, 2012

1 commit


28 Jul, 2011

1 commit

  • After the last patch, We are left in a state in which only drivers calling
    ether_setup have IFF_TX_SKB_SHARING set (we assume that drivers touching real
    hardware call ether_setup for their net_devices and don't hold any state in
    their skbs. There are a handful of drivers that violate this assumption of
    course, and need to be fixed up. This patch identifies those drivers, and marks
    them as not being able to support the safe transmission of skbs by clearning the
    IFF_TX_SKB_SHARING flag in priv_flags

    Signed-off-by: Neil Horman
    CC: Karsten Keil
    CC: "David S. Miller"
    CC: Jay Vosburgh
    CC: Andy Gospodarek
    CC: Patrick McHardy
    CC: Krzysztof Halasa
    CC: "John W. Linville"
    CC: Greg Kroah-Hartman
    CC: Marcel Holtmann
    CC: Johannes Berg
    Signed-off-by: David S. Miller

    Neil Horman
     

22 Mar, 2011

1 commit

  • A struct used in the l2tp_eth driver for registering network namespace
    ops was incorrectly marked as __net_initdata, leading to oops when
    module unloaded.

    BUG: unable to handle kernel paging request at ffffffffa00ec098
    IP: [] ops_exit_list+0x7/0x4b
    PGD 142d067 PUD 1431063 PMD 195da8067 PTE 0
    Oops: 0000 [#1] SMP
    last sysfs file: /sys/module/l2tp_eth/refcnt
    Call Trace:
    [] ? unregister_pernet_operations+0x32/0x93
    [] ? unregister_pernet_device+0x2b/0x38
    [] ? sys_delete_module+0x1b8/0x222
    [] ? do_munmap+0x254/0x318
    [] ? page_fault+0x25/0x30
    [] ? system_call_fastpath+0x16/0x1b

    Signed-off-by: James Chapman
    Signed-off-by: David S. Miller

    James Chapman
     

10 Sep, 2010

1 commit


03 Sep, 2010

1 commit


27 Aug, 2010

1 commit

  • close https://bugzilla.kernel.org/show_bug.cgi?id=16529

    Before calling dev_forward_skb(), we should make sure skb head contains
    at least an ethernet header, even if length included in upper layer said
    so. Use pskb_may_pull() to make sure this ethernet header is present in
    skb head.

    Reported-by: Thomas Heil
    Reported-by: Ian Campbell
    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

24 Apr, 2010

1 commit

  • Since .size is set properly in "struct pernet_operations l2tp_eth_net_ops",
    allocating space for "struct l2tp_eth_net" by hand is not correct, even causes
    memory leakage.

    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Jiri Pirko
     

04 Apr, 2010

3 commits

  • We have to check CONFIG_L2TP_DEBUGFS_MODULE as well as
    CONFIG_L2TP_DEBUGFS.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • The existing pppol2tp driver exports debug info to
    /proc/net/pppol2tp. Rather than adding info to that file for the new
    functionality added in this patch series, we add new files in debugfs,
    leaving the old /proc file for backwards compatibility (L2TPv2 only).

    Currently only one file is provided: l2tp/tunnels, which lists
    internal debug info for all l2tp tunnels and sessions. More files may
    be added later. The info is for debug and problem analysis only -
    userspace apps should use netlink to obtain status about l2tp tunnels
    and sessions.

    Although debugfs does not support net namespaces, the tunnels and
    sessions dumped in l2tp/tunnels are only those in the net namespace of
    the process reading the file.

    Signed-off-by: James Chapman
    Signed-off-by: David S. Miller

    James Chapman
     
  • This driver presents a regular net_device for each L2TP ethernet
    pseudowire instance. These interfaces are named l2tpethN by default,
    though userspace can specify an alternative name when the L2TP
    session is created, if preferred. When the pseudowire is established,
    regular Linux networking utilities may be used to configure the
    interface, i.e. give it IP address info or add it to a bridge. Any
    data passed over the interface is carried over an L2TP tunnel.

    Signed-off-by: James Chapman
    Reviewed-by: Randy Dunlap
    Signed-off-by: David S. Miller

    James Chapman