10 years agor8169: use RxFIFO overflow workaround for 8168c chipset.
Ivan Vecera [Thu, 27 Jan 2011 11:24:11 +0000 (12:24 +0100)]
r8169: use RxFIFO overflow workaround for 8168c chipset.

I found that one of the 8168c chipsets (concretely XID 1c4000c0) starts
generating RxFIFO overflow errors. The result is an infinite loop in
interrupt handler as the RxFIFOOver is handled only for ...MAC_VER_11.
With the workaround everything goes fine.

Signed-off-by: Ivan Vecera <>
Acked-by: Francois Romieu <>
Cc: Hayes <>
10 years agoinclude/net/genetlink.h: Allow genlmsg_cancel to accept a NULL argument
Julia Lawall [Fri, 28 Jan 2011 05:43:40 +0000 (05:43 +0000)]
include/net/genetlink.h: Allow genlmsg_cancel to accept a NULL argument

nlmsg_cancel can accept NULL as its second argument, so for similarity,
this patch extends genlmsg_cancel to be able to accept a NULL second
argument as well.

Signed-off-by: Julia Lawall <>
Signed-off-by: David S. Miller <>
10 years agonet: Provide compat support for SIOCGETMIFCNT_IN6 and SIOCGETSGCNT_IN6.
David S. Miller [Fri, 4 Feb 2011 01:59:32 +0000 (17:59 -0800)]
net: Provide compat support for SIOCGETMIFCNT_IN6 and SIOCGETSGCNT_IN6.

Signed-off-by: David S. Miller <>
10 years agonet: Support compat SIOCGETVIFCNT ioctl in ipv4.
David S. Miller [Fri, 4 Feb 2011 01:24:28 +0000 (17:24 -0800)]
net: Support compat SIOCGETVIFCNT ioctl in ipv4.

Signed-off-by: David S. Miller <>
10 years agonet: Fix bug in compat SIOCGETSGCNT handling.
David S. Miller [Fri, 4 Feb 2011 01:21:31 +0000 (17:21 -0800)]
net: Fix bug in compat SIOCGETSGCNT handling.

Commit 709b46e8d90badda1898caea50483c12af178e96 ("net: Add compat
ioctl support for the ipv4 multicast ioctl SIOCGETSGCNT") added the
correct plumbing to handle SIOCGETSGCNT properly.

However, whilst definiting a proper "struct compat_sioc_sg_req" it
isn't actually used in ipmr_compat_ioctl().

Correct this oversight.

Signed-off-by: David S. Miller <>
10 years agoniu: Fix races between up/down and get_stats.
David S. Miller [Fri, 4 Feb 2011 00:12:50 +0000 (16:12 -0800)]
niu: Fix races between up/down and get_stats.

As reported by Flavio Leitner, there is no synchronization to protect
NIU's get_stats method from seeing a NULL pointer in either
np->rx_rings or np->tx_rings.  In fact, as far as ->ndo_get_stats
is concerned, these values are set completely asynchronously.

Flavio attempted to fix this using a RW semaphore, which in fact
works most of the time.  However, dev_get_stats() can be invoked
from non-sleepable contexts in some cases, so this fix doesn't
work in all cases.

So instead, control the visibility of the np->{rx,tx}_ring pointers
when the device is being brough up, and use properties of the device
down sequence to our advantage.

In niu_get_stats(), return immediately if netif_running() is false.
The device shutdown sequence first marks the device as not running (by
clearing the __LINK_STATE_START bit), then it performans a
synchronize_rcu() (in dev_deactive_many()), and then finally it
invokes the driver ->ndo_stop() method.

This guarentees that all invocations of niu_get_stats() either see
netif_running() as false, or they see the channel pointers before
->ndo_stop() clears them out.

If netif_running() is true, protect against startup races by loading
the np->{rx,tx}_rings pointer into a local variable, and punting if
it is NULL.  Use ACCESS_ONCE to prevent the compiler from reloading
the pointer on us.

Also, during open, control the order in which the pointers and the
ring counts become visible globally using SMP write memory barriers.
We make sure the np->num_{rx,tx}_rings value is stable and visible
before np->{rx,tx}_rings is.

Such visibility control is not necessary on the niu_free_channels()
side because of the RCU sequencing that happens during device down as
described above.  We are always guarenteed that all niu_get_stats
calls are finished, or will see netif_running() false, by the time
->ndo_stop is invoked.

Reported-by: Flavio Leitner <>
Signed-off-by: David S. Miller <>
10 years agoMerge branch 'master' of git://
David S. Miller [Wed, 2 Feb 2011 23:52:23 +0000 (15:52 -0800)]
Merge branch 'master' of git://git./linux/kernel/git/kaber/nf-2.6

10 years agotcp_ecn is an integer not a boolean
Peter Chubb [Wed, 2 Feb 2011 23:39:58 +0000 (15:39 -0800)]
tcp_ecn is an integer not a boolean

There was some confusion at LCA as to why the sysctl tcp_ecn took one
of three values when it was documented as a Boolean.  This patch fixes
the documentation.

Signed-off-by: Peter Chubb <>
Signed-off-by: David S. Miller <>
10 years agoatl1c: Add missing PCI device ID
Chuck Ebbert [Wed, 2 Feb 2011 23:02:08 +0000 (15:02 -0800)]
atl1c: Add missing PCI device ID

Commit 8f574b35f22fbb9b5e5f1d11ad6b55b6f35f4533 ("atl1c: Add AR8151 v2
support and change L0s/L1 routine") added support for a new adapter
but failed to add it to the PCI device table.

Signed-Off-By: Chuck Ebbert <>
Signed-off-by: David S. Miller <>
10 years agos390: Fix possibly wrong size in strncmp (smsgiucv)
Stefan Weil [Wed, 2 Feb 2011 06:04:36 +0000 (06:04 +0000)]
s390: Fix possibly wrong size in strncmp (smsgiucv)

This error was reported by cppcheck:
drivers/s390/net/smsgiucv.c:63: error: Using sizeof for array given as
function argument returns the size of pointer.

Although there is no runtime problem as long as sizeof(u8 *) == 8,
this misleading code should get fixed.

Signed-off-by: Stefan Weil <>
Signed-off-by: Frank Blaschka <>
Signed-off-by: David S. Miller <>
10 years agos390: Fix wrong size in memcmp (netiucv)
Stefan Weil [Wed, 2 Feb 2011 06:04:35 +0000 (06:04 +0000)]
s390: Fix wrong size in memcmp (netiucv)

This error was reported by cppcheck:
drivers/s390/net/netiucv.c:568: error: Using sizeof for array given
as function argument returns the size of pointer.

sizeof(ipuser) did not result in 16 (as many programmers would have
expected) but sizeof(u8 *), so it is 4 or 8, too small here.

Signed-off-by: Stefan Weil <>
Signed-off-by: Frank Blaschka <>
Signed-off-by: David S. Miller <>
10 years agoqeth: allow OSA CHPARM change in suspend state
Ursula Braun [Wed, 2 Feb 2011 06:04:34 +0000 (06:04 +0000)]
qeth: allow OSA CHPARM change in suspend state

For OSA the CHPARM-definition determines the number of available
outbound queues.
A CHPARM-change may occur while a Linux system with probed
OSA device is in suspend state. This patch enables proper
resuming of an OSA device in this case.

Signed-off-by: Ursula braun <>
Signed-off-by: Frank Blaschka <>
Signed-off-by: David S. Miller <>
10 years agoqeth: allow HiperSockets framesize change in suspend
Ursula Braun [Wed, 2 Feb 2011 06:04:33 +0000 (06:04 +0000)]
qeth: allow HiperSockets framesize change in suspend

For HiperSockets the framesize-definition determines the selected
mtu-size and the size of the allocated qdio buffers.
A framesize-change may occur while a Linux system with probed
HiperSockets device is in suspend state. This patch enables proper
resuming of a HiperSockets device in this case.

Signed-off-by: Ursula Braun <>
Signed-off-by: Frank Blaschka <>
Signed-off-by: David S. Miller <>
10 years agoqeth: add more strict MTU checking
Frank Blaschka [Wed, 2 Feb 2011 06:04:32 +0000 (06:04 +0000)]
qeth: add more strict MTU checking

HiperSockets and OSA hardware report a maximum MTU size. Add checking
to reject larger MTUs than allowed by hardware.

Signed-off-by: Frank Blaschka <>
Signed-off-by: David S. Miller <>
10 years agoqeth: show new mac-address if its setting fails
Ursula Braun [Wed, 2 Feb 2011 06:04:31 +0000 (06:04 +0000)]
qeth: show new mac-address if its setting fails

Setting of a MAC-address may fail because an already used MAC-address
is to bet set or because of authorization problems. In those cases
qeth issues a message, but the mentioned MAC-address is not the
new MAC-address to be set, but the actual MAC-address. This patch
chooses now the new MAC-address to be set for the error messages.

Signed-off-by: Ursula Braun <>
Signed-off-by: Frank Blaschka <>
Signed-off-by: David S. Miller <>
10 years agogro: reset skb_iif on reuse
Andy Gospodarek [Wed, 2 Feb 2011 22:53:25 +0000 (14:53 -0800)]
gro: reset skb_iif on reuse

Like Herbert's change from a few days ago:

66c46d741e2e60f0e8b625b80edb0ab820c46d7a gro: Reset dev pointer on reuse

this may not be necessary at this point, but we should still clean up
the skb->skb_iif.  If not we may end up with an invalid valid for
skb->skb_iif when the skb is reused and the check is done in

Signed-off-by: Andy Gospodarek <>
Signed-off-by: David S. Miller <>
10 years agobe2net: remove netif_stop_queue being called before register_netdev.
Ajit Khaparde [Tue, 1 Feb 2011 23:41:59 +0000 (15:41 -0800)]
be2net: remove netif_stop_queue being called before register_netdev.

It is illegal to call netif_stop_queue before register_netdev.

Signed-off-by: Ajit Khaparde <>
Signed-off-by: David S. Miller <>
10 years agobe2net: fix a crash seen during insmod/rmmod test
Ajit Khaparde [Tue, 1 Feb 2011 23:41:13 +0000 (15:41 -0800)]
be2net: fix a crash seen during insmod/rmmod test

While running insmod/rmood in a loop, an unnecessary netif_stop_queue
causes the system to crash. Remove the netif_stop_queue call
and netif_start_queue in the link status update path.

Signed-off-by: Ajit Khaparde <>
Signed-off-by: David S. Miller <>
10 years agoisdn: icn: Fix potentially wrong string handling
Stefan Weil [Sun, 30 Jan 2011 10:31:26 +0000 (10:31 +0000)]
isdn: icn: Fix potentially wrong string handling

This warning was reported by cppcheck:
drivers/isdn/icn/icn.c:1641: error: Dangerous usage of 'rev' (strncpy doesn't always 0-terminate it)

If strncpy copied 20 bytes, the destination string rev was not terminated.
The patch adds one more byte to rev and makes sure that this byte is
always 0.

Cc: Karsten Keil <>
Cc: "David S. Miller" <>
Cc: Tejun Heo <>
Cc: Steven Rostedt <>
Signed-off-by: Stefan Weil <>
Signed-off-by: David S. Miller <>
10 years agobnx2x: multicasts in NPAR mode
Vladislav Zolotarov [Tue, 1 Feb 2011 22:05:30 +0000 (14:05 -0800)]
bnx2x: multicasts in NPAR mode

The chip was erroneously configured to accept all multicast frames
in a normal (none-promisc) rx mode both on the RSS and on the FCoE L2 rings
when in an NPAR mode. This caused packet duplication for every received multicast
frame in this mode.

Signed-off-by: Vladislav Zolotarov <>
Signed-off-by: Eilon Greenstein <>
Signed-off-by: David S. Miller <>
10 years agodepca: Fix warnings
Alan Cox [Tue, 1 Feb 2011 21:19:07 +0000 (13:19 -0800)]
depca: Fix warnings

Replace the rather weird use of ++ with + 1 as the value is being assigned

Signed-off-by: Alan Cox <>
10 years agoMerge branch 'master' of git://
David S. Miller [Tue, 1 Feb 2011 21:08:59 +0000 (13:08 -0800)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless-2.6

10 years agoMerge branch 'vhost-net' of git://
David S. Miller [Tue, 1 Feb 2011 20:56:11 +0000 (12:56 -0800)]
Merge branch 'vhost-net' of git://git./linux/kernel/git/mst/vhost

10 years agovxge: Fix wrong boolean operator
Stefan Weil [Fri, 28 Jan 2011 12:30:17 +0000 (12:30 +0000)]
vxge: Fix wrong boolean operator

This error is reported by cppcheck:
drivers/net/vxge/vxge-config.c:3693: warning: Mutual exclusion over || always evaluates to true. Did you intend to use && instead?

It looks like cppcheck is correct, so fix this. No test was run.

Cc: Ramkrishna Vepa <>
Cc: Sivakumar Subramani <>
Cc: Sreenivasa Honnur <>
Cc: Jon Mason <>
Signed-off-by: Stefan Weil <>
Acked-by: Ram Vepa <>
Signed-off-by: David S. Miller <>
10 years agoath9k: Fix memory leak due to failed PAPRD frames
Mohammed Shafi Shajakhan [Mon, 31 Jan 2011 07:55:29 +0000 (13:25 +0530)]
ath9k: Fix memory leak due to failed PAPRD frames

free the skb's when the Tx of PAPRD frames fails and also add a debug
message indicating that.

Signed-off-by: Mohammed Shafi Shajakhan <>
Signed-off-by: John W. Linville <>
10 years agonetfilter: ecache: always set events bits, filter them later
Pablo Neira Ayuso [Tue, 1 Feb 2011 15:06:30 +0000 (16:06 +0100)]
netfilter: ecache: always set events bits, filter them later

For the following rule:

iptables -I PREROUTING -t raw -j CT --ctevents assured

The event delivered looks like the following:

 [UPDATE] tcp      6 src= dst= sport=37041 dport=80 src= dst= sport=80 dport=37041 [ASSURED]

Note that the TCP protocol state is not included. For that reason
the CT event filtering is not very useful for conntrackd.

To resolve this issue, instead of conditionally setting the CT events
bits based on the ctmask, we always set them and perform the filtering
in the late stage, just before the delivery.

Thus, the event delivered looks like the following:

 [UPDATE] tcp      6 432000 ESTABLISHED src= dst= sport=37041 dport=80 src= dst= sport=80 dport=37041 [ASSURED]

Signed-off-by: Pablo Neira Ayuso <>
Signed-off-by: Patrick McHardy <>
10 years agonetfilter: arpt_mangle: fix return values of checkentry
Pablo Neira Ayuso [Tue, 1 Feb 2011 15:03:46 +0000 (16:03 +0100)]
netfilter: arpt_mangle: fix return values of checkentry

In 135367b "netfilter: xtables: change xt_target.checkentry return type",
the type returned by checkentry was changed from boolean to int, but the
return values where not adjusted.

arptables: Input/output error

This broke arptables with the mangle target since it returns true
under success, which is interpreted by xtables as >0, thus
returning EIO.

Signed-off-by: Pablo Neira Ayuso <>
Signed-off-by: Patrick McHardy <>
10 years agovhost: rcu annotation fixup
Michael S. Tsirkin [Tue, 18 Jan 2011 11:04:43 +0000 (13:04 +0200)]
vhost: rcu annotation fixup

When built with rcu checks enabled, vhost triggers
bogus warnings as vhost features are read without
dev->mutex sometimes, and private pointer is read
with our kind of rcu where work serves as a
read side critical section.

Fixing it properly is not trivial.
Disable the warnings by stubbing out the checks for now.

Signed-off-by: Michael S. Tsirkin <>
10 years agoenc28j60: Fix reading of transmit status vector
Stefan Weil [Tue, 1 Feb 2011 04:56:54 +0000 (20:56 -0800)]
enc28j60: Fix reading of transmit status vector

This error was reported by cppcheck:
drivers/net/enc28j60.c:815: error: Using sizeof for array given as function argument returns the size of pointer.

The original code reads 4 or 8 bytes instead of TSV_SIZE (= 100) bytes.
I just fixed the code, but did not run any tests.

Signed-off-by: Stefan Weil <>
Signed-off-by: David S. Miller <>
10 years agonet: Fix ipv6 neighbour unregister_sysctl_table warning
Eric W. Biederman [Tue, 1 Feb 2011 04:54:17 +0000 (20:54 -0800)]
net: Fix ipv6 neighbour unregister_sysctl_table warning

In my testing of 2.6.37 I was occassionally getting a warning about
sysctl table entries being unregistered in the wrong order.  Digging
in it turns out this dates back to the last great sysctl reorg done
where Al Viro introduced the requirement that sysctl directories
needed to be created before and destroyed after the files in them.

It turns out that in that great reorg /proc/sys/net/ipv6/neigh was
overlooked.  So this patch fixes that oversight and makes an annoying
warning message go away.

>------------[ cut here ]------------
>WARNING: at kernel/sysctl.c:1992 unregister_sysctl_table+0x134/0x164()
>Pid: 23951, comm: kworker/u:3 Not tainted 2.6.37-350888.2010AroraKernelBeta.fc14.x86_64 #1
>Call Trace:
> [<ffffffff8103e034>] warn_slowpath_common+0x80/0x98
> [<ffffffff8103e061>] warn_slowpath_null+0x15/0x17
> [<ffffffff810452f8>] unregister_sysctl_table+0x134/0x164
> [<ffffffff810e7834>] ? kfree+0xc4/0xd1
> [<ffffffff813439b2>] neigh_sysctl_unregister+0x22/0x3a
> [<ffffffffa02cd14e>] addrconf_ifdown+0x33f/0x37b [ipv6]
> [<ffffffff81331ec2>] ? skb_dequeue+0x5f/0x6b
> [<ffffffffa02ce4a5>] addrconf_notify+0x69b/0x75c [ipv6]
> [<ffffffffa02eb953>] ? ip6mr_device_event+0x98/0xa9 [ipv6]
> [<ffffffff813d2413>] notifier_call_chain+0x32/0x5e
> [<ffffffff8105bdea>] raw_notifier_call_chain+0xf/0x11
> [<ffffffff8133cdac>] call_netdevice_notifiers+0x45/0x4a
> [<ffffffff8133d2b0>] rollback_registered_many+0x118/0x201
> [<ffffffff8133d3af>] unregister_netdevice_many+0x16/0x6d
> [<ffffffff8133d571>] default_device_exit_batch+0xa4/0xb8
> [<ffffffff81337c42>] ? cleanup_net+0x0/0x194
> [<ffffffff81337a2a>] ops_exit_list+0x4e/0x56
> [<ffffffff81337d36>] cleanup_net+0xf4/0x194
> [<ffffffff81053318>] process_one_work+0x187/0x280
> [<ffffffff8105441b>] worker_thread+0xff/0x19f
> [<ffffffff8105431c>] ? worker_thread+0x0/0x19f
> [<ffffffff8105776d>] kthread+0x7d/0x85
> [<ffffffff81003824>] kernel_thread_helper+0x4/0x10
> [<ffffffff810576f0>] ? kthread+0x0/0x85
> [<ffffffff81003820>] ? kernel_thread_helper+0x0/0x10
>---[ end trace 8a7e9310b35e9486 ]---

Signed-off-by: Eric W. Biederman <>
Signed-off-by: David S. Miller <>
10 years agoaxnet_cs: reduce delay time at ei_rx_overrun
Ken Kawasaki [Sun, 30 Jan 2011 11:16:16 +0000 (11:16 +0000)]
axnet_cs: reduce delay time at ei_rx_overrun

    mdelay of 10ms is too long at ei_rx_overrun.
    It should be reduced to 2ms.

Signed-off-by: Ken Kawasaki <>
Signed-off-by: David S. Miller <>
10 years agonet: Check rps_flow_table when RPS map length is 1
Tom Herbert [Tue, 1 Feb 2011 00:23:42 +0000 (16:23 -0800)]
net: Check rps_flow_table when RPS map length is 1

In get_rps_cpu, add check that the rps_flow_table for the device is
NULL when trying to take fast path when RPS map length is one.
Without this, RFS is effectively disabled if map length is one which
is not correct.

Signed-off-by: Tom Herbert <>
Signed-off-by: David S. Miller <>
10 years agoCAN: softing driver depends on IOMEM
Chuck Ebbert [Mon, 31 Jan 2011 05:44:07 +0000 (05:44 +0000)]
CAN: softing driver depends on IOMEM

Without this dependency the softing driver will be buildable on s390,
where it fails.

Signed-Off-By: Chuck Ebbert <>
Acked-by: Kurt Van Dijck <>
Signed-off-by: David S. Miller <>
10 years agonet: Add default_mtu() methods to blackhole dst_ops
Roland Dreier [Mon, 31 Jan 2011 21:16:00 +0000 (13:16 -0800)]
net: Add default_mtu() methods to blackhole dst_ops

When an IPSEC SA is still being set up, __xfrm_lookup() will return
-EREMOTE and so ip_route_output_flow() will return a blackhole route.
This can happen in a sndmsg call, and after d33e455337ea ("net: Abstract
default MTU metric calculation behind an accessor.") this leads to a
crash in ip_append_data() because the blackhole dst_ops have no
default_mtu() method and so dst_mtu() calls a NULL pointer.

Fix this by adding default_mtu() methods (that simply return 0, matching
the old behavior) to the blackhole dst_ops.

The IPv4 part of this patch fixes a crash that I saw when using an IPSEC
VPN; the IPv6 part is untested because I don't have an IPv6 VPN, but it
looks to be needed as well.

Signed-off-by: Roland Dreier <>
Signed-off-by: David S. Miller <>
10 years agowl12xx: fix use after free
Mathias Krause [Sun, 30 Jan 2011 10:29:47 +0000 (11:29 +0100)]
wl12xx: fix use after free

When DEBUG_SPI is included in the debug log level wl1271_spi_reset()
will dump the already freed memory instead of the SPI buffer.

This bug was spotted by the semantic patch tool coccinelle using the
script found at scripts/coccinelle/free/kfree.cocci.

More information about semantic patching is available at

Signed-off-by: Mathias Krause <>
Signed-off-by: John W. Linville <>
11 years agobnx2x: Update bnx2x version to 1.62.00-5
Yaniv Rosner [Sun, 30 Jan 2011 04:15:13 +0000 (04:15 +0000)]
bnx2x: Update bnx2x version to 1.62.00-5

Update bnx2x version to 1.62.00-5

Signed-off-by: Yaniv Rosner <>
Signed-off-by: Eilon Greenstein <>
Signed-off-by: David S. Miller <>
11 years agobnx2x: Fix potential link loss in multi-function mode
Yaniv Rosner [Sun, 30 Jan 2011 04:15:07 +0000 (04:15 +0000)]
bnx2x: Fix potential link loss in multi-function mode

All functions on a port should be set to take the MDC/MDIO lock to avoid contention on the bus

Signed-off-by: Yaniv Rosner <>
Signed-off-by: Eilon Greenstein <>
Signed-off-by: David S. Miller <>
11 years agobnx2x: Fix port swap for BCM8073
Yaniv Rosner [Sun, 30 Jan 2011 04:15:00 +0000 (04:15 +0000)]
bnx2x: Fix port swap for BCM8073

Fix link on BCM57712 + BCM8073 when port swap is enabled. Common PHY reset was done on the wrong port.

Signed-off-by: Yaniv Rosner <>
Signed-off-by: Eilon Greenstein <>
Signed-off-by: David S. Miller <>
11 years agobnx2x: Fix LED blink rate on BCM84823
Yaniv Rosner [Sun, 30 Jan 2011 04:14:55 +0000 (04:14 +0000)]
bnx2x: Fix LED blink rate on BCM84823

Fix blink rate of activity LED of the BCM84823 on 10G link

Signed-off-by: Yaniv Rosner <>
Signed-off-by: Eilon Greenstein <>
Signed-off-by: David S. Miller <>
11 years agobnx2x: Remove setting XAUI low-power for BCM8073
Yaniv Rosner [Sun, 30 Jan 2011 04:14:48 +0000 (04:14 +0000)]
bnx2x: Remove setting XAUI low-power for BCM8073

A rare link issue with the BCM8073 PHY may occur due to setting XAUI low power mode, while the PHY microcode already does that.
The fix is not to set set XAUI low power mode for this PHY.

Signed-off-by: Yaniv Rosner <>
Signed-off-by: Eilon Greenstein <>
Signed-off-by: David S. Miller <>
11 years agoMerge branch 'batman-adv/merge-oopsonly' of git://
David S. Miller [Mon, 31 Jan 2011 06:16:34 +0000 (22:16 -0800)]
Merge branch 'batman-adv/merge-oopsonly' of git://

11 years agobatman-adv: Make vis info stack traversal threadsafe
Sven Eckelmann [Fri, 28 Jan 2011 17:34:07 +0000 (18:34 +0100)]
batman-adv: Make vis info stack traversal threadsafe

The batman-adv vis server has to a stack which stores all information
about packets which should be send later. This stack is protected
with a spinlock that is used to prevent concurrent write access to it.

The send_vis_packets function has to take all elements from the stack
and send them to other hosts over the primary interface. The send will
be initiated without the lock which protects the stack.

The implementation using list_for_each_entry_safe has the problem that
it stores the next element as "safe ptr" to allow the deletion of the
current element in the list. The list may be modified during the
unlock/lock pair in the loop body which may make the safe pointer
not pointing to correct next element.

It is safer to remove and use the first element from the stack until no
elements are available. This does not need reduntant information which
would have to be validated each time the lock was removed.

Reported-by: Russell Senior <>
Signed-off-by: Sven Eckelmann <>
11 years agobatman-adv: Remove vis info element in free_info
Sven Eckelmann [Fri, 28 Jan 2011 17:34:06 +0000 (18:34 +0100)]
batman-adv: Remove vis info element in free_info

The free_info function will be called when no reference to the info
object exists anymore. It must be ensured that the allocated memory
gets freed and not only the elements which are managed by the info

Signed-off-by: Sven Eckelmann <>
11 years agobatman-adv: Remove vis info on hashing errors
Sven Eckelmann [Fri, 28 Jan 2011 17:34:05 +0000 (18:34 +0100)]
batman-adv: Remove vis info on hashing errors

A newly created vis info object must be removed when it couldn't be
added to the hash. The old_info which has to be replaced was already
removed and isn't related to the hash anymore.

Signed-off-by: Sven Eckelmann <>
11 years agonet: Add compat ioctl support for the ipv4 multicast ioctl SIOCGETSGCNT
Eric W. Biederman [Sat, 29 Jan 2011 16:15:56 +0000 (16:15 +0000)]
net: Add compat ioctl support for the ipv4 multicast ioctl SIOCGETSGCNT

SIOCGETSGCNT is not a unique ioctl value as it it maps tio SIOCPROTOPRIVATE +1,
which unfortunately means the existing infrastructure for compat networking
ioctls is insufficient.  A trivial compact ioctl implementation would conflict


To make this work I have updated the compat_ioctl decode path to mirror the
the normal ioctl decode path.  I have added an ipv4 inet_compat_ioctl function
so that I can have ipv4 specific compat ioctls.   I have added a compat_ioctl
function into struct proto so I can break out ioctls by which kind of ip socket
I am using.  I have added a compat_raw_ioctl function because SIOCGETSGCNT only
works on raw sockets.  I have added a ipmr_compat_ioctl that mirrors the normal

This was necessary because unfortunately the struct layout for the SIOCGETSGCNT
has unsigned longs in it so changes between 32bit and 64bit kernels.

This change was sufficient to run a 32bit ip multicast routing daemon on a
64bit kernel.

Reported-by: Bill Fenner <>
Signed-off-by: Eric W. Biederman <>
Signed-off-by: David S. Miller <>
11 years agonet: Fix ip link add netns oops
Eric W. Biederman [Sat, 29 Jan 2011 14:57:22 +0000 (14:57 +0000)]
net: Fix ip link add netns oops

Ed Swierk <> writes:
> On
>  ip link add link eth0 netns 9999 type macvlan
> where 9999 is a nonexistent PID triggers an oops and causes all network functions to hang:
> [10663.821898] BUG: unable to handle kernel NULL pointer dereference at 000000000000006d
>  [10663.821917] IP: [<ffffffff8149c2fa>] __dev_alloc_name+0x9a/0x170
>  [10663.821933] PGD 1d3927067 PUD 22f5c5067 PMD 0
>  [10663.821944] Oops: 0000 [#1] SMP
>  [10663.821953] last sysfs file: /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
>  [10663.821959] CPU 3
>  [10663.821963] Modules linked in: macvlan ip6table_filter ip6_tables rfcomm ipt_MASQUERADE binfmt_misc iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack sco ipt_REJECT bnep l2cap xt_tcpudp iptable_filter ip_tables x_tables bridge stp vboxnetadp vboxnetflt vboxdrv kvm_intel kvm parport_pc ppdev snd_hda_codec_intelhdmi snd_hda_codec_conexant arc4 iwlagn iwlcore mac80211 snd_hda_intel snd_hda_codec snd_hwdep snd_pcm snd_seq_midi snd_rawmidi i915 snd_seq_midi_event snd_seq thinkpad_acpi drm_kms_helper btusb tpm_tis nvram uvcvideo snd_timer snd_seq_device bluetooth videodev v4l1_compat v4l2_compat_ioctl32 tpm drm tpm_bios snd cfg80211 psmouse serio_raw intel_ips soundcore snd_page_alloc intel_agp i2c_algo_bit video output netconsole configfs lp parport usbhid hid e1000e sdhci_pci ahci libahci sdhci led_class
>  [10663.822155]
>  [10663.822161] Pid: 6000, comm: ip Not tainted 2.6.35-23-generic #41-Ubuntu 2901CTO/2901CTO
>  [10663.822167] RIP: 0010:[<ffffffff8149c2fa>] [<ffffffff8149c2fa>] __dev_alloc_name+0x9a/0x170
>  [10663.822177] RSP: 0018:ffff88014aebf7b8 EFLAGS: 00010286
>  [10663.822182] RAX: 00000000fffffff4 RBX: ffff8801ad900800 RCX: 0000000000000000
>  [10663.822187] RDX: ffff880000000000 RSI: 0000000000000000 RDI: ffff88014ad63000
>  [10663.822191] RBP: ffff88014aebf808 R08: 0000000000000041 R09: 0000000000000041
>  [10663.822196] R10: 0000000000000000 R11: dead000000200200 R12: ffff88014aebf818
>  [10663.822201] R13: fffffffffffffffd R14: ffff88014aebf918 R15: ffff88014ad62000
>  [10663.822207] FS: 00007f00c487f700(0000) GS:ffff880001f80000(0000) knlGS:0000000000000000
>  [10663.822212] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>  [10663.822216] CR2: 000000000000006d CR3: 0000000231f19000 CR4: 00000000000026e0
>  [10663.822221] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
>  [10663.822226] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
>  [10663.822231] Process ip (pid: 6000, threadinfo ffff88014aebe000, task ffff88014afb16e0)
>  [10663.822236] Stack:
>  [10663.822240] ffff88014aebf808 ffffffff814a2bb5 ffff88014aebf7e8 00000000a00ee8d6
>  [10663.822251] <0> 0000000000000000 ffffffffa00ef940 ffff8801ad900800 ffff88014aebf818
>  [10663.822265] <0> ffff88014aebf918 ffff8801ad900800 ffff88014aebf858 ffffffff8149c413
>  [10663.822281] Call Trace:
>  [10663.822290] [<ffffffff814a2bb5>] ? dev_addr_init+0x75/0xb0
>  [10663.822298] [<ffffffff8149c413>] dev_alloc_name+0x43/0x90
>  [10663.822307] [<ffffffff814a85ee>] rtnl_create_link+0xbe/0x1b0
>  [10663.822314] [<ffffffff814ab2aa>] rtnl_newlink+0x48a/0x570
>  [10663.822321] [<ffffffff814aafcc>] ? rtnl_newlink+0x1ac/0x570
>  [10663.822332] [<ffffffff81030064>] ? native_x2apic_icr_read+0x4/0x20
>  [10663.822339] [<ffffffff814a8c17>] rtnetlink_rcv_msg+0x177/0x290
>  [10663.822346] [<ffffffff814a8aa0>] ? rtnetlink_rcv_msg+0x0/0x290
>  [10663.822354] [<ffffffff814c25d9>] netlink_rcv_skb+0xa9/0xd0
>  [10663.822360] [<ffffffff814a8a85>] rtnetlink_rcv+0x25/0x40
>  [10663.822367] [<ffffffff814c223e>] netlink_unicast+0x2de/0x2f0
>  [10663.822374] [<ffffffff814c303e>] netlink_sendmsg+0x1fe/0x2e0
>  [10663.822383] [<ffffffff81488533>] sock_sendmsg+0xf3/0x120
>  [10663.822391] [<ffffffff815899fe>] ? _raw_spin_lock+0xe/0x20
>  [10663.822400] [<ffffffff81168656>] ? __d_lookup+0x136/0x150
>  [10663.822406] [<ffffffff815899fe>] ? _raw_spin_lock+0xe/0x20
>  [10663.822414] [<ffffffff812b7a0d>] ? _atomic_dec_and_lock+0x4d/0x80
>  [10663.822422] [<ffffffff8116ea90>] ? mntput_no_expire+0x30/0x110
>  [10663.822429] [<ffffffff81486ff5>] ? move_addr_to_kernel+0x65/0x70
>  [10663.822435] [<ffffffff81493308>] ? verify_iovec+0x88/0xe0
>  [10663.822442] [<ffffffff81489020>] sys_sendmsg+0x240/0x3a0
> [10663.822450] [<ffffffff8111e2a9>] ? __do_fault+0x479/0x560
>  [10663.822457] [<ffffffff815899fe>] ? _raw_spin_lock+0xe/0x20
>  [10663.822465] [<ffffffff8116cf4a>] ? alloc_fd+0x10a/0x150
>  [10663.822473] [<ffffffff8158d76e>] ? do_page_fault+0x15e/0x350
>  [10663.822482] [<ffffffff8100a0f2>] system_call_fastpath+0x16/0x1b
>  [10663.822487] Code: 90 48 8d 78 02 be 25 00 00 00 e8 92 1d e2 ff 48 85 c0 75 cf bf 20 00 00 00 e8 c3 b1 c6 ff 49 89 c7 b8 f4 ff ff ff 4d 85 ff 74 bd <4d> 8b 75 70 49 8d 45 70 48 89 45 b8 49 83 ee 58 eb 28 48 8d 55
>  [10663.822618] RIP [<ffffffff8149c2fa>] __dev_alloc_name+0x9a/0x170
>  [10663.822627] RSP <ffff88014aebf7b8>
>  [10663.822631] CR2: 000000000000006d
>  [10663.822636] ---[ end trace 3dfd6c3ad5327ca7 ]---

This bug was introduced in:
commit 81adee47dfb608df3ad0b91d230fb3cef75f0060
Author: Eric W. Biederman <>
Date:   Sun Nov 8 00:53:51 2009 -0800

    net: Support specifying the network namespace upon device creation.

    There is no good reason to not support userspace specifying the
    network namespace during device creation, and it makes it easier
    to create a network device and pass it to a child network namespace
    with a well known name.

    We have to be careful to ensure that the target network namespace
    for the new device exists through the life of the call.  To keep
    that logic clear I have factored out the network namespace grabbing
    logic into rtnl_link_get_net.

    In addtion we need to continue to pass the source network namespace
    to the rtnl_link_ops.newlink method so that we can find the base
    device source network namespace.

Signed-off-by: Eric W. Biederman <>
Acked-by: Eric Dumazet <>
Where apparently I forgot to add error handling to the path where we create
a new network device in a new network namespace, and pass in an invalid pid.

Reported-by: Ed Swierk <>
Signed-off-by: "Eric W. Biederman" <>
Signed-off-by: David S. Miller <>
11 years agocaif: bugfix - add caif headers for userspace usage. [Sat, 29 Jan 2011 13:10:37 +0000 (13:10 +0000)]
caif: bugfix - add caif headers for userspace usage.

Add caif_socket.h and if_caif.h to the kernel header files
exported for use by userspace.

Signed-off-by: Sjur Braendeland <>
Signed-off-by: David S. Miller <>
11 years agoslcan: fix referenced website in Kconfig help text
Oliver Hartkopp [Sun, 30 Jan 2011 09:09:37 +0000 (01:09 -0800)]
slcan: fix referenced website in Kconfig help text

Fix the referenced project website to in the Kconfig
help text for the slcan driver.

Signed-off-by: Oliver Hartkopp <>
Signed-off-by: David S. Miller <>
11 years agogro: Reset dev pointer on reuse
Herbert Xu [Sun, 30 Jan 2011 04:44:54 +0000 (20:44 -0800)]
gro: Reset dev pointer on reuse

On older kernels the VLAN code may zero skb->dev before dropping
it and causing it to be reused by GRO.

Unfortunately we didn't reset skb->dev in that case which causes
the next GRO user to get a bogus skb->dev pointer.

This particular problem no longer happens with the current upstream
kernel due to changes in VLAN processing.

However, for correctness we should still reset the skb->dev pointer
in the GRO reuse function in case a future user does the same thing.

Signed-off-by: Herbert Xu <>
Signed-off-by: David S. Miller <>
11 years agoath9k: Fix power save usage count imbalance on deinit
Rajkumar Manoharan [Thu, 27 Jan 2011 13:09:38 +0000 (18:39 +0530)]
ath9k: Fix power save usage count imbalance on deinit

While unloading the driver, the ps_usecount is incremented
before configuring gpio registers in deinit_device.
But it is failed to restore the ps_usecount after that.
The problem is that the chip is forcibly moved to FULL SLEEP
by radio_disable when mac80211 is reporting as idle
though ps_usecount is not zero.

This patch retores ps_usecount properly and ensures that
the chip is always moved to full sleep only if ps usage
count is zero which also helps in debugging deadbeef on
multivif case. And also fixes the following warning.

ath: DMA failed to stop in 10 ms AR_CR=0xdeadbeef AR_DIAG_SW=0xdeadbeef
ath: Could not stop RX, we could be confusing the DMA engine when we
start RX up
------------[ cut here ]------------
WARNING: at drivers/net/wireless/ath/ath9k/recv.c:536
ath_stoprecv+0xf4/0x100 [ath9k]()

Cc: Paul Stewart <>
Signed-off-by: Rajkumar Manoharan <>
Signed-off-by: John W. Linville <>
11 years agoath9k_hw: Fix system hang when resuming from S3/S4
Rajkumar Manoharan [Thu, 27 Jan 2011 13:09:37 +0000 (18:39 +0530)]
ath9k_hw: Fix system hang when resuming from S3/S4

The bit 6 & 7 of AR_WA (0x4004) should be enabled only
for the chips that are supporting L0s functionality
while resuming back from S3/S4.

Enabling these bits for AR9280 is causing system hang
within a few S3/S4-resume cycles.

Cc: Jack Lee <>
Signed-off-by: Rajkumar Manoharan <>
Signed-off-by: John W. Linville <>
11 years agoipv6: Remove route peer binding assertions.
David S. Miller [Thu, 27 Jan 2011 22:55:22 +0000 (14:55 -0800)]
ipv6: Remove route peer binding assertions.

They are bogus.  The basic idea is that I wanted to make sure
that prefixed routes never bind to peers.

The test I used was whether RTF_CACHE was set.

But first of all, the RTF_CACHE flag is set at different spots
depending upon which ip6_rt_copy() caller you're talking about.

I've validated all of the code paths, and even in the future
where we bind peers more aggressively (for route metric COW'ing)
we never bind to prefix'd routes, only fully specified ones.
This even applies when addrconf or icmp6 routes are allocated.

Signed-off-by: David S. Miller <>
11 years agonet: add kmemcheck annotation in __alloc_skb()
Eric Dumazet [Tue, 25 Jan 2011 23:18:38 +0000 (23:18 +0000)]
net: add kmemcheck annotation in __alloc_skb()

pskb_expand_head() triggers a kmemcheck warning when copy of
skb_shared_info is done in pskb_expand_head()

This is because destructor_arg field is not necessarily initialized at
this point. Add kmemcheck_annotate_variable() call in __alloc_skb() to
instruct kmemcheck this is a normal situation.

Resolves 27212

Reported-by: Christian Casteyde <>
Signed-off-by: Eric Dumazet <>
CC: Andrew Morton <>
Signed-off-by: David S. Miller <>
11 years agonet: fix validate_link_af in rtnetlink core
Kurt Van Dijck [Wed, 26 Jan 2011 04:55:24 +0000 (04:55 +0000)]
net: fix validate_link_af in rtnetlink core

I'm testing an API that uses IFLA_AF_SPEC attribute.
In the rtnetlink core , the set_link_af() member
of the rtnl_af_ops struct receives the nested attribute
(as I expected), but the validate_link_af() member
receives the parent attribute.
IMO, this patch fixes this.

Signed-off-by: Kurt Van Dijck <>
Signed-off-by: David S. Miller <>
11 years agodl2k: nulify fraginfo after unmap
Stanislaw Gruszka [Wed, 26 Jan 2011 00:45:42 +0000 (00:45 +0000)]
dl2k: nulify fraginfo after unmap

Patch fixes: "DMA-API: device driver tries to free an invalid DMA
memory address" warning reported here:

Reported-by: Frantisek Hanzlik <>
Signed-off-by: Stanislaw Gruszka <>
Signed-off-by: David S. Miller <>
11 years agoxen: netfront: handle incoming GSO SKBs which are not CHECKSUM_PARTIAL
Ian Campbell [Thu, 27 Jan 2011 04:14:03 +0000 (04:14 +0000)]
xen: netfront: handle incoming GSO SKBs which are not CHECKSUM_PARTIAL

The Linux network stack expects all GSO SKBs to have ip_summed ==
CHECKSUM_PARTIAL (which implies that the frame contains a partial
checksum) and the Xen network ring protocol similarly expects an SKB
which has GSO set to also have NETRX_csum_blank (which also implies a
partial checksum).

However there have been cases of buggy guests which mark a frame as
GSO but do not set csum_blank. If we detect that we a receiving such a
frame (which manifests as ip_summed != PARTIAL && skb_is_gso) then
force the SKB to partial and recalculate the checksum, since we cannot
rely on the peer having done so if they have not set csum_blank.

Add an ethtool stat to track occurances of this event.

Signed-off-by: Ian Campbell <>
Cc: Jeremy Fitzhardinge <>
Cc: David Miller <>
Signed-off-by: David S. Miller <>
11 years agoeconet: remove compiler warnings
Eric Dumazet [Wed, 26 Jan 2011 00:04:18 +0000 (00:04 +0000)]
econet: remove compiler warnings

net/econet/af_econet.c: In function ‘econet_sendmsg’:
net/econet/af_econet.c:494: warning: label ‘error’ defined but not used
net/econet/af_econet.c:268: warning: unused variable ‘sk’

Signed-off-by: Eric Dumazet <>
Acked-by: Phil Blundell <>
Signed-off-by: David S. Miller <>
11 years agoMAINTAINERS: update information for the wl12xx driver
Luciano Coelho [Wed, 26 Jan 2011 19:46:29 +0000 (21:46 +0200)]
MAINTAINERS: update information for the wl12xx driver

Update maintainer's email address, webpage and align with renaming of

Signed-off-by: Luciano Coelho <>
Signed-off-by: John W. Linville <>
11 years agoath9k_htc: fix race conditions when stop device
Stanislaw Gruszka [Tue, 25 Jan 2011 13:15:12 +0000 (14:15 +0100)]
ath9k_htc: fix race conditions when stop device

We do not kill any scheduled tasklets when stopping device, that may
cause usage of resources after free. Disable interrupts, kill tasklets
and then works in correct order.

Tested-by: Sujith <>
Signed-off-by: Stanislaw Gruszka <>
Signed-off-by: John W. Linville <>
11 years agoath9k: fix race conditions when stop device
Stanislaw Gruszka [Tue, 25 Jan 2011 13:08:40 +0000 (14:08 +0100)]
ath9k: fix race conditions when stop device

We do not kill any scheduled tasklets when stopping device, that may
cause usage of resources after free. Moreover we enable interrupts
in tasklet function, so we could potentially end with interrupts
enabled when driver is not ready to receive them.

I think patch should fix Ben's kernel crash from:

Signed-off-by: Stanislaw Gruszka <>
Signed-off-by: John W. Linville <>
11 years agoath5k: correct endianness of frame duration
Bob Copeland [Tue, 25 Jan 2011 04:31:44 +0000 (23:31 -0500)]
ath5k: correct endianness of frame duration

The ath5k version of ieee80211_generic_frame_duration() returns
an __le16 for standard modes but a cpu-endian int for turbo/half/
quarter rates.  Make it always return cpu-endian values.

Signed-off-by: Bob Copeland <>
Acked-by: Bruno Randolf <>
Acked-by: Nick Kossifidis <>
Signed-off-by: John W. Linville <>
11 years agoath5k: fix error handling in ath5k_hw_dma_stop
Bob Copeland [Tue, 25 Jan 2011 04:31:43 +0000 (23:31 -0500)]
ath5k: fix error handling in ath5k_hw_dma_stop

Review spotted a problem with the error handling in ath5k_hw_dma_stop:
a successful return from ath5k_hw_stop_tx_dma will be treated as
an error, so we always bail out of the loop after processing a single
active queue.  As a result, we may not actually stop some queues during

Signed-off-by: Bob Copeland <>
Acked-by: Bruno Randolf <>
Acked-by: Nick Kossifidis <>
Reviewed-by: Stanislaw Gruszka <>
Signed-off-by: John W. Linville <>
11 years agortlwifi: Fix firmware upload errors
Chaoming Li [Fri, 21 Jan 2011 19:57:37 +0000 (13:57 -0600)]
rtlwifi: Fix firmware upload errors

When the source code from Realtek was prepared for kernel inclusion,
some routines were refactored to reduce the level of indentation. This
patch repairs errors introduced in that process.

Signed-off-by: Chaoming Li <>
Signed-off-by: Larry Finger <>
Signed-off-by: John W. Linville <>
11 years agobnx2: Eliminate AER error messages on systems not supporting it
Michael Chan [Tue, 25 Jan 2011 22:14:51 +0000 (22:14 +0000)]
bnx2: Eliminate AER error messages on systems not supporting it

On PPC for example, AER is not supported and we see unnecessary AER
error message without this patch:

bnx2 0003:01:00.1: pci_cleanup_aer_uncorrect_error_status failed 0xfffffffb

Reported-by: Breno Leitao <>
Signed-off-by: Michael Chan <>
Signed-off-by: David S. Miller <>
11 years agocnic: Fix big endian bug
Michael Chan [Tue, 25 Jan 2011 22:14:50 +0000 (22:14 +0000)]
cnic: Fix big endian bug

The chip's page tables did not set up properly on big endian machines,
causing EEH errors on PPC machines.

Reported-by: Breno Leitao <>
Signed-off-by: Michael Chan <>
Signed-off-by: David S. Miller <>
11 years agoxfrm6: Don't forget to propagate peer into ipsec route.
David S. Miller [Wed, 26 Jan 2011 21:41:03 +0000 (13:41 -0800)]
xfrm6: Don't forget to propagate peer into ipsec route.

Like ipv4, we have to propagate the ipv6 route peer into
the ipsec top-level route during instantiation.

Signed-off-by: David S. Miller <>
11 years agotg3: Use new VLAN code
Matt Carlson [Wed, 26 Jan 2011 21:13:10 +0000 (13:13 -0800)]
tg3: Use new VLAN code

This patch pivots the tg3 driver to the new VLAN infrastructure.
All references to vlgrp have been removed.  The driver still attempts to
disable VLAN tag stripping if CONFIG_VLAN_8021Q or
CONFIG_VLAN_8021Q_MODULE is not defined.

Signed-off-by: Matt Carlson <>
Reviewed-by: Michael Chan <>
Signed-off-by: David S. Miller <>
11 years agoMerge branch 'master' of git://
David S. Miller [Wed, 26 Jan 2011 19:49:49 +0000 (11:49 -0800)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless-2.6

11 years agobatman-adv: Fix kernel panic when fetching vis data on a vis server
Linus Lüssing [Tue, 25 Jan 2011 21:56:16 +0000 (21:56 +0000)]
batman-adv: Fix kernel panic when fetching vis data on a vis server

The hash_iterate removal introduced a bug leading to a kernel panic when
fetching the vis data on a vis server. That commit forgot to rename one
variable name, which this commit fixes now.

Reported-by: Russell Senior <>
Signed-off-by: Linus Lüssing <>
Signed-off-by: Sven Eckelmann <>
11 years agobonding: update documentation - alternate configuration.
Nicolas de Pesloüan [Mon, 24 Jan 2011 13:21:37 +0000 (13:21 +0000)]
bonding: update documentation - alternate configuration.

The bonding documentation used to provide configuration
details and examples for initscripts and sysconfig only.

This patch describe the third possible configuration:

Signed-off-by: Nicolas de Pesloüan <>
Signed-off-by: David S. Miller <>
11 years agoTCP: fix a bug that triggers large number of TCP RST by mistake
Jerry Chu [Tue, 25 Jan 2011 21:46:30 +0000 (13:46 -0800)]
TCP: fix a bug that triggers large number of TCP RST by mistake

This patch fixes a bug that causes TCP RST packets to be generated
on otherwise correctly behaved applications, e.g., no unread data
on close,..., etc. To trigger the bug, at least two conditions must
be met:

1. The FIN flag is set on the last data packet, i.e., it's not on a
separate, FIN only packet.
2. The size of the last data chunk on the receive side matches
exactly with the size of buffer posted by the receiver, and the
receiver closes the socket without any further read attempt.

This bug was first noticed on our netperf based testbed for our IW10
proposal to IETF where a large number of RST packets were observed.
netperf's read side code meets the condition 2 above 100%.

Before the fix, tcp_data_queue() will queue the last skb that meets
condition 1 to sk_receive_queue even though it has fully copied out
(skb_copy_datagram_iovec()) the data. Then if condition 2 is also met,
tcp_recvmsg() often returns all the copied out data successfully
without actually consuming the skb, due to a check
"if ((chunk = len - tp->ucopy.len) != 0) {"
"len -= chunk;"
after tcp_prequeue_process() that causes "len" to become 0 and an
early exit from the big while loop.

I don't see any reason not to free the skb whose data have been fully
consumed in tcp_data_queue(), regardless of the FIN flag.  We won't
get there if MSG_PEEK is on. Am I missing some arcane cases related
to urgent data?

Signed-off-by: H.K. Jerry Chu <>
Signed-off-by: David S. Miller <>
11 years agoMAINTAINERS: remove Reinette Chatre as iwlwifi maintainer
Reinette Chatre [Tue, 25 Jan 2011 16:38:06 +0000 (08:38 -0800)]
MAINTAINERS: remove Reinette Chatre as iwlwifi maintainer

Signed-off-by: Reinette Chatre <>
Signed-off-by: Wey-Yi Guy <>
Signed-off-by: John W. Linville <>
11 years agort2x00: add device id for windy31 usb device
Greg Kroah-Hartman [Tue, 25 Jan 2011 09:42:29 +0000 (17:42 +0800)]
rt2x00: add device id for windy31 usb device

This patch adds the device id for the windy31 USB device to the rt73usb

Thanks to Ralf Flaxa for reporting this and providing testing and a
sample device.

Reported-by: Ralf Flaxa <>
Tested-by: Ralf Flaxa <>
Cc: stable <>
Signed-off-by: Greg Kroah-Hartman <>
Acked-by: Ivo van Doorn <>
Signed-off-by: John W. Linville <>
11 years agomac80211: fix a crash in ieee80211_beacon_get_tim on change_interface
Felix Fietkau [Mon, 24 Jan 2011 18:28:49 +0000 (19:28 +0100)]
mac80211: fix a crash in ieee80211_beacon_get_tim on change_interface

Some drivers (e.g. ath9k) do not always disable beacons when they're
supposed to. When an interface is changed using the change_interface op,
the mode specific sdata part is in an undefined state and trying to
get a beacon at this point can produce weird crashes.

To fix this, add a check for ieee80211_sdata_running before using
anything from the sdata.

Signed-off-by: Felix Fietkau <>
Signed-off-by: John W. Linville <>
11 years agoipv6: Revert 'administrative down' address handling changes.
David S. Miller [Mon, 24 Jan 2011 07:27:15 +0000 (23:27 -0800)]
ipv6: Revert 'administrative down' address handling changes.

This reverts the following set of commits:

d1ed113f1669390da9898da3beddcc058d938587 ("ipv6: remove duplicate neigh_ifdown")
29ba5fed1bbd09c2cba890798c8f9eaab251401d ("ipv6: don't flush routes when setting loopback down")
9d82ca98f71fd686ef2f3017c5e3e6a4871b6e46 ("ipv6: fix missing in6_ifa_put in addrconf")
2de795707294972f6c34bae9de713e502c431296 ("ipv6: addrconf: don't remove address state on ifdown if the address is being kept")
8595805aafc8b077e01804c9a3668e9aa3510e89 ("IPv6: only notify protocols if address is compeletely gone")
27bdb2abcc5edb3526e25407b74bf17d1872c329 ("IPv6: keep tentative addresses in hash table")
93fa159abe50d3c55c7f83622d3f5c09b6e06f4b ("IPv6: keep route for tentative address")
8f37ada5b5f6bfb4d251a7f510f249cb855b77b3 ("IPv6: fix race between cleanup and add/delete address")
84e8b803f1e16f3a2b8b80f80a63fa2f2f8a9be6 ("IPv6: addrconf notify when address is unavailable")
dc2b99f71ef477a31020511876ab4403fb7c4420 ("IPv6: keep permanent addresses on admin down")

because the core semantic change to ipv6 address handling on ifdown
has broken some things, in particular "disable_ipv6" sysctl handling.

Stephen has made several attempts to get things back in working order,
but nothing has restored disable_ipv6 fully yet.

Reported-by: Eric W. Biederman <>
Tested-by: Eric W. Biederman <>
Signed-off-by: David S. Miller <>
11 years agotextsearch: doc - fix spelling in lib/textsearch.c.
Jesper Dangaard Brouer [Mon, 24 Jan 2011 02:41:37 +0000 (02:41 +0000)]
textsearch: doc - fix spelling in lib/textsearch.c.

Found the following spelling errors while reading the textsearch code:
  "facitilies"  -> "facilities"
  "continously" -> "continuously"
  "arbitary"    -> "arbitrary"
  "patern"      -> "pattern"
  "occurences"  -> "occurrences"

I'll try to push this patch through DaveM, given the only users
of textsearch is in the net/ tree (nf_conntrack_amanda.c, xt_string.c
and em_text.c)

Signed-off-by: Jesper Sander <>
Signed-off-by: Jesper Dangaard Brouer <>
Signed-off-by: David S. Miller <>
11 years agoUSB NET KL5KUSB101: Fix mem leak in error path of kaweth_download_firmware()
Jesper Juhl [Sun, 23 Jan 2011 12:19:55 +0000 (12:19 +0000)]
USB NET KL5KUSB101: Fix mem leak in error path of kaweth_download_firmware()

We will leak the storage allocated by request_firmware() if the size of
the firmware is greater than KAWETH_FIRMWARE_BUF_SIZE.
This removes the leak by calling release_firmware() before we return

Signed-off-by: Jesper Juhl <>
Signed-off-by: David S. Miller <>
11 years agopch_gbe: don't use flush_scheduled_work()
Tejun Heo [Tue, 25 Jan 2011 07:19:10 +0000 (23:19 -0800)]
pch_gbe: don't use flush_scheduled_work()

Directly cancel adapter->reset_task instead of using to-be-deprecated

Signed-off-by: Tejun Heo <>
Signed-off-by: David S. Miller <>
11 years agobnx2: Always set ETH_FLAG_TXVLAN
Michael Chan [Mon, 24 Jan 2011 12:59:02 +0000 (12:59 +0000)]
bnx2: Always set ETH_FLAG_TXVLAN

TSO does not work if the VLAN tag is in the packet (non-accelerated).
We may be able to remove this restriction in future firmware.

Reported-by: Eric Dumazet <>
Signed-off-by: Michael Chan <>
Signed-off-by: David S. Miller <>
11 years agonet: clear heap allocation for ethtool_get_regs()
Eugene Teo [Tue, 25 Jan 2011 05:05:17 +0000 (21:05 -0800)]
net: clear heap allocation for ethtool_get_regs()

There is a conflict between commit b00916b1 and a77f5db3. This patch resolves
the conflict by clearing the heap allocation in ethtool_get_regs().

Signed-off-by: Eugene Teo <>
Signed-off-by: David S. Miller <>
11 years agoipv6: Always clone offlink routes.
David S. Miller [Tue, 25 Jan 2011 00:01:58 +0000 (16:01 -0800)]
ipv6: Always clone offlink routes.

Do not handle PMTU vs. route lookup creation any differently
wrt. offlink routes, always clone them.

Reported-by: PK <>
Signed-off-by: David S. Miller <>
11 years agodcbnl: make get_app handling symmetric for IEEE and CEE DCBx
John Fastabend [Fri, 21 Jan 2011 16:35:18 +0000 (16:35 +0000)]
dcbnl: make get_app handling symmetric for IEEE and CEE DCBx

The IEEE get/set app handlers use generic routines and do not
require the net_device to implement the dcbnl_ops routines. This
patch makes it symmetric so user space and drivers do not have
to handle the CEE version and IEEE DCBx versions differently.

Signed-off-by: John Fastabend <>
Signed-off-by: David S. Miller <>
11 years agoMerge branch 'can/at91_can-for-net-2.6' of git://
David S. Miller [Mon, 24 Jan 2011 23:16:11 +0000 (15:16 -0800)]
Merge branch 'can/at91_can-for-net-2.6' of git://

11 years agotcp: fix bug in listening_get_next()
Eric Dumazet [Mon, 24 Jan 2011 22:41:20 +0000 (14:41 -0800)]
tcp: fix bug in listening_get_next()

commit a8b690f98baf9fb19 (tcp: Fix slowness in read /proc/net/tcp)
introduced a bug in handling of SYN_RECV sockets.

st->offset represents number of sockets found since beginning of

We should not reset st->offset when iterating through
syn_table[st->sbucket], or else if more than ~25 sockets (if
PAGE_SIZE=4096) are in SYN_RECV state, we exit from listening_get_next()
with a too small st->offset

Next time we enter tcp_seek_last_pos(), we are not able to seek past
already found sockets.

Reported-by: PK <>
CC: Tom Herbert <>
Signed-off-by: Eric Dumazet <>
Signed-off-by: David S. Miller <>
11 years agoinetpeer: Use correct AVL tree base pointer in inet_getpeer().
David S. Miller [Mon, 24 Jan 2011 22:37:46 +0000 (14:37 -0800)]
inetpeer: Use correct AVL tree base pointer in inet_getpeer().

Family was hard-coded to AF_INET but should be daddr->family.

This fixes crashes when unlinking ipv6 peer entries, since the
unlink code was looking up the base pointer properly.

Reported-by: Eric Dumazet <>
Signed-off-by: David S. Miller <>
11 years agoGRO: fix merging a paged skb after non-paged skbs
Michal Schmidt [Mon, 24 Jan 2011 12:08:48 +0000 (12:08 +0000)]
GRO: fix merging a paged skb after non-paged skbs

Suppose that several linear skbs of the same flow were received by GRO. They
were thus merged into one skb with a frag_list. Then a new skb of the same flow
arrives, but it is a paged skb with data starting in its frags[].

Before adding the skb to the frag_list skb_gro_receive() will of course adjust
the skb to throw away the headers. It correctly modifies the page_offset and
size of the frag, but it leaves incorrect information in the skb:
 ->data_len is not decreased at all.
 ->len is decreased only by headlen, as if no change were done to the frag.
Later in a receiving process this causes skb_copy_datagram_iovec() to return
-EFAULT and this is seen in userspace as the result of the recv() syscall.

In practice the bug can be reproduced with the sfc driver. By default the
driver uses an adaptive scheme when it switches between using
napi_gro_receive() (with skbs) and napi_gro_frags() (with pages). The bug is
reproduced when under rx load with enough successful GRO merging the driver
decides to switch from the former to the latter.

Manual control is also possible, so reproducing this is easy with netcat:
 - on machine1 (with sfc): nc -l 12345 > /dev/null
 - on machine2: nc machine1 12345 < /dev/zero
 - on machine1:
   echo 1 > /sys/module/sfc/parameters/rx_alloc_method  # use skbs
   echo 2 > /sys/module/sfc/parameters/rx_alloc_method  # use pages
 - See that nc has quit suddenly.

[v2: Modified by Eric Dumazet to avoid advancing skb->data past the end
     and to use a temporary variable.]

Signed-off-by: Michal Schmidt <>
Acked-by: Eric Dumazet <>
Signed-off-by: David S. Miller <>
11 years agoMerge branch 'master' of
David S. Miller [Mon, 24 Jan 2011 21:17:06 +0000 (13:17 -0800)]
Merge branch 'master' of /linux/kernel/git/torvalds/linux-2.6

11 years agonet: arp_ioctl() must hold RTNL
Eric Dumazet [Mon, 24 Jan 2011 21:16:16 +0000 (13:16 -0800)]
net: arp_ioctl() must hold RTNL

Commit 941666c2e3e0 "net: RCU conversion of dev_getbyhwaddr() and
arp_ioctl()" introduced a regression, reported by Jamie Heilman.
"arp -Ds eth0 pub" triggered the ASSERT_RTNL() assert
in pneigh_lookup()

Removing RTNL requirement from arp_ioctl() was a mistake, just revert
that part.

Reported-by: Jamie Heilman <>
Signed-off-by: Eric Dumazet <>
Signed-off-by: David S. Miller <>
11 years agonetfilter: xt_iprange: Incorrect xt_iprange boundary check for IPv6
Thomas Jacob [Mon, 24 Jan 2011 20:35:36 +0000 (21:35 +0100)]
netfilter: xt_iprange: Incorrect xt_iprange boundary check for IPv6

iprange_ipv6_sub was substracting 2 unsigned ints and then casting
the result to int to find out whether they are lt, eq or gt each
other, this doesn't work if the full 32 bits of each part
can be used in IPv6 addresses. Patch should remedy that without
significant performance penalties. Also number of ntohl
calls can be reduced this way (Jozsef Kadlecsik).

Signed-off-by: Thomas Jacob <>
Signed-off-by: Patrick McHardy <>
11 years agofix a shutdown regression in intel_idle
Shaohua Li [Mon, 24 Jan 2011 08:00:01 +0000 (08:00 +0000)]
fix a shutdown regression in intel_idle

Fix a shutdown regression caused by 2a2d31c8dc6f ("intel_idle: open
broadcast clock event").  The clockevent framework can automatically
shutdown broadcast timers for hotremove CPUs.  And we get a shutdown
regression when we shutdown broadcast timer for hot remove CPU, so just
delete some code.

Also fix some section mismatch.

Reported-by: Ari Savolainen <>
Signed-off-by: Shaohua Li <>
Tested-by: Linus Torvalds <>
Signed-off-by: Linus Torvalds <>
11 years agoMerge branch 'omap-fixes-for-linus' of git://
Linus Torvalds [Mon, 24 Jan 2011 19:29:49 +0000 (05:29 +1000)]
Merge branch 'omap-fixes-for-linus' of git://git./linux/kernel/git/tmlind/linux-omap-2.6

* 'omap-fixes-for-linus' of git://
  omap: DMA: clear interrupt status correctly
  OMAP3: Devkit8000: Fix tps65930 pullup/pulldown configuration
  arm: omap3: cm-t3517: minor comment fix
  arm: omap3: cm-t3517: rtc fix
  omap1: Fix sched_clock implementation when both MPU timer and 32K timer are used
  omap1: Fix booting for 15xx and 730 with omap1_defconfig
  omap1: Fix sched_clock for the MPU timer
  OMAP: PRCM: remove duplicated headers
  OMAP4: clockdomain: bypass unimplemented wake-up dependency functions on OMAP4
  OMAP: counter_32k: init clocksource as part of machine timer init

11 years agoMerge branch 'perf-fixes-for-linus' of git://
Linus Torvalds [Mon, 24 Jan 2011 19:26:47 +0000 (05:26 +1000)]
Merge branch 'perf-fixes-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'perf-fixes-for-linus' of git://
  perf tools: Fix time function double declaration with glibc
  perf tools: Fix build by checking if extra warnings are supported
  perf tools: Fix build when using gcc 3.4.6
  perf tools: Add missing header, fixes build
  perf tools: Fix 64 bit integer format strings
  perf test: Fix build on older glibcs
  perf: perf_event_exit_task_context: s/rcu_dereference/rcu_dereference_raw/
  perf test: Use cpu_map->[cpu] when setting affinity
  perf symbols: Fix annotation of thumb code
  perf: Annotate cpuctx->ctx.mutex to avoid a lockdep splat
  powerpc, perf: Fix frequency calculation for overflowing counters (FSL version)
  perf: Fix perf_event_init_task()/perf_event_free_task() interaction
  perf: Fix find_get_context() vs perf_event_exit_task() race

11 years agoMerge branch 'timers-fixes-for-linus' of git://
Linus Torvalds [Mon, 24 Jan 2011 19:25:55 +0000 (05:25 +1000)]
Merge branch 'timers-fixes-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'timers-fixes-for-linus' of git://
  RTC: Remove Kconfig symbol for UIE emulation
  RTC: Properly handle rtc_read_alarm error propagation and fix bug
  RTC: Propagate error handling via rtc_timer_enqueue properly
  acpi_pm: Clear pmtmr_ioport if acpi_pm initialization fails
  rtc: Cleanup removed UIE emulation declaration
  hrtimers: Notify hrtimer users of switches to NOHZ mode

11 years agoMerge branch 'sched-fixes-for-linus' of git://
Linus Torvalds [Mon, 24 Jan 2011 19:25:13 +0000 (05:25 +1000)]
Merge branch 'sched-fixes-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'sched-fixes-for-linus' of git://
  sched: Fix poor interactivity on UP systems due to group scheduler nice tune bug

11 years agoMerge branch 'x86-fixes-for-linus' of git://
Linus Torvalds [Mon, 24 Jan 2011 19:24:12 +0000 (05:24 +1000)]
Merge branch 'x86-fixes-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'x86-fixes-for-linus' of git://
  x86: Fix jump label with RO/NX module protection crash
  x86, hotplug: Fix powersavings with offlined cores on AMD
  x86, mcheck, therm_throt.c: Export symbol platform_thermal_notify to allow coretemp to handler intr
  x86: Use asm-generic/cacheflush.h
  x86: Update CPU cache attributes table descriptors

11 years agonetfilter: ctnetlink: fix missing refcount increment during dumps
Pablo Neira Ayuso [Mon, 24 Jan 2011 18:01:07 +0000 (19:01 +0100)]
netfilter: ctnetlink: fix missing refcount increment during dumps

In 13ee6ac netfilter: fix race in conntrack between dump_table and
destroy, we recovered spinlocks to protect the dump of the conntrack
table according to reports from Stephen and acknowledgments on the
issue from Eric.

In that patch, the refcount bump that allows to keep a reference
to the current ct object was removed. However, we still decrement
the refcount for that object in the output path of

        if (last)

Cc: Stephen Hemminger <>
Signed-off-by: Pablo Neira Ayuso <>
Acked-by: Eric Dumazet <>
Signed-off-by: Patrick McHardy <>
11 years agocan: at91_can: make can_id of mailbox 0 configurable
Marc Kleine-Budde [Mon, 10 Jan 2011 19:44:22 +0000 (20:44 +0100)]
can: at91_can: make can_id of mailbox 0 configurable

Due to a chip bug (errata & in
"AT91SAM9263 Preliminary 6249H-ATARM-27-Jul-09") the contents of mailbox
0 may be send under certain conditions (even if disabled or in rx mode).

The workaround in the errata suggests not to use the mailbox and load it
with an unused identifier.

This patch implements the second part of the workaround. A sysfs entry
"mb0_id" is introduced. While the interface is down it can be used to
configure the can_id of mailbox 0. The default value id 0x7ff.

In order to use an extended can_id add the CAN_EFF_FLAG (0x80000000U)
to the can_id. Example:

- standard id 0x7ff:
echo 0x7ff      > /sys/class/net/can0/mb0_id

- extended id 0x1fffffff:
echo 0x9fffffff > /sys/class/net/can0/mb0_id

Signed-off-by: Marc Kleine-Budde <>
Acked-by: Wolfgang Grandegger <>
Acked-by: Kurt Van Dijck <>
For the Documentation-part:
Acked-by: Wolfram Sang <>
11 years agocan: at91_can: don't use mailbox 0
Marc Kleine-Budde [Sun, 9 Jan 2011 21:46:25 +0000 (22:46 +0100)]
can: at91_can: don't use mailbox 0

Due to a chip bug (errata & in
"AT91SAM9263 Preliminary 6249H-ATARM-27-Jul-09") the contents of mailbox
0 may be send under certain conditions (even if disabled or in rx mode).

The workaround in the errata suggests not to use the mailbox and load it
with a unused identifier.

This patch implements the first part of the workaround, it updates
AT91_MB_RX_NUM and AT91_MB_RX_FIRST (and the inline documentation)
so that mailbox 0 stays unused.

Signed-off-by: Marc Kleine-Budde <>
Acked-by: Wolfgang Grandegger <>
Acked-by: Kurt Van Dijck <>
11 years agocan: at91_can: clean up usage of AT91_MB_RX_FIRST and AT91_MB_RX_NUM
Marc Kleine-Budde [Thu, 6 Jan 2011 08:58:42 +0000 (09:58 +0100)]
can: at91_can: clean up usage of AT91_MB_RX_FIRST and AT91_MB_RX_NUM

This patch cleans up the usage of two macros which specify the mailbox
usage. AT91_MB_RX_FIRST and AT91_MB_RX_NUM define the first and the
number of RX mailboxes. The current driver uses these variables in an
unclean way; assuming that AT91_MB_RX_FIRST is 0;

This patch cleans up the usage of these macros, no longer assuming
AT91_MB_RX_FIRST == 0.

Signed-off-by: Marc Kleine-Budde <>
Acked-by: Wolfgang Grandegger <>
11 years agosched: Fix poor interactivity on UP systems due to group scheduler nice tune bug
Yong Zhang [Mon, 24 Jan 2011 07:33:52 +0000 (15:33 +0800)]
sched: Fix poor interactivity on UP systems due to group scheduler nice tune bug

Michael Witten and Christian Kujau reported that the autogroup
scheduling feature hurts interactivity on their UP systems.

It turns out that this is an older bug in the group scheduling code,
and the wider appeal provided by the autogroup feature exposed it
more prominently.

When on UP with FAIR_GROUP_SCHED enabled, tune shares
only affect tg->shares, but is not reflected in
tg->se->load. The reason is that update_cfs_shares()
does nothing on UP.

So introduce update_cfs_shares() for UP && FAIR_GROUP_SCHED.

This issue was found when enable autogroup scheduling was enabled,
but it is an older bug that also exists on cgroup.cpu on UP.

Reported-and-Tested-by: Michael Witten <>
Reported-and-Tested-by: Christian Kujau <>
Signed-off-by: Yong Zhang <>
Acked-by: Pekka Enberg <>
Acked-by: Mike Galbraith <>
Acked-by: Peter Zijlstra <>
Cc: Linus Torvalds <>
LKML-Reference: <>
Signed-off-by: Ingo Molnar <>