safe/jmp/linux-2.6
14 years agomemcg: fix css_id() RCU locking for real
KAMEZAWA Hiroyuki [Tue, 11 May 2010 21:06:58 +0000 (14:06 -0700)]
memcg: fix css_id() RCU locking for real

Commit ad4ba375373937817404fd92239ef4cadbded23b ("memcg: css_id() must be
called under rcu_read_lock()") modifies memcontol.c for fixing RCU check
message.  But Andrew Morton pointed out that the fix doesn't seems sane
and it was just for hidining lockdep messages.

This is a patch for do proper things.  Checking again, all places,
accessing without rcu_read_lock, that commit fixies was intentional....
all callers of css_id() has reference count on it.  So, it's not necessary
to be under rcu_read_lock().

Considering again, we can use rcu_dereference_check for css_id().  We know
css->id is valid if css->refcnt > 0.  (css->id never changes and freed
after css->refcnt going to be 0.)

This patch makes use of rcu_dereference_check() in css_id/depth and remove
unnecessary rcu-read-lock added by the commit.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agobsdacct: use del_timer_sync() in acct_exit_ns()
Vitaliy Gusev [Tue, 11 May 2010 21:06:56 +0000 (14:06 -0700)]
bsdacct: use del_timer_sync() in acct_exit_ns()

acct_exit_ns --> acct_file_reopen deletes timer without check timer
execution on other CPUs.  So acct_timeout() can change an unmapped memory.

Signed-off-by: Vitaliy Gusev <vgusev@openvz.org>
Cc: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agormap: remove anon_vma check in page_address_in_vma()
Naoya Horiguchi [Tue, 11 May 2010 21:06:55 +0000 (14:06 -0700)]
rmap: remove anon_vma check in page_address_in_vma()

Currently page_address_in_vma() compares vma->anon_vma and
page_anon_vma(page) for parameter check, but in 2.6.34 a vma can have
multiple anon_vmas with anon_vma_chain, so current check does not work.
(For anonymous page shared by multiple processes, some verified (page,vma)
pairs return -EFAULT wrongly.)

We can go to checking all anon_vmas in the "same_vma" chain, but it needs
to meet lock requirement.  Instead, we can remove anon_vma check safely
because page_address_in_vma() assumes that page and vma are already
checked to belong to the identical process.

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agohugetlbfs: kill applications that use MAP_NORESERVE with SIGBUS instead of OOM-killer
Mel Gorman [Tue, 11 May 2010 21:06:53 +0000 (14:06 -0700)]
hugetlbfs: kill applications that use MAP_NORESERVE with SIGBUS instead of OOM-killer

Ordinarily, application using hugetlbfs will create mappings with
reserves.  For shared mappings, these pages are reserved before mmap()
returns success and for private mappings, the caller process is guaranteed
and a child process that cannot get the pages gets killed with sigbus.

An application that uses MAP_NORESERVE gets no reservations and mmap()
will always succeed at the risk the page will not be available at fault
time.  This might be used for example on very large sparse mappings where
the developer is confident the necessary huge pages exist to satisfy all
faults even though the whole mapping cannot be backed by huge pages.
Unfortunately, if an allocation does fail, VM_FAULT_OOM is returned to the
fault handler which proceeds to trigger the OOM-killer.  This is
unhelpful.

Even without hugetlbfs mounted, a user using mmap() can trivially trigger
the OOM-killer because VM_FAULT_OOM is returned (will provide example
program if desired - it's a whopping 24 lines long).  It could be
considered a DOS available to an unprivileged user.

This patch alters hugetlbfs to kill a process that uses MAP_NORESERVE
where huge pages were not available with SIGBUS instead of triggering the
OOM killer.

This change affects hugetlb_cow() as well.  I feel there is a failure case
in there, but I didn't create one.  It would need a fairly specific target
in terms of the faulting application and the hugepage pool size.  The
hugetlb_no_page() path is much easier to hit but both might as well be
closed.

Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agokexec: fix OOPS in crash_kernel_shrink
Vitaly Mayatskikh [Tue, 11 May 2010 21:06:51 +0000 (14:06 -0700)]
kexec: fix OOPS in crash_kernel_shrink

Two "echo 0 > /sys/kernel/kexec_crash_size" OOPSes kernel.  Also content
of this file is invalid after first shrink to zero: it shows 1 instead of
0.

This scenario is unlikely to happen often (root privs, valid crashkernel=
in cmdline, dump-capture kernel not loaded), I hit it only by chance.

This patch fixes it.

Signed-off-by: Vitaly Mayatskikh <v.mayatskih@gmail.com>
Cc: Cong Wang <amwang@redhat.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agommc: atmel-mci: fix in debugfs: response value printing
Nicolas Ferre [Tue, 11 May 2010 21:06:50 +0000 (14:06 -0700)]
mmc: atmel-mci: fix in debugfs: response value printing

In debugfs, printing of command response reports resp[2] twice: fix it to
resp[3].

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agommc: atmel-mci: remove data error interrupt after xfer
Nicolas Ferre [Tue, 11 May 2010 21:06:50 +0000 (14:06 -0700)]
mmc: atmel-mci: remove data error interrupt after xfer

Disable data error interrupts while we are actually recording that there
is not such errors.  This will prevent, in some cases, the warning message
printed at new request queuing (in atmci_start_request()).

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: <linux-mmc@vger.kernel.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agommc: atmel-mci: prevent kernel oops while removing card
Nicolas Ferre [Tue, 11 May 2010 21:06:49 +0000 (14:06 -0700)]
mmc: atmel-mci: prevent kernel oops while removing card

The removing of an SD card in certain circumstances can lead to a kernel
oops if we do not make sure that the "data" field of the host structure is
valid.  This patch adds a test in atmci_dma_cleanup() function and also
calls atmci_stop_dma() before throwing away the reference to data.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: <linux-mmc@vger.kernel.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agommc: atmel-mci: fix two parameters swapped
Nicolas Ferre [Tue, 11 May 2010 21:06:48 +0000 (14:06 -0700)]
mmc: atmel-mci: fix two parameters swapped

Two parameters were swapped in the calls to atmci_init_slot().

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Reported-by: Anders Grahn <anders.grahn@hd-wireless.se>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: <linux-mmc@vger.kernel.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agorevert "procfs: provide stack information for threads" and its fixup commits
Robin Holt [Tue, 11 May 2010 21:06:46 +0000 (14:06 -0700)]
revert "procfs: provide stack information for threads" and its fixup commits

Originally, commit d899bf7b ("procfs: provide stack information for
threads") attempted to introduce a new feature for showing where the
threadstack was located and how many pages are being utilized by the
stack.

Commit c44972f1 ("procfs: disable per-task stack usage on NOMMU") was
applied to fix the NO_MMU case.

Commit 89240ba0 ("x86, fs: Fix x86 procfs stack information for threads on
64-bit") was applied to fix a bug in ia32 executables being loaded.

Commit 9ebd4eba7 ("procfs: fix /proc/<pid>/stat stack pointer for kernel
threads") was applied to fix a bug which had kernel threads printing a
userland stack address.

Commit 1306d603f ('proc: partially revert "procfs: provide stack
information for threads"') was then applied to revert the stack pages
being used to solve a significant performance regression.

This patch nearly undoes the effect of all these patches.

The reason for reverting these is it provides an unusable value in
field 28.  For x86_64, a fork will result in the task->stack_start
value being updated to the current user top of stack and not the stack
start address.  This unpredictability of the stack_start value makes
it worthless.  That includes the intended use of showing how much stack
space a thread has.

Other architectures will get different values.  As an example, ia64
gets 0.  The do_fork() and copy_process() functions appear to treat the
stack_start and stack_size parameters as architecture specific.

I only partially reverted c44972f1 ("procfs: disable per-task stack usage
on NOMMU") .  If I had completely reverted it, I would have had to change
mm/Makefile only build pagewalk.o when CONFIG_PROC_PAGE_MONITOR is
configured.  Since I could not test the builds without significant effort,
I decided to not change mm/Makefile.

I only partially reverted 89240ba0 ("x86, fs: Fix x86 procfs stack
information for threads on 64-bit") .  I left the KSTK_ESP() change in
place as that seemed worthwhile.

Signed-off-by: Robin Holt <holt@sgi.com>
Cc: Stefani Seibold <stefani@seibold.net>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoit8761e_gpio: fix bug in gpio numbering
Denis Turischev [Tue, 11 May 2010 21:06:44 +0000 (14:06 -0700)]
it8761e_gpio: fix bug in gpio numbering

The SIO chip contains 16 possible gpio lines, not 14.  The schematic was
not read carefully.

Signed-off-by: Denis Turischev <denis@compulab.co.il>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agodma-mapping: fix dma_sync_single_range_*
FUJITA Tomonori [Tue, 11 May 2010 21:06:43 +0000 (14:06 -0700)]
dma-mapping: fix dma_sync_single_range_*

dma_sync_single_range_for_cpu() and dma_sync_single_range_for_device() use
a wrong address with a partial synchronization.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agowimax/i2400m: driver defaults to firmware v1.5 for i6x60 devices
Inaky Perez-Gonzalez [Mon, 12 Oct 2009 03:45:40 +0000 (12:45 +0900)]
wimax/i2400m: driver defaults to firmware v1.5 for i6x60 devices

Firmware is available in the linux-firmware package.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agowimax/i2400m: driver defaults to firmware v1.5 for i5x50 devices
Inaky Perez-Gonzalez [Sat, 3 Oct 2009 07:55:11 +0000 (16:55 +0900)]
wimax/i2400m: driver defaults to firmware v1.5 for i5x50 devices

Updates the i2400m driver to default to firmware versions v1.5 for the
Intel Wireless WiMAX Connection 5150 and 5350 devices.

Firmware available in linux-firmware.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agowimax/i2400m: Move module params to other file so they can be static
Prasanna S Panchamukhi [Wed, 18 Nov 2009 02:29:35 +0000 (18:29 -0800)]
wimax/i2400m: Move module params to other file so they can be static

This patch moves the module parameters to the file where they
can be avoided to be global and allow them to be static.

The module param : idle_mode_disabled and power_save_disabled
are moved from  driver.c to control.c. Also these module parameters
are declared to be static as they are not required to be global anymore.
The module param : rx_reorder_disabled is moved from driver.c file to
rx.c file. Also this parameter is declated as static as it is not
required to be global anymore.

Signed-off-by: Prasanna S Panchamukhi<prasannax.s.panchamukhi@intel.com>
14 years agowimax: wimax_msg_alloc() returns ERR_PTR not null
Dan Carpenter [Thu, 22 Apr 2010 09:46:32 +0000 (11:46 +0200)]
wimax: wimax_msg_alloc() returns ERR_PTR not null

wimax_msg_alloc() returns an ERR_PTR and not null.  I changed it to test
for ERR_PTR instead of null.  I also added a check in front of the
kfree() because kfree() can handle null but not ERR_PTR.

Signed-off-by: Dan Carpenter <error27@gmail.com>
14 years agowimax: checking ERR_PTR vs null
Dan Carpenter [Thu, 22 Apr 2010 09:50:10 +0000 (02:50 -0700)]
wimax: checking ERR_PTR vs null

stch_skb is allocated with wimax_gnl_re_state_change_alloc().  That
function returns ERR_PTRs on failure and doesn't return NULL.

Signed-off-by: Dan Carpenter <error27@gmail.com>
14 years agowimax/i2400m: USB specific TX queue's minimum buffer room required for new message
Prasanna S. Panchamukhi [Tue, 13 Apr 2010 23:36:33 +0000 (16:36 -0700)]
wimax/i2400m: USB specific TX queue's minimum buffer room required for new message

This patch specifies the TX queue's buffer room required by the
USB bus driver while allocating header space for a new message.
Please refer the documentation in the code.

Signed-off-by: Prasanna S. Panchamukhi <prasannax.s.panchamukhi@intel.com>
14 years agowimax/i2400m: SDIO specific TX queue's minimum buffer room for new message
Prasanna S. Panchamukhi [Tue, 13 Apr 2010 23:36:26 +0000 (16:36 -0700)]
wimax/i2400m: SDIO specific TX queue's minimum buffer room for new message

This patch specifies the TX queue's minimum buffer room required to
accommodate one smallest SDIO payload.
Please refer the documentation in the code.

Signed-off-by: Prasanna S. Panchamukhi <prasannax.s.panchamukhi@intel.com>
14 years agowimax/i2400m: reserve additional space in the TX queue's buffer while allocating...
Prasanna S. Panchamukhi [Tue, 13 Apr 2010 23:36:19 +0000 (16:36 -0700)]
wimax/i2400m: reserve additional space in the TX queue's buffer while allocating space for a new message header

Increase the possibilities of including at least one payload by reserving
some additional space in the TX queue while allocating TX queue's space
for new message header. Please refer the documentation in the code for details.

Signed-off-by: Prasanna S. Panchamukhi <prasannax.s.panchamukhi@intel.com>
14 years agowimax/i2400m: fix incorrect handling of type 2 and 3 RX messages
Prasanna S. Panchamukhi [Tue, 13 Apr 2010 23:36:10 +0000 (16:36 -0700)]
wimax/i2400m: fix incorrect handling of type 2 and 3 RX messages

According to Intel Wimax i3200, i5x50 and i6x60 device specification documents,
the host driver must not reset the device if the normalized sequence numbers
are greater than 1023 for type 2 and type 3 RX messages.
This patch removes the code that incorrectly used to reset the device.

Signed-off-by: Prasanna S. Panchamukhi <prasannax.s.panchamukhi@intel.com>
14 years agowimax i2400m: fix race condition while accessing rx_roq by using kref count
Prasanna S. Panchamukhi [Tue, 13 Apr 2010 23:35:58 +0000 (16:35 -0700)]
wimax i2400m: fix race condition while accessing rx_roq by using kref count

This patch fixes the race condition when one thread tries to destroy
the memory allocated for rx_roq, while another thread still happen
to access rx_roq.
Such a race condition occurs when i2400m-sdio kernel module gets
unloaded, destroying the memory allocated for rx_roq while rx_roq
is accessed by i2400m_rx_edata(), as explained below:
$thread1                                $thread2
$ void i2400m_rx_edata()                $
$Access rx_roq[]                        $
$roq = &i2400m->rx_roq[ro_cin]          $
$ i2400m_roq_[reset/queue/update_ws]    $
$                                       $ void i2400m_rx_release();
$                                       $kfree(rx->roq);
$                                       $rx->roq = NULL;
$Oops! rx_roq is NULL

This patch fixes the race condition using refcount approach.

Signed-off-by: Prasanna S. Panchamukhi <prasannax.s.panchamukhi@intel.com>
14 years agowimax/i2400m: increase tx queue length from 5 to 20 [v1]
Prasanna S. Panchamukhi [Thu, 8 Apr 2010 23:24:32 +0000 (16:24 -0700)]
wimax/i2400m: increase tx queue length from 5 to 20 [v1]

This patch increases the tx_queue_len to 20 so as to
minimize the jitter in the throughput.

Signed-off-by: Prasanna S. Panchamukhi <prasannax.s.panchamukhi@intel.com>
14 years agowimax/i2400m: fix system freeze caused by an infinite loop [v1]
Prasanna S. Panchamukhi [Thu, 8 Apr 2010 23:24:31 +0000 (16:24 -0700)]
wimax/i2400m: fix system freeze caused by an infinite loop [v1]

This patch fixes an infinite loop caused by i2400m_tx_fifo_push() due
to a corner case where there is no tail space in the TX FIFO.
Please refer the documentation in the code for details.

Signed-off-by: Prasanna S. Panchamukhi <prasannax.s.panchamukhi@intel.com>
14 years agowimax/i2400m: modify i2400m_tx_fifo_push() to check for head room space in the TX...
Prasanna S. Panchamukhi [Thu, 8 Apr 2010 23:24:30 +0000 (16:24 -0700)]
wimax/i2400m: modify i2400m_tx_fifo_push() to check for head room space in the TX FIFO [v1]

This fixes i2400m_tx_fifo_push(); the check for having enough
space in the TX FIFO's tail was obscure and broken in certain
corner cases. The new check works in all cases and is way
clearer. Please refer the documentation in the code for details.

Signed-off-by: Prasanna S. Panchamukhi <prasannax.s.panchamukhi@intel.com>
14 years agowimax/i2400m: fix BUILD_BUG_ON() to use the maximum message size constant [v1]
Prasanna S. Panchamukhi [Thu, 8 Apr 2010 23:24:29 +0000 (16:24 -0700)]
wimax/i2400m: fix BUILD_BUG_ON() to use the maximum message size constant [v1]

The older method of computing the maximum PDU size relied
on a method that doesn't work when we prop the maximum
number of payloads up to the physical limit, and thus we kill
the whole computation and just verify that the constants are
congruent.

Signed-off-by: Prasanna S. Panchamukhi <prasannax.s.panchamukhi@intel.com>
14 years agowimax/i2400m: limit the message size upto 16KiB [v1]
Prasanna S. Panchamukhi [Thu, 8 Apr 2010 23:24:28 +0000 (16:24 -0700)]
wimax/i2400m: limit the message size upto 16KiB [v1]

According to Intel Wimax i3200, i5x50 and i6x50 specification
documents, the maximum size of each TX message can be upto 16KiB.
This patch modifies the i2400m_tx() routine to check that the
message size does not exceed the 16KiB limit.
Please refer the documentation in the code for details.

Signed-off-by: Prasanna S. Panchamukhi <prasannax.s.panchamukhi@intel.com>
14 years agowimax/i2400m: increase the maximum number of payloads per message to 60 [v1]
Prasanna S. Panchamukhi [Thu, 8 Apr 2010 23:24:27 +0000 (16:24 -0700)]
wimax/i2400m: increase the maximum number of payloads per message to 60 [v1]

According to Intel Wimax i3200, i5x50 and i6x50 device specification
documents, the maximum number of payloads per message can be up to 60.

Increasing the number of payloads to 60 per message helps to
accommodate smaller payloads in a single transaction. This patch
increases the maximum number of payloads from 12 to 60 per message.

Signed-off-by: Prasanna S. Panchamukhi <prasannax.s.panchamukhi@intel.com>
14 years agowimax/i2400m: Reset the TX FIFO indices when allocating the TX FIFO in tx_setup()
Cindy H Kao [Sat, 24 Apr 2010 00:19:06 +0000 (17:19 -0700)]
wimax/i2400m: Reset the TX FIFO indices when allocating the TX FIFO in tx_setup()

This patch makes sure whenever tx_setup() is invoked during driver
initialization or device reset where TX FIFO is released and re-allocated,
the indices tx_in, tx_out, tx_msg_size, tx_sequence, tx_msg are properly
initialized.

When a device reset happens and the TX FIFO is released/re-allocated,
a new block of memory may be allocated for the TX FIFO, therefore tx_msg
should be cleared so that no any TX threads (tx_worker, tx) would access
to the out-of-date addresses.

Also, the TX threads use tx_in and tx_out to decide where to put the new
host-to-device messages and from where to copy them to the device HW FIFO,
these indices have to be cleared so after the TX FIFO is re-allocated during
the reset, the indices both refer to the head of the FIFO, ie. a new start.
The same rational applies to tx_msg_size and tx_sequence.

To protect the indices from being accessed by multiple threads simultaneously,
the lock tx_lock has to be obtained before the initializations and released
afterwards.

Signed-off-by: Cindy H Kao <cindy.h.kao@intel.com>
14 years agowimax/i2400m: Correct the error path handlers order in i2400m_post_reset()
Cindy H Kao [Thu, 8 Apr 2010 23:03:12 +0000 (16:03 -0700)]
wimax/i2400m: Correct the error path handlers order in i2400m_post_reset()

When bus_setup fails in i2400m_post_reset(), it falls to the error path handler
"error_bus_setup:" which includes unlock the mutext. However, we didn't ever
try to the obtain the lock when running bus_setup.

The patch is to fix the misplaced error path handler "error_bus_setup:".

Signed-off-by: Cindy H Kao <cindy.h.kao@intel.com>
14 years agowimax/i2400m: add the error recovery mechanism on TX path
Cindy H Kao [Thu, 8 Apr 2010 03:07:47 +0000 (20:07 -0700)]
wimax/i2400m: add the error recovery mechanism on TX path

This patch adds an error recovery mechanism on TX path.
The intention is to bring back the device to some known state
whenever TX sees -110 (-ETIMEOUT) on copying the data to the HW FIFO.

The TX failure could mean a device bus stuck or function stuck, so
the current error recovery implementation is to trigger a bus reset
and expect this can bring back the device.

Since the TX work is done in a thread context, there may be a queue of TX works
already that all hit the -ETIMEOUT error condition because the device has
somewhat stuck already. We don't want any consecutive bus resets simply because
multiple TX works in the queue all hit the same device erratum, the flag
"error_recovery" is introduced to denote if we are ready for taking any
error recovery. See @error_recovery doc in i2400m.h.

Signed-off-by: Cindy H Kao <cindy.h.kao@intel.com>
14 years agowimax/i2400m: fix for missed reset events if triggered by dev_reset_handle()
Cindy H Kao [Thu, 8 Apr 2010 02:42:42 +0000 (19:42 -0700)]
wimax/i2400m: fix for missed reset events if triggered by dev_reset_handle()

The problem is only seen on SDIO interface since on USB, a bus reset would
really re-probe the driver, but on SDIO interface, a bus reset will not
re-enumerate the SDIO bus, so no driver re-probe is happening. Therefore,
on SDIO interface, the reset event should be still detected and handled by
dev_reset_handle().

Problem description:
Whenever a reboot barker is received during operational mode (i2400m->boot_mode == 0),
dev_reset_handle() is invoked to handle that function reset event.
dev_reset_handle() then sets the flag i2400m->boot_mode to 1 indicating the device is
back to bootmode before proceeding to dev_stop() and dev_start().
If dev_start() returns failure, a bus reset is triggered by dev_reset_handle().

The flag i2400m->boot_mode then remains 1 when the second reboot barker arrives.
However the interrupt service routine i2400ms_rx() instead of invoking dev_reset_handle()
to handle that reset event, it filters out that boot event to bootmode because it sees
the flag i2400m->boot_mode equal to 1.

The fix:
Maintain the flag i2400m->boot_mode within dev_reset_handle() and set the flag
i2400m->boot_mode to 1 when entering dev_reset_handle(). It remains 1
until the dev_reset_handle() issues a bus reset. ie: the bus reset is
taking place just like it happens for the first time during operational mode.

To denote the actual device state and the state we expect, a flag i2400m->alive
is introduced in addition to the existing flag i2400m->updown.
It's maintained with the same way for i2400m->updown but instead of reflecting
the actual state like i2400m->updown does, i2400m->alive maintains the state
we expect. i2400m->alive is set 1 just like whenever i2400m->updown is set 1.
Yet i2400m->alive remains 1 since we expect the device to be up all the time
until the driver is removed. See the doc for @alive in i2400m.h.

An enumeration I2400M_BUS_RESET_RETRIES is added to define the maximum number of
bus resets that a device reboot can retry.

A counter i2400m->bus_reset_retries is added to track how many bus resets
have been retried in one device reboot. If I2400M_BUS_RESET_RETRIES bus resets
were retried in this boot, we give up any further retrying so the device would enter
low power state. The counter i2400m->bus_reset_retries is incremented whenever
dev_reset_handle() is issuing a bus reset and is cleared to 0 when dev_start() is
successfully done, ie: a successful reboot.

Signed-off-by: Cindy H Kao <cindy.h.kao@intel.com>
14 years agowimax/i2400m: correct the error path handlers in dev_start()
Cindy H Kao [Wed, 31 Mar 2010 02:19:37 +0000 (19:19 -0700)]
wimax/i2400m: correct the error path handlers in dev_start()

This fix is to correct order of the handlers in the error path
of dev_start(). When i2400m_firmware_check fails, all the works done
before it should be released or cleared.

Signed-off-by: Cindy H Kao <cindy.h.kao@intel.com>
14 years agowimax/i2400m: fix the race condition for accessing TX queue
Cindy H Kao [Sat, 30 Jan 2010 09:26:54 +0000 (01:26 -0800)]
wimax/i2400m: fix the race condition for accessing TX queue

The race condition happens when the TX queue is accessed by
the TX work while the same TX queue is being destroyed because
a bus reset is triggered either by debugfs entry or simply
by failing waking up the device from WiMAX IDLE mode.

This fix is to prevent the TX queue from being accessed by
multiple threads

Signed-off-by: Cindy H Kao <cindy.h.kao@intel.com>
14 years agowimax/i2400m: fix insufficient size of Tx buffer for 12 payload of 1400 MTU.
Prasanna S. Panchamukhi [Wed, 27 Jan 2010 02:44:45 +0000 (19:44 -0700)]
wimax/i2400m: fix insufficient size of Tx buffer for 12 payload of 1400 MTU.

This patch increases the Tx buffer size so as to accommodate 12 payloads
of 1408 (1400 MTU 16 bytes aligned). Currently Tx buffer is 32 KiB which
is insufficient to accommodate 12 payloads of 1408 size.
This patch
 - increases I2400M_TX_BUF_SIZE from 32KiB to 64KiB
 - Adds a BUILD_BUG_ON if the calculated buffer size based
   on the given MTU exceeds the I2400M_TX_BUF_SIZE.

Below is how we calculate the size of the Tx buffer.
Payload + 4 bytes prefix for each payload (1400 MTU 16 bytes boundary aligned)
= (1408 + sizeof(struct i2400m_pl_data_hdr)) * I2400M_TX_PLD_MAX
Adding 16 byte message header = + sizeof(struct i2400m_msg_hdr)
Aligning to 256 byte boundary
Total Tx buffer = (((((1408 + sizeof(struct i2400m_pl_data_hdr))
* I2400M_TX_PLD_MAX )+ sizeof(struct i2400m_msg_hdr))
/ 256) + 1) * 256 * 2

Signed-off-by: Prasanna S. Panchamukhi <prasannax.s.panchamukhi@intel.com>
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agowimax/i2400m: move I2400M_MAX_MTU enum from netdev.c to i2400m.h
Prasanna S. Panchamukhi [Wed, 27 Jan 2010 02:44:44 +0000 (19:44 -0700)]
wimax/i2400m: move I2400M_MAX_MTU enum from netdev.c to i2400m.h

This patch moves I2400M_MAX_MTU enum defined in netdev.c to i2400m.h.
Follow up changes will make use of this value in other location,
thus requiring it to be moved to a global header file i2400m.h.

Signed-off-by: Prasanna S. Panchamukhi <prasannax.s.panchamukhi@intel.com>
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
14 years agowimax/i2400m: fix incorrect return -ESHUTDOWN when there is no Tx buffer available
Prasanna S.Panchamukhi [Mon, 18 Jan 2010 22:28:23 +0000 (14:28 -0800)]
wimax/i2400m: fix incorrect return -ESHUTDOWN when there is no Tx buffer available

i2400m_tx() routine was returning -ESHUTDOWN even when there was no Tx buffer
available. This patch fixes the i2400m_tx() to return -ESHUTDOWN only when
the device is down(i2400m->tx_buf is NULL) and also to return -ENOSPC
when there is no Tx buffer. Error seen in the kernel log.
kernel: i2400m_sdio mmc0:0001:1: can't send message 0x5606: -108
kernel: i2400m_sdio mmc0:0001:1: Failed to issue 'Enter power save'command: -108

Signed-off-by: Prasanna S.Panchamukhi <prasannax.s.panchamukhi@intel.com>
14 years agoar9170: fix for driver-core ABI change
Stephen Rothwell [Wed, 3 Mar 2010 06:08:11 +0000 (17:08 +1100)]
ar9170: fix for driver-core ABI change

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
John W. Linville [Tue, 11 May 2010 18:24:55 +0000 (14:24 -0400)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless-next-2.6 into for-davem

Conflicts:
drivers/net/wireless/ath/ar9170/main.c

14 years agoMerge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
Linus Torvalds [Tue, 11 May 2010 17:12:18 +0000 (10:12 -0700)]
Merge branch 'drm-linus' of git://git./linux/kernel/git/airlied/drm-2.6

* 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
  drm/radeon: Fix 3 regressions - since buffer rework

14 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Linus Torvalds [Tue, 11 May 2010 17:11:40 +0000 (10:11 -0700)]
Merge git://git./linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
  net: Fix FDDI and TR config checks in ipv4 arp and LLC.
  IPv4: unresolved multicast route cleanup
  mac80211: remove association work when processing deauth request
  ar9170: wait for asynchronous firmware loading
  ipv4: udp: fix short packet and bad checksum logging
  phy: Fix initialization in micrel driver.
  sctp: Fix a race between ICMP protocol unreachable and connect()
  veth: Dont kfree_skb() after dev_forward_skb()
  IPv6: fix IPV6_RECVERR handling of locally-generated errors
  net/gianfar: drop recycled skbs on MTU change
  iwlwifi: work around passive scan issue

14 years agoCacheFiles: Fix occasional EIO on call to vfs_unlink()
David Howells [Tue, 11 May 2010 15:51:39 +0000 (16:51 +0100)]
CacheFiles: Fix occasional EIO on call to vfs_unlink()

Fix an occasional EIO returned by a call to vfs_unlink():

[ 4868.465413] CacheFiles: I/O Error: Unlink failed
[ 4868.465444] FS-Cache: Cache cachefiles stopped due to I/O error
[ 4947.320011] CacheFiles: File cache on md3 unregistering
[ 4947.320041] FS-Cache: Withdrawing cache "mycache"
[ 5127.348683] FS-Cache: Cache "mycache" added (type cachefiles)
[ 5127.348716] CacheFiles: File cache on md3 registered
[ 7076.871081] CacheFiles: I/O Error: Unlink failed
[ 7076.871130] FS-Cache: Cache cachefiles stopped due to I/O error
[ 7116.780891] CacheFiles: File cache on md3 unregistering
[ 7116.780937] FS-Cache: Withdrawing cache "mycache"
[ 7296.813394] FS-Cache: Cache "mycache" added (type cachefiles)
[ 7296.813432] CacheFiles: File cache on md3 registered

What happens is this:

 (1) A cached NFS file is seen to have become out of date, so NFS retires the
     object and immediately acquires a new object with the same key.

 (2) Retirement of the old object is done asynchronously - so the lookup/create
     to generate the new object may be done first.

     This can be a problem as the old object and the new object must exist at
     the same point in the backing filesystem (i.e. they must have the same
     pathname).

 (3) The lookup for the new object sees that a backing file already exists,
     checks to see whether it is valid and sees that it isn't.  It then deletes
     that file and creates a new one on disk.

 (4) The retirement phase for the old file is then performed.  It tries to
     delete the dentry it has, but ext4_unlink() returns -EIO because the inode
     attached to that dentry no longer matches the inode number associated with
     the filename in the parent directory.

The trace below shows this quite well.

[md5sum] ==> __fscache_relinquish_cookie(ffff88002d12fb58{NFS.fh,ffff88002ce62100},1)
[md5sum] ==> __fscache_acquire_cookie({NFS.server},{NFS.fh},ffff88002ce62100)

NFS has retired the old cookie and asked for a new one.

[kslowd] ==> fscache_object_state_machine({OBJ52,OBJECT_ACTIVE,24})
[kslowd] <== fscache_object_state_machine() [->OBJECT_DYING]
[kslowd] ==> fscache_object_state_machine({OBJ53,OBJECT_INIT,0})
[kslowd] <== fscache_object_state_machine() [->OBJECT_LOOKING_UP]
[kslowd] ==> fscache_object_state_machine({OBJ52,OBJECT_DYING,24})
[kslowd] <== fscache_object_state_machine() [->OBJECT_RECYCLING]

The old object (OBJ52) is going through the terminal states to get rid of it,
whilst the new object - (OBJ53) - is coming into being.

[kslowd] ==> fscache_object_state_machine({OBJ53,OBJECT_LOOKING_UP,0})
[kslowd] ==> cachefiles_walk_to_object({ffff88003029d8b8},OBJ53,@68,)
[kslowd] lookup '@68'
[kslowd] next -> ffff88002ce41bd0 positive
[kslowd] advance
[kslowd] lookup 'Es0g00og0_Nd_XCYe3BOzvXrsBLMlN6aw16M1htaA'
[kslowd] next -> ffff8800369faac8 positive

The new object has looked up the subdir in which the file would be in (getting
dentry ffff88002ce41bd0) and then looked up the file itself (getting dentry
ffff8800369faac8).

[kslowd] validate 'Es0g00og0_Nd_XCYe3BOzvXrsBLMlN6aw16M1htaA'
[kslowd] ==> cachefiles_bury_object(,'@68','Es0g00og0_Nd_XCYe3BOzvXrsBLMlN6aw16M1htaA')
[kslowd] remove ffff8800369faac8 from ffff88002ce41bd0
[kslowd] unlink stale object
[kslowd] <== cachefiles_bury_object() = 0

It then checks the file's xattrs to see if it's valid.  NFS says that the
auxiliary data indicate the file is out of date (obvious to us - that's why NFS
ditched the old version and got a new one).  CacheFiles then deletes the old
file (dentry ffff8800369faac8).

[kslowd] redo lookup
[kslowd] lookup 'Es0g00og0_Nd_XCYe3BOzvXrsBLMlN6aw16M1htaA'
[kslowd] next -> ffff88002cd94288 negative
[kslowd] create -> ffff88002cd94288{ffff88002cdaf238{ino=148247}}

CacheFiles then redoes the lookup and gets a negative result in a new dentry
(ffff88002cd94288) which it then creates a file for.

[kslowd] ==> cachefiles_mark_object_active(,OBJ53)
[kslowd] <== cachefiles_mark_object_active() = 0
[kslowd] === OBTAINED_OBJECT ===
[kslowd] <== cachefiles_walk_to_object() = 0 [148247]
[kslowd] <== fscache_object_state_machine() [->OBJECT_AVAILABLE]

The new object is then marked active and the state machine moves to the
available state - at which point NFS can start filling the object.

[kslowd] ==> fscache_object_state_machine({OBJ52,OBJECT_RECYCLING,20})
[kslowd] ==> fscache_release_object()
[kslowd] ==> cachefiles_drop_object({OBJ52,2})
[kslowd] ==> cachefiles_delete_object(,OBJ52{ffff8800369faac8})

The old object, meanwhile, goes on with being retired.  If allocation occurs
first, cachefiles_delete_object() has to wait for dir->d_inode->i_mutex to
become available before it can continue.

[kslowd] ==> cachefiles_bury_object(,'@68','Es0g00og0_Nd_XCYe3BOzvXrsBLMlN6aw16M1htaA')
[kslowd] remove ffff8800369faac8 from ffff88002ce41bd0
[kslowd] unlink stale object
EXT4-fs warning (device sda6): ext4_unlink: Inode number mismatch in unlink (148247!=148193)
CacheFiles: I/O Error: Unlink failed
FS-Cache: Cache cachefiles stopped due to I/O error

CacheFiles then tries to delete the file for the old object, but the dentry it
has (ffff8800369faac8) no longer points to a valid inode for that directory
entry, and so ext4_unlink() returns -EIO when de->inode does not match i_ino.

[kslowd] <== cachefiles_bury_object() = -5
[kslowd] <== cachefiles_delete_object() = -5
[kslowd] <== fscache_object_state_machine() [->OBJECT_DEAD]
[kslowd] ==> fscache_object_state_machine({OBJ53,OBJECT_AVAILABLE,0})
[kslowd] <== fscache_object_state_machine() [->OBJECT_ACTIVE]

(Note that the above trace includes extra information beyond that produced by
the upstream code).

The fix is to note when an object that is being retired has had its object
deleted preemptively by a replacement object that is being created, and to
skip the second removal attempt in such a case.

Reported-by: Greg M <gregm@servu.net.au>
Reported-by: Mark Moseley <moseleymark@gmail.com>
Reported-by: Romain DEGEZ <romain.degez@smartjog.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoACPI: sleep: eliminate duplicate entries in acpisleep_dmi_table[]
Alex Chiang [Tue, 11 May 2010 16:21:38 +0000 (10:21 -0600)]
ACPI: sleep: eliminate duplicate entries in acpisleep_dmi_table[]

Duplicate entries ended up acpisleep_dmi_table[] by accident.
They don't hurt functionality, but they are ugly, so let's get
rid of them.

Cc: stable@kernel.org
Signed-off-by: Alex Chiang <achiang@canonical.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoMerge branch 'master' of git://dev.medozas.de/linux
Patrick McHardy [Tue, 11 May 2010 16:59:21 +0000 (18:59 +0200)]
Merge branch 'master' of git://dev.medozas.de/linux

14 years agonetfilter: xtables: combine built-in extension structs
Jan Engelhardt [Sat, 4 Jul 2009 10:50:00 +0000 (12:50 +0200)]
netfilter: xtables: combine built-in extension structs

Prepare the arrays for use with the multiregister function. The
future layer-3 xt matches can then be easily added to it without
needing more (un)register code.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agonetfilter: xtables: change hotdrop pointer to direct modification
Jan Engelhardt [Tue, 7 Jul 2009 18:54:30 +0000 (20:54 +0200)]
netfilter: xtables: change hotdrop pointer to direct modification

Since xt_action_param is writable, let's use it. The pointer to
'bool hotdrop' always worried (8 bytes (64-bit) to write 1 byte!).
Surprisingly results in a reduction in size:

   text    data     bss filename
5457066  692730  357892 vmlinux.o-prev
5456554  692730  357892 vmlinux.o

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agonetfilter: xtables: deconstify struct xt_action_param for matches
Jan Engelhardt [Tue, 7 Jul 2009 18:42:08 +0000 (20:42 +0200)]
netfilter: xtables: deconstify struct xt_action_param for matches

In future, layer-3 matches will be an xt module of their own, and
need to set the fragoff and thoff fields. Adding more pointers would
needlessy increase memory requirements (esp. so for 64-bit, where
pointers are wider).

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agonetfilter: xtables: substitute temporary defines by final name
Jan Engelhardt [Sun, 5 Jul 2009 17:43:26 +0000 (19:43 +0200)]
netfilter: xtables: substitute temporary defines by final name

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agonetfilter: xtables: combine struct xt_match_param and xt_target_param
Jan Engelhardt [Sun, 5 Jul 2009 16:26:37 +0000 (18:26 +0200)]
netfilter: xtables: combine struct xt_match_param and xt_target_param

The structures carried - besides match/target - almost the same data.
It is possible to combine them, as extensions are evaluated serially,
and so, the callers end up a little smaller.

  text  data  bss  filename
-15318   740  104  net/ipv4/netfilter/ip_tables.o
+15286   740  104  net/ipv4/netfilter/ip_tables.o
-15333   540  152  net/ipv6/netfilter/ip6_tables.o
+15269   540  152  net/ipv6/netfilter/ip6_tables.o

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
14 years agoipv6: ip6mr: add support for dumping routing tables over netlink
Patrick McHardy [Tue, 11 May 2010 12:40:56 +0000 (14:40 +0200)]
ipv6: ip6mr: add support for dumping routing tables over netlink

The ip6mr /proc interface (ip6_mr_cache) can't be extended to dump routes
from any tables but the main table in a backwards compatible fashion since
the output format ends in a variable amount of output interfaces.

Introduce a new netlink interface to dump multicast routes from all tables,
similar to the netlink interface for regular routes.

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoipv6: ip6mr: support multiple tables
Patrick McHardy [Tue, 11 May 2010 12:40:55 +0000 (14:40 +0200)]
ipv6: ip6mr: support multiple tables

This patch adds support for multiple independant multicast routing instances,
named "tables".

Userspace multicast routing daemons can bind to a specific table instance by
issuing a setsockopt call using a new option MRT6_TABLE. The table number is
stored in the raw socket data and affects all following ip6mr setsockopt(),
getsockopt() and ioctl() calls. By default, a single table (RT6_TABLE_DFLT)
is created with a default routing rule pointing to it. Newly created pim6reg
devices have the table number appended ("pim6regX"), with the exception of
devices created in the default table, which are named just "pim6reg" for
compatibility reasons.

Packets are directed to a specific table instance using routing rules,
similar to how regular routing rules work. Currently iif, oif and mark
are supported as keys, source and destination addresses could be supported
additionally.

Example usage:

- bind pimd/xorp/... to a specific table:

uint32_t table = 123;
setsockopt(fd, SOL_IPV6, MRT6_TABLE, &table, sizeof(table));

- create routing rules directing packets to the new table:

# ip -6 mrule add iif eth0 lookup 123
# ip -6 mrule add oif eth0 lookup 123

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoipv6: ip6mr: move mroute data into seperate structure
Patrick McHardy [Tue, 11 May 2010 12:40:53 +0000 (14:40 +0200)]
ipv6: ip6mr: move mroute data into seperate structure

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoipv6: ip6mr: convert struct mfc_cache to struct list_head
Patrick McHardy [Tue, 11 May 2010 12:40:51 +0000 (14:40 +0200)]
ipv6: ip6mr: convert struct mfc_cache to struct list_head

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoipv6: ip6mr: remove net pointer from struct mfc6_cache
Patrick McHardy [Tue, 11 May 2010 12:40:50 +0000 (14:40 +0200)]
ipv6: ip6mr: remove net pointer from struct mfc6_cache

Now that cache entries in unres_queue don't need to be distinguished by their
network namespace pointer anymore, we can remove it from struct mfc6_cache
add pass the namespace as function argument to the functions that need it.

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoipv6: ip6mr: move unres_queue and timer to per-namespace data
Patrick McHardy [Tue, 11 May 2010 12:40:48 +0000 (14:40 +0200)]
ipv6: ip6mr: move unres_queue and timer to per-namespace data

The unres_queue is currently shared between all namespaces. Following patches
will additionally allow to create multiple multicast routing tables in each
namespace. Having a single shared queue for all these users seems to excessive,
move the queue and the cleanup timer to the per-namespace data to unshare it.

As a side-effect, this fixes a bug in the seq file iteration functions: the
first entry returned is always from the current namespace, entries returned
after that may belong to any namespace.

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agohwmon: (applesmc) Correct sysfs fan error handling
Henrik Rydberg [Tue, 11 May 2010 07:17:47 +0000 (09:17 +0200)]
hwmon: (applesmc) Correct sysfs fan error handling

The current code will not remove the sysfs files for fan numbers three
and up. Also, upon exit, fans one and two are removed regardless of
their existence.  This patch cleans up the sysfs error handling for
the fans.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
14 years agohwmon: (asc7621) Bug fixes
Ken Milmore [Tue, 11 May 2010 07:17:46 +0000 (09:17 +0200)]
hwmon: (asc7621) Bug fixes

* Allow fan minimum RPM to be set to zero without triggering alarms.
* Fix voltage scaling arithmetic and correct scale factors.
* Correct fan1-fan4 alarm bit shifts.
* Correct register address for temp3_smoothing_enable.
* Read the alarm registers with high priority.

Signed-off-by: Ken Milmore <ken.milmore@googlemail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
14 years agokprobes/x86: Fix removed int3 checking order
Masami Hiramatsu [Tue, 27 Apr 2010 22:33:49 +0000 (18:33 -0400)]
kprobes/x86: Fix removed int3 checking order

Fix kprobe/x86 to check removed int3 when failing to get kprobe
from hlist. Since we have a time window between checking int3
exists on probed address and getting kprobe on that address,
we can have following scenario:

 -------
 CPU1                     CPU2
 hit int3
 check int3 exists
                          remove int3
                          remove kprobe from hlist
 get kprobe from hlist
 no kprobe->OOPS!
 -------

This patch moves int3 checking if there is no kprobe on that
address for fixing this problem as follows:

 ------
 CPU1                     CPU2
 hit int3
                          remove int3
                          remove kprobe from hlist
 get kprobe from hlist
 no kprobe->check int3 exists
          ->rollback&retry
 ------

Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: systemtap <systemtap@sources.redhat.com>
Cc: DLE <dle-develop@lists.sourceforge.net>
Cc: Dave Anderson <anderson@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20100427223348.2322.9112.stgit@localhost6.localdomain6>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
14 years agoperf: Fix static strings treated like dynamic ones
Frederic Weisbecker [Wed, 5 May 2010 20:07:39 +0000 (22:07 +0200)]
perf: Fix static strings treated like dynamic ones

The raw_field_ptr() helper, used to retrieve the address of a field
inside a trace event, treats every strings as if they were dynamic
ie: having a secondary level of indirection to retrieve their
contents.

FIELD_IS_STRING doesn't mean FIELD_IS_DYNAMIC, we only need to
compute the secondary dereference for the latter case.

This fixes perf sched segfaults, bad cmdline report and may be
some other bugs.

Reported-by: Jason Baron <jbaron@redhat.com>
Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
14 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6
David S. Miller [Tue, 11 May 2010 06:03:26 +0000 (23:03 -0700)]
Merge branch 'master' of git://git./linux/kernel/git/kaber/nf-next-2.6

14 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
David S. Miller [Tue, 11 May 2010 05:53:41 +0000 (22:53 -0700)]
Merge branch 'master' of git://git./linux/kernel/git/linville/wireless-2.6

14 years agodrm/radeon: Fix 3 regressions - since buffer rework
Jean Delvare [Tue, 11 May 2010 04:01:45 +0000 (14:01 +1000)]
drm/radeon: Fix 3 regressions - since buffer rework

Commit b4fe945405e477cded91772b4fec854705443dd5 introduced 3 bugs,
fix them:

* Use the right command dword for second packet offset in
  RADEON_CNTL_PAINT/BITBLT_MULTI.
* Don't leak memory if drm_buffer_copy_from_user() fails.
* Don't call drm_buffer_unprocessed() unless drm_buffer_alloc() and
  drm_buffer_copy_from_user() have been called successfully first.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Pauli Nieminen <suokkos@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
14 years agowireless: depends on NET
Randy Dunlap [Mon, 10 May 2010 16:24:29 +0000 (09:24 -0700)]
wireless: depends on NET

When CONFIG_NET is disabled, the attempt to build wext-priv.c
fails with:

net/wireless/wext-priv.c: In function 'ioctl_private_call':
net/wireless/wext-priv.c:207: error: implicit declaration of function 'call_commit_handler'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agowireless: rt2x00: rt2800usb: replace X by x
Xose Vazquez Perez [Mon, 10 May 2010 09:35:36 +0000 (11:35 +0200)]
wireless: rt2x00: rt2800usb: replace X by x

s/X/x

Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Clean up generic procedures on descriptor writing.
Gertjan van Wingerde [Sun, 9 May 2010 19:24:22 +0000 (21:24 +0200)]
rt2x00: Clean up generic procedures on descriptor writing.

With a little bit of restructuring it isn't necessary to have special
cases in rt2x00queue_write_tx_descriptor for writing the descriptor
for beacons.
Simply split off the kicking of the TX queue to a separate function
with is only called for non-beacons.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Fix beaconing on rt2800.
Gertjan van Wingerde [Sat, 8 May 2010 21:40:26 +0000 (23:40 +0200)]
rt2x00: Fix beaconing on rt2800.

According to the Ralink vendor driver for rt2800 we don't need a full
TXD for a beacon but just a TXWI in front of the actual beacon.
Fix the rt2800pci and rt2800usb beaconing code accordingly.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: provide beacon's txdesc to write_beacon callback function.
Gertjan van Wingerde [Sat, 8 May 2010 21:40:25 +0000 (23:40 +0200)]
rt2x00: provide beacon's txdesc to write_beacon callback function.

Preparation to fix rt2800 beaconing.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Clean up all driver's kick_tx_queue callback functions.
Gertjan van Wingerde [Sat, 8 May 2010 21:40:24 +0000 (23:40 +0200)]
rt2x00: Clean up all driver's kick_tx_queue callback functions.

All of the driver's kick_tx_queue callback functions treat the TX queue
for beacons in a special manner.
Clean this up by integrating the kicking of the beacon queue into the
write_beacon callback function, and let the generic code no longer call
the kick_tx_queue callback function when updating the beacon.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Factor out RXWI processing to common rt2800 code.
Gertjan van Wingerde [Sat, 8 May 2010 21:40:22 +0000 (23:40 +0200)]
rt2x00: Factor out RXWI processing to common rt2800 code.

RXWI processing is exactly the same for rt2800pci and rt2800usb, so
make it common code.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Factor out TXWI writing to common rt2800 code.
Gertjan van Wingerde [Sat, 8 May 2010 21:40:21 +0000 (23:40 +0200)]
rt2x00: Factor out TXWI writing to common rt2800 code.

TXWI writing is exactly the same for rt2800pci and rt2800usb, so
make it common code.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Don't check whether hardware crypto is enabled when reading RXD.
Gertjan van Wingerde [Sat, 8 May 2010 21:40:20 +0000 (23:40 +0200)]
rt2x00: Don't check whether hardware crypto is enabled when reading RXD.

We should simply follow what the hardware told us it has done.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Clean up rt2800usb.h.
Gertjan van Wingerde [Sat, 8 May 2010 21:40:19 +0000 (23:40 +0200)]
rt2x00: Clean up rt2800usb.h.

Remove unused RXD_DESC_SIZE define and remove duplicated RXWI definitions
from rt2800.h.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agort2x00: Fix setting of txdesc->length field.
Gertjan van Wingerde [Sat, 8 May 2010 21:40:18 +0000 (23:40 +0200)]
rt2x00: Fix setting of txdesc->length field.

We should take the stripping of the IV into account for the txdesc->length
field.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Tested-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath5k: several off by one range checks
Dan Carpenter [Sat, 8 May 2010 16:24:38 +0000 (18:24 +0200)]
ath5k: several off by one range checks

There are several places that use > ARRAY_SIZE() instead of
>= ARRAY_SIZE().

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k/htc_drv_main: off by one error
Dan Carpenter [Sat, 8 May 2010 16:24:02 +0000 (18:24 +0200)]
ath9k/htc_drv_main: off by one error

I changed "> ATH9K_HTC_MAX_TID" to ">= ATH9K_HTC_MAX_TID" to avoid a
potential overflow.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k/htc_drv_main: null dereference typo
Dan Carpenter [Sat, 8 May 2010 16:23:20 +0000 (18:23 +0200)]
ath9k/htc_drv_main: null dereference typo

This is a stray null dereference.  We initialize "ista" properly later on.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoiwlwifi: remove stray mutex_unlock()
Dan Carpenter [Sat, 8 May 2010 16:21:01 +0000 (18:21 +0200)]
iwlwifi: remove stray mutex_unlock()

This mutex_unlock() has been here from the initial commit, but as nearly
as I can tell, there isn't a reason for it.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoath9k_hw: enable PCIe low power mode for AR9003
Luis R. Rodriguez [Fri, 7 May 2010 22:23:22 +0000 (18:23 -0400)]
ath9k_hw: enable PCIe low power mode for AR9003

Cc: Paul Shaw <paul.shaw@atheros.com>
Cc: Don Breslin <don.breslin@atheros.com>
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agortl8180: change PCI DMA mask to DMA_BIT_MASK(32)
John W. Linville [Mon, 10 May 2010 18:24:34 +0000 (14:24 -0400)]
rtl8180: change PCI DMA mask to DMA_BIT_MASK(32)

From the original report:

"I had problems to get my rtl8185 PCI card running on Sparc64: I always
got an error about "No suitable DMA available" followed by an error
that no device could be detected. When comparing the rtl8180 driver to
others I noticed that others are mostly using DMA_BIT_MASK so I changed
the custom mask to DMA_BIT_MASK(32) which fixed my issue."

Reported-by: Tiziano Müller <tm@dev-zero.ch>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
14 years agoMerge branch 'fix/hda' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
Linus Torvalds [Mon, 10 May 2010 16:48:27 +0000 (09:48 -0700)]
Merge branch 'fix/hda' of git://git./linux/kernel/git/tiwai/sound-2.6

* 'fix/hda' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ALSA: Revert "ALSA: hda/realtek: quirk for D945GCLF2 mainboard"
  ALSA: hda - add support for Lenovo ThinkPad X100e in conexant codec
  ALSA: hda - fix DG45ID SPDIF output

14 years agoautofs4-2.6.34-rc1 - fix link_count usage
Ian Kent [Mon, 10 May 2010 08:46:08 +0000 (16:46 +0800)]
autofs4-2.6.34-rc1 - fix link_count usage

After commit 1f36f774b2 ("Switch !O_CREAT case to use of do_last()") in
2.6.34-rc1 autofs direct mounts stopped working.  This is caused by
current->link_count being 0 when ->follow_link() is called from
do_filp_open().

I can't work out why this hasn't been seen before Als patch series.

This patch removes the autofs dependence on current->link_count.

Signed-off-by: Ian Kent <raven@themaw.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agonetfilter: use rcu_dereference_protected()
Patrick McHardy [Mon, 10 May 2010 16:47:57 +0000 (18:47 +0200)]
netfilter: use rcu_dereference_protected()

Restore the rcu_dereference() calls in conntrack/expectation notifier
and logger registration/unregistration, but use the _protected variant,
which will be required by the upcoming __rcu annotations.

Based on patch by Eric Dumazet <eric.dumazet@gmail.com>

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Linus Torvalds [Mon, 10 May 2010 16:44:53 +0000 (09:44 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/jikos/hid

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
  HID: fix suspend crash by moving initializations earlier
  HID: sony: fix sony_set_operational_bt
  HID: ntrig: Remove unused macro, TripleTap and QuadTap
  HID: ntrig: TipSwitch for single touch mode touch.
  HID: hidraw: fix numbered reports
  HID: wacom: remove annoying non-error printk
  HID: ntrig: Emit TOUCH with DOUBLETAP for single touch
  HID: add support for cymotion master solar keyboard
  HID: ntrig: explain firmware quirk
  HID: fix N-trig touch panel with recent firmware

14 years agoMerge branch 'master' of /repos/git/net-next-2.6
Patrick McHardy [Mon, 10 May 2010 16:39:28 +0000 (18:39 +0200)]
Merge branch 'master' of /repos/git/net-next-2.6

Conflicts:
net/bridge/br_device.c
net/bridge/br_forward.c

Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agonetfilter: nf_conntrack_proto: fix warning with CONFIG_PROVE_RCU
Patrick McHardy [Mon, 10 May 2010 15:45:56 +0000 (17:45 +0200)]
netfilter: nf_conntrack_proto: fix warning with CONFIG_PROVE_RCU

===================================================
[ INFO: suspicious rcu_dereference_check() usage. ]
---------------------------------------------------
include/net/netfilter/nf_conntrack_l3proto.h:92 invoked rcu_dereference_check()
without protection!

other info that might help us debug this:

rcu_scheduler_active = 1, debug_locks = 0
2 locks held by iptables/3197:
 #0:  (sk_lock-AF_INET){+.+.+.}, at: [<ffffffff8149bd8c>]
ip_setsockopt+0x7c/0xa0
 #1:  (&xt[i].mutex){+.+.+.}, at: [<ffffffff8148a5fe>]
xt_find_table_lock+0x3e/0x110

stack backtrace:
Pid: 3197, comm: iptables Not tainted 2.6.34-rc4 #2
Call Trace:
 [<ffffffff8105e2e8>] lockdep_rcu_dereference+0xb8/0xc0
 [<ffffffff8147fb3b>] nf_ct_l3proto_module_put+0x6b/0x70
 [<ffffffff8148d891>] state_mt_destroy+0x11/0x20
 [<ffffffff814d3baf>] cleanup_match+0x2f/0x50
 [<ffffffff814d3c63>] cleanup_entry+0x33/0x90
 [<ffffffff814d5653>] ? __do_replace+0x1a3/0x210
 [<ffffffff814d564c>] __do_replace+0x19c/0x210
 [<ffffffff814d651a>] do_ipt_set_ctl+0x16a/0x1b0
 [<ffffffff8147a610>] nf_sockopt+0x60/0xa0
...

The __nf_ct_l3proto_find() call doesn't actually need rcu read side
protection since the caller holds a reference to the protocol. Use
rcu_read_lock() anyways to avoid the warning.

Kernel bugzilla #15781: https://bugzilla.kernel.org/show_bug.cgi?id=15781

Reported-by: Christian Casteyde <casteyde.christian@free.fr>
Signed-off-by: Patrick McHardy <kaber@trash.net>
14 years agoALSA: Revert "ALSA: hda/realtek: quirk for D945GCLF2 mainboard"
Stefan Lippers-Hollmann [Mon, 10 May 2010 15:14:34 +0000 (17:14 +0200)]
ALSA: Revert "ALSA: hda/realtek: quirk for D945GCLF2 mainboard"

This reverts commit 7aee67466536bbf8bb44a95712c848a61c5a0acd.

As it doesn't seem to be universally valid for all mainboard revisions of
the D945GCLF2 and breaks snd-hda-intel/ snd-hda-codec-realtek on the Intel
Corporation "D945GCLF2" (LF94510J.86A.0229.2009.0729.0209) mainboard.

00:1b.0 Audio device [0403]: Intel Corporation N10/ICH 7 Family High Definition Audio Controller [8086:27d8] (rev 01)

Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Cc: <stable@kernel.org> [2.6.33]
Signed-off-by: Takashi Iwai <tiwai@suse.de>
14 years agonet: trans_start cleanups
Eric Dumazet [Mon, 10 May 2010 12:01:31 +0000 (05:01 -0700)]
net: trans_start cleanups

Now that core network takes care of trans_start updates, dont do it
in drivers themselves, if possible. Drivers can avoid one cache miss
(on dev->trans_start) in their start_xmit() handler.

Exceptions are NETIF_F_LLTX drivers

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agonet: Fix FDDI and TR config checks in ipv4 arp and LLC.
David S. Miller [Mon, 10 May 2010 11:59:07 +0000 (04:59 -0700)]
net: Fix FDDI and TR config checks in ipv4 arp and LLC.

Need to check both CONFIG_FOO and CONFIG_FOO_MODULE

Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoIPv4: unresolved multicast route cleanup
Andreas Meissner [Mon, 10 May 2010 11:47:49 +0000 (04:47 -0700)]
IPv4: unresolved multicast route cleanup

Fixes the expiration timer for unresolved multicast route entries.
In case new multicast routing requests come in faster than the
expiration timeout occurs (e.g. zap through multicast TV streams), the
timer is prevented from being called at time for already existing entries.

As the single timer is resetted to default whenever a new entry is made,
the timeout for existing unresolved entires are missed and/or not
updated. As a consequence new requests are denied when the limit of
unresolved entries has been reached because old entries live longer than
they are supposed to.

The solution is to reset the timer only for the first unresolved entry
in the multicast routing cache. All other timers are already set and
updated correctly within the timer function itself by now.

Signed-off by: Andreas Meissner <andreas.meissner@sphairon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 years agoBluetooth: Fix issues where sk_sleep() helper is needed now
Marcel Holtmann [Mon, 10 May 2010 09:33:10 +0000 (11:33 +0200)]
Bluetooth: Fix issues where sk_sleep() helper is needed now

There were some left-overs that used sk->sk_sleep instead of the new
sk_sleep() helper.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoALSA: hda - add support for Lenovo ThinkPad X100e in conexant codec
Andrej Gelenberg [Sun, 9 May 2010 20:10:41 +0000 (22:10 +0200)]
ALSA: hda - add support for Lenovo ThinkPad X100e in conexant codec

Ideapad quirks working for my ThinkPad X100e (microphone is not tested).

Signed-off-by: Andrej Gelenberg <andrej.gelenberg@udo.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
14 years agoBluetooth: Use strict_strtoul instead of simple_strtoul
Tomas Winkler [Tue, 9 Mar 2010 19:38:03 +0000 (21:38 +0200)]
Bluetooth: Use strict_strtoul instead of simple_strtoul

Use strict_strtoul as suggested by checkpatch.pl for more strict input
checking.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Set hdev->dev_type based on Marvell device type
Bing Zhao [Wed, 3 Mar 2010 22:37:37 +0000 (14:37 -0800)]
Bluetooth: Set hdev->dev_type based on Marvell device type

Get the device type from MODULE_BRINGUP_REQ command response.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Separate btmrvl_register_hdev() from btmrvl_add_card()
Bing Zhao [Wed, 3 Mar 2010 22:37:36 +0000 (14:37 -0800)]
Bluetooth: Separate btmrvl_register_hdev() from btmrvl_add_card()

Move btmrvl hdev registration code out of btmrvl_add_card().
New function btmrvl_register_hdev() is added.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Decode btmrvl MODULE_BRINGUP_REG response correctly
Bing Zhao [Wed, 3 Mar 2010 22:37:35 +0000 (14:37 -0800)]
Bluetooth: Decode btmrvl MODULE_BRINGUP_REG response correctly

The MODULE_BRINGUP_REQ command response returns success with
either 0x00 or 0x0c.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Fix storing negative values as unsigned char
Dan Carpenter [Mon, 8 Mar 2010 12:15:59 +0000 (15:15 +0300)]
Bluetooth: Fix storing negative values as unsigned char

This is mostly cleanup. There is only one caller and it just checks for
non-zero return values. Still "ret" should be int because we want to return
-EINVAL on errors.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Create per controller workqueue
Marcel Holtmann [Sat, 20 Mar 2010 14:20:04 +0000 (15:20 +0100)]
Bluetooth: Create per controller workqueue

Instead of having a global workqueue for all controllers, it makes
more sense to have a workqueue per controller.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Fix spec error in the RemoteBusy Logic
Gustavo F. Padovan [Wed, 5 May 2010 02:16:01 +0000 (23:16 -0300)]
Bluetooth: Fix spec error in the RemoteBusy Logic

On the receipt of an RR(P=1) under RemoteBusy set to TRUE(on the RECV
state table) we have to call sendIorRRorRNR(F=1) and just after set
RemoteBusy to False. This leads to a freeze in the sending process since
it's not allowed send data with RemoteBusy set to true and no one
call SendPending-I-Frames after set RemoteBusy to false(The last action
for that event).

Actually sendIorRRorRNR() calls SendPending-I-Frames but at that moment
RemoteBusy is still True and we cannot send any frame, after, no one
calls SendPending-I-Frames again and the sending process stops.

The solution here is to set RemoteBusy to false inside
SendPending-I-Frames just before call SendPending-I-Frames. That will
make SendPending-I-Frames able to send frames. This solution is similar
to what RR(P=0)(F=0) on the RECV table and RR(P=1) on the SREJ_SENT
table do.

Actually doesn't make any sense call SendPending-I-Frames if we can send
any frame, i. e., RemoteBusy is True.

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Prevents buffer overflow on l2cap_ertm_reassembly_sdu()
Gustavo F. Padovan [Sat, 1 May 2010 19:15:45 +0000 (16:15 -0300)]
Bluetooth: Prevents buffer overflow on l2cap_ertm_reassembly_sdu()

The checks should be done before the the memcpy to avoid buffer
overflow.

Reported-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
14 years agoBluetooth: Fix race condition on l2cap_ertm_send()
Gustavo F. Padovan [Sat, 1 May 2010 19:15:45 +0000 (16:15 -0300)]
Bluetooth: Fix race condition on l2cap_ertm_send()

l2cap_ertm_send() can be called both from user context and bottom half
context. The socket locks for that contexts are different, the user
context uses a mutex(which can sleep) and the second one uses a
spinlock_bh. That creates a race condition when we have interruptions on
both contexts at the same time.

The better way to solve this is to add a new spinlock to lock
l2cap_ertm_send() and the vars it access. The other solution was to defer
l2cap_ertm_send() with a workqueue, but we the sending process already
has one defer on the hci layer. It's not a good idea add another one.

The patch refactor the code to create l2cap_retransmit_frames(), then we
encapulate the lock of l2cap_ertm_send() for some call. It also changes
l2cap_retransmit_frame() to l2cap_retransmit_one_frame() to avoid
confusion

Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>