22 Feb, 2013

1 commit

  • Pull driver core patches from Greg Kroah-Hartman:
    "Here is the big driver core merge for 3.9-rc1

    There are two major series here, both of which touch lots of drivers
    all over the kernel, and will cause you some merge conflicts:

    - add a new function called devm_ioremap_resource() to properly be
    able to check return values.

    - remove CONFIG_EXPERIMENTAL

    Other than those patches, there's not much here, some minor fixes and
    updates"

    Fix up trivial conflicts

    * tag 'driver-core-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (221 commits)
    base: memory: fix soft/hard_offline_page permissions
    drivercore: Fix ordering between deferred_probe and exiting initcalls
    backlight: fix class_find_device() arguments
    TTY: mark tty_get_device call with the proper const values
    driver-core: constify data for class_find_device()
    firmware: Ignore abort check when no user-helper is used
    firmware: Reduce ifdef CONFIG_FW_LOADER_USER_HELPER
    firmware: Make user-mode helper optional
    firmware: Refactoring for splitting user-mode helper code
    Driver core: treat unregistered bus_types as having no devices
    watchdog: Convert to devm_ioremap_resource()
    thermal: Convert to devm_ioremap_resource()
    spi: Convert to devm_ioremap_resource()
    power: Convert to devm_ioremap_resource()
    mtd: Convert to devm_ioremap_resource()
    mmc: Convert to devm_ioremap_resource()
    mfd: Convert to devm_ioremap_resource()
    media: Convert to devm_ioremap_resource()
    iommu: Convert to devm_ioremap_resource()
    drm: Convert to devm_ioremap_resource()
    ...

    Linus Torvalds
     

19 Feb, 2013

2 commits

  • proc_net_remove is only used to remove proc entries
    that under /proc/net,it's not a general function for
    removing proc entries of netns. if we want to remove
    some proc entries which under /proc/net/stat/, we still
    need to call remove_proc_entry.

    this patch use remove_proc_entry to replace proc_net_remove.
    we can remove proc_net_remove after this patch.

    Signed-off-by: Gao feng
    Signed-off-by: David S. Miller

    Gao feng
     
  • Right now, some modules such as bonding use proc_create
    to create proc entries under /proc/net/, and other modules
    such as ipv4 use proc_net_fops_create.

    It looks a little chaos.this patch changes all of
    proc_net_fops_create to proc_create. we can remove
    proc_net_fops_create after this patch.

    Signed-off-by: Gao feng
    Signed-off-by: David S. Miller

    Gao feng
     

09 Feb, 2013

1 commit


08 Feb, 2013

1 commit

  • Andrew Savchenko reported a DNS failure and we diagnosed that
    some UDP sockets were unable to send more packets because their
    sk_wmem_alloc was corrupted after a while (tx_queue column in
    following trace)

    $ cat /proc/net/udp
    sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode ref pointer drops
    ...
    459: 00000000:0270 00000000:0000 07 00000000:00000000 00:00000000 00000000 0 0 4507 2 ffff88003d612380 0
    466: 00000000:0277 00000000:0000 07 00000000:00000000 00:00000000 00000000 0 0 4802 2 ffff88003d613180 0
    470: 076A070A:007B 00000000:0000 07 FFFF4600:00000000 00:00000000 00000000 123 0 5552 2 ffff880039974380 0
    470: 010213AC:007B 00000000:0000 07 00000000:00000000 00:00000000 00000000 0 0 4986 2 ffff88003dbd3180 0
    470: 010013AC:007B 00000000:0000 07 00000000:00000000 00:00000000 00000000 0 0 4985 2 ffff88003dbd2e00 0
    470: 00FCA8C0:007B 00000000:0000 07 FFFFFB00:00000000 00:00000000 00000000 0 0 4984 2 ffff88003dbd2a80 0
    ...

    Playing with skb->truesize is tricky, especially when
    skb is attached to a socket, as we can fool memory charging.

    Just remove this code, its not worth trying to be ultra
    precise in xmit path.

    Reported-by: Andrew Savchenko
    Tested-by: Andrew Savchenko
    Signed-off-by: Eric Dumazet
    Cc: James Chapman
    Signed-off-by: David S. Miller

    Eric Dumazet
     

06 Feb, 2013

5 commits

  • The infrastructure is already pretty much entirely there
    to allow this conversion.

    The tunnel and session lookups have per-namespace tables,
    and the ipv4 bind lookup includes the namespace in the
    lookup key.

    Set netns_ok in l2tp_ip_protocol.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • When creating unmanaged tunnel sockets we should honour the network namespace
    passed to l2tp_tunnel_create. Furthermore, unmanaged tunnel sockets should
    not hold a reference to the network namespace lest they accidentally keep
    alive a namespace which should otherwise have been released.

    Unmanaged tunnel sockets now drop their namespace reference via sk_change_net,
    and are released in a new pernet exit callback, l2tp_exit_net.

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

    Tom Parkin
     
  • l2tp_tunnel_create is passed a pointer to the network namespace for the
    tunnel, along with an optional file descriptor for the tunnel which may
    be passed in from userspace via. netlink.

    In the case where the file descriptor is defined, ensure that the namespace
    associated with that socket matches the namespace explicitly passed to
    l2tp_tunnel_create.

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

    Tom Parkin
     
  • The L2TP netlink code can run in namespaces. Set the netnsok flag in
    genl_family to true to reflect that fact.

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

    Tom Parkin
     
  • To allow l2tp_tunnel_delete to be called from an atomic context, place the
    tunnel socket release calls on a workqueue for asynchronous execution.

    Tunnel memory is eventually freed in the tunnel socket destructor.

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

    Tom Parkin
     

01 Feb, 2013

2 commits

  • l2tp_ip6 is incorrectly using the IPv4-specific ip_cmsg_recv to handle
    ancillary data. This means that socket options such as IPV6_RECVPKTINFO are
    not honoured in userspace.

    Convert l2tp_ip6 to use the IPv6-specific handler.

    Ref: net/ipv6/udp.c

    Signed-off-by: Tom Parkin
    Signed-off-by: James Chapman
    Signed-off-by: Chris Elston
    Signed-off-by: David S. Miller

    Tom Parkin
     
  • The datagram_*_ctl functions in net/ipv6/datagram.c are IPv6-specific. Since
    datagram_send_ctl is publicly exported it should be appropriately named to
    reflect the fact that it's for IPv6 only.

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

    Tom Parkin
     

30 Jan, 2013

1 commit

  • If a tunnel socket is created by userspace, l2tp hooks the socket destructor
    in order to clean up resources if userspace closes the socket or crashes. It
    also caches a pointer to the struct sock for use in the data path and in the
    netlink interface.

    While it is safe to use the cached sock pointer in the data path, where the
    skb references keep the socket alive, it is not safe to use it elsewhere as
    such access introduces a race with userspace closing the socket. In
    particular, l2tp_tunnel_delete is prone to oopsing if a multithreaded
    userspace application closes a socket at the same time as sending a netlink
    delete command for the tunnel.

    This patch fixes this oops by forcing l2tp_tunnel_delete to explicitly look up
    a tunnel socket held by userspace using sockfd_lookup().

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

    Tom Parkin
     

12 Jan, 2013

1 commit

  • The CONFIG_EXPERIMENTAL config item has not carried much meaning for a
    while now and is almost always enabled by default. As agreed during the
    Linux kernel summit, remove it from any "depends on" lines in Kconfigs.

    CC: "David S. Miller"
    Signed-off-by: Kees Cook
    Acked-by: David S. Miller

    Kees Cook
     

11 Nov, 2012

1 commit


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
     

26 Oct, 2012

1 commit


29 Sep, 2012

1 commit

  • Conflicts:
    drivers/net/team/team.c
    drivers/net/usb/qmi_wwan.c
    net/batman-adv/bat_iv_ogm.c
    net/ipv4/fib_frontend.c
    net/ipv4/route.c
    net/l2tp/l2tp_netlink.c

    The team, fib_frontend, route, and l2tp_netlink conflicts were simply
    overlapping changes.

    qmi_wwan and bat_iv_ogm were of the "use HEAD" variety.

    With help from Antonio Quartulli.

    Signed-off-by: David S. Miller

    David S. Miller
     

28 Sep, 2012

1 commit

  • In case of error, the function genlmsg_put() returns NULL pointer
    not ERR_PTR(). The IS_ERR() test in the return value check should
    be replaced with NULL test.

    dpatch engine is used to auto generate this patch.
    (https://github.com/weiyj/dpatch)

    Signed-off-by: Wei Yongjun
    Signed-off-by: David S. Miller

    Wei Yongjun
     

22 Sep, 2012

1 commit

  • When CONFIG_IPV6=m and CONFIG_L2TP=y, I got the following compile error:

    LD init/built-in.o
    net/built-in.o: In function `l2tp_xmit_core':
    l2tp_core.c:(.text+0x147781): undefined reference to `inet6_csk_xmit'
    net/built-in.o: In function `l2tp_tunnel_create':
    (.text+0x149067): undefined reference to `udpv6_encap_enable'
    net/built-in.o: In function `l2tp_ip6_recvmsg':
    l2tp_ip6.c:(.text+0x14e991): undefined reference to `ipv6_recv_error'
    net/built-in.o: In function `l2tp_ip6_sendmsg':
    l2tp_ip6.c:(.text+0x14ec64): undefined reference to `fl6_sock_lookup'
    l2tp_ip6.c:(.text+0x14ed6b): undefined reference to `datagram_send_ctl'
    l2tp_ip6.c:(.text+0x14eda0): undefined reference to `fl6_sock_lookup'
    l2tp_ip6.c:(.text+0x14ede5): undefined reference to `fl6_merge_options'
    l2tp_ip6.c:(.text+0x14edf4): undefined reference to `ipv6_fixup_options'
    l2tp_ip6.c:(.text+0x14ee5d): undefined reference to `fl6_update_dst'
    l2tp_ip6.c:(.text+0x14eea3): undefined reference to `ip6_dst_lookup_flow'
    l2tp_ip6.c:(.text+0x14eee7): undefined reference to `ip6_dst_hoplimit'
    l2tp_ip6.c:(.text+0x14ef8b): undefined reference to `ip6_append_data'
    l2tp_ip6.c:(.text+0x14ef9d): undefined reference to `ip6_flush_pending_frames'
    l2tp_ip6.c:(.text+0x14efe2): undefined reference to `ip6_push_pending_frames'
    net/built-in.o: In function `l2tp_ip6_destroy_sock':
    l2tp_ip6.c:(.text+0x14f090): undefined reference to `ip6_flush_pending_frames'
    l2tp_ip6.c:(.text+0x14f0a0): undefined reference to `inet6_destroy_sock'
    net/built-in.o: In function `l2tp_ip6_connect':
    l2tp_ip6.c:(.text+0x14f14d): undefined reference to `ip6_datagram_connect'
    net/built-in.o: In function `l2tp_ip6_bind':
    l2tp_ip6.c:(.text+0x14f4fe): undefined reference to `ipv6_chk_addr'
    net/built-in.o: In function `l2tp_ip6_init':
    l2tp_ip6.c:(.init.text+0x73fa): undefined reference to `inet6_add_protocol'
    l2tp_ip6.c:(.init.text+0x740c): undefined reference to `inet6_register_protosw'
    net/built-in.o: In function `l2tp_ip6_exit':
    l2tp_ip6.c:(.exit.text+0x1954): undefined reference to `inet6_unregister_protosw'
    l2tp_ip6.c:(.exit.text+0x1965): undefined reference to `inet6_del_protocol'
    net/built-in.o:(.rodata+0xf2d0): undefined reference to `inet6_release'
    net/built-in.o:(.rodata+0xf2d8): undefined reference to `inet6_bind'
    net/built-in.o:(.rodata+0xf308): undefined reference to `inet6_ioctl'
    net/built-in.o:(.data+0x1af40): undefined reference to `ipv6_setsockopt'
    net/built-in.o:(.data+0x1af48): undefined reference to `ipv6_getsockopt'
    net/built-in.o:(.data+0x1af50): undefined reference to `compat_ipv6_setsockopt'
    net/built-in.o:(.data+0x1af58): undefined reference to `compat_ipv6_getsockopt'
    make: *** [vmlinux] Error 1

    This is due to l2tp uses symbols from IPV6, so when IPV6
    is a module, l2tp is not allowed to be builtin.

    Cc: David Miller
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Amerigo Wang
     

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
     

11 Sep, 2012

1 commit

  • It is a frequent mistake to confuse the netlink port identifier with a
    process identifier. Try to reduce this confusion by renaming fields
    that hold port identifiers portid instead of pid.

    I have carefully avoided changing the structures exported to
    userspace to avoid changing the userspace API.

    I have successfully built an allyesconfig kernel with this change.

    Signed-off-by: "Eric W. Biederman"
    Acked-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

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

2 commits

  • While investigating l2tp bug, I hit a bug in eth_type_trans(),
    because not enough bytes were pulled in skb head.

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

    Eric Dumazet
     
  • Fixes following lockdep splat :

    [ 1614.734896] =============================================
    [ 1614.734898] [ INFO: possible recursive locking detected ]
    [ 1614.734901] 3.6.0-rc3+ #782 Not tainted
    [ 1614.734903] ---------------------------------------------
    [ 1614.734905] swapper/11/0 is trying to acquire lock:
    [ 1614.734907] (slock-AF_INET){+.-...}, at: [] l2tp_xmit_skb+0x172/0xa50 [l2tp_core]
    [ 1614.734920]
    [ 1614.734920] but task is already holding lock:
    [ 1614.734922] (slock-AF_INET){+.-...}, at: [] tcp_v4_err+0x163/0x6b0
    [ 1614.734932]
    [ 1614.734932] other info that might help us debug this:
    [ 1614.734935] Possible unsafe locking scenario:
    [ 1614.734935]
    [ 1614.734937] CPU0
    [ 1614.734938] ----
    [ 1614.734940] lock(slock-AF_INET);
    [ 1614.734943] lock(slock-AF_INET);
    [ 1614.734946]
    [ 1614.734946] *** DEADLOCK ***
    [ 1614.734946]
    [ 1614.734949] May be due to missing lock nesting notation
    [ 1614.734949]
    [ 1614.734952] 7 locks held by swapper/11/0:
    [ 1614.734954] #0: (rcu_read_lock){.+.+..}, at: [] __netif_receive_skb+0x251/0xd00
    [ 1614.734964] #1: (rcu_read_lock){.+.+..}, at: [] ip_local_deliver_finish+0x4c/0x4e0
    [ 1614.734972] #2: (rcu_read_lock){.+.+..}, at: [] icmp_socket_deliver+0x46/0x230
    [ 1614.734982] #3: (slock-AF_INET){+.-...}, at: [] tcp_v4_err+0x163/0x6b0
    [ 1614.734989] #4: (rcu_read_lock){.+.+..}, at: [] ip_queue_xmit+0x0/0x680
    [ 1614.734997] #5: (rcu_read_lock_bh){.+....}, at: [] ip_finish_output+0x135/0x890
    [ 1614.735004] #6: (rcu_read_lock_bh){.+....}, at: [] dev_queue_xmit+0x0/0xe00
    [ 1614.735012]
    [ 1614.735012] stack backtrace:
    [ 1614.735016] Pid: 0, comm: swapper/11 Not tainted 3.6.0-rc3+ #782
    [ 1614.735018] Call Trace:
    [ 1614.735020] [] __lock_acquire+0x144c/0x1b10
    [ 1614.735033] [] ? check_usage+0x9b/0x4d0
    [ 1614.735037] [] ? mark_held_locks+0x82/0x130
    [ 1614.735042] [] lock_acquire+0x90/0x200
    [ 1614.735047] [] ? l2tp_xmit_skb+0x172/0xa50 [l2tp_core]
    [ 1614.735051] [] ? trace_hardirqs_on+0xd/0x10
    [ 1614.735060] [] _raw_spin_lock+0x41/0x50
    [ 1614.735065] [] ? l2tp_xmit_skb+0x172/0xa50 [l2tp_core]
    [ 1614.735069] [] l2tp_xmit_skb+0x172/0xa50 [l2tp_core]
    [ 1614.735075] [] l2tp_eth_dev_xmit+0x32/0x60 [l2tp_eth]
    [ 1614.735079] [] dev_hard_start_xmit+0x502/0xa70
    [ 1614.735083] [] ? dev_hard_start_xmit+0x5e/0xa70
    [ 1614.735087] [] ? dev_queue_xmit+0x141/0xe00
    [ 1614.735093] [] sch_direct_xmit+0xfe/0x290
    [ 1614.735098] [] dev_queue_xmit+0x1e5/0xe00
    [ 1614.735102] [] ? dev_hard_start_xmit+0xa70/0xa70
    [ 1614.735106] [] ? eth_header+0x3a/0xf0
    [ 1614.735111] [] ? fib_get_table+0x2e/0x280
    [ 1614.735117] [] arp_xmit+0x22/0x60
    [ 1614.735121] [] arp_send+0x43/0x50
    [ 1614.735125] [] arp_solicit+0x18f/0x450
    [ 1614.735132] [] neigh_probe+0x4a/0x70
    [ 1614.735137] [] __neigh_event_send+0xea/0x300
    [ 1614.735141] [] neigh_resolve_output+0x163/0x260
    [ 1614.735146] [] ip_finish_output+0x505/0x890
    [ 1614.735150] [] ? ip_finish_output+0x135/0x890
    [ 1614.735154] [] ip_output+0x59/0xf0
    [ 1614.735158] [] ip_local_out+0x2d/0xa0
    [ 1614.735162] [] ip_queue_xmit+0x1c3/0x680
    [ 1614.735165] [] ? ip_local_out+0xa0/0xa0
    [ 1614.735172] [] tcp_transmit_skb+0x402/0xa60
    [ 1614.735177] [] tcp_retransmit_skb+0x1a1/0x620
    [ 1614.735181] [] tcp_retransmit_timer+0x393/0x960
    [ 1614.735185] [] ? tcp_v4_err+0x163/0x6b0
    [ 1614.735189] [] tcp_v4_err+0x657/0x6b0
    [ 1614.735194] [] ? icmp_socket_deliver+0x46/0x230
    [ 1614.735199] [] icmp_socket_deliver+0xce/0x230
    [ 1614.735203] [] ? icmp_socket_deliver+0x46/0x230
    [ 1614.735208] [] icmp_unreach+0xe4/0x2c0
    [ 1614.735213] [] icmp_rcv+0x350/0x4a0
    [ 1614.735217] [] ip_local_deliver_finish+0x135/0x4e0
    [ 1614.735221] [] ? ip_local_deliver_finish+0x4c/0x4e0
    [ 1614.735225] [] ip_local_deliver+0x4a/0x90
    [ 1614.735229] [] ip_rcv_finish+0x187/0x730
    [ 1614.735233] [] ip_rcv+0x21d/0x300
    [ 1614.735237] [] __netif_receive_skb+0x46b/0xd00
    [ 1614.735241] [] ? __netif_receive_skb+0x251/0xd00
    [ 1614.735245] [] process_backlog+0xb8/0x180
    [ 1614.735249] [] net_rx_action+0x159/0x330
    [ 1614.735257] [] __do_softirq+0xd0/0x3e0
    [ 1614.735264] [] ? tick_program_event+0x24/0x30
    [ 1614.735270] [] call_softirq+0x1c/0x30
    [ 1614.735278] [] do_softirq+0x8d/0xc0
    [ 1614.735282] [] irq_exit+0xae/0xe0
    [ 1614.735287] [] smp_apic_timer_interrupt+0x6e/0x99
    [ 1614.735291] [] apic_timer_interrupt+0x6c/0x80
    [ 1614.735293] [] ? trace_hardirqs_off+0xd/0x10
    [ 1614.735306] [] ? intel_idle+0xf5/0x150
    [ 1614.735310] [] ? intel_idle+0xee/0x150
    [ 1614.735317] [] cpuidle_enter+0x19/0x20
    [ 1614.735321] [] cpuidle_idle_call+0xa8/0x630
    [ 1614.735327] [] cpu_idle+0x8a/0xe0
    [ 1614.735333] [] start_secondary+0x220/0x222

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

    Eric Dumazet
     

31 Aug, 2012

1 commit


16 Aug, 2012

1 commit

  • The L2TP code for IPv6 fails to initialize the l2tp_unused member of
    struct sockaddr_l2tpip6 and that for leaks two bytes kernel stack via
    the getsockname() syscall. Initialize l2tp_unused with 0 to avoid the
    info leak.

    Signed-off-by: Mathias Krause
    Cc: James Chapman
    Signed-off-by: David S. Miller

    Mathias Krause
     

29 Jun, 2012

3 commits

  • 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
     
  • Using NLMSG_GOODSIZE results in multiple pages being used as
    nlmsg_new() will automatically add the size of the netlink
    header to the payload thus exceeding the page limit.

    NLMSG_DEFAULT_SIZE takes this into account.

    Signed-off-by: Thomas Graf
    Cc: Jiri Pirko
    Cc: Dmitry Eremin-Solenikov
    Cc: Sergey Lapin
    Cc: Johannes Berg
    Cc: Lauro Ramos Venancio
    Cc: Aloisio Almeida Jr
    Cc: Samuel Ortiz
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Thomas Graf
     
  • Conflicts:
    drivers/net/caif/caif_hsi.c
    drivers/net/usb/qmi_wwan.c

    The qmi_wwan merge was trivial.

    The caif_hsi.c, on the other hand, was not. It's a conflict between
    1c385f1fdf6f9c66d982802cd74349c040980b50 ("caif-hsi: Replace platform
    device with ops structure.") in the net-next tree and commit
    39abbaef19cd0a30be93794aa4773c779c3eb1f3 ("caif-hsi: Postpone init of
    HIS until open()") in the net tree.

    I did my best with that one and will ask Sjur to check it out.

    Signed-off-by: David S. Miller

    David S. Miller
     

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


13 Jun, 2012

1 commit

  • Conflicts:
    MAINTAINERS
    drivers/net/wireless/iwlwifi/pcie/trans.c

    The iwlwifi conflict was resolved by keeping the code added
    in 'net' that turns off the buggy chip feature.

    The MAINTAINERS conflict was merely overlapping changes, one
    change updated all the wireless web site URLs and the other
    changed some GIT trees to be Johannes's instead of John's.

    Signed-off-by: David S. Miller

    David S. Miller
     

09 Jun, 2012

1 commit

  • Commit 081b1b1bb27f (l2tp: fix l2tp_ip_sendmsg() route handling) added
    a race, in case IP route cache is disabled.

    In this case, we should not do the dst_release(&rt->dst), since it'll
    free the dst immediately, instead of waiting a RCU grace period.

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

    Eric Dumazet
     

08 Jun, 2012

1 commit


04 Jun, 2012

1 commit

  • Adding casts of objects to the same type is unnecessary
    and confusing for a human reader.

    For example, this cast:

    int y;
    int *p = (int *)&y;

    I used the coccinelle script below to find and remove these
    unnecessary casts. I manually removed the conversions this
    script produces of casts with __force and __user.

    @@
    type T;
    T *p;
    @@

    - (T *)p
    + p

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

    Joe Perches
     

30 May, 2012

2 commits

  • Generic netlink searches for -type- formatted aliases when requesting a module to
    fulfill a protocol request (i.e. net-pf-16-proto-16-type-, where x is a type
    value). However generic netlink protocols have no well defined type numbers,
    they have string names. Modify genl_ctrl_getfamily to request an alias in the
    format net-pf-16-proto-16-family- instead, where x is a generic string, and
    add a macro that builds on the previously added MODULE_ALIAS_NET_PF_PROTO_NAME
    macro to allow modules to specifify those generic strings.

    Note, l2tp previously hacked together an net-pf-16-proto-16-type-l2tp alias
    using the MODULE_ALIAS macro, with these updates we can convert that to use the
    PROTO_NAME macro.

    Signed-off-by: Neil Horman
    CC: Eric Dumazet
    CC: James Chapman
    CC: David Miller
    Signed-off-by: David S. Miller

    Neil Horman
     
  • An application may call connect() to disconnect a socket using an
    address with family AF_UNSPEC. The L2TP IP sockets were not handling
    this case when the socket is not bound and an attempt to connect()
    using AF_UNSPEC in such cases would result in an oops. This patch
    addresses the problem by protecting the sk_prot->disconnect() call
    against trying to unhash the socket before it is bound.

    The L2TP IPv4 and IPv6 sockets have the same problem. Both are fixed
    by this patch.

    The patch also adds more checks that the sockaddr supplied to bind()
    and connect() calls is valid.

    RIP: 0010:[] [] inet_unhash+0x50/0xd0
    RSP: 0018:ffff88001989be28 EFLAGS: 00010293
    Stack:
    ffff8800407a8000 0000000000000000 ffff88001989be78 ffffffff82e3a249
    ffffffff82e3a050 ffff88001989bec8 ffff88001989be88 ffff8800407a8000
    0000000000000010 ffff88001989bec8 ffff88001989bea8 ffffffff82e42639
    Call Trace:
    [] udp_disconnect+0x1f9/0x290
    [] inet_dgram_connect+0x29/0x80
    [] sys_connect+0x9c/0x100

    Reported-by: Sasha Levin
    Signed-off-by: James Chapman
    Signed-off-by: David S. Miller

    James Chapman
     

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
     

11 May, 2012

1 commit

  • If enabled, L2TP data packets have sequence numbers which a receiver
    can use to drop out of sequence frames or try to reorder them. The
    first frame has sequence number 0, but the L2TP code currently expects
    it to be 1. This results in the first data frame being handled as out
    of sequence.

    This one-line patch fixes the problem.

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

    James Chapman