firefly-linux-kernel-4.4.55.git
14 years agoUSB: composite: Add usb_composite_force_reset utility to force enumeration
Mike Lockwood [Mon, 28 Jun 2010 20:19:32 +0000 (16:19 -0400)]
USB: composite: Add usb_composite_force_reset utility to force enumeration

Use this rather than calling usb_gadget_disconnect and usb_gadget_connect
directly to avoid sending USB disconnect events to userspace when resetting
the bus.

Signed-off-by: Mike Lockwood <lockwood@android.com>
14 years agoUSB: gadget: composite: Move switch_set_state calls to a work queue
Mike Lockwood [Mon, 28 Jun 2010 00:05:55 +0000 (20:05 -0400)]
USB: gadget: composite: Move switch_set_state calls to a work queue

Signed-off-by: Mike Lockwood <lockwood@android.com>
14 years agoUSB: gadget: composite: Add userspace notifications for USB state changes
Mike Lockwood [Wed, 23 Jun 2010 12:20:59 +0000 (08:20 -0400)]
USB: gadget: composite: Add userspace notifications for USB state changes

Add switch to notify current USB configuration.  This can be used to detect
USB connect and disconnect events.

Broadcast a change via the usb_composite class when a USB function is
enabled or disabled.

Rename usb_function.hidden to usb_function.disabled.

Signed-off-by: Mike Lockwood <lockwood@android.com>
14 years agoashmem: Fix ASHMEM_SET_PROT_MASK.
Arve Hjønnevåg [Thu, 15 Jul 2010 23:31:16 +0000 (16:31 -0700)]
ashmem: Fix ASHMEM_SET_PROT_MASK.

Change-Id: I1412cc9560de8c4feb1162fc30922f0e3362a476
Signed-off-by: Arve Hjønnevåg <arve@android.com>
14 years agoImplement read(2) in ashmem driver
Bjorn Bringert [Thu, 15 Apr 2010 09:04:01 +0000 (10:04 +0100)]
Implement read(2) in ashmem driver

Bug: 2595601
Change-Id: I47c0016f594f9354fb8658ccb26e3d395bcb137b
Signed-off-by: Bjorn Bringert <bringert@android.com>
14 years agostaging: android: lowmemorykiller: Remove bitrotted codepath
San Mehat [Thu, 6 May 2010 22:43:46 +0000 (15:43 -0700)]
staging: android: lowmemorykiller: Remove bitrotted codepath

Now that we're murder-synchronous, this code path will never be
called (and if it does, it doesn't tell us anything useful other
than we killed a task that was already being killed by somebody
else but hadn't gotten its' signal yet)

Signed-off-by: San Mehat <san@google.com>
14 years agostaging: android: lowmemorykiller: Fix task_struct leak
San Mehat [Thu, 6 May 2010 22:40:07 +0000 (15:40 -0700)]
staging: android: lowmemorykiller: Fix task_struct leak

As it turns out, the CONFIG_PROFILING interfaces leak a
task struct if the notifier chain returns NOTIFY_OK.. doh.

This patch reworks lowmemkiller to use the new generic task
free notifier chain.

Signed-off-by: San Mehat <san@google.com>
14 years agosched: Add a generic notifier when a task struct is about to be freed
San Mehat [Thu, 6 May 2010 22:37:55 +0000 (15:37 -0700)]
sched: Add a generic notifier when a task struct is about to be freed

This patch adds a notifier which can be used by subsystems that may
be interested in when a task has completely died and is about to
have it's last resource freed.

  The Android lowmemory killer uses this to determine when a task
it has killed has finally given up its goods.

Signed-off-by: San Mehat <san@google.com>
14 years agobinder: Fix memory corruption via page aliasing
Christopher Lais [Sat, 1 May 2010 20:51:48 +0000 (15:51 -0500)]
binder: Fix memory corruption via page aliasing

binder_deferred_release was not unmapping the page from the buffer
before freeing it, causing memory corruption.  This only happened
when page(s) had not been freed by binder_update_page_range, which
properly unmaps the pages.

This only happens on architectures with VIPT aliasing.

To reproduce, create a program which opens, mmaps, munmaps, then closes
the binder very quickly.  This should leave a page allocated when the
binder is released.  When binder_deferrred_release is called on the
close, the page will remain mapped to the address in the linear
proc->buffer.  Later, we may map the same physical page to a different
virtual address that has different coloring, and this may cause
aliasing to occur.

PAGE_POISONING will greatly increase your chances of noticing any
problems.

Change-Id: I6941bf212881b8bf846bdfda43d3609c7ae4892e

Signed-off-by: Christopher Lais <chris+android@zenthought.org>
14 years agostaging: android: lowmemkiller: Substantially reduce overhead during reclaim
San Mehat [Wed, 5 May 2010 18:38:42 +0000 (11:38 -0700)]
staging: android: lowmemkiller: Substantially reduce overhead during reclaim

This patch optimizes lowmemkiller to not do any work when it has an outstanding
kill-request. This greatly reduces the pressure on the task_list lock
(improving interactivity), as well as improving the vmscan performance
when under heavy memory pressure (by up to 20x in tests).

Note: For this enhancement to work, you need CONFIG_PROFILING

Signed-off-by: San Mehat <san@google.com>
14 years ago[ARM] Do not call flush_cache_user_range with mmap_sem held
Dima Zavin [Wed, 28 Apr 2010 03:57:04 +0000 (20:57 -0700)]
[ARM] Do not call flush_cache_user_range with mmap_sem held

We can't be holding the mmap_sem while calling flush_cache_user_range
because the flush can fault. If we fault on a user address, the
page fault handler will try to take mmap_sem again. Since both places
acquire the read lock, most of the time it succeeds. However, if another
thread tries to acquire the write lock on the mmap_sem (e.g. mmap) in
between the call to flush_cache_user_range and the fault, the down_read
in do_page_fault will deadlock.

Also, since we really can't be holding the mmap_sem while calling
flush_cache_user_range AND vma is actually unused by the flush itself,
get rid of vma as an argument.

Change-Id: If55409bde41ad1060fa4fe7cbd4ac530d4d9a106
Signed-off-by: Dima Zavin <dima@android.com>
14 years agoUSB: android gadget: mass storage: Fix format issue for Vista Host
Velempati Chiranjeevi [Wed, 21 Oct 2009 04:23:10 +0000 (09:53 +0530)]
USB: android gadget: mass storage: Fix format issue for Vista Host

As part of formating the mass storage device, Host sends the INQUIRY
scsi command. As per the standard, the command length for this
command should be 6 bytes, whereas the Vista host sends 12 bytes.

When the command length of the command is not equal to the standard
length, the device sends a phase error as part of the status phase.
When the host receives a phase error, it re-enumerates, hence the
error.

If the command is INQUIRY, and the command length is 12 bytes,
treating this as a good command and not sending the phase error
to the host fixes this issue.

Signed-off-by: Velempati Chiranjeevi <c_cvelem@qualcomm.com>
Signed-off-by: Mike Lockwood <lockwood@android.com>
14 years agolowmemorykiller: Don't try to kill the same pid over and over
San Mehat [Mon, 26 Apr 2010 22:11:04 +0000 (15:11 -0700)]
lowmemorykiller: Don't try to kill the same pid over and over

  Under certain circumstances, a process can take awhile to
handle a sig-kill (especially if it's in a scheduler group with
a very low share ratio). When this occurs, lowmemkiller returns
to vmscan indicating the process memory has been freed - even
though the process is still waiting to die. Since the memory
hasn't actually freed, lowmemkiller is called again shortly after,
and picks the same process to die; regardless of the fact that
it has already been 'scheduled' to die and the memory has already
been reported to vmscan as having been freed.

  Solution is to check fatal_signal_pending() on the selected
task, and if it's already pending destruction return; indicating
to vmscan that no resources were freed on this pass.

Signed-off-by: San Mehat <san@google.com>
14 years agoStaging: android: binder: Create dedicated workqueue for binder deferred work
Arve Hjønnevåg [Thu, 22 Apr 2010 22:53:23 +0000 (15:53 -0700)]
Staging: android: binder: Create dedicated workqueue for binder deferred work

Some drivers flush the global workqueue when closed. This would deadlock if
the last reference to the file was released from the binder.

Change-Id: Ifdabc0b383fecb20836d1bbb9786c632402a14e1
Signed-off-by: Arve Hjønnevåg <arve@android.com>
14 years agoproc: pagemap: Hold mmap_sem during page walk
KAMEZAWA Hiroyuki [Fri, 2 Apr 2010 00:11:29 +0000 (09:11 +0900)]
proc: pagemap: Hold mmap_sem during page walk

In initial design, walk_page_range() was designed just for walking page
table and it didn't require mmap_sem.  Now, find_vma() etc..  are used
in walk_page_range() and we need mmap_sem around it.

This patch adds mmap_sem around walk_page_range().

Because /proc/<pid>/pagemap's callback routine use put_user(), we have
to get rid of it to do sane fix.

Changelog: 2010/Apr/2
 - fixed start_vaddr and end overflow
Changelog: 2010/Apr/1
 - fixed start_vaddr calculation
 - removed unnecessary cast.
 - removed unnecessary change in smaps.
 - use GFP_TEMPORARY instead of GFP_KERNEL

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Matt Mackall <mpm@selenic.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Brian Swetland <swetland@google.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: San Mehat <san@google.com>
[ Fixed kmalloc failure return code as per Matt ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoRevert "proc: pagemap: Hold mmap_sem during page walk"
San Mehat [Mon, 19 Apr 2010 14:45:33 +0000 (07:45 -0700)]
Revert "proc: pagemap: Hold mmap_sem during page walk"

This reverts commit 0bf551684025a5f0f3c9aac694cd5cf73706cb70.

Reverting for proper up-stream fix

Signed-off-by: San Mehat <san@google.com>
14 years agoStaging: android: timed_gpio: Properly discard invalid timeout values.
Mike Lockwood [Sat, 17 Apr 2010 16:01:35 +0000 (12:01 -0400)]
Staging: android: timed_gpio: Properly discard invalid timeout values.

The timed output device never previously checked the return value of sscanf,
resulting in an uninitialized int being passed to enable() if input value
was invalid.

Signed-off-by: Mike Lockwood <lockwood@android.com>
14 years agoUSB: gadget: f_mass_storage: Defer handling interface changes until it is safe.
Mike Lockwood [Thu, 15 Apr 2010 19:04:07 +0000 (15:04 -0400)]
USB: gadget: f_mass_storage: Defer handling interface changes until it is safe.

Pulling in some code from file_storage.c, we now handle interface changes
in do_set_config(), which is now not called until any pending requests have
been successfully completed or cancelled.

This fixes a race condition that resulted in usb_ep_free_request() being called
while the request is still busy.

Signed-off-by: Mike Lockwood <lockwood@android.com>
14 years agofs: partitions: Fix warnings in fs/partitions/check.c
Colin Cross [Wed, 7 Apr 2010 19:08:27 +0000 (12:08 -0700)]
fs: partitions: Fix warnings in fs/partitions/check.c

Change-Id: I4398ace0c55d4833b1fcbb7a4e71ab8f0b1b044a
Signed-off-by: Colin Cross <ccross@android.com>
14 years agoBluetooth: Hack: Don't dereference null pointer.
Nick Pelly [Thu, 8 Apr 2010 23:23:32 +0000 (16:23 -0700)]
Bluetooth: Hack: Don't dereference null pointer.

This avoids the S305 panic during incoming connection.

S305 sends PSM 25 L2CAP connection request before the L2CAP info response.
When we receive that info response we crash on null pointer here.

Bug: 2127637
Change-Id: Ib637516251f46fa9a9c87ac015dc2f27df5a27fd
Signed-off-by: Nick Pelly <npelly@google.com>
14 years agoUSB: gadget: android: mass_storage: Use spin_lock_irqsave/spin_unlock_irqrestore
Arve Hjønnevåg [Thu, 11 Dec 2008 04:01:15 +0000 (20:01 -0800)]
USB: gadget: android: mass_storage: Use spin_lock_irqsave/spin_unlock_irqrestore

The old code did not allways disable interrupts when called from thread
context, but tried to lock the same spinlock from interrupt context.

This was merged from a change to drivers/usb/function/mass_storage.c
in the android-msm-2.6.29 branch.

Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Mike Lockwood <lockwood@android.com>
14 years agoproc: pagemap: Hold mmap_sem during page walk
San Mehat [Tue, 30 Mar 2010 23:43:18 +0000 (16:43 -0700)]
proc: pagemap: Hold mmap_sem during page walk

If the mmap_sem is not held while we walk_page_range(), then
it is possible for find_vma() to race with a remove_vma_list()
caused by do_munmap() (or others).

Unable to handle kernel paging request at virtual address 6b6b6b5b
Internal error: Oops: 5 [#1] PREEMPT
CPU: 0    Not tainted  (2.6.32.9-27154-ge3e6e27 #1)
PC is at find_vma+0x40/0x7c
LR is at walk_page_range+0x70/0x230
pc : [<c00aa3ac>]    lr : [<c00b298c>]    psr: 20000013
sp : c6aa9eb8  ip : 6b6b6b53  fp : c6a58f60
r10: c7e1d1b8  r9 : 0001bca0  r8 : 47000000
r7 : c6aa9f80  r6 : c6aa8000  r5 : 46fbd000  r4 : 6b6b6b6b
r3 : c7ca4820  r2 : 6b6b6b6b  r1 : 46fbd000  r0 : c70e3e40
Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c5787d  Table: 26574019  DAC: 00000015

[<c00aa3ac>] (find_vma+0x40/0x7c) from [<c00b298c>] (walk_page_range+0x70/0x230)
[<c00b298c>] (walk_page_range+0x70/0x230) from [<c00f5d3c>] (pagemap_read+0x1a4/0x278)
[<c00f5d3c>] (pagemap_read+0x1a4/0x278) from [<c00bac40>] (vfs_read+0xa8/0x150)
[<c00bac40>] (vfs_read+0xa8/0x150) from [<c00bad94>] (sys_read+0x3c/0x68)
[<c00bad94>] (sys_read+0x3c/0x68) from [<c0026f00>] (ret_fast_syscall+0x0/0x2c)
Code: 98bd8010 e5932004 e3a00000 ea000008 (e5124010)

Signed-off-by: San Mehat <san@google.com>
CC: Brian Swetland <swetland@google.com>
CC: Matt Mackall <mpm@selenic.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linus Torvalds <torvalds@linux-foundation.org>
14 years agowlan: Extract generic wlan platform data from tiwlan specific header
Dmitry Shmidt [Thu, 18 Mar 2010 23:04:18 +0000 (16:04 -0700)]
wlan: Extract generic wlan platform data from tiwlan specific header

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
14 years agoUSB: gadget: android: check for null _android_dev in android_register_function()
Mike Lockwood [Wed, 17 Mar 2010 19:42:29 +0000 (15:42 -0400)]
USB: gadget: android: check for null _android_dev in android_register_function()

This fixes a load ordering issue that occurred if a function driver loads before
the android gadget driver is initialized.

Signed-off-by: Mike Lockwood <lockwood@android.com>
14 years agoapanic: make APANIC_LABEL depend on APANIC
Iliyan Malchev [Wed, 17 Mar 2010 19:02:26 +0000 (12:02 -0700)]
apanic: make APANIC_LABEL depend on APANIC

Signed-off-by: Iliyan Malchev <malchev@google.com>
14 years agoUSB: gadget: f_mass_storage: Flush writes after every 4 MB.
Mike Lockwood [Fri, 12 Mar 2010 16:01:05 +0000 (11:01 -0500)]
USB: gadget: f_mass_storage: Flush writes after every 4 MB.

This avoids excessive caching at the block level layer when copying large
files to the storage device.

Signed-off-by: Mike Lockwood <lockwood@android.com>
14 years agoMerge commit 'v2.6.32.9' into android-2.6.32
Arve Hjønnevåg [Thu, 11 Mar 2010 00:38:33 +0000 (16:38 -0800)]
Merge commit 'v2.6.32.9' into android-2.6.32

14 years agoRevert "sysfs: Fix sysfs owner and group."
Arve Hjønnevåg [Thu, 11 Mar 2010 00:38:13 +0000 (16:38 -0800)]
Revert "sysfs: Fix sysfs owner and group."

This reverts commit f1f8e7cd6f796b15ed011361f09b57db796d9b4e.

14 years agoUSB: gadget: f_rndis: Add platform data for RNDIS vendor ID and MAC address.
Mike Lockwood [Wed, 10 Mar 2010 22:05:03 +0000 (17:05 -0500)]
USB: gadget: f_rndis: Add platform data for RNDIS vendor ID and MAC address.

This fixes a kernel panic in rndis.c when receiving the
OID_GEN_VENDOR_DESCRIPTION command.

Signed-off-by: Mike Lockwood <lockwood@android.com>
14 years agoBluetooth: Use non-flushable pb flag by default for ACL data on capable chipsets.
Nick Pelly [Wed, 9 Dec 2009 03:42:21 +0000 (19:42 -0800)]
Bluetooth: Use non-flushable pb flag by default for ACL data on capable chipsets.

With Bluetooth 2.1 ACL packets can be flushable or non-flushable. This commit
makes ACL data packets non-flushable by default on compatible chipsets, and
adds the L2CAP_LM_FLUSHABLE socket option to explicitly request flushable ACL
data packets for a given L2CAP socket. This is useful for A2DP data which can
be safely discarded if it can not be delivered within a short time (while
other ACL data should not be discarded).

Note that making ACL data flushable has no effect unless the automatic flush
timeout for that ACL link is changed from its default of 0 (infinite).

Change-Id: Ie3d4befdeaefb8c979de7ae603ff5ec462b3483c
Signed-off-by: Nick Pelly <npelly@google.com>
14 years agoRevert "Bluetooth: Introduce L2CAP_LM_FLUSHABLE to allow flushing of ACL packets."
Nick Pelly [Tue, 9 Mar 2010 20:08:00 +0000 (12:08 -0800)]
Revert "Bluetooth: Introduce L2CAP_LM_FLUSHABLE to allow flushing of ACL packets."

This reverts commit d7897fd1e9fb3a5df0740dc2dc45ec94ca0965f2.

Change-Id: I3401550b6dc97b683104e9fdac30a617a2db8c8e
Signed-off-by: Nick Pelly <npelly@google.com>
14 years agopmem: Add cache flush ioctl for pmem buffers
Dima Zavin [Tue, 2 Mar 2010 23:47:57 +0000 (15:47 -0800)]
pmem: Add cache flush ioctl for pmem buffers

Change-Id: I9156bad829e8c65087f122b48cc57638902fab12
Signed-off-by: Dima Zavin <dima@android.com>
14 years agoUSB: gadget: composite: Don't increment interface number for alt settings.
Mike Lockwood [Fri, 26 Feb 2010 14:34:19 +0000 (09:34 -0500)]
USB: gadget: composite: Don't increment interface number for alt settings.

Signed-off-by: Mike Lockwood <lockwood@android.com>
14 years agoUSB: gadget: composite: Don't call set_alt() on functions that are hidden.
Mike Lockwood [Fri, 26 Feb 2010 14:30:01 +0000 (09:30 -0500)]
USB: gadget: composite: Don't call set_alt() on functions that are hidden.

Signed-off-by: Mike Lockwood <lockwood@android.com>
14 years agoBluetooth: Allow SCO/eSCO packet type selection for outgoing SCO connections.
Nick Pelly [Thu, 11 Feb 2010 19:54:28 +0000 (11:54 -0800)]
Bluetooth: Allow SCO/eSCO packet type selection for outgoing SCO connections.

__u16 sco_pkt_type is introduced to struct sockaddr_sco. It allows bitwise
selection of SCO/eSCO packet types. Currently those bits are:

0x0001 HV1 may be used.
0x0002 HV2 may be used.
0x0004 HV3 may be used.
0x0008 EV3 may be used.
0x0010 EV4 may be used.
0x0020 EV5 may be used.
0x0040 2-EV3 may be used.
0x0080 3-EV3 may be used.
0x0100 2-EV5 may be used.
0x0200 3-EV5 may be used.

This is similar to the Packet Type parameter in the HCI Setup Synchronous
Connection Command, except that we are not reversing the logic on the EDR bits.
This makes the use of sco_pkt_tpye forward portable for the use case of
white-listing packet types, which we expect will be the primary use case.

If sco_pkt_type is zero, or userspace uses the old struct sockaddr_sco,
then the default behavior is to allow all packet types.

Packet type selection is just a request made to the Bluetooth chipset, and
it is up to the link manager on the chipset to negiotiate and decide on the
actual packet types used. Furthermore, when a SCO/eSCO connection is eventually
made there is no way for the host stack to determine which packet type was used
(however it is possible to get the link type of SCO or eSCO).

sco_pkt_type is ignored for incoming SCO connections. It is possible
to add this in the future as a parameter to the Accept Synchronous Connection
Command, however its a little trickier because the kernel does not
currently preserve sockaddr_sco data between userspace calls to accept().

The most common use for sco_pkt_type will be to white-list only SCO packets,
which can be done with the hci.h constant SCO_ESCO_MASK.

This patch is motivated by broken Bluetooth carkits such as the Motorolo
HF850 (it claims to support eSCO, but will actually reject eSCO connections
after 5 seconds) and the 2007/2008 Infiniti G35/37 (fails to route audio
if a 2-EV5 packet type is negiotiated). With this patch userspace can maintain
a list of compatible packet types to workaround remote devices such as these.

Based on a patch by Marcel Holtmann.

Change-Id: I304d8fda5b4145254820a3003820163bf53de5a5
Signed-off-by: Nick Pelly <npelly@google.com>
14 years agoRevert "Bluetooth: Change RFCOMM to use BT_CONNECT2 for BT_DEFER_SETUP"
Nick Pelly [Wed, 24 Feb 2010 17:29:45 +0000 (09:29 -0800)]
Revert "Bluetooth: Change RFCOMM to use BT_CONNECT2 for BT_DEFER_SETUP"

This reverts commit 8bf4794174659b06d43cc5e290cd384757374613.

Change-Id: Ieaeed6866996446e0392e387b77b446361f23d46
Signed-off-by: Nick Pelly <npelly@google.com>
14 years agoRevert "Bluetooth: Fix removing of RFCOMM DLC timer with DEFER_SETUP"
Nick Pelly [Wed, 24 Feb 2010 17:29:10 +0000 (09:29 -0800)]
Revert "Bluetooth: Fix removing of RFCOMM DLC timer with DEFER_SETUP"

This reverts commit e2139b32726e5dd184974c785ea3f62026590801.

Change-Id: Id948d5860840aaf85eca7d8894a7bb3192f0bb47
Signed-off-by: Nick Pelly <npelly@google.com>
14 years agoUSB: gadget: android: Disable UMS when RNDIS ethernet is active.
Mike Lockwood [Wed, 24 Feb 2010 15:20:59 +0000 (10:20 -0500)]
USB: gadget: android: Disable UMS when RNDIS ethernet is active.

Signed-off-by: Mike Lockwood <lockwood@android.com>
14 years agoandroid: logger: Add new system log for framework/system log messages
San Mehat [Wed, 24 Feb 2010 00:09:47 +0000 (16:09 -0800)]
android: logger: Add new system log for framework/system log messages

Signed-off-by: San Mehat <san@google.com>
14 years agoLinux 2.6.32.9
Greg Kroah-Hartman [Tue, 23 Feb 2010 15:38:51 +0000 (07:38 -0800)]
Linux 2.6.32.9

14 years agodm log: userspace fix overhead_size calcuations
Jonathan Brassow [Tue, 16 Feb 2010 18:42:53 +0000 (18:42 +0000)]
dm log: userspace fix overhead_size calcuations

commit ebfd32bba9b518d684009d9d21a56742337ca1b3 upstream.

This patch fixes two bugs that revolve around the miscalculation and
misuse of the variable 'overhead_size'.  'overhead_size' is the size of
the various header structures used during communication.

The first bug is the use of 'sizeof' with the pointer of a structure
instead of the structure itself - resulting in the wrong size being
computed.  This is then used in a check to see if the payload
(data_size) would be to large for the preallocated structure.  Since the
bug produces a smaller value for the overhead, it was possible for the
structure to be breached.  (Although the current users of the code do
not currently send enough data to trigger this bug.)

The second bug is that the 'overhead_size' value is used to compute how
much of the preallocated space should be cleared before populating it
with fresh data.  This should have simply been 'sizeof(struct cn_msg)'
not overhead_size.  The fact that 'overhead_size' was computed
incorrectly made this problem "less bad" - leaving only a pointer's
worth of space at the end uncleared.  Thus, this bug was never producing
a bad result, but still needs to be fixed - especially now that the
value is computed correctly.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agodm stripe: avoid divide by zero with invalid stripe count
Nikanth Karthikesan [Tue, 16 Feb 2010 18:42:47 +0000 (18:42 +0000)]
dm stripe: avoid divide by zero with invalid stripe count

commit 781248c1b50c776a9ef4be1130f84ced1cba42fe upstream.

If a table containing zero as stripe count is passed into stripe_ctr
the code attempts to divide by zero.

This patch changes DM_TABLE_LOAD to return -EINVAL if the stripe count
is zero.

We now get the following error messages:
  device-mapper: table: 253:0: striped: Invalid stripe count
  device-mapper: ioctl: error adding target to table

Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoiwlwifi: Fix to set correct ht configuration
Wey-Yi Guy [Fri, 5 Feb 2010 19:40:00 +0000 (11:40 -0800)]
iwlwifi: Fix to set correct ht configuration

commit 098dfded5b1b09927995e89c6d689f85a0f53384 upstream.

iwl_set_rxon_ht() only get called in iwl_post_associate(); which cause
possible incorrect ht configuration. Adding the call in iwl_mac_config() if
IEEE80211_CONF_CHANGE_CHANNEL flag is set to re-configure and send rxon
command.

Fixes
http://bugzilla.intellinuxwireless.org/show_bug.cgi?id=2146

Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agomac80211: Fix probe request filtering in IBSS mode
Benoit Papillault [Fri, 5 Feb 2010 00:21:03 +0000 (01:21 +0100)]
mac80211: Fix probe request filtering in IBSS mode

commit 0da780c269957783d341fc3559e6b4c9912af7b4 upstream.

We only reply to probe request if either the requested SSID is the
broadcast SSID or if the requested SSID matches our own SSID. This
latter case was not properly handled since we were replying to different
SSID with the same length as our own SSID.

Signed-off-by: Benoit Papillault <benoit.papillault@free.fr>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoath9k: Fix sequence numbers for PAE frames
Sujith [Tue, 9 Feb 2010 04:37:00 +0000 (10:07 +0530)]
ath9k: Fix sequence numbers for PAE frames

commit 6c8afef551fef87a3bf24f8a74c69a7f2f72fc82 upstream.

Currently, PAE frames are not assigned proper sequence numbers.
Since sending PAE frames as part of aggregates breaks
crupto with several APs, they are sent as normal MPDUs.
Fix the seqeuence number issue by updating the frame with the
internal sequence number.

Tested-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agob43: Fix throughput regression
Larry Finger [Tue, 2 Feb 2010 16:08:19 +0000 (10:08 -0600)]
b43: Fix throughput regression

commit b6c3f5be7c6ac3375f44de4545c1ffe216b34022 upstream.

Commit c7ab5ef9bcd281135c21b4732c9be779585181be entitled "b43: implement
short slot and basic rate handling" reduced the transmit throughput for
my BCM4311 device from 18 Mb/s to 0.7 Mb/s. The basic rate handling
portion is OK, the problem is in the short slot handling.

Prior to this change, the short slot enable/disable routines were never
called. Experimentation showed that the critical part was changing the
value at offset 0x0010 in the shared memory. This is supposed to contain
the 802.11 Slot Time in usec, but if it is changed from its initial value
of zero, performance is destroyed. On the other hand, changing the value
in the MMIO register corresponding to the Interframe Slot Time increased
performance from 18 to 22 Mb/s. A BCM4306/3 also shows dramatic
improvement of the transmit rate from 5.3 to 19.0 Mb/s.

Other changes in the patch include removal of the magic number for the
MMIO register, and allowing the slot time to be set for any PHY operating
in the 2.4 GHz band. Previously, the routine was executed only for G PHYs.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoeCryptfs: Add getattr function
Tyler Hicks [Wed, 4 Nov 2009 08:48:01 +0000 (02:48 -0600)]
eCryptfs: Add getattr function

commit f8f484d1b6677dd5cd5e7e605db747e8c30bbd47 upstream.

The i_blocks field of an eCryptfs inode cannot be trusted, but
generic_fillattr() uses it to instantiate the blocks field of a stat()
syscall when a filesystem doesn't implement its own getattr().  Users
have noticed that the output of du is incorrect on newly created files.

This patch creates ecryptfs_getattr() which calls into the lower
filesystem's getattr() so that eCryptfs can use its kstat.blocks value
after calling generic_fillattr().  It is important to note that the
block count includes the eCryptfs metadata stored in the beginning of
the lower file plus any padding used to fill an extent before
encryption.

https://bugs.launchpad.net/ecryptfs/+bug/390833

Reported-by: Dominic Sacré <dominic.sacre@gmx.de>
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Cc: Tim Gardner <timg@tpi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoNFS: Too many GETATTR and ACCESS calls after direct I/O
Chuck Lever [Mon, 15 Feb 2010 17:19:53 +0000 (12:19 -0500)]
NFS: Too many GETATTR and ACCESS calls after direct I/O

commit 65d269538a1129495ac45a14a777cd11cfe881d8 upstream.

The cached read and write paths initialize fattr->time_start in their
setup procedures.  The value of fattr->time_start is propagated to
read_cache_jiffies by nfs_update_inode().  Subsequent calls to
nfs_attribute_timeout() will then use a good time stamp when
computing the attribute cache timeout, and squelch unneeded GETATTR
calls.

Since the direct I/O paths erroneously leave the inode's
fattr->time_start field set to zero, read_cache_jiffies for that inode
is set to zero after any direct read or write operation.  This
triggers an otw GETATTR or ACCESS call to update the file's attribute
and access caches properly, even when the NFS READ or WRITE replies
have usable post-op attributes.

Make sure the direct read and write setup code performs the same fattr
initialization as the cached I/O paths to prevent unnecessary GETATTR
calls.

This was likely introduced by commit 0e574af1 in 2.6.15, which appears
to add new nfs_fattr_init() call sites in the cached read and write
paths, but not in the equivalent places in fs/nfs/direct.c.  A
subsequent commit in the same series, 33801147, introduces the
fattr->time_start field.

Interestingly, the direct write reschedule path already has a call to
nfs_fattr_init() in the right place.

Reported-by: Quentin Barnes <qbarnes@yahoo-inc.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agodrm/radeon/kms: use udelay for short delays
Dave Airlie [Sat, 30 Jan 2010 21:07:14 +0000 (07:07 +1000)]
drm/radeon/kms: use udelay for short delays

commit 01d4503968f471f876fb44335800d2cf8dc5a2ce upstream.

For usec delays use udelay instead of scheduling, this should
allow reclocking to happen faster. This also was the cause
of reported 33s delays at bootup on certain systems.

fixes: freedesktop.org bug 25506

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoACPI: fix High cpu temperature with 2.6.32
Arjan van de Ven [Wed, 27 Jan 2010 23:25:39 +0000 (15:25 -0800)]
ACPI: fix High cpu temperature with 2.6.32

commit 370d5cd88509b93b76eb2f5f97efbd71c25061cb upstream.

Since the rewrite of the CPU idle governor in 2.6.32, two laptops have
surfaced where the BIOS advertises a C2 power state, but for some reason
this state is not functioning (as verified in both cases by powertop
before the patch in .32).

The old governor had the accidental behavior that if a non-working state
was chosen too many times, it would end up falling back to C1.  The new
governor works differently and this accidental behavior is no longer
there; the result is a high temperature on these two machines.

This patch adds these 2 machines to the DMI table for C state anomalies;
by just not using C2 both these machines are better off (the TSC can be
used instead of the pm timer, giving a performance boost for example).

Addresses http://bugzilla.kernel.org/show_bug.cgi?id=14742

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Reported-by: <akwatts@ymail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoACPI: Add NULL pointer check in acpi_bus_start
Thomas Renninger [Fri, 29 Jan 2010 16:48:51 +0000 (17:48 +0100)]
ACPI: Add NULL pointer check in acpi_bus_start

commit d2f6650a950dadd20667a04a9dc785f240d43695 upstream.

If acpi_bus_add does not return a device and it's passed
to acpi_bus_start, bad things will happen:

BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: [<ffffffff8128402d>] acpi_bus_start+0x14/0x24
...
[<ffffffffa008977a>] acpiphp_bus_add+0xba/0x130 [acpiphp]
[<ffffffffa008aa72>] enable_device+0x132/0x2ff [acpiphp]
[<ffffffffa0089b68>] acpiphp_enable_slot+0xb8/0x130 [acpiphp]
[<ffffffffa0089df7>] handle_hotplug_event_func+0x87/0x190 [acpiphp]

Next patch would make this NULL pointer check obsolete, but
better having one more than one missing...

Signed-off-by: Thomas Renninger <trenn@suse.de>
Acked-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agortl8187: Add new device ID
Jelle Martijn Kok [Wed, 10 Feb 2010 15:34:09 +0000 (09:34 -0600)]
rtl8187: Add new device ID

commit 174b24963eaf96dc5e093502ee09639aed13eb2f upstream.

Add new RTL8187B device.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: usbfs: properly clean up the as structure on error paths
Linus Torvalds [Tue, 16 Feb 2010 20:35:07 +0000 (12:35 -0800)]
USB: usbfs: properly clean up the as structure on error paths

commit ddeee0b2eec2a51b0712b04de4b39e7bec892a53 upstream.

I notice that the processcompl_compat() function seems to be leaking the
'struct async *as' in the error paths.

I think that the calling convention is fundamentally buggered. The
caller is the one that did the "reap_as()" to get the as thing, the
caller should be the one to free it too.

Freeing it in the caller also means that it very clearly always gets
freed, and avoids the need for any "free in the error case too".

From: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Marcus Meissner <meissner@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoUSB: usbfs: only copy the actual data received
Greg KH [Mon, 15 Feb 2010 17:37:46 +0000 (09:37 -0800)]
USB: usbfs: only copy the actual data received

commit d4a4683ca054ed9917dfc9e3ff0f7ecf74ad90d6 upstream.

We need to only copy the data received by the device to userspace, not
the whole kernel buffer, which can contain "stale" data.

Thanks to Marcus Meissner for pointing this out and testing the fix.

Reported-by: Marcus Meissner <meissner@suse.de>
Tested-by: Marcus Meissner <meissner@suse.de>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoclass: Free the class private data in class_release
Laurent Pinchart [Wed, 10 Feb 2010 12:32:49 +0000 (13:32 +0100)]
class: Free the class private data in class_release

commit 18d19c96457d172d913510c083bc7411ed40cb10 upstream.

Fix a memory leak by freeing the memory allocated in __class_register
for the class private data.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agosysfs: sysfs_sd_setattr set iattrs unconditionally
Eric W. Biederman [Thu, 4 Feb 2010 07:13:24 +0000 (23:13 -0800)]
sysfs: sysfs_sd_setattr set iattrs unconditionally

commit 7c0ff870d1ed287504a61ed865f3d728c757436b upstream.

There is currently a bug in sysfs_sd_setattr inherited from
sysfs_setattr in 2.6.32 where the first time we set the attributes
on a sysfs file we allocate backing store but do not set the
backing store attributes.  Resulting in overly restrictive
permissions on sysfs files.

The fix is to simply modify the code so that it always executes
when we update the sysfs attributes, as we did in 2.6.31 and earlier.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Tested-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoserial: 8250: add serial transmitter fully empty test
Dick Hollenbeck [Wed, 9 Dec 2009 20:31:34 +0000 (12:31 -0800)]
serial: 8250: add serial transmitter fully empty test

commit bca476139d2ded86be146dae09b06e22548b67f3 upstream.

When controlling an industrial radio modem it can be necessary to
manipulate the handshake lines in order to control the radio modem's
transmitter, from userspace.

The transmitter should not be turned off before all characters have been
transmitted.  serial8250_tx_empty() was reporting that all characters were
transmitted before they actually were.

===

Discovered in parallel with more testing and analysis by Kees Schoenmakers
as follows:

I ran into an NetMos 9835 serial pci board which behaves a little
different than the standard.  This type of expansion board is very common.

"Standard" 8250 compatible devices clear the 'UART_LST_TEMT" bit together
with the "UART_LSR_THRE" bit when writing data to the device.

The NetMos device does it slightly different

I believe that the TEMT bit is coupled to the shift register.  The problem
is that after writing data to the device and very quickly after that one
does call serial8250_tx_empty, it returns the wrong information.

My patch makes the test more robust (and solves the problem) and it does
not affect the already correct devices.

Alan:

  We may yet need to quirk this but now we know which chips we have a
  way to do that should we find this breaks some other 8250 clone with
  dodgy THRE.

Signed-off-by: Dick Hollenbeck <dick@softplc.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Cc: Kees Schoenmakers <k.schoenmakers@sigmae.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoALSA: usb-audio - Avoid Oops after disconnect
Takashi Iwai [Mon, 28 Dec 2009 11:24:22 +0000 (12:24 +0100)]
ALSA: usb-audio - Avoid Oops after disconnect

commit 78b8d5d2ee280c463908fd75f3bdf246bcb6ac8d upstream.

As the release of substreams may be done asynchronously from the
disconnection, close callback needs to check the shutdown flag before
actually accessing the usb interface.

Reference: Novell bnc#505027
http://bugzilla.novell.com/show_bug.cgi?id=565027

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoStaging: fix rtl8187se compilation errors with mac80211
George Kadianakis [Wed, 16 Dec 2009 23:16:00 +0000 (01:16 +0200)]
Staging: fix rtl8187se compilation errors with mac80211

commit df574b8ecfb3a84af96229f336a6be88ca4a7055 upstream.

This patch fixes compilation problems that were caused by function
naming conflicts between the rtl8187se driver and the mac80211 stack.

Signed-off-by: George Kadianakis <desnacked@gmail.com>
Cc: maximilian attems <max@stro.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agox86: Re-get cfg_new in case reuse/move irq_desc
Yinghai Lu [Sat, 21 Nov 2009 08:23:37 +0000 (00:23 -0800)]
x86: Re-get cfg_new in case reuse/move irq_desc

commit 37ef2a3029fde884808ff1b369677abc7dd9a79a upstream.

When irq_desc is moved, we need to make sure to use the right cfg_new.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
LKML-Reference: <4B07A739.3030104@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agox86/amd-iommu: Fix deassignment of a device from the pt_domain
Joerg Roedel [Wed, 3 Feb 2010 15:13:41 +0000 (16:13 +0100)]
x86/amd-iommu: Fix deassignment of a device from the pt_domain

commit d3ad9373b7c29b63d5e8460a69453718d200cc3b upstream.

Deassigning a device from the passthrough domain does not
work and breaks device assignment to kvm guests. This patch
fixes the issue.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agox86/amd-iommu: Fix IOMMU-API initialization for iommu=pt
Joerg Roedel [Wed, 3 Feb 2010 15:13:08 +0000 (16:13 +0100)]
x86/amd-iommu: Fix IOMMU-API initialization for iommu=pt

commit f5325094379158e6b876ea0010c807bf7890ec8f upstream

This patch moves the initialization of the iommu-api out of
the dma-ops initialization code. This ensures that the
iommu-api is initialized even with iommu=pt.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agopktgen: Fix freezing problem
Rafael J. Wysocki [Thu, 4 Feb 2010 22:00:41 +0000 (14:00 -0800)]
pktgen: Fix freezing problem

commit 1b3f720bf033fde1fbb6231f9b156b918c5f68d8 upstream.

Add missing try_to_freeze() to one of the pktgen_thread_worker() code
paths so that it doesn't block suspend/hibernation.

Fixes http://bugzilla.kernel.org/show_bug.cgi?id=15006

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reported-and-tested-by: Ciprian Dorin Craciun <ciprian.craciun@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoahci: add Acer G725 to broken suspend list
Tejun Heo [Thu, 28 Jan 2010 07:04:15 +0000 (16:04 +0900)]
ahci: add Acer G725 to broken suspend list

commit cedc9bf906dae044443d403371c887affdb44168 upstream.

Acer G725 shares the same suspend problem with the HP laptops which
lose ATA devices on resume.  New firmware which fixes the problem is
already available.  Add G725 with old firmwares to the broken suspend
list.

This problem has been reported in bko#15104.

  http://bugzilla.kernel.org/show_bug.cgi?id=15104

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Jani-Matti Hätinen <jani-matti.hatinen@iki.fi>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoCall flush_dcache_page after PIO data transfers in libata-sff.c
Catalin Marinas [Thu, 4 Feb 2010 06:04:50 +0000 (01:04 -0500)]
Call flush_dcache_page after PIO data transfers in libata-sff.c

commit 2d68b7fe55d9e19a8a868224ed0dfd6526568521 upstream.

flush_dcache_page() must be called after (!ATA_TFLAG_WRITE) the
data copying to avoid D-cache aliasing with user space or I-D cache
coherency issues (when reading data from an ATA device using PIO,
the kernel dirties the D-cache but there is no flush_dcache_page()
required on Harvard architectures).

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agortc-fm3130: add missing braces
Sergey Matyukevich [Tue, 2 Feb 2010 21:43:59 +0000 (13:43 -0800)]
rtc-fm3130: add missing braces

commit f4b5162820de60204afa5c8639335f4931b7fb0c upstream.

Add missing braces for multiline 'if' statements in fm3130_probe.

Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: Sergey Lapin <slapin@ossfans.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agobefs: fix leak
Al Viro [Fri, 29 Jan 2010 03:11:38 +0000 (22:11 -0500)]
befs: fix leak

commit 8dd5ca532c2d2c2b85f16bc038ebfff05b8853e1 upstream.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoALSA: hda - Improved MacBook (Pro) 5,1 / 5,2 support
Alex Murray [Wed, 13 Jan 2010 12:45:03 +0000 (23:15 +1030)]
ALSA: hda - Improved MacBook (Pro) 5,1 / 5,2 support

commit a76221d47ef2b73ff16c0fef00a784026308ea02 upstream.

This patch adds support for automatically muting the speakers when headphones
are inserted, as well as relabelling the headphone widgets from the
non-standard "HP" to the standard "Headphone" for the mb5 model.

Signed-off-by: Alex Murray <murray.alex@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agodst: call cond_resched() in dst_gc_task()
Eric Dumazet [Mon, 8 Feb 2010 23:00:39 +0000 (15:00 -0800)]
dst: call cond_resched() in dst_gc_task()

commit 2fc1b5dd99f66d93ffc23fd8df82d384c1a354c8 upstream.

Kernel bugzilla #15239

On some workloads, it is quite possible to get a huge dst list to
process in dst_gc_task(), and trigger soft lockup detection.

Fix is to call cond_resched(), as we run in process context.

Reported-by: Pawel Staszewski <pstaszewski@itcare.pl>
Tested-by: Pawel Staszewski <pstaszewski@itcare.pl>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoALSA: hda - use WARN_ON_ONCE() for zero-division detection
Takashi Iwai [Fri, 12 Feb 2010 17:17:06 +0000 (18:17 +0100)]
ALSA: hda - use WARN_ON_ONCE() for zero-division detection

commit d6d8bf549393484e906913f02fa3c9518a2819b6 upstream.

Replace the zero-division warning message with WARN_ON_ONCE() per the
advice by Linus.  This shouldn't happen, but if it happens, it's
possible that the bug happens often due to buggy IRQs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agosh: Couple kernel and user write page perm bits for CONFIG_X2TLB
Matt Fleming [Fri, 11 Dec 2009 22:58:17 +0000 (22:58 +0000)]
sh: Couple kernel and user write page perm bits for CONFIG_X2TLB

commit fcb4ebd678858850e8b029909064175cb627868d upstream.

pte_write() should check whether the permissions include either the user
or kernel write permission bits. Likewise, pte_wrprotect() needs to
remove both the kernel and user write bits.

Without this patch handle_tlbmiss() doesn't handle faulting in pages
from the P3 area (our vmalloc space) because of a write. Mappings of the
P3 space have the _PAGE_EXT_KERN_WRITE bit but not _PAGE_EXT_USER_WRITE.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoSCSI: mptfusion : mptscsih_abort return value should be SUCCESS instead of value 0.
Kashyap, Desai [Mon, 25 Jan 2010 10:50:52 +0000 (16:20 +0530)]
SCSI: mptfusion : mptscsih_abort return value should be SUCCESS instead of value 0.

commit 9858ae38011d699d4c2fa7f3493a47accf43a0f5 upstream.

retval should be SUCCESS/FAILED which is defined at scsi.h
retval = 0 is directing wrong return value. It must be retval = SUCCESS.

Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agodevmem: fix kmem write bug on memory holes
Wu Fengguang [Fri, 5 Feb 2010 20:02:13 +0000 (15:02 -0500)]
devmem: fix kmem write bug on memory holes

commit c85e9a97c4102ce2e83112da850d838cfab5ab13 upstream

devmem: fix kmem write bug on memory holes

[ cebbert@redhat.com : backport to 2.6.32 ]

write_kmem() used to assume vwrite() always return the full buffer length.
However now vwrite() could return 0 to indicate memory hole.  This
creates a bug that "buf" is not advanced accordingly.

Fix it to simply ignore the return value, hence the memory hole.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Tejun Heo <tj@kernel.org>
Cc: Nick Piggin <npiggin@suse.de>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agodevmem: check vmalloc address on kmem read/write
KAMEZAWA Hiroyuki [Fri, 5 Feb 2010 20:01:09 +0000 (15:01 -0500)]
devmem: check vmalloc address on kmem read/write

commit 325fda71d0badc1073dc59f12a948f24ff05796a

[ cebbert@redhat.com : backport to 2.6.32 ]

devmem: check vmalloc address on kmem read/write

Otherwise vmalloc_to_page() will BUG().

This also makes the kmem read/write implementation aligned with mem(4):
"References to nonexistent locations cause errors to be returned." Here we
return -ENXIO (inspired by Hugh) if no bytes have been transfered to/from
user space, otherwise return partial read/write results.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years ago/dev/mem: introduce size_inside_page()
Wu Fengguang [Fri, 5 Feb 2010 20:00:52 +0000 (15:00 -0500)]
/dev/mem: introduce size_inside_page()

commit f222318e9c3a315723e3524fb9d6566b2430db44 upstream

/dev/mem: introduce size_inside_page()

[ cebbert@redhat.com : backport to 2.6.32 ]
[ subset of original patch, for just /dev/kmem ]

Introduce size_inside_page() to replace duplicate /dev/mem code.

Also apply it to /dev/kmem, whose alignment logic was buggy.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Acked-by: Andi Kleen <ak@linux.intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Avi Kivity <avi@qumranet.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agodell-wmi, hp-wmi, msi-wmi: check wmi_get_event_data() return value
Len Brown [Sat, 30 Jan 2010 23:01:42 +0000 (18:01 -0500)]
dell-wmi, hp-wmi, msi-wmi: check wmi_get_event_data() return value

commit fda11e61ff8a4e3a8ebbd434e46560b67cc0ca9d upstream

[ backport to 2.6.32 ]

When acpi_evaluate_object() is passed ACPI_ALLOCATE_BUFFER,
the caller must kfree the returned buffer if AE_OK is returned.

The callers of wmi_get_event_data() pass ACPI_ALLOCATE_BUFFER,
and thus must check its return value before accessing
or kfree() on the buffer.

Signed-off-by: Len Brown <len.brown@intel.com>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agowmi: Free the allocated acpi objects through wmi_get_event_data
Anisse Astier [Sat, 30 Jan 2010 23:00:17 +0000 (18:00 -0500)]
wmi: Free the allocated acpi objects through wmi_get_event_data

commit 3e9b988e4edf065d39c1343937f717319b1c1065 upstream

[ backported to 2.6.32 ]

These function allocate an acpi object by calling wmi_get_event_data, which
then calls acpi_evaluate_object, and it is not freed afterwards.

And kernel doc is fixed for parameters of wmi_get_event_data.

Signed-off-by: Anisse Astier <anisse@astier.eu>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Carlos Corbacho <carlos@strangeworlds.co.uk>
Signed-off-by: Len Brown <len.brown@intel.com>
Cc: Chuck Ebbert <cebbert@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agocrypto: padlock-sha - Add import/export support
Herbert Xu [Sun, 31 Jan 2010 22:17:56 +0000 (09:17 +1100)]
crypto: padlock-sha - Add import/export support

commit a8d7ac279743077965afeca0c9ed748507b68e89 upstream.

As the padlock driver for SHA uses a software fallback to perform
partial hashing, it must implement custom import/export functions.
Otherwise hmac which depends on import/export for prehashing will
not work with padlock-sha.

Reported-by: Wolfgang Walter <wolfgang.walter@stwm.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agodasd: remove strings from s390dbf
Stefan Haberland [Mon, 7 Dec 2009 11:51:52 +0000 (12:51 +0100)]
dasd: remove strings from s390dbf

commit b8ed5dd54895647c2690575aad6f07748c2c618a upstream.

Remove strings from s390 debugfeature entries that could lead to a
crash when the data is read from dbf because the strings do not exist
any more.

Signed-off-by: Stefan Haberland <stefan.haberland@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agodrm/i915: Don't wait interruptible for possible plane buffer flush
Zhenyu Wang [Wed, 25 Nov 2009 05:09:39 +0000 (13:09 +0800)]
drm/i915: Don't wait interruptible for possible plane buffer flush

commit b9241ea31fae4887104e5d1b3b18f4009c25a0c4 upstream.

When we setup buffer for display plane, we'll check any pending
required GPU flush and possible make interruptible wait for flush
complete. But that wait would be most possibly to fail in case of
signals received for X process, which will then fail modeset process
and put display engine in unconsistent state. The result could be
blank screen or CPU hang, and DDX driver would always turn on outputs
DPMS after whatever modeset fails or not.

So this one creates new helper for setup display plane buffer, and
when needing flush using uninterruptible wait for that.

This one should fix bug like https://bugs.freedesktop.org/show_bug.cgi?id=24009.
Also fixing mode switch stress test on Ironlake.

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agodrm/i915: add i915_lp_ring_sync helper
Daniel Vetter [Tue, 15 Sep 2009 20:57:32 +0000 (22:57 +0200)]
drm/i915: add i915_lp_ring_sync helper

commit 48764bf43f746113fc77877d7e80f2df23ca4cbb upstream.

This just waits until the hw passed the current ring position with
cmd execution. This slightly changes the existing i915_wait_request
function to make uninterruptible waiting possible - no point in
returning to userspace while mucking around with the overlay, that
piece of hw is just too fragile.

Also replace a magic 0 with the symbolic constant (and kill the then
superflous comment) while I was looking at the code.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agodrm/i915: remove full registers dump debug
Zhenyu Wang [Mon, 28 Dec 2009 05:23:36 +0000 (13:23 +0800)]
drm/i915: remove full registers dump debug

commit 823f68fd646da6a39a9c0d3eb4c60d69dab5aa13 upstream.

This one reverts 9e3a6d155ed0a7636b926a798dd7221ea107b274.
As reported by http://bugzilla.kernel.org/show_bug.cgi?id=14485,
this dump will cause hang problem on some machine. If something
really needs this kind of full registers dump, that could be done
within intel-gpu-tools.

Cc: Ben Gamari <bgamari.foss@gmail.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agonetfilter: nf_conntrack: fix hash resizing with namespaces
Patrick McHardy [Mon, 8 Feb 2010 19:18:07 +0000 (11:18 -0800)]
netfilter: nf_conntrack: fix hash resizing with namespaces

commit d696c7bdaa55e2208e56c6f98e6bc1599f34286d upstream.

As noticed by Jon Masters <jonathan@jonmasters.org>, the conntrack hash
size is global and not per namespace, but modifiable at runtime through
/sys/module/nf_conntrack/hashsize. Changing the hash size will only
resize the hash in the current namespace however, so other namespaces
will use an invalid hash size. This can cause crashes when enlarging
the hashsize, or false negative lookups when shrinking it.

Move the hash size into the per-namespace data and only use the global
hash size to initialize the per-namespace value when instanciating a
new namespace. Additionally restrict hash resizing to init_net for
now as other namespaces are not handled currently.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agonetfilter: xtables: compat out of scope fix
Alexey Dobriyan [Mon, 8 Feb 2010 19:17:43 +0000 (11:17 -0800)]
netfilter: xtables: compat out of scope fix

commit 14c7dbe043d01a83a30633ab6b109ba2ac61d9f7 upstream.

As per C99 6.2.4(2) when temporary table data goes out of scope,
the behaviour is undefined:

if (compat) {
struct foo tmp;
...
private = &tmp;
}
[dereference private]

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agonetfilter: nf_conntrack: restrict runtime expect hashsize modifications
Alexey Dobriyan [Mon, 8 Feb 2010 19:17:22 +0000 (11:17 -0800)]
netfilter: nf_conntrack: restrict runtime expect hashsize modifications

commit 13ccdfc2af03e09e60791f7d4bc4ccf53398af7c upstream.

Expectation hashtable size was simply glued to a variable with no code
to rehash expectations, so it was a bug to allow writing to it.
Make "expect_hashsize" readonly.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agonetfilter: nf_conntrack: per netns nf_conntrack_cachep
Eric Dumazet [Mon, 8 Feb 2010 19:16:56 +0000 (11:16 -0800)]
netfilter: nf_conntrack: per netns nf_conntrack_cachep

commit 5b3501faa8741d50617ce4191c20061c6ef36cb3 upstream.

nf_conntrack_cachep is currently shared by all netns instances, but
because of SLAB_DESTROY_BY_RCU special semantics, this is wrong.

If we use a shared slab cache, one object can instantly flight between
one hash table (netns ONE) to another one (netns TWO), and concurrent
reader (doing a lookup in netns ONE, 'finding' an object of netns TWO)
can be fooled without notice, because no RCU grace period has to be
observed between object freeing and its reuse.

We dont have this problem with UDP/TCP slab caches because TCP/UDP
hashtables are global to the machine (and each object has a pointer to
its netns).

If we use per netns conntrack hash tables, we also *must* use per netns
conntrack slab caches, to guarantee an object can not escape from one
namespace to another one.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
[Patrick: added unique slab name allocation]
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agonetfilter: nf_conntrack: fix memory corruption with multiple namespaces
Patrick McHardy [Mon, 8 Feb 2010 19:16:26 +0000 (11:16 -0800)]
netfilter: nf_conntrack: fix memory corruption with multiple namespaces

commit 9edd7ca0a3e3999c260642c92fa008892d82ca6e upstream.

As discovered by Jon Masters <jonathan@jonmasters.org>, the "untracked"
conntrack, which is located in the data section, might be accidentally
freed when a new namespace is instantiated while the untracked conntrack
is attached to a skb because the reference count it re-initialized.

The best fix would be to use a seperate untracked conntrack per
namespace since it includes a namespace pointer. Unfortunately this is
not possible without larger changes since the namespace is not easily
available everywhere we need it. For now move the untracked conntrack
initialization to the init_net setup function to make sure the reference
count is not re-initialized and handle cleanup in the init_net cleanup
function to make sure namespaces can exit properly while the untracked
conntrack is in use in other namespaces.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoamd64_edac: Do not falsely trigger kerneloops
Borislav Petkov [Thu, 11 Feb 2010 16:15:57 +0000 (17:15 +0100)]
amd64_edac: Do not falsely trigger kerneloops

commit cab4d27764d5a8654212b3e96eb0ae793aec5b94 upstream.

An unfortunate "WARNING" in the message amd64_edac dumps when the system
doesn't support DRAM ECC or ECC checking is not enabled in the BIOS
used to trigger kerneloops which qualified the message as an OOPS thus
misleading the users. See, e.g.

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/422536
http://bugzilla.kernel.org/show_bug.cgi?id=15238

Downgrade the message level to KERN_NOTICE and fix the formulation.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Acked-by: Doug Thompson <dougthompson@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agotpm_infineon: fix suspend/resume handler for pnp_driver
Marcel Selhorst [Wed, 10 Feb 2010 21:56:32 +0000 (13:56 -0800)]
tpm_infineon: fix suspend/resume handler for pnp_driver

commit 93716b9470fbfd9efdc7d0f2445cb34635de3f6d upstream.

When suspending, tpm_infineon calls the generic suspend function of the
TPM framework.  However, the TPM framework does not return and the system
hangs upon suspend.  When sending the necessary command "TPM_SaveState"
directly within the driver, suspending and resuming works fine.

Signed-off-by: Marcel Selhorst <m.selhorst@sirrix.com>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Debora Velarde <debora@linux.vnet.ibm.com>
Cc: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoKVM: PIT: control word is write-only
Marcelo Tosatti [Fri, 29 Jan 2010 19:28:41 +0000 (17:28 -0200)]
KVM: PIT: control word is write-only

commit ee73f656a604d5aa9df86a97102e4e462dd79924 upstream.

PIT control word (address 0x43) is write-only, reads are undefined.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agokvmclock: count total_sleep_time when updating guest clock
Jason Wang [Wed, 27 Jan 2010 11:13:49 +0000 (19:13 +0800)]
kvmclock: count total_sleep_time when updating guest clock

commit 923de3cf5bf12049628019010e36623fca5ef6d1 upstream.

Current kvm wallclock does not consider the total_sleep_time which could cause
wrong wallclock in guest after host suspend/resume. This patch solve
this issue by counting total_sleep_time to get the correct host boot time.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoExport the symbol of getboottime and mmonotonic_to_bootbased
Jason Wang [Wed, 27 Jan 2010 11:13:40 +0000 (19:13 +0800)]
Export the symbol of getboottime and mmonotonic_to_bootbased

commit c93d89f3dbf0202bf19c07960ca8602b48c2f9a0 upstream.

Export getboottime and monotonic_to_bootbased in order to let them
could be used by following patch.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoV4L/DVB: dvb-core: fix initialization of feeds list in demux filter
Francesco Lavra [Sun, 7 Feb 2010 12:49:58 +0000 (09:49 -0300)]
V4L/DVB: dvb-core: fix initialization of feeds list in demux filter

commit 691c9ae099b9bcb5c27125af00a4a90120977458 upstream.

A DVB demultiplexer device can be used to set up either a PES filter or
a section filter. In the former case, the ts field of the feed union of
struct dmxdev_filter is used, in the latter case the sec field of the
same union is used.
The ts field is a struct list_head, and is currently initialized in the
open() method of the demux device. When for a given demuxer a section
filter is set up, the sec field is played with, thus if a PES filter
needs to be set up after that the ts field will be corrupted, causing a
kernel oops.
This fix moves the list head initialization to
dvb_dmxdev_pes_filter_set(), so that the ts field is properly
initialized every time a PES filter is set up.

Signed-off-by: Francesco Lavra <francescolavra@interfree.it>
Reviewed-by: Andy Walls <awalls@radix.net>
Tested-by: hermann pitton <hermann-pitton@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agomd: fix 'degraded' calculation when starting a reshape.
NeilBrown [Tue, 9 Feb 2010 01:31:47 +0000 (12:31 +1100)]
md: fix 'degraded' calculation when starting a reshape.

commit 9eb07c259207d048e3ee8be2a77b2a4680b1edd4 upstream.

This code was written long ago when it was not possible to
reshape a degraded array.  Now it is so the current level of
degraded-ness needs to be taken in to account.  Also newly addded
devices should only reduce degradedness if they are deemed to be
in-sync.

In particular, if you convert a RAID5 to a RAID6, and increase the
number of devices at the same time, then the 5->6 conversion will
make the array degraded so the current code will produce a wrong
value for 'degraded' - "-1" to be precise.

If the reshape runs to completion end_reshape will calculate a correct
new value for 'degraded', but if a device fails during the reshape an
incorrect decision might be made based on the incorrect value of
"degraded".

This patch is suitable for 2.6.32-stable and if they are still open,
2.6.31-stable and 2.6.30-stable as well.

Reported-by: Michael Evans <mjevans1983@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoNFS: Fix the mapping of the NFSERR_SERVERFAULT error
Trond Myklebust [Mon, 8 Feb 2010 14:32:40 +0000 (09:32 -0500)]
NFS: Fix the mapping of the NFSERR_SERVERFAULT error

commit fdcb45777a3d1689c5541e1f85ee3ebbd197d2c1 upstream.

It was recently pointed out that the NFSERR_SERVERFAULT error, which is
designed to inform the user of a serious internal error on the server, was
being mapped to an error value that is internal to the kernel.

This patch maps it to the error EREMOTEIO, which is exported to userland
through errno.h.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoNFS: Fix a bug in nfs_fscache_release_page()
Trond Myklebust [Mon, 8 Feb 2010 14:32:27 +0000 (09:32 -0500)]
NFS: Fix a bug in nfs_fscache_release_page()

commit 2c1740098c708b465e87637b237feb2fd98f129a upstream.

Not having an fscache cookie is perfectly valid if the user didn't mount
with the fscache option.

This patch fixes http://bugzilla.kernel.org/show_bug.cgi?id=15234

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoNFS: Fix a umount race
Trond Myklebust [Wed, 3 Feb 2010 13:27:35 +0000 (08:27 -0500)]
NFS: Fix a umount race

commit 387c149b54b4321cbc790dadbd4f8eedb5a90468 upstream.

Ensure that we unregister the bdi before kill_anon_super() calls
ida_remove() on our device name.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoNFS: Fix an Oops when truncating a file
Trond Myklebust [Wed, 3 Feb 2010 13:27:22 +0000 (08:27 -0500)]
NFS: Fix an Oops when truncating a file

commit 9f557cd8073104b39528794d44e129331ded649f upstream.

The VM/VFS does not allow mapping->a_ops->invalidatepage() to fail.
Unfortunately, nfs_wb_page_cancel() may fail if a fatal signal occurs.
Since the NFS code assumes that the page stays mapped for as long as the
writeback is active, we can end up Oopsing (among other things).

The only safe fix here is to convert nfs_wait_on_request(), so as to make
it uninterruptible (as is already the case with wait_on_page_writeback()).

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoNFSv4: Ensure that the NFSv4 locking can recover from stateid errors
Trond Myklebust [Tue, 26 Jan 2010 20:42:21 +0000 (15:42 -0500)]
NFSv4: Ensure that the NFSv4 locking can recover from stateid errors

commit 2bee72a6aa1e6d0a4f5da56217f0d0bbbdd0d9a3 upstream.

In most cases, we just want to mark the lock_stateid sequence id as being
uninitialised.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14 years agoNFSv4: Don't allow posix locking against servers that don't support it
Trond Myklebust [Tue, 26 Jan 2010 20:42:30 +0000 (15:42 -0500)]
NFSv4: Don't allow posix locking against servers that don't support it

commit 8e469ebd6dc32cbaf620e134d79f740bf0ebab79 upstream.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>