Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battery drain with headphones (HTC Vision) #5

Open
ghost opened this issue Sep 23, 2012 · 0 comments
Open

Battery drain with headphones (HTC Vision) #5

ghost opened this issue Sep 23, 2012 · 0 comments

Comments

@ghost
Copy link

ghost commented Sep 23, 2012

Just wanted to chime in to let you guys know that commit 87a49cb (updated camera drivers for S5K4E1GX sensors) introduces a battery drain when playing back audio with headphones plugged in.
It has something to do with the gpio stuff I guess, but i'm not an expert.
With this commit, battery drains at around -600mA with screen on and -400/500 mA with screen off (e.g. it doesn't go into sleep mode). Reverting this commit reduces battery drain to around -100/200mA with screen on and -50mA with screen off.
Also, the drain only occurs during audio output (music/calls/notifications etc.). It doesn't happen when the headphones are idle and plugged in. It also doesn't happen when the audio output happens through the phone's own speaker.

Juansheng referenced this issue in Andromadus/htc7x30-3.0 Oct 8, 2012
vfs: dcache: fix deadlock in tree traversal

commit 8110e16 upstream.

IBM reported a deadlock in select_parent().  This was found to be caused
by taking rename_lock when already locked when restarting the tree
traversal.

There are two cases when the traversal needs to be restarted:

 1) concurrent d_move(); this can only happen when not already locked,
    since taking rename_lock protects against concurrent d_move().

 2) racing with final d_put() on child just at the moment of ascending
    to parent; rename_lock doesn't protect against this rare race, so it
    can happen when already locked.

Because of case 2, we need to be able to handle restarting the traversal
when rename_lock is already held.  This patch fixes all three callers of
try_to_ascend().

IBM reported that the deadlock is gone with this patch.

[ I rewrote the patch to be smaller and just do the "goto again" if the
  lock was already held, but credit goes to Miklos for the real work.
   - Linus ]

Signed-off-by: Miklos Szeredi <[email protected]>
Cc: Al Viro <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

dm: handle requests beyond end of device instead of using BUG_ON

commit ba1cbad upstream.

The access beyond the end of device BUG_ON that was introduced to
dm_request_fn via commit 29e4013 ("dm: implement
REQ_FLUSH/FUA support for request-based dm") was an overly
drastic (but simple) response to this situation.

I have received a report that this BUG_ON was hit and now think
it would be better to use dm_kill_unmapped_request() to fail the clone
and original request with -EIO.

map_request() will assign the valid target returned by
dm_table_find_target to tio->ti.  But when the target
isn't valid tio->ti is never assigned (because map_request isn't
called); so add a check for tio->ti != NULL to dm_done().

Reported-by: Mike Christie <[email protected]>
Signed-off-by: Mike Snitzer <[email protected]>
Signed-off-by: Jun'ichi Nomura <[email protected]>
Signed-off-by: Alasdair G Kergon <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: option: blacklist QMI interface on ZTE MF683

commit 160c942 upstream.

Interface #5 on ZTE MF683 is a QMI/wwan interface.

Signed-off-by: Bjørn Mork <[email protected]>
Cc: Shawn J. Goff <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: ftdi_sio: add TIAO USB Multi-Protocol Adapter (TUMPA) support

commit 54575b0 upstream.

TIAO/DIYGADGET USB Multi-Protocol Adapter (TUMPA) is an FTDI FT2232H
based device which provides an easily accessible JTAG, SPI, I2C, serial
breakout.

http://www.diygadget.com/tiao-usb-multi-protocol-adapter-jtag-spi-i2c-serial.html
http://www.tiaowiki.com/w/TIAO_USB_Multi_Protocol_Adapter_User%27s_Manual

FTDI FT2232H provides two serial channels (A and B), but on the TUMPA
channel A is dedicated to JTAG/SPI while channel B can be used for
UART/RS-232: use the ftdi_jtag_quirk to expose only channel B as
a usb-serial interface to userspace.

Signed-off-by: Antonio Ospite <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: qcaux: add Pantech vendor class match

commit c638eb2 upstream.

The three Pantech devices UML190 (106c:3716), UML290 (106c:3718) and
P4200 (106c:3721) all use the same subclasses to identify vendor
specific functions.  Replace the existing device specific entries
with generic vendor matching, adding support for the P4200.

Signed-off-by: Bjørn Mork <[email protected]>
Cc: Thomas Schäfer <[email protected]>
Acked-by: Dan Williams <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

staging: speakup_soft: Fix reading of init string

commit 40fe4f8 upstream.

softsynth_read() reads a character at a time from the init string;
when it finds the null terminator it sets the initialized flag but
then repeats the last character.

Additionally, if the read() buffer is not big enough for the init
string, the next read() will start reading from the beginning again.
So the caller may never progress to reading anything else.

Replace the simple initialized flag with the current position in
the init string, carried over between calls.  Switch to reading
real data once this reaches the null terminator.

(This assumes that the length of the init string can't change, which
seems to be the case.  Really, the string and position belong together
in a per-file private struct.)

Tested-by: Samuel Thibault <[email protected]>
Signed-off-by: Ben Hutchings <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

staging: comedi: s626: don't dereference insn->data

commit b655c2c upstream.

`s626_enc_insn_config()` is incorrectly dereferencing `insn->data` which
is a pointer to user memory.  It should be dereferencing the separate
`data` parameter that points to a copy of the data in kernel memory.

Signed-off-by: Ian Abbott <[email protected]>
Reviewed-by: H Hartley Sweeten <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

staging: comedi: jr3_pci: fix iomem dereference

commit e187895 upstream.

Correct a direct dereference of I/O memory to use an appropriate I/O
memory access function.  Note that the pointer being dereferenced is not
currently tagged with `__iomem` but I plan to correct that for 3.7.

Signed-off-by: Ian Abbott <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

staging: comedi: don't dereference user memory for INSN_INTTRIG

commit 5d06e3d upstream.

`parse_insn()` is dereferencing the user-space pointer `insn->data`
directly when handling the `INSN_INTTRIG` comedi instruction.  It
shouldn't be using `insn->data` at all; it should be using the separate
`data` pointer passed to the function.  Fix it.

Signed-off-by: Ian Abbott <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

staging: comedi: fix memory leak for saved channel list

commit c8cad4c upstream.

When `do_cmd_ioctl()` allocates memory for the kernel copy of a channel
list, it frees any previously allocated channel list in
`async->cmd.chanlist` and replaces it with the new one.  However, if the
device is ever removed (or "detached") the cleanup code in
`cleanup_device()` in "drivers.c" does not free this memory so it is
lost.

A sensible place to free the kernel copy of the channel list is in
`do_become_nonbusy()` as at that point the comedi asynchronous command
associated with the channel list is no longer valid.  Free the channel
list in `do_become_nonbusy()` instead of `do_cmd_ioctl()` and clear the
pointer to prevent it being freed more than once.

Note that `cleanup_device()` could be called at an inappropriate time
while the comedi device is open, but that's a separate bug not related
to this this patch.

Signed-off-by: Ian Abbott <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Remove BUG_ON from n_tty_read()

commit e9490e9 upstream.

Change the BUG_ON to WARN_ON and return in case of tty->read_buf==NULL. We want to track a
couple of long standing reports of this but at the same time we can avoid killing the box.

Signed-off-by: Stanislav Kozina <[email protected]>
Signed-off-by: Alan Cox <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

TTY: ttyprintk, don't touch behind tty->write_buf

commit ee8b593 upstream.

If a user provides a buffer larger than a tty->write_buf chunk and
passes '\r' at the end of the buffer, we touch an out-of-bound memory.

Add a check there to prevent this.

Signed-off-by: Jiri Slaby <[email protected]>
Cc: Samo Pogacnik <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

serial: pl011: handle corruption at high clock speeds

commit c5dd553 upstream.

This works around a few glitches in the ST version of the PL011
serial driver when using very high baud rates, as we do in the
Ux500: 3, 3.25, 4 and 4.05 Mbps.

Problem Observed/rootcause:

When using high baud-rates, and the baudrate*8 is getting close to
the provided clock frequency (so a division factor close to 1), when
using bursts of characters (so they are abutted), then it seems as if
there is not enough time to detect the beginning of the start-bit which
is a timing reference for the entire character, and thus the sampling
moment of character bits is moving towards the end of each bit, instead
of the middle.

Fix:
Increase slightly the RX baud rate of the UART above the theoretical
baudrate by 5%. This will definitely give more margin time to the
UART_RX to correctly sample the data at the middle of the bit period.

Also fix the ages old copy-paste error in the very stressed comment,
it's referencing the registers used in the PL010 driver rather than
the PL011 ones.

Signed-off-by: Guillaume Jaunet <[email protected]>
Signed-off-by: Christophe Arnal <[email protected]>
Signed-off-by: Matthias Locher <[email protected]>
Signed-off-by: Rajanikanth HV <[email protected]>
Cc: Bibek Basu <[email protected]>
Cc: Par-Gunnar Hjalmdahl <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

serial: set correct baud_base for EXSYS EX-41092 Dual 16950

commit 26e8220 upstream.

Apparently the same card model has two IDs, so this patch
complements the commit 39aced6
adding the missing one.

Signed-off-by: Flavio Leitner <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

b43legacy: Fix crash on unload when firmware not available

commit 2d838bb upstream.

When b43legacy is loaded without the firmware being available, a following
unload generates a kernel NULL pointer dereference BUG as follows:

[  214.330789] BUG: unable to handle kernel NULL pointer dereference at 0000004c
[  214.330997] IP: [<c104c395>] drain_workqueue+0x15/0x170
[  214.331179] *pde = 00000000
[  214.331311] Oops: 0000 [#1] SMP
[  214.331471] Modules linked in: b43legacy(-) ssb pcmcia mac80211 cfg80211 af_packet mperf arc4 ppdev sr_mod cdrom sg shpchp yenta_socket pcmcia_rsrc pci_hotplug pcmcia_core battery parport_pc parport floppy container ac button edd autofs4 ohci_hcd ehci_hcd usbcore usb_common thermal processor scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc scsi_dh_alua scsi_dh fan thermal_sys hwmon ata_generic pata_ali libata [last unloaded: cfg80211]
[  214.333421] Pid: 3639, comm: modprobe Not tainted 3.6.0-rc6-wl+ #163 Source Technology VIC 9921/ALI Based Notebook
[  214.333580] EIP: 0060:[<c104c395>] EFLAGS: 00010246 CPU: 0
[  214.333687] EIP is at drain_workqueue+0x15/0x170
[  214.333788] EAX: c162ac40 EBX: cdfb8360 ECX: 0000002a EDX: 00002a2a
[  214.333890] ESI: 00000000 EDI: 00000000 EBP: cd767e7c ESP: cd767e5c
[  214.333957]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
[  214.333957] CR0: 8005003b CR2: 0000004c CR3: 0c96a000 CR4: 00000090
[  214.333957] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
[  214.333957] DR6: ffff0ff0 DR7: 00000400
[  214.333957] Process modprobe (pid: 3639, ti=cd766000 task=cf802e90 task.ti=cd766000)
[  214.333957] Stack:
[  214.333957]  00000292 cd767e74 c12c5e09 00000296 00000296 cdfb8360 cdfb9220 00000000
[  214.333957]  cd767e90 c104c4fd cdfb8360 cdfb9220 cd682800 cd767ea4 d0c10184 cd682800
[  214.333957]  cd767ea4 cba31064 cd767eb8 d0867908 cba31064 d087e09c cd96f034 cd767ec4
[  214.333957] Call Trace:
[  214.333957]  [<c12c5e09>] ? skb_dequeue+0x49/0x60
[  214.333957]  [<c104c4fd>] destroy_workqueue+0xd/0x150
[  214.333957]  [<d0c10184>] ieee80211_unregister_hw+0xc4/0x100 [mac80211]
[  214.333957]  [<d0867908>] b43legacy_remove+0x78/0x80 [b43legacy]
[  214.333957]  [<d083654d>] ssb_device_remove+0x1d/0x30 [ssb]
[  214.333957]  [<c126f15a>] __device_release_driver+0x5a/0xb0
[  214.333957]  [<c126fb07>] driver_detach+0x87/0x90
[  214.333957]  [<c126ef4c>] bus_remove_driver+0x6c/0xe0
[  214.333957]  [<c1270120>] driver_unregister+0x40/0x70
[  214.333957]  [<d083686b>] ssb_driver_unregister+0xb/0x10 [ssb]
[  214.333957]  [<d087c488>] b43legacy_exit+0xd/0xf [b43legacy]
[  214.333957]  [<c1089dde>] sys_delete_module+0x14e/0x2b0
[  214.333957]  [<c110a4a7>] ? vfs_write+0xf7/0x150
[  214.333957]  [<c1240050>] ? tty_write_lock+0x50/0x50
[  214.333957]  [<c110a6f8>] ? sys_write+0x38/0x70
[  214.333957]  [<c1397c55>] syscall_call+0x7/0xb
[  214.333957] Code: bc 27 00 00 00 00 a1 74 61 56 c1 55 89 e5 e8 a3 fc ff ff 5d c3 90 55 89 e5 57 56 89 c6 53 b8 40 ac 62 c1 83 ec 14 e8 bb b7 34 00 <8b> 46 4c 8d 50 01 85 c0 89 56 4c 75 03 83 0e 40 80 05 40 ac 62
[  214.333957] EIP: [<c104c395>] drain_workqueue+0x15/0x170 SS:ESP 0068:cd767e5c
[  214.333957] CR2: 000000000000004c
[  214.341110] ---[ end trace c7e90ec026d875a6 ]---Index: wireless-testing/drivers/net/wireless/b43legacy/main.c

The problem is fixed by making certain that the ucode pointer is not NULL
before deregistering the driver in mac80211.

Signed-off-by: Larry Finger <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

firmware: Add missing attributes to EFI variable attribute print out from sysfs

commit 7083909 upstream.

Some of the EFI variable attributes are missing from print out from
/sys/firmware/efi/vars/*/attributes. This patch adds those in. It also
updates code to use pre-defined constants for masking current value
of attributes.

Signed-off-by: Khalid Aziz <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Acked-by: Matthew Garrett <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

xhci: Intel Panther Point BEI quirk.

commit 80fab3b upstream.

When a device with an isochronous endpoint is behind a hub plugged into
the Intel Panther Point xHCI host controller, and the driver submits
multiple frames per URB, the xHCI driver will set the Block Event
Interrupt (BEI) flag on all but the last TD for the URB.  This causes
the host controller to place an event on the event ring, but not send an
interrupt.  When the last TD for the URB completes, BEI is cleared, and
we get an interrupt for the whole URB.

However, under a Panther Point xHCI host controller, if the parent hub
is unplugged when one or more events from transfers with BEI set are on
the event ring, a port status change event is placed on the event ring,
but no interrupt is generated.  This means URBs stop completing, and the
USB device disconnect is not noticed.  Something like a USB headset will
cause mplayer to hang when the device is disconnected.

If another transfer is sent (such as running `sudo lsusb -v`), the next
transfer event seems to "unstick" the event ring, the xHCI driver gets
an interrupt, and the disconnect is reported to the USB core.

The fix is not to use the BEI flag under the Panther Point xHCI host.
This will impact power consumption and system responsiveness, because
the xHCI driver will receive an interrupt for every frame in all
isochronous URBs instead of once per URB.

Intel chipset developers confirm that this bug will be hit if the BEI
flag is used on any endpoint, not just ones that are behind a hub.

This patch should be backported to kernels as old as 3.0, that contain
the commit 69e848c "Intel xhci: Support
EHCI/xHCI port switching."

Signed-off-by: Sarah Sharp <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

n_gsm: added interlocking for gsm_data_lock for certain code paths

commit 5e44708 upstream.

There were some locking holes in the management of the MUX's
message queue for 2 code paths:
1) gsmld_write_wakeup
2) receipt of CMD_FCON flow-control message
In both cases gsm_data_kick is called w/o locking so it can collide
with other other instances of gsm_data_kick (pulling messages tx_tail)
or potentially other instances of __gsm_data_queu (adding messages to tx_head)

Changed to take the tx_lock in these 2 cases

Signed-off-by: Russ Gorby <[email protected]>
Tested-by: Yin, Fengwei <[email protected]>
Signed-off-by: Alan Cox <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

coredump: prevent double-free on an error path in core dumper

commit f34f9d1 upstream.

In !CORE_DUMP_USE_REGSET case, if elf_note_info_init fails to allocate
memory for info->fields, it frees already allocated stuff and returns
error to its caller, fill_note_info.  Which in turn returns error to its
caller, elf_core_dump.  Which jumps to cleanup label and calls
free_note_info, which will happily try to free all info->fields again.
BOOM.

This is the fix.

Signed-off-by: Oleg Nesterov <[email protected]>
Signed-off-by: Denys Vlasenko <[email protected]>
Cc: Venu Byravarasu <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Increase XHCI suspend timeout to 16ms

commit a6e097d upstream.

The Intel XHCI specification says that after clearing the run/stop bit
the controller may take up to 16ms to halt. We've seen a device take
14ms, which with the current timeout of 10ms causes the kernel to
abort the suspend. Increasing the timeout to the recommended value
fixes the problem.

This patch should be backported to kernels as old as 2.6.37, that
contain the commit 5535b1d "USB: xHCI:
PCI power management implementation".

Signed-off-by: Michael Spang <[email protected]>
Signed-off-by: Sarah Sharp <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

n_gsm: memory leak in uplink error path

commit 88ed2a6 upstream.

Uplink (TX) network data will go through gsm_dlci_data_output_framed
there is a bug where if memory allocation fails, the skb which
has already been pulled off the list will be lost.

In addition TX skbs were being processed in LIFO order

Fixed the memory leak, and changed to FIFO order processing

Signed-off-by: Russ Gorby <[email protected]>
Tested-by: Kappel, LaurentX <[email protected]>
Signed-off-by: Alan Cox <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

UBI: fix autoresize handling in R/O mode

commit abb3e01 upstream.

Currently UBI fails in autoresize when it is in R/O mode (e.g., because the
underlying MTD device is R/O). This patch fixes the issue - we just skip
autoresize and print a warning.

Reported-by: Pali Rohár <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

SCSI: ibmvscsi: Fix host config length field overflow

commit 225c569 upstream.

The length field in the host config packet is only 16-bit long, so
passing it 0x10000 (64K which is our standard PAGE_SIZE) doesn't
work and result in an empty config from the server.

Signed-off-by: Benjamin Herrenschmidt <[email protected]>
Acked-by: Robert Jennings <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

SCSI: hpsa: Use LUN reset instead of target reset

commit 21e89af upstream.

It turns out Smart Array logical drives do not support target
reset and when the target reset fails, the logical drive will
be taken off line.  Symptoms look like this:

hpsa 0000:03:00.0: Abort request on C1:B0:T0:L0
hpsa 0000:03:00.0: resetting device 1:0:0:0
hpsa 0000:03:00.0: cp ffff880037c56000 is reported invalid (probably means target device no longer present)
hpsa 0000:03:00.0: resetting device failed.
sd 1:0:0:0: Device offlined - not ready after error recovery
sd 1:0:0:0: rejecting I/O to offline device
EXT3-fs error (device sdb1): read_block_bitmap:

LUN reset is supported though, and is what we should be using.
Target reset is also disruptive in shared SAS situations,
for example, an external MSA1210m which does support target
reset attached to Smart Arrays in multiple hosts -- a target
reset from one host is disruptive to other hosts as all LUNs
on the target will be reset and will abort all outstanding i/os
back to all the attached hosts.  So we should use LUN reset,
not target reset.

Tested this with Smart Array logical drives and with tape drives.
Not sure how this bug survived since 2009, except it must be very
rare for a Smart Array to require more than 30s to complete a request.

Signed-off-by: Stephen M. Cameron <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: mscan-mpc5xxx: fix return value check in mpc512x_can_get_clock()

commit f61bd05 upstream.

In case of error, the function clk_get() returns ERR_PTR()
and never returns NULL pointer. The NULL test in the error
handling should be replaced with IS_ERR().

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

Signed-off-by: Wei Yongjun <[email protected]>
Acked-by: Wolfgang Grandegger <[email protected]>
Signed-off-by: Marc Kleine-Budde <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

IPoIB: Fix use-after-free of multicast object

commit bea1e22 upstream.

Fix a crash in ipoib_mcast_join_task().  (with help from Or Gerlitz)

Commit c8c2afe ("IPoIB: Use rtnl lock/unlock when changing device
flags") added a call to rtnl_lock() in ipoib_mcast_join_task(), which
is run from the ipoib_workqueue, and hence the workqueue can't be
flushed from the context of ipoib_stop().

In the current code, ipoib_stop() (which doesn't flush the workqueue)
calls ipoib_mcast_dev_flush(), which goes and deletes all the
multicast entries.  This takes place without any synchronization with
a possible running instance of ipoib_mcast_join_task() for the same
ipoib device, leading to a crash due to NULL pointer dereference.

Fix this by making sure that the workqueue is flushed before
ipoib_mcast_dev_flush() is called.  To make that possible, we move the
RTNL-lock wrapped code to ipoib_mcast_join_finish().

Signed-off-by: Patrick McHardy <[email protected]>
Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

IB/srp: Fix use-after-free in srp_reset_req()

commit 9b796d0 upstream.

srp_free_req() uses the scsi_cmnd structure contents to unmap
buffers, so we must invoke srp_free_req() before we release
ownership of that structure.

Signed-off-by: Bart Van Assche <[email protected]>
Acked-by: David Dillow <[email protected]>
Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

IB/srp: Avoid having aborted requests hang

commit d853667 upstream.

We need to call scsi_done() for commands after we abort them.

Signed-off-by: Bart Van Assche <[email protected]>
Acked-by: David Dillow <[email protected]>
Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

isci: fix isci_pci_probe() generates warning on efi failure path

commit 6d70a74 upstream.

The oem parameter image embedded in the efi variable is at an offset
from the start of the variable.  However, in the failure path we try to
free the 'orom' pointer which is only valid when the paramaters are
being read from the legacy option-rom space.

Since failure to load the oem parameters is unlikely and we keep the
memory around in the success case just defer all de-allocation to devm.

Reported-by: Don Morris <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

x86/alternatives: Fix p6 nops on non-modular kernels

commit cb09cad upstream.

Probably a leftover from the early days of self-patching, p6nops
are marked __initconst_or_module, which causes them to be
discarded in a non-modular kernel.  If something later triggers
patching, it will overwrite kernel code with garbage.

Reported-by: Tomas Racek <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>
Cc: Michael Tokarev <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Marcelo Tosatti <[email protected]>
Cc: [email protected]
Cc: Anthony Liguori <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Alan Cox <[email protected]>
Cc: Alan Cox <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
Cc: Ben Jencks <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

PCI: honor child buses add_size in hot plug configuration

commit be76891 upstream.

git commit c8adf9a
    "PCI: pre-allocate additional resources to devices only after
	successful allocation of essential resources."

fails to take into consideration the optional-resources needed by children
devices while calculating the optional-resource needed by the bridge.

This can be a problem on some setup. For example, if a hotplug bridge has 8
children hotplug bridges, the bridge should have enough resources to accomodate
the hotplug requirements for each of its children hotplug bridges.  Currently
this is not the case.

This patch fixes the problem.

Signed-off-by: Yinghai Lu <[email protected]>
Reviewed-by: Ram Pai <[email protected]>
Signed-off-by: Jesse Barnes <[email protected]>
Cc: Andrew Worsley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

SCSI: scsi_remove_target: fix softlockup regression on hot remove

commit bc3f02a upstream.

John reports:
 BUG: soft lockup - CPU#2 stuck for 23s! [kworker/u:8:2202]
 [..]
 Call Trace:
  [<ffffffff8141782a>] scsi_remove_target+0xda/0x1f0
  [<ffffffff81421de5>] sas_rphy_remove+0x55/0x60
  [<ffffffff81421e01>] sas_rphy_delete+0x11/0x20
  [<ffffffff81421e35>] sas_port_delete+0x25/0x160
  [<ffffffff814549a3>] mptsas_del_end_device+0x183/0x270

...introduced by commit 3b661a9 "[SCSI] fix hot unplug vs async scan race".

Don't restart lookup of more stargets in the multi-target case, just
arrange to traverse the list once, on the assumption that new targets
are always added at the end.  There is no guarantee that the target will
change state in scsi_target_reap() so we can end up spinning if we
restart.

Acked-by: Jack Wang <[email protected]>
LKML-Reference: <CAEhu1-6wq1YsNiscGMwP4ud0Q+MrViRzv=kcWCQSBNc8c68N5Q@mail.gmail.com>
Reported-by: John Drescher <[email protected]>
Tested-by: John Drescher <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

SCSI: scsi_dh_alua: Enable STPG for unavailable ports

commit e47f897 upstream.

A quote from SPC-4: "While in the unavailable primary target port
asymmetric access state, the device server shall support those of
the following commands that it supports while in the active/optimized
state: [ ... ] d) SET TARGET PORT GROUPS; [ ... ]". Hence enable
sending STPG to a target port group that is in the unavailable state.

Signed-off-by: Bart Van Assche <[email protected]>
Reviewed-by: Mike Christie <[email protected]>
Acked-by: Hannes Reinecke <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Linux 3.0.45
synergydev referenced this issue in KangBangKreations/KangBanged-7x30 Oct 8, 2012
3.0.45 ChangeLog:
commit 24e842a
Author: Greg Kroah-Hartman <[email protected]>
Date:   Sun Oct 7 08:28:29 2012 -0700

    Linux 3.0.45

commit d71df54
Author: Bart Van Assche <[email protected]>
Date:   Fri Aug 24 09:08:41 2012 +0000

    SCSI: scsi_dh_alua: Enable STPG for unavailable ports

    commit e47f897 upstream.

    A quote from SPC-4: "While in the unavailable primary target port
    asymmetric access state, the device server shall support those of
    the following commands that it supports while in the active/optimized
    state: [ ... ] d) SET TARGET PORT GROUPS; [ ... ]". Hence enable
    sending STPG to a target port group that is in the unavailable state.

    Signed-off-by: Bart Van Assche <[email protected]>
    Reviewed-by: Mike Christie <[email protected]>
    Acked-by: Hannes Reinecke <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 8fda079
Author: Dan Williams <[email protected]>
Date:   Tue Aug 28 22:12:10 2012 -0700

    SCSI: scsi_remove_target: fix softlockup regression on hot remove

    commit bc3f02a upstream.

    John reports:
     BUG: soft lockup - CPU#2 stuck for 23s! [kworker/u:8:2202]
     [..]
     Call Trace:
      [<ffffffff8141782a>] scsi_remove_target+0xda/0x1f0
      [<ffffffff81421de5>] sas_rphy_remove+0x55/0x60
      [<ffffffff81421e01>] sas_rphy_delete+0x11/0x20
      [<ffffffff81421e35>] sas_port_delete+0x25/0x160
      [<ffffffff814549a3>] mptsas_del_end_device+0x183/0x270

    ...introduced by commit 3b661a9 "[SCSI] fix hot unplug vs async scan race".

    Don't restart lookup of more stargets in the multi-target case, just
    arrange to traverse the list once, on the assumption that new targets
    are always added at the end.  There is no guarantee that the target will
    change state in scsi_target_reap() so we can end up spinning if we
    restart.

    Acked-by: Jack Wang <[email protected]>
    LKML-Reference: <CAEhu1-6wq1YsNiscGMwP4ud0Q+MrViRzv=kcWCQSBNc8c68N5Q@mail.gmail.com>
    Reported-by: John Drescher <[email protected]>
    Tested-by: John Drescher <[email protected]>
    Signed-off-by: Dan Williams <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit fc3ef18
Author: Yinghai Lu <[email protected]>
Date:   Mon Jul 25 13:08:38 2011 -0700

    PCI: honor child buses add_size in hot plug configuration

    commit be76891 upstream.

    git commit c8adf9a
        "PCI: pre-allocate additional resources to devices only after
    	successful allocation of essential resources."

    fails to take into consideration the optional-resources needed by children
    devices while calculating the optional-resource needed by the bridge.

    This can be a problem on some setup. For example, if a hotplug bridge has 8
    children hotplug bridges, the bridge should have enough resources to accomodate
    the hotplug requirements for each of its children hotplug bridges.  Currently
    this is not the case.

    This patch fixes the problem.

    Signed-off-by: Yinghai Lu <[email protected]>
    Reviewed-by: Ram Pai <[email protected]>
    Signed-off-by: Jesse Barnes <[email protected]>
    Cc: Andrew Worsley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 368d531
Author: Avi Kivity <[email protected]>
Date:   Wed Aug 22 13:03:48 2012 +0300

    x86/alternatives: Fix p6 nops on non-modular kernels

    commit cb09cad upstream.

    Probably a leftover from the early days of self-patching, p6nops
    are marked __initconst_or_module, which causes them to be
    discarded in a non-modular kernel.  If something later triggers
    patching, it will overwrite kernel code with garbage.

    Reported-by: Tomas Racek <[email protected]>
    Signed-off-by: Avi Kivity <[email protected]>
    Cc: Michael Tokarev <[email protected]>
    Cc: Borislav Petkov <[email protected]>
    Cc: Marcelo Tosatti <[email protected]>
    Cc: [email protected]
    Cc: Anthony Liguori <[email protected]>
    Cc: H. Peter Anvin <[email protected]>
    Cc: Alan Cox <[email protected]>
    Cc: Alan Cox <[email protected]>
    Link: http://lkml.kernel.org/r/[email protected]
    Signed-off-by: Ingo Molnar <[email protected]>
    Cc: Ben Jencks <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 42cc576
Author: Dan Williams <[email protected]>
Date:   Fri Jun 22 11:31:14 2012 -0700

    isci: fix isci_pci_probe() generates warning on efi failure path

    commit 6d70a74 upstream.

    The oem parameter image embedded in the efi variable is at an offset
    from the start of the variable.  However, in the failure path we try to
    free the 'orom' pointer which is only valid when the paramaters are
    being read from the legacy option-rom space.

    Since failure to load the oem parameters is unlikely and we keep the
    memory around in the success case just defer all de-allocation to devm.

    Reported-by: Don Morris <[email protected]>
    Signed-off-by: Dan Williams <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7385895
Author: Bart Van Assche <[email protected]>
Date:   Fri Aug 24 10:29:11 2012 +0000

    IB/srp: Avoid having aborted requests hang

    commit d853667 upstream.

    We need to call scsi_done() for commands after we abort them.

    Signed-off-by: Bart Van Assche <[email protected]>
    Acked-by: David Dillow <[email protected]>
    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7846edb
Author: Bart Van Assche <[email protected]>
Date:   Fri Aug 24 10:27:54 2012 +0000

    IB/srp: Fix use-after-free in srp_reset_req()

    commit 9b796d0 upstream.

    srp_free_req() uses the scsi_cmnd structure contents to unmap
    buffers, so we must invoke srp_free_req() before we release
    ownership of that structure.

    Signed-off-by: Bart Van Assche <[email protected]>
    Acked-by: David Dillow <[email protected]>
    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 0a44207
Author: Patrick McHardy <[email protected]>
Date:   Thu Aug 30 07:01:30 2012 +0000

    IPoIB: Fix use-after-free of multicast object

    commit bea1e22 upstream.

    Fix a crash in ipoib_mcast_join_task().  (with help from Or Gerlitz)

    Commit c8c2afe ("IPoIB: Use rtnl lock/unlock when changing device
    flags") added a call to rtnl_lock() in ipoib_mcast_join_task(), which
    is run from the ipoib_workqueue, and hence the workqueue can't be
    flushed from the context of ipoib_stop().

    In the current code, ipoib_stop() (which doesn't flush the workqueue)
    calls ipoib_mcast_dev_flush(), which goes and deletes all the
    multicast entries.  This takes place without any synchronization with
    a possible running instance of ipoib_mcast_join_task() for the same
    ipoib device, leading to a crash due to NULL pointer dereference.

    Fix this by making sure that the workqueue is flushed before
    ipoib_mcast_dev_flush() is called.  To make that possible, we move the
    RTNL-lock wrapped code to ipoib_mcast_join_finish().

    Signed-off-by: Patrick McHardy <[email protected]>
    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d125a7e
Author: Wei Yongjun <[email protected]>
Date:   Fri Sep 21 15:09:47 2012 +0800

    can: mscan-mpc5xxx: fix return value check in mpc512x_can_get_clock()

    commit f61bd05 upstream.

    In case of error, the function clk_get() returns ERR_PTR()
    and never returns NULL pointer. The NULL test in the error
    handling should be replaced with IS_ERR().

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

    Signed-off-by: Wei Yongjun <[email protected]>
    Acked-by: Wolfgang Grandegger <[email protected]>
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c07ad5e
Author: Stephen M. Cameron <[email protected]>
Date:   Thu Jul 26 11:34:10 2012 -0500

    SCSI: hpsa: Use LUN reset instead of target reset

    commit 21e89af upstream.

    It turns out Smart Array logical drives do not support target
    reset and when the target reset fails, the logical drive will
    be taken off line.  Symptoms look like this:

    hpsa 0000:03:00.0: Abort request on C1:B0:T0:L0
    hpsa 0000:03:00.0: resetting device 1:0:0:0
    hpsa 0000:03:00.0: cp ffff880037c56000 is reported invalid (probably means target device no longer present)
    hpsa 0000:03:00.0: resetting device failed.
    sd 1:0:0:0: Device offlined - not ready after error recovery
    sd 1:0:0:0: rejecting I/O to offline device
    EXT3-fs error (device sdb1): read_block_bitmap:

    LUN reset is supported though, and is what we should be using.
    Target reset is also disruptive in shared SAS situations,
    for example, an external MSA1210m which does support target
    reset attached to Smart Arrays in multiple hosts -- a target
    reset from one host is disruptive to other hosts as all LUNs
    on the target will be reset and will abort all outstanding i/os
    back to all the attached hosts.  So we should use LUN reset,
    not target reset.

    Tested this with Smart Array logical drives and with tape drives.
    Not sure how this bug survived since 2009, except it must be very
    rare for a Smart Array to require more than 30s to complete a request.

    Signed-off-by: Stephen M. Cameron <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a3b1f83
Author: Benjamin Herrenschmidt <[email protected]>
Date:   Mon Jul 30 11:33:05 2012 +1000

    SCSI: ibmvscsi: Fix host config length field overflow

    commit 225c569 upstream.

    The length field in the host config packet is only 16-bit long, so
    passing it 0x10000 (64K which is our standard PAGE_SIZE) doesn't
    work and result in an empty config from the server.

    Signed-off-by: Benjamin Herrenschmidt <[email protected]>
    Acked-by: Robert Jennings <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 079c1ed
Author: Artem Bityutskiy <[email protected]>
Date:   Sat Aug 18 14:11:42 2012 +0200

    UBI: fix autoresize handling in R/O mode

    commit abb3e01 upstream.

    Currently UBI fails in autoresize when it is in R/O mode (e.g., because the
    underlying MTD device is R/O). This patch fixes the issue - we just skip
    autoresize and print a warning.

    Reported-by: Pali Rohár <[email protected]>
    Signed-off-by: Artem Bityutskiy <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e54195a
Author: Russ Gorby <[email protected]>
Date:   Mon Aug 13 13:45:30 2012 +0100

    n_gsm: memory leak in uplink error path

    commit 88ed2a6 upstream.

    Uplink (TX) network data will go through gsm_dlci_data_output_framed
    there is a bug where if memory allocation fails, the skb which
    has already been pulled off the list will be lost.

    In addition TX skbs were being processed in LIFO order

    Fixed the memory leak, and changed to FIFO order processing

    Signed-off-by: Russ Gorby <[email protected]>
    Tested-by: Kappel, LaurentX <[email protected]>
    Signed-off-by: Alan Cox <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a4e92d2
Author: Michael Spang <[email protected]>
Date:   Fri Sep 14 13:05:49 2012 -0400

    Increase XHCI suspend timeout to 16ms

    commit a6e097d upstream.

    The Intel XHCI specification says that after clearing the run/stop bit
    the controller may take up to 16ms to halt. We've seen a device take
    14ms, which with the current timeout of 10ms causes the kernel to
    abort the suspend. Increasing the timeout to the recommended value
    fixes the problem.

    This patch should be backported to kernels as old as 2.6.37, that
    contain the commit 5535b1d "USB: xHCI:
    PCI power management implementation".

    Signed-off-by: Michael Spang <[email protected]>
    Signed-off-by: Sarah Sharp <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7c36d46
Author: Denys Vlasenko <[email protected]>
Date:   Wed Sep 26 11:34:50 2012 +1000

    coredump: prevent double-free on an error path in core dumper

    commit f34f9d1 upstream.

    In !CORE_DUMP_USE_REGSET case, if elf_note_info_init fails to allocate
    memory for info->fields, it frees already allocated stuff and returns
    error to its caller, fill_note_info.  Which in turn returns error to its
    caller, elf_core_dump.  Which jumps to cleanup label and calls
    free_note_info, which will happily try to free all info->fields again.
    BOOM.

    This is the fix.

    Signed-off-by: Oleg Nesterov <[email protected]>
    Signed-off-by: Denys Vlasenko <[email protected]>
    Cc: Venu Byravarasu <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 9ce5f86
Author: Russ Gorby <[email protected]>
Date:   Mon Aug 13 13:44:40 2012 +0100

    n_gsm: added interlocking for gsm_data_lock for certain code paths

    commit 5e44708 upstream.

    There were some locking holes in the management of the MUX's
    message queue for 2 code paths:
    1) gsmld_write_wakeup
    2) receipt of CMD_FCON flow-control message
    In both cases gsm_data_kick is called w/o locking so it can collide
    with other other instances of gsm_data_kick (pulling messages tx_tail)
    or potentially other instances of __gsm_data_queu (adding messages to tx_head)

    Changed to take the tx_lock in these 2 cases

    Signed-off-by: Russ Gorby <[email protected]>
    Tested-by: Yin, Fengwei <[email protected]>
    Signed-off-by: Alan Cox <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 9c1ce83
Author: Sarah Sharp <[email protected]>
Date:   Wed Sep 19 16:27:26 2012 -0700

    xhci: Intel Panther Point BEI quirk.

    commit 80fab3b upstream.

    When a device with an isochronous endpoint is behind a hub plugged into
    the Intel Panther Point xHCI host controller, and the driver submits
    multiple frames per URB, the xHCI driver will set the Block Event
    Interrupt (BEI) flag on all but the last TD for the URB.  This causes
    the host controller to place an event on the event ring, but not send an
    interrupt.  When the last TD for the URB completes, BEI is cleared, and
    we get an interrupt for the whole URB.

    However, under a Panther Point xHCI host controller, if the parent hub
    is unplugged when one or more events from transfers with BEI set are on
    the event ring, a port status change event is placed on the event ring,
    but no interrupt is generated.  This means URBs stop completing, and the
    USB device disconnect is not noticed.  Something like a USB headset will
    cause mplayer to hang when the device is disconnected.

    If another transfer is sent (such as running `sudo lsusb -v`), the next
    transfer event seems to "unstick" the event ring, the xHCI driver gets
    an interrupt, and the disconnect is reported to the USB core.

    The fix is not to use the BEI flag under the Panther Point xHCI host.
    This will impact power consumption and system responsiveness, because
    the xHCI driver will receive an interrupt for every frame in all
    isochronous URBs instead of once per URB.

    Intel chipset developers confirm that this bug will be hit if the BEI
    flag is used on any endpoint, not just ones that are behind a hub.

    This patch should be backported to kernels as old as 3.0, that contain
    the commit 69e848c "Intel xhci: Support
    EHCI/xHCI port switching."

    Signed-off-by: Sarah Sharp <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c19d52a
Author: Khalid Aziz <[email protected]>
Date:   Mon Sep 10 12:52:42 2012 -0600

    firmware: Add missing attributes to EFI variable attribute print out from sysfs

    commit 7083909 upstream.

    Some of the EFI variable attributes are missing from print out from
    /sys/firmware/efi/vars/*/attributes. This patch adds those in. It also
    updates code to use pre-defined constants for masking current value
    of attributes.

    Signed-off-by: Khalid Aziz <[email protected]>
    Reviewed-by: Kees Cook <[email protected]>
    Acked-by: Matthew Garrett <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit f39a3e8
Author: Larry Finger <[email protected]>
Date:   Wed Sep 26 12:32:02 2012 -0500

    b43legacy: Fix crash on unload when firmware not available

    commit 2d838bb upstream.

    When b43legacy is loaded without the firmware being available, a following
    unload generates a kernel NULL pointer dereference BUG as follows:

    [  214.330789] BUG: unable to handle kernel NULL pointer dereference at 0000004c
    [  214.330997] IP: [<c104c395>] drain_workqueue+0x15/0x170
    [  214.331179] *pde = 00000000
    [  214.331311] Oops: 0000 [#1] SMP
    [  214.331471] Modules linked in: b43legacy(-) ssb pcmcia mac80211 cfg80211 af_packet mperf arc4 ppdev sr_mod cdrom sg shpchp yenta_socket pcmcia_rsrc pci_hotplug pcmcia_core battery parport_pc parport floppy container ac button edd autofs4 ohci_hcd ehci_hcd usbcore usb_common thermal processor scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc scsi_dh_alua scsi_dh fan thermal_sys hwmon ata_generic pata_ali libata [last unloaded: cfg80211]
    [  214.333421] Pid: 3639, comm: modprobe Not tainted 3.6.0-rc6-wl+ #163 Source Technology VIC 9921/ALI Based Notebook
    [  214.333580] EIP: 0060:[<c104c395>] EFLAGS: 00010246 CPU: 0
    [  214.333687] EIP is at drain_workqueue+0x15/0x170
    [  214.333788] EAX: c162ac40 EBX: cdfb8360 ECX: 0000002a EDX: 00002a2a
    [  214.333890] ESI: 00000000 EDI: 00000000 EBP: cd767e7c ESP: cd767e5c
    [  214.333957]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
    [  214.333957] CR0: 8005003b CR2: 0000004c CR3: 0c96a000 CR4: 00000090
    [  214.333957] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
    [  214.333957] DR6: ffff0ff0 DR7: 00000400
    [  214.333957] Process modprobe (pid: 3639, ti=cd766000 task=cf802e90 task.ti=cd766000)
    [  214.333957] Stack:
    [  214.333957]  00000292 cd767e74 c12c5e09 00000296 00000296 cdfb8360 cdfb9220 00000000
    [  214.333957]  cd767e90 c104c4fd cdfb8360 cdfb9220 cd682800 cd767ea4 d0c10184 cd682800
    [  214.333957]  cd767ea4 cba31064 cd767eb8 d0867908 cba31064 d087e09c cd96f034 cd767ec4
    [  214.333957] Call Trace:
    [  214.333957]  [<c12c5e09>] ? skb_dequeue+0x49/0x60
    [  214.333957]  [<c104c4fd>] destroy_workqueue+0xd/0x150
    [  214.333957]  [<d0c10184>] ieee80211_unregister_hw+0xc4/0x100 [mac80211]
    [  214.333957]  [<d0867908>] b43legacy_remove+0x78/0x80 [b43legacy]
    [  214.333957]  [<d083654d>] ssb_device_remove+0x1d/0x30 [ssb]
    [  214.333957]  [<c126f15a>] __device_release_driver+0x5a/0xb0
    [  214.333957]  [<c126fb07>] driver_detach+0x87/0x90
    [  214.333957]  [<c126ef4c>] bus_remove_driver+0x6c/0xe0
    [  214.333957]  [<c1270120>] driver_unregister+0x40/0x70
    [  214.333957]  [<d083686b>] ssb_driver_unregister+0xb/0x10 [ssb]
    [  214.333957]  [<d087c488>] b43legacy_exit+0xd/0xf [b43legacy]
    [  214.333957]  [<c1089dde>] sys_delete_module+0x14e/0x2b0
    [  214.333957]  [<c110a4a7>] ? vfs_write+0xf7/0x150
    [  214.333957]  [<c1240050>] ? tty_write_lock+0x50/0x50
    [  214.333957]  [<c110a6f8>] ? sys_write+0x38/0x70
    [  214.333957]  [<c1397c55>] syscall_call+0x7/0xb
    [  214.333957] Code: bc 27 00 00 00 00 a1 74 61 56 c1 55 89 e5 e8 a3 fc ff ff 5d c3 90 55 89 e5 57 56 89 c6 53 b8 40 ac 62 c1 83 ec 14 e8 bb b7 34 00 <8b> 46 4c 8d 50 01 85 c0 89 56 4c 75 03 83 0e 40 80 05 40 ac 62
    [  214.333957] EIP: [<c104c395>] drain_workqueue+0x15/0x170 SS:ESP 0068:cd767e5c
    [  214.333957] CR2: 000000000000004c
    [  214.341110] ---[ end trace c7e90ec026d875a6 ]---Index: wireless-testing/drivers/net/wireless/b43legacy/main.c

    The problem is fixed by making certain that the ucode pointer is not NULL
    before deregistering the driver in mac80211.

    Signed-off-by: Larry Finger <[email protected]>
    Signed-off-by: John W. Linville <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d482e8f
Author: Flavio Leitner <[email protected]>
Date:   Fri Sep 21 21:04:34 2012 -0300

    serial: set correct baud_base for EXSYS EX-41092 Dual 16950

    commit 26e8220 upstream.

    Apparently the same card model has two IDs, so this patch
    complements the commit 39aced6
    adding the missing one.

    Signed-off-by: Flavio Leitner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit f580d51
Author: Linus Walleij <[email protected]>
Date:   Wed Sep 26 17:21:36 2012 +0200

    serial: pl011: handle corruption at high clock speeds

    commit c5dd553 upstream.

    This works around a few glitches in the ST version of the PL011
    serial driver when using very high baud rates, as we do in the
    Ux500: 3, 3.25, 4 and 4.05 Mbps.

    Problem Observed/rootcause:

    When using high baud-rates, and the baudrate*8 is getting close to
    the provided clock frequency (so a division factor close to 1), when
    using bursts of characters (so they are abutted), then it seems as if
    there is not enough time to detect the beginning of the start-bit which
    is a timing reference for the entire character, and thus the sampling
    moment of character bits is moving towards the end of each bit, instead
    of the middle.

    Fix:
    Increase slightly the RX baud rate of the UART above the theoretical
    baudrate by 5%. This will definitely give more margin time to the
    UART_RX to correctly sample the data at the middle of the bit period.

    Also fix the ages old copy-paste error in the very stressed comment,
    it's referencing the registers used in the PL010 driver rather than
    the PL011 ones.

    Signed-off-by: Guillaume Jaunet <[email protected]>
    Signed-off-by: Christophe Arnal <[email protected]>
    Signed-off-by: Matthias Locher <[email protected]>
    Signed-off-by: Rajanikanth HV <[email protected]>
    Cc: Bibek Basu <[email protected]>
    Cc: Par-Gunnar Hjalmdahl <[email protected]>
    Signed-off-by: Linus Walleij <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 63959b0
Author: Jiri Slaby <[email protected]>
Date:   Tue Aug 7 21:47:39 2012 +0200

    TTY: ttyprintk, don't touch behind tty->write_buf

    commit ee8b593 upstream.

    If a user provides a buffer larger than a tty->write_buf chunk and
    passes '\r' at the end of the buffer, we touch an out-of-bound memory.

    Add a check there to prevent this.

    Signed-off-by: Jiri Slaby <[email protected]>
    Cc: Samo Pogacnik <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 0950902
Author: Stanislav Kozina <[email protected]>
Date:   Thu Aug 16 12:01:47 2012 +0100

    Remove BUG_ON from n_tty_read()

    commit e9490e9 upstream.

    Change the BUG_ON to WARN_ON and return in case of tty->read_buf==NULL. We want to track a
    couple of long standing reports of this but at the same time we can avoid killing the box.

    Signed-off-by: Stanislav Kozina <[email protected]>
    Signed-off-by: Alan Cox <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 8455d77
Author: Ian Abbott <[email protected]>
Date:   Wed Sep 19 19:37:39 2012 +0100

    staging: comedi: fix memory leak for saved channel list

    commit c8cad4c upstream.

    When `do_cmd_ioctl()` allocates memory for the kernel copy of a channel
    list, it frees any previously allocated channel list in
    `async->cmd.chanlist` and replaces it with the new one.  However, if the
    device is ever removed (or "detached") the cleanup code in
    `cleanup_device()` in "drivers.c" does not free this memory so it is
    lost.

    A sensible place to free the kernel copy of the channel list is in
    `do_become_nonbusy()` as at that point the comedi asynchronous command
    associated with the channel list is no longer valid.  Free the channel
    list in `do_become_nonbusy()` instead of `do_cmd_ioctl()` and clear the
    pointer to prevent it being freed more than once.

    Note that `cleanup_device()` could be called at an inappropriate time
    while the comedi device is open, but that's a separate bug not related
    to this this patch.

    Signed-off-by: Ian Abbott <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 03acba6
Author: Ian Abbott <[email protected]>
Date:   Tue Sep 18 19:46:58 2012 +0100

    staging: comedi: don't dereference user memory for INSN_INTTRIG

    commit 5d06e3d upstream.

    `parse_insn()` is dereferencing the user-space pointer `insn->data`
    directly when handling the `INSN_INTTRIG` comedi instruction.  It
    shouldn't be using `insn->data` at all; it should be using the separate
    `data` pointer passed to the function.  Fix it.

    Signed-off-by: Ian Abbott <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e451b6d
Author: Ian Abbott <[email protected]>
Date:   Thu Sep 27 17:45:27 2012 +0100

    staging: comedi: jr3_pci: fix iomem dereference

    commit e187895 upstream.

    Correct a direct dereference of I/O memory to use an appropriate I/O
    memory access function.  Note that the pointer being dereferenced is not
    currently tagged with `__iomem` but I plan to correct that for 3.7.

    Signed-off-by: Ian Abbott <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 99f7fee
Author: Ian Abbott <[email protected]>
Date:   Mon Sep 24 17:20:52 2012 +0100

    staging: comedi: s626: don't dereference insn->data

    commit b655c2c upstream.

    `s626_enc_insn_config()` is incorrectly dereferencing `insn->data` which
    is a pointer to user memory.  It should be dereferencing the separate
    `data` parameter that points to a copy of the data in kernel memory.

    Signed-off-by: Ian Abbott <[email protected]>
    Reviewed-by: H Hartley Sweeten <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit bf26fa2
Author: Ben Hutchings <[email protected]>
Date:   Sun Sep 16 04:18:50 2012 +0100

    staging: speakup_soft: Fix reading of init string

    commit 40fe4f8 upstream.

    softsynth_read() reads a character at a time from the init string;
    when it finds the null terminator it sets the initialized flag but
    then repeats the last character.

    Additionally, if the read() buffer is not big enough for the init
    string, the next read() will start reading from the beginning again.
    So the caller may never progress to reading anything else.

    Replace the simple initialized flag with the current position in
    the init string, carried over between calls.  Switch to reading
    real data once this reaches the null terminator.

    (This assumes that the length of the init string can't change, which
    seems to be the case.  Really, the string and position belong together
    in a per-file private struct.)

    Tested-by: Samuel Thibault <[email protected]>
    Signed-off-by: Ben Hutchings <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit bd6a0fa
Author: Bjørn Mork <[email protected]>
Date:   Wed Sep 19 22:02:03 2012 +0200

    USB: qcaux: add Pantech vendor class match

    commit c638eb2 upstream.

    The three Pantech devices UML190 (106c:3716), UML290 (106c:3718) and
    P4200 (106c:3721) all use the same subclasses to identify vendor
    specific functions.  Replace the existing device specific entries
    with generic vendor matching, adding support for the P4200.

    Signed-off-by: Bjørn Mork <[email protected]>
    Cc: Thomas Schäfer <[email protected]>
    Acked-by: Dan Williams <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 3f72cbc
Author: Antonio Ospite <[email protected]>
Date:   Sun Sep 23 09:57:25 2012 +0200

    USB: ftdi_sio: add TIAO USB Multi-Protocol Adapter (TUMPA) support

    commit 54575b0 upstream.

    TIAO/DIYGADGET USB Multi-Protocol Adapter (TUMPA) is an FTDI FT2232H
    based device which provides an easily accessible JTAG, SPI, I2C, serial
    breakout.

    http://www.diygadget.com/tiao-usb-multi-protocol-adapter-jtag-spi-i2c-serial.html
    http://www.tiaowiki.com/w/TIAO_USB_Multi_Protocol_Adapter_User%27s_Manual

    FTDI FT2232H provides two serial channels (A and B), but on the TUMPA
    channel A is dedicated to JTAG/SPI while channel B can be used for
    UART/RS-232: use the ftdi_jtag_quirk to expose only channel B as
    a usb-serial interface to userspace.

    Signed-off-by: Antonio Ospite <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 952c5d8
Author: Bjørn Mork <[email protected]>
Date:   Wed Sep 19 22:02:12 2012 +0200

    USB: option: blacklist QMI interface on ZTE MF683

    commit 160c942 upstream.

    Interface #5 on ZTE MF683 is a QMI/wwan interface.

    Signed-off-by: Bjørn Mork <[email protected]>
    Cc: Shawn J. Goff <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7da444a
Author: Mike Snitzer <[email protected]>
Date:   Wed Sep 26 23:45:42 2012 +0100

    dm: handle requests beyond end of device instead of using BUG_ON

    commit ba1cbad upstream.

    The access beyond the end of device BUG_ON that was introduced to
    dm_request_fn via commit 29e4013 ("dm: implement
    REQ_FLUSH/FUA support for request-based dm") was an overly
    drastic (but simple) response to this situation.

    I have received a report that this BUG_ON was hit and now think
    it would be better to use dm_kill_unmapped_request() to fail the clone
    and original request with -EIO.

    map_request() will assign the valid target returned by
    dm_table_find_target to tio->ti.  But when the target
    isn't valid tio->ti is never assigned (because map_request isn't
    called); so add a check for tio->ti != NULL to dm_done().

    Reported-by: Mike Christie <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Jun'ichi Nomura <[email protected]>
    Signed-off-by: Alasdair G Kergon <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d2212d2
Author: Miklos Szeredi <[email protected]>
Date:   Mon Sep 17 22:23:30 2012 +0200

    vfs: dcache: fix deadlock in tree traversal

    commit 8110e16 upstream.

    IBM reported a deadlock in select_parent().  This was found to be caused
    by taking rename_lock when already locked when restarting the tree
    traversal.

    There are two cases when the traversal needs to be restarted:

     1) concurrent d_move(); this can only happen when not already locked,
        since taking rename_lock protects against concurrent d_move().

     2) racing with final d_put() on child just at the moment of ascending
        to parent; rename_lock doesn't protect against this rare race, so it
        can happen when already locked.

    Because of case 2, we need to be able to handle restarting the traversal
    when rename_lock is already held.  This patch fixes all three callers of
    try_to_ascend().

    IBM reported that the deadlock is gone with this patch.

    [ I rewrote the patch to be smaller and just do the "goto again" if the
      lock was already held, but credit goes to Miklos for the real work.
       - Linus ]

    Signed-off-by: Miklos Szeredi <[email protected]>
    Cc: Al Viro <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
synergydev referenced this issue in KangBangKreations/KangBanged-7x30 Oct 8, 2012
3.0.45 ChangeLog:
commit 24e842a
Author: Greg Kroah-Hartman <[email protected]>
Date:   Sun Oct 7 08:28:29 2012 -0700

    Linux 3.0.45

commit d71df54
Author: Bart Van Assche <[email protected]>
Date:   Fri Aug 24 09:08:41 2012 +0000

    SCSI: scsi_dh_alua: Enable STPG for unavailable ports

    commit e47f897 upstream.

    A quote from SPC-4: "While in the unavailable primary target port
    asymmetric access state, the device server shall support those of
    the following commands that it supports while in the active/optimized
    state: [ ... ] d) SET TARGET PORT GROUPS; [ ... ]". Hence enable
    sending STPG to a target port group that is in the unavailable state.

    Signed-off-by: Bart Van Assche <[email protected]>
    Reviewed-by: Mike Christie <[email protected]>
    Acked-by: Hannes Reinecke <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 8fda079
Author: Dan Williams <[email protected]>
Date:   Tue Aug 28 22:12:10 2012 -0700

    SCSI: scsi_remove_target: fix softlockup regression on hot remove

    commit bc3f02a upstream.

    John reports:
     BUG: soft lockup - CPU#2 stuck for 23s! [kworker/u:8:2202]
     [..]
     Call Trace:
      [<ffffffff8141782a>] scsi_remove_target+0xda/0x1f0
      [<ffffffff81421de5>] sas_rphy_remove+0x55/0x60
      [<ffffffff81421e01>] sas_rphy_delete+0x11/0x20
      [<ffffffff81421e35>] sas_port_delete+0x25/0x160
      [<ffffffff814549a3>] mptsas_del_end_device+0x183/0x270

    ...introduced by commit 3b661a9 "[SCSI] fix hot unplug vs async scan race".

    Don't restart lookup of more stargets in the multi-target case, just
    arrange to traverse the list once, on the assumption that new targets
    are always added at the end.  There is no guarantee that the target will
    change state in scsi_target_reap() so we can end up spinning if we
    restart.

    Acked-by: Jack Wang <[email protected]>
    LKML-Reference: <CAEhu1-6wq1YsNiscGMwP4ud0Q+MrViRzv=kcWCQSBNc8c68N5Q@mail.gmail.com>
    Reported-by: John Drescher <[email protected]>
    Tested-by: John Drescher <[email protected]>
    Signed-off-by: Dan Williams <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit fc3ef18
Author: Yinghai Lu <[email protected]>
Date:   Mon Jul 25 13:08:38 2011 -0700

    PCI: honor child buses add_size in hot plug configuration

    commit be76891 upstream.

    git commit c8adf9a
        "PCI: pre-allocate additional resources to devices only after
    	successful allocation of essential resources."

    fails to take into consideration the optional-resources needed by children
    devices while calculating the optional-resource needed by the bridge.

    This can be a problem on some setup. For example, if a hotplug bridge has 8
    children hotplug bridges, the bridge should have enough resources to accomodate
    the hotplug requirements for each of its children hotplug bridges.  Currently
    this is not the case.

    This patch fixes the problem.

    Signed-off-by: Yinghai Lu <[email protected]>
    Reviewed-by: Ram Pai <[email protected]>
    Signed-off-by: Jesse Barnes <[email protected]>
    Cc: Andrew Worsley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 368d531
Author: Avi Kivity <[email protected]>
Date:   Wed Aug 22 13:03:48 2012 +0300

    x86/alternatives: Fix p6 nops on non-modular kernels

    commit cb09cad upstream.

    Probably a leftover from the early days of self-patching, p6nops
    are marked __initconst_or_module, which causes them to be
    discarded in a non-modular kernel.  If something later triggers
    patching, it will overwrite kernel code with garbage.

    Reported-by: Tomas Racek <[email protected]>
    Signed-off-by: Avi Kivity <[email protected]>
    Cc: Michael Tokarev <[email protected]>
    Cc: Borislav Petkov <[email protected]>
    Cc: Marcelo Tosatti <[email protected]>
    Cc: [email protected]
    Cc: Anthony Liguori <[email protected]>
    Cc: H. Peter Anvin <[email protected]>
    Cc: Alan Cox <[email protected]>
    Cc: Alan Cox <[email protected]>
    Link: http://lkml.kernel.org/r/[email protected]
    Signed-off-by: Ingo Molnar <[email protected]>
    Cc: Ben Jencks <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 42cc576
Author: Dan Williams <[email protected]>
Date:   Fri Jun 22 11:31:14 2012 -0700

    isci: fix isci_pci_probe() generates warning on efi failure path

    commit 6d70a74 upstream.

    The oem parameter image embedded in the efi variable is at an offset
    from the start of the variable.  However, in the failure path we try to
    free the 'orom' pointer which is only valid when the paramaters are
    being read from the legacy option-rom space.

    Since failure to load the oem parameters is unlikely and we keep the
    memory around in the success case just defer all de-allocation to devm.

    Reported-by: Don Morris <[email protected]>
    Signed-off-by: Dan Williams <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7385895
Author: Bart Van Assche <[email protected]>
Date:   Fri Aug 24 10:29:11 2012 +0000

    IB/srp: Avoid having aborted requests hang

    commit d853667 upstream.

    We need to call scsi_done() for commands after we abort them.

    Signed-off-by: Bart Van Assche <[email protected]>
    Acked-by: David Dillow <[email protected]>
    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7846edb
Author: Bart Van Assche <[email protected]>
Date:   Fri Aug 24 10:27:54 2012 +0000

    IB/srp: Fix use-after-free in srp_reset_req()

    commit 9b796d0 upstream.

    srp_free_req() uses the scsi_cmnd structure contents to unmap
    buffers, so we must invoke srp_free_req() before we release
    ownership of that structure.

    Signed-off-by: Bart Van Assche <[email protected]>
    Acked-by: David Dillow <[email protected]>
    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 0a44207
Author: Patrick McHardy <[email protected]>
Date:   Thu Aug 30 07:01:30 2012 +0000

    IPoIB: Fix use-after-free of multicast object

    commit bea1e22 upstream.

    Fix a crash in ipoib_mcast_join_task().  (with help from Or Gerlitz)

    Commit c8c2afe ("IPoIB: Use rtnl lock/unlock when changing device
    flags") added a call to rtnl_lock() in ipoib_mcast_join_task(), which
    is run from the ipoib_workqueue, and hence the workqueue can't be
    flushed from the context of ipoib_stop().

    In the current code, ipoib_stop() (which doesn't flush the workqueue)
    calls ipoib_mcast_dev_flush(), which goes and deletes all the
    multicast entries.  This takes place without any synchronization with
    a possible running instance of ipoib_mcast_join_task() for the same
    ipoib device, leading to a crash due to NULL pointer dereference.

    Fix this by making sure that the workqueue is flushed before
    ipoib_mcast_dev_flush() is called.  To make that possible, we move the
    RTNL-lock wrapped code to ipoib_mcast_join_finish().

    Signed-off-by: Patrick McHardy <[email protected]>
    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d125a7e
Author: Wei Yongjun <[email protected]>
Date:   Fri Sep 21 15:09:47 2012 +0800

    can: mscan-mpc5xxx: fix return value check in mpc512x_can_get_clock()

    commit f61bd05 upstream.

    In case of error, the function clk_get() returns ERR_PTR()
    and never returns NULL pointer. The NULL test in the error
    handling should be replaced with IS_ERR().

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

    Signed-off-by: Wei Yongjun <[email protected]>
    Acked-by: Wolfgang Grandegger <[email protected]>
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c07ad5e
Author: Stephen M. Cameron <[email protected]>
Date:   Thu Jul 26 11:34:10 2012 -0500

    SCSI: hpsa: Use LUN reset instead of target reset

    commit 21e89af upstream.

    It turns out Smart Array logical drives do not support target
    reset and when the target reset fails, the logical drive will
    be taken off line.  Symptoms look like this:

    hpsa 0000:03:00.0: Abort request on C1:B0:T0:L0
    hpsa 0000:03:00.0: resetting device 1:0:0:0
    hpsa 0000:03:00.0: cp ffff880037c56000 is reported invalid (probably means target device no longer present)
    hpsa 0000:03:00.0: resetting device failed.
    sd 1:0:0:0: Device offlined - not ready after error recovery
    sd 1:0:0:0: rejecting I/O to offline device
    EXT3-fs error (device sdb1): read_block_bitmap:

    LUN reset is supported though, and is what we should be using.
    Target reset is also disruptive in shared SAS situations,
    for example, an external MSA1210m which does support target
    reset attached to Smart Arrays in multiple hosts -- a target
    reset from one host is disruptive to other hosts as all LUNs
    on the target will be reset and will abort all outstanding i/os
    back to all the attached hosts.  So we should use LUN reset,
    not target reset.

    Tested this with Smart Array logical drives and with tape drives.
    Not sure how this bug survived since 2009, except it must be very
    rare for a Smart Array to require more than 30s to complete a request.

    Signed-off-by: Stephen M. Cameron <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a3b1f83
Author: Benjamin Herrenschmidt <[email protected]>
Date:   Mon Jul 30 11:33:05 2012 +1000

    SCSI: ibmvscsi: Fix host config length field overflow

    commit 225c569 upstream.

    The length field in the host config packet is only 16-bit long, so
    passing it 0x10000 (64K which is our standard PAGE_SIZE) doesn't
    work and result in an empty config from the server.

    Signed-off-by: Benjamin Herrenschmidt <[email protected]>
    Acked-by: Robert Jennings <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 079c1ed
Author: Artem Bityutskiy <[email protected]>
Date:   Sat Aug 18 14:11:42 2012 +0200

    UBI: fix autoresize handling in R/O mode

    commit abb3e01 upstream.

    Currently UBI fails in autoresize when it is in R/O mode (e.g., because the
    underlying MTD device is R/O). This patch fixes the issue - we just skip
    autoresize and print a warning.

    Reported-by: Pali Rohár <[email protected]>
    Signed-off-by: Artem Bityutskiy <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e54195a
Author: Russ Gorby <[email protected]>
Date:   Mon Aug 13 13:45:30 2012 +0100

    n_gsm: memory leak in uplink error path

    commit 88ed2a6 upstream.

    Uplink (TX) network data will go through gsm_dlci_data_output_framed
    there is a bug where if memory allocation fails, the skb which
    has already been pulled off the list will be lost.

    In addition TX skbs were being processed in LIFO order

    Fixed the memory leak, and changed to FIFO order processing

    Signed-off-by: Russ Gorby <[email protected]>
    Tested-by: Kappel, LaurentX <[email protected]>
    Signed-off-by: Alan Cox <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a4e92d2
Author: Michael Spang <[email protected]>
Date:   Fri Sep 14 13:05:49 2012 -0400

    Increase XHCI suspend timeout to 16ms

    commit a6e097d upstream.

    The Intel XHCI specification says that after clearing the run/stop bit
    the controller may take up to 16ms to halt. We've seen a device take
    14ms, which with the current timeout of 10ms causes the kernel to
    abort the suspend. Increasing the timeout to the recommended value
    fixes the problem.

    This patch should be backported to kernels as old as 2.6.37, that
    contain the commit 5535b1d "USB: xHCI:
    PCI power management implementation".

    Signed-off-by: Michael Spang <[email protected]>
    Signed-off-by: Sarah Sharp <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7c36d46
Author: Denys Vlasenko <[email protected]>
Date:   Wed Sep 26 11:34:50 2012 +1000

    coredump: prevent double-free on an error path in core dumper

    commit f34f9d1 upstream.

    In !CORE_DUMP_USE_REGSET case, if elf_note_info_init fails to allocate
    memory for info->fields, it frees already allocated stuff and returns
    error to its caller, fill_note_info.  Which in turn returns error to its
    caller, elf_core_dump.  Which jumps to cleanup label and calls
    free_note_info, which will happily try to free all info->fields again.
    BOOM.

    This is the fix.

    Signed-off-by: Oleg Nesterov <[email protected]>
    Signed-off-by: Denys Vlasenko <[email protected]>
    Cc: Venu Byravarasu <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 9ce5f86
Author: Russ Gorby <[email protected]>
Date:   Mon Aug 13 13:44:40 2012 +0100

    n_gsm: added interlocking for gsm_data_lock for certain code paths

    commit 5e44708 upstream.

    There were some locking holes in the management of the MUX's
    message queue for 2 code paths:
    1) gsmld_write_wakeup
    2) receipt of CMD_FCON flow-control message
    In both cases gsm_data_kick is called w/o locking so it can collide
    with other other instances of gsm_data_kick (pulling messages tx_tail)
    or potentially other instances of __gsm_data_queu (adding messages to tx_head)

    Changed to take the tx_lock in these 2 cases

    Signed-off-by: Russ Gorby <[email protected]>
    Tested-by: Yin, Fengwei <[email protected]>
    Signed-off-by: Alan Cox <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 9c1ce83
Author: Sarah Sharp <[email protected]>
Date:   Wed Sep 19 16:27:26 2012 -0700

    xhci: Intel Panther Point BEI quirk.

    commit 80fab3b upstream.

    When a device with an isochronous endpoint is behind a hub plugged into
    the Intel Panther Point xHCI host controller, and the driver submits
    multiple frames per URB, the xHCI driver will set the Block Event
    Interrupt (BEI) flag on all but the last TD for the URB.  This causes
    the host controller to place an event on the event ring, but not send an
    interrupt.  When the last TD for the URB completes, BEI is cleared, and
    we get an interrupt for the whole URB.

    However, under a Panther Point xHCI host controller, if the parent hub
    is unplugged when one or more events from transfers with BEI set are on
    the event ring, a port status change event is placed on the event ring,
    but no interrupt is generated.  This means URBs stop completing, and the
    USB device disconnect is not noticed.  Something like a USB headset will
    cause mplayer to hang when the device is disconnected.

    If another transfer is sent (such as running `sudo lsusb -v`), the next
    transfer event seems to "unstick" the event ring, the xHCI driver gets
    an interrupt, and the disconnect is reported to the USB core.

    The fix is not to use the BEI flag under the Panther Point xHCI host.
    This will impact power consumption and system responsiveness, because
    the xHCI driver will receive an interrupt for every frame in all
    isochronous URBs instead of once per URB.

    Intel chipset developers confirm that this bug will be hit if the BEI
    flag is used on any endpoint, not just ones that are behind a hub.

    This patch should be backported to kernels as old as 3.0, that contain
    the commit 69e848c "Intel xhci: Support
    EHCI/xHCI port switching."

    Signed-off-by: Sarah Sharp <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c19d52a
Author: Khalid Aziz <[email protected]>
Date:   Mon Sep 10 12:52:42 2012 -0600

    firmware: Add missing attributes to EFI variable attribute print out from sysfs

    commit 7083909 upstream.

    Some of the EFI variable attributes are missing from print out from
    /sys/firmware/efi/vars/*/attributes. This patch adds those in. It also
    updates code to use pre-defined constants for masking current value
    of attributes.

    Signed-off-by: Khalid Aziz <[email protected]>
    Reviewed-by: Kees Cook <[email protected]>
    Acked-by: Matthew Garrett <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit f39a3e8
Author: Larry Finger <[email protected]>
Date:   Wed Sep 26 12:32:02 2012 -0500

    b43legacy: Fix crash on unload when firmware not available

    commit 2d838bb upstream.

    When b43legacy is loaded without the firmware being available, a following
    unload generates a kernel NULL pointer dereference BUG as follows:

    [  214.330789] BUG: unable to handle kernel NULL pointer dereference at 0000004c
    [  214.330997] IP: [<c104c395>] drain_workqueue+0x15/0x170
    [  214.331179] *pde = 00000000
    [  214.331311] Oops: 0000 [#1] SMP
    [  214.331471] Modules linked in: b43legacy(-) ssb pcmcia mac80211 cfg80211 af_packet mperf arc4 ppdev sr_mod cdrom sg shpchp yenta_socket pcmcia_rsrc pci_hotplug pcmcia_core battery parport_pc parport floppy container ac button edd autofs4 ohci_hcd ehci_hcd usbcore usb_common thermal processor scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc scsi_dh_alua scsi_dh fan thermal_sys hwmon ata_generic pata_ali libata [last unloaded: cfg80211]
    [  214.333421] Pid: 3639, comm: modprobe Not tainted 3.6.0-rc6-wl+ #163 Source Technology VIC 9921/ALI Based Notebook
    [  214.333580] EIP: 0060:[<c104c395>] EFLAGS: 00010246 CPU: 0
    [  214.333687] EIP is at drain_workqueue+0x15/0x170
    [  214.333788] EAX: c162ac40 EBX: cdfb8360 ECX: 0000002a EDX: 00002a2a
    [  214.333890] ESI: 00000000 EDI: 00000000 EBP: cd767e7c ESP: cd767e5c
    [  214.333957]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
    [  214.333957] CR0: 8005003b CR2: 0000004c CR3: 0c96a000 CR4: 00000090
    [  214.333957] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
    [  214.333957] DR6: ffff0ff0 DR7: 00000400
    [  214.333957] Process modprobe (pid: 3639, ti=cd766000 task=cf802e90 task.ti=cd766000)
    [  214.333957] Stack:
    [  214.333957]  00000292 cd767e74 c12c5e09 00000296 00000296 cdfb8360 cdfb9220 00000000
    [  214.333957]  cd767e90 c104c4fd cdfb8360 cdfb9220 cd682800 cd767ea4 d0c10184 cd682800
    [  214.333957]  cd767ea4 cba31064 cd767eb8 d0867908 cba31064 d087e09c cd96f034 cd767ec4
    [  214.333957] Call Trace:
    [  214.333957]  [<c12c5e09>] ? skb_dequeue+0x49/0x60
    [  214.333957]  [<c104c4fd>] destroy_workqueue+0xd/0x150
    [  214.333957]  [<d0c10184>] ieee80211_unregister_hw+0xc4/0x100 [mac80211]
    [  214.333957]  [<d0867908>] b43legacy_remove+0x78/0x80 [b43legacy]
    [  214.333957]  [<d083654d>] ssb_device_remove+0x1d/0x30 [ssb]
    [  214.333957]  [<c126f15a>] __device_release_driver+0x5a/0xb0
    [  214.333957]  [<c126fb07>] driver_detach+0x87/0x90
    [  214.333957]  [<c126ef4c>] bus_remove_driver+0x6c/0xe0
    [  214.333957]  [<c1270120>] driver_unregister+0x40/0x70
    [  214.333957]  [<d083686b>] ssb_driver_unregister+0xb/0x10 [ssb]
    [  214.333957]  [<d087c488>] b43legacy_exit+0xd/0xf [b43legacy]
    [  214.333957]  [<c1089dde>] sys_delete_module+0x14e/0x2b0
    [  214.333957]  [<c110a4a7>] ? vfs_write+0xf7/0x150
    [  214.333957]  [<c1240050>] ? tty_write_lock+0x50/0x50
    [  214.333957]  [<c110a6f8>] ? sys_write+0x38/0x70
    [  214.333957]  [<c1397c55>] syscall_call+0x7/0xb
    [  214.333957] Code: bc 27 00 00 00 00 a1 74 61 56 c1 55 89 e5 e8 a3 fc ff ff 5d c3 90 55 89 e5 57 56 89 c6 53 b8 40 ac 62 c1 83 ec 14 e8 bb b7 34 00 <8b> 46 4c 8d 50 01 85 c0 89 56 4c 75 03 83 0e 40 80 05 40 ac 62
    [  214.333957] EIP: [<c104c395>] drain_workqueue+0x15/0x170 SS:ESP 0068:cd767e5c
    [  214.333957] CR2: 000000000000004c
    [  214.341110] ---[ end trace c7e90ec026d875a6 ]---Index: wireless-testing/drivers/net/wireless/b43legacy/main.c

    The problem is fixed by making certain that the ucode pointer is not NULL
    before deregistering the driver in mac80211.

    Signed-off-by: Larry Finger <[email protected]>
    Signed-off-by: John W. Linville <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d482e8f
Author: Flavio Leitner <[email protected]>
Date:   Fri Sep 21 21:04:34 2012 -0300

    serial: set correct baud_base for EXSYS EX-41092 Dual 16950

    commit 26e8220 upstream.

    Apparently the same card model has two IDs, so this patch
    complements the commit 39aced6
    adding the missing one.

    Signed-off-by: Flavio Leitner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit f580d51
Author: Linus Walleij <[email protected]>
Date:   Wed Sep 26 17:21:36 2012 +0200

    serial: pl011: handle corruption at high clock speeds

    commit c5dd553 upstream.

    This works around a few glitches in the ST version of the PL011
    serial driver when using very high baud rates, as we do in the
    Ux500: 3, 3.25, 4 and 4.05 Mbps.

    Problem Observed/rootcause:

    When using high baud-rates, and the baudrate*8 is getting close to
    the provided clock frequency (so a division factor close to 1), when
    using bursts of characters (so they are abutted), then it seems as if
    there is not enough time to detect the beginning of the start-bit which
    is a timing reference for the entire character, and thus the sampling
    moment of character bits is moving towards the end of each bit, instead
    of the middle.

    Fix:
    Increase slightly the RX baud rate of the UART above the theoretical
    baudrate by 5%. This will definitely give more margin time to the
    UART_RX to correctly sample the data at the middle of the bit period.

    Also fix the ages old copy-paste error in the very stressed comment,
    it's referencing the registers used in the PL010 driver rather than
    the PL011 ones.

    Signed-off-by: Guillaume Jaunet <[email protected]>
    Signed-off-by: Christophe Arnal <[email protected]>
    Signed-off-by: Matthias Locher <[email protected]>
    Signed-off-by: Rajanikanth HV <[email protected]>
    Cc: Bibek Basu <[email protected]>
    Cc: Par-Gunnar Hjalmdahl <[email protected]>
    Signed-off-by: Linus Walleij <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 63959b0
Author: Jiri Slaby <[email protected]>
Date:   Tue Aug 7 21:47:39 2012 +0200

    TTY: ttyprintk, don't touch behind tty->write_buf

    commit ee8b593 upstream.

    If a user provides a buffer larger than a tty->write_buf chunk and
    passes '\r' at the end of the buffer, we touch an out-of-bound memory.

    Add a check there to prevent this.

    Signed-off-by: Jiri Slaby <[email protected]>
    Cc: Samo Pogacnik <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 0950902
Author: Stanislav Kozina <[email protected]>
Date:   Thu Aug 16 12:01:47 2012 +0100

    Remove BUG_ON from n_tty_read()

    commit e9490e9 upstream.

    Change the BUG_ON to WARN_ON and return in case of tty->read_buf==NULL. We want to track a
    couple of long standing reports of this but at the same time we can avoid killing the box.

    Signed-off-by: Stanislav Kozina <[email protected]>
    Signed-off-by: Alan Cox <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 8455d77
Author: Ian Abbott <[email protected]>
Date:   Wed Sep 19 19:37:39 2012 +0100

    staging: comedi: fix memory leak for saved channel list

    commit c8cad4c upstream.

    When `do_cmd_ioctl()` allocates memory for the kernel copy of a channel
    list, it frees any previously allocated channel list in
    `async->cmd.chanlist` and replaces it with the new one.  However, if the
    device is ever removed (or "detached") the cleanup code in
    `cleanup_device()` in "drivers.c" does not free this memory so it is
    lost.

    A sensible place to free the kernel copy of the channel list is in
    `do_become_nonbusy()` as at that point the comedi asynchronous command
    associated with the channel list is no longer valid.  Free the channel
    list in `do_become_nonbusy()` instead of `do_cmd_ioctl()` and clear the
    pointer to prevent it being freed more than once.

    Note that `cleanup_device()` could be called at an inappropriate time
    while the comedi device is open, but that's a separate bug not related
    to this this patch.

    Signed-off-by: Ian Abbott <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 03acba6
Author: Ian Abbott <[email protected]>
Date:   Tue Sep 18 19:46:58 2012 +0100

    staging: comedi: don't dereference user memory for INSN_INTTRIG

    commit 5d06e3d upstream.

    `parse_insn()` is dereferencing the user-space pointer `insn->data`
    directly when handling the `INSN_INTTRIG` comedi instruction.  It
    shouldn't be using `insn->data` at all; it should be using the separate
    `data` pointer passed to the function.  Fix it.

    Signed-off-by: Ian Abbott <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e451b6d
Author: Ian Abbott <[email protected]>
Date:   Thu Sep 27 17:45:27 2012 +0100

    staging: comedi: jr3_pci: fix iomem dereference

    commit e187895 upstream.

    Correct a direct dereference of I/O memory to use an appropriate I/O
    memory access function.  Note that the pointer being dereferenced is not
    currently tagged with `__iomem` but I plan to correct that for 3.7.

    Signed-off-by: Ian Abbott <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 99f7fee
Author: Ian Abbott <[email protected]>
Date:   Mon Sep 24 17:20:52 2012 +0100

    staging: comedi: s626: don't dereference insn->data

    commit b655c2c upstream.

    `s626_enc_insn_config()` is incorrectly dereferencing `insn->data` which
    is a pointer to user memory.  It should be dereferencing the separate
    `data` parameter that points to a copy of the data in kernel memory.

    Signed-off-by: Ian Abbott <[email protected]>
    Reviewed-by: H Hartley Sweeten <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit bf26fa2
Author: Ben Hutchings <[email protected]>
Date:   Sun Sep 16 04:18:50 2012 +0100

    staging: speakup_soft: Fix reading of init string

    commit 40fe4f8 upstream.

    softsynth_read() reads a character at a time from the init string;
    when it finds the null terminator it sets the initialized flag but
    then repeats the last character.

    Additionally, if the read() buffer is not big enough for the init
    string, the next read() will start reading from the beginning again.
    So the caller may never progress to reading anything else.

    Replace the simple initialized flag with the current position in
    the init string, carried over between calls.  Switch to reading
    real data once this reaches the null terminator.

    (This assumes that the length of the init string can't change, which
    seems to be the case.  Really, the string and position belong together
    in a per-file private struct.)

    Tested-by: Samuel Thibault <[email protected]>
    Signed-off-by: Ben Hutchings <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit bd6a0fa
Author: Bjørn Mork <[email protected]>
Date:   Wed Sep 19 22:02:03 2012 +0200

    USB: qcaux: add Pantech vendor class match

    commit c638eb2 upstream.

    The three Pantech devices UML190 (106c:3716), UML290 (106c:3718) and
    P4200 (106c:3721) all use the same subclasses to identify vendor
    specific functions.  Replace the existing device specific entries
    with generic vendor matching, adding support for the P4200.

    Signed-off-by: Bjørn Mork <[email protected]>
    Cc: Thomas Schäfer <[email protected]>
    Acked-by: Dan Williams <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 3f72cbc
Author: Antonio Ospite <[email protected]>
Date:   Sun Sep 23 09:57:25 2012 +0200

    USB: ftdi_sio: add TIAO USB Multi-Protocol Adapter (TUMPA) support

    commit 54575b0 upstream.

    TIAO/DIYGADGET USB Multi-Protocol Adapter (TUMPA) is an FTDI FT2232H
    based device which provides an easily accessible JTAG, SPI, I2C, serial
    breakout.

    http://www.diygadget.com/tiao-usb-multi-protocol-adapter-jtag-spi-i2c-serial.html
    http://www.tiaowiki.com/w/TIAO_USB_Multi_Protocol_Adapter_User%27s_Manual

    FTDI FT2232H provides two serial channels (A and B), but on the TUMPA
    channel A is dedicated to JTAG/SPI while channel B can be used for
    UART/RS-232: use the ftdi_jtag_quirk to expose only channel B as
    a usb-serial interface to userspace.

    Signed-off-by: Antonio Ospite <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 952c5d8
Author: Bjørn Mork <[email protected]>
Date:   Wed Sep 19 22:02:12 2012 +0200

    USB: option: blacklist QMI interface on ZTE MF683

    commit 160c942 upstream.

    Interface #5 on ZTE MF683 is a QMI/wwan interface.

    Signed-off-by: Bjørn Mork <[email protected]>
    Cc: Shawn J. Goff <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7da444a
Author: Mike Snitzer <[email protected]>
Date:   Wed Sep 26 23:45:42 2012 +0100

    dm: handle requests beyond end of device instead of using BUG_ON

    commit ba1cbad upstream.

    The access beyond the end of device BUG_ON that was introduced to
    dm_request_fn via commit 29e4013 ("dm: implement
    REQ_FLUSH/FUA support for request-based dm") was an overly
    drastic (but simple) response to this situation.

    I have received a report that this BUG_ON was hit and now think
    it would be better to use dm_kill_unmapped_request() to fail the clone
    and original request with -EIO.

    map_request() will assign the valid target returned by
    dm_table_find_target to tio->ti.  But when the target
    isn't valid tio->ti is never assigned (because map_request isn't
    called); so add a check for tio->ti != NULL to dm_done().

    Reported-by: Mike Christie <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Jun'ichi Nomura <[email protected]>
    Signed-off-by: Alasdair G Kergon <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d2212d2
Author: Miklos Szeredi <[email protected]>
Date:   Mon Sep 17 22:23:30 2012 +0200

    vfs: dcache: fix deadlock in tree traversal

    commit 8110e16 upstream.

    IBM reported a deadlock in select_parent().  This was found to be caused
    by taking rename_lock when already locked when restarting the tree
    traversal.

    There are two cases when the traversal needs to be restarted:

     1) concurrent d_move(); this can only happen when not already locked,
        since taking rename_lock protects against concurrent d_move().

     2) racing with final d_put() on child just at the moment of ascending
        to parent; rename_lock doesn't protect against this rare race, so it
        can happen when already locked.

    Because of case 2, we need to be able to handle restarting the traversal
    when rename_lock is already held.  This patch fixes all three callers of
    try_to_ascend().

    IBM reported that the deadlock is gone with this patch.

    [ I rewrote the patch to be smaller and just do the "goto again" if the
      lock was already held, but credit goes to Miklos for the real work.
       - Linus ]

    Signed-off-by: Miklos Szeredi <[email protected]>
    Cc: Al Viro <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
synergydev referenced this issue in KangBangKreations/KangBanged-7x30 Oct 11, 2012
3.0.45 ChangeLog:
commit 24e842a
Author: Greg Kroah-Hartman <[email protected]>
Date:   Sun Oct 7 08:28:29 2012 -0700

    Linux 3.0.45

commit d71df54
Author: Bart Van Assche <[email protected]>
Date:   Fri Aug 24 09:08:41 2012 +0000

    SCSI: scsi_dh_alua: Enable STPG for unavailable ports

    commit e47f897 upstream.

    A quote from SPC-4: "While in the unavailable primary target port
    asymmetric access state, the device server shall support those of
    the following commands that it supports while in the active/optimized
    state: [ ... ] d) SET TARGET PORT GROUPS; [ ... ]". Hence enable
    sending STPG to a target port group that is in the unavailable state.

    Signed-off-by: Bart Van Assche <[email protected]>
    Reviewed-by: Mike Christie <[email protected]>
    Acked-by: Hannes Reinecke <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 8fda079
Author: Dan Williams <[email protected]>
Date:   Tue Aug 28 22:12:10 2012 -0700

    SCSI: scsi_remove_target: fix softlockup regression on hot remove

    commit bc3f02a upstream.

    John reports:
     BUG: soft lockup - CPU#2 stuck for 23s! [kworker/u:8:2202]
     [..]
     Call Trace:
      [<ffffffff8141782a>] scsi_remove_target+0xda/0x1f0
      [<ffffffff81421de5>] sas_rphy_remove+0x55/0x60
      [<ffffffff81421e01>] sas_rphy_delete+0x11/0x20
      [<ffffffff81421e35>] sas_port_delete+0x25/0x160
      [<ffffffff814549a3>] mptsas_del_end_device+0x183/0x270

    ...introduced by commit 3b661a9 "[SCSI] fix hot unplug vs async scan race".

    Don't restart lookup of more stargets in the multi-target case, just
    arrange to traverse the list once, on the assumption that new targets
    are always added at the end.  There is no guarantee that the target will
    change state in scsi_target_reap() so we can end up spinning if we
    restart.

    Acked-by: Jack Wang <[email protected]>
    LKML-Reference: <CAEhu1-6wq1YsNiscGMwP4ud0Q+MrViRzv=kcWCQSBNc8c68N5Q@mail.gmail.com>
    Reported-by: John Drescher <[email protected]>
    Tested-by: John Drescher <[email protected]>
    Signed-off-by: Dan Williams <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit fc3ef18
Author: Yinghai Lu <[email protected]>
Date:   Mon Jul 25 13:08:38 2011 -0700

    PCI: honor child buses add_size in hot plug configuration

    commit be76891 upstream.

    git commit c8adf9a
        "PCI: pre-allocate additional resources to devices only after
    	successful allocation of essential resources."

    fails to take into consideration the optional-resources needed by children
    devices while calculating the optional-resource needed by the bridge.

    This can be a problem on some setup. For example, if a hotplug bridge has 8
    children hotplug bridges, the bridge should have enough resources to accomodate
    the hotplug requirements for each of its children hotplug bridges.  Currently
    this is not the case.

    This patch fixes the problem.

    Signed-off-by: Yinghai Lu <[email protected]>
    Reviewed-by: Ram Pai <[email protected]>
    Signed-off-by: Jesse Barnes <[email protected]>
    Cc: Andrew Worsley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 368d531
Author: Avi Kivity <[email protected]>
Date:   Wed Aug 22 13:03:48 2012 +0300

    x86/alternatives: Fix p6 nops on non-modular kernels

    commit cb09cad upstream.

    Probably a leftover from the early days of self-patching, p6nops
    are marked __initconst_or_module, which causes them to be
    discarded in a non-modular kernel.  If something later triggers
    patching, it will overwrite kernel code with garbage.

    Reported-by: Tomas Racek <[email protected]>
    Signed-off-by: Avi Kivity <[email protected]>
    Cc: Michael Tokarev <[email protected]>
    Cc: Borislav Petkov <[email protected]>
    Cc: Marcelo Tosatti <[email protected]>
    Cc: [email protected]
    Cc: Anthony Liguori <[email protected]>
    Cc: H. Peter Anvin <[email protected]>
    Cc: Alan Cox <[email protected]>
    Cc: Alan Cox <[email protected]>
    Link: http://lkml.kernel.org/r/[email protected]
    Signed-off-by: Ingo Molnar <[email protected]>
    Cc: Ben Jencks <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 42cc576
Author: Dan Williams <[email protected]>
Date:   Fri Jun 22 11:31:14 2012 -0700

    isci: fix isci_pci_probe() generates warning on efi failure path

    commit 6d70a74 upstream.

    The oem parameter image embedded in the efi variable is at an offset
    from the start of the variable.  However, in the failure path we try to
    free the 'orom' pointer which is only valid when the paramaters are
    being read from the legacy option-rom space.

    Since failure to load the oem parameters is unlikely and we keep the
    memory around in the success case just defer all de-allocation to devm.

    Reported-by: Don Morris <[email protected]>
    Signed-off-by: Dan Williams <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7385895
Author: Bart Van Assche <[email protected]>
Date:   Fri Aug 24 10:29:11 2012 +0000

    IB/srp: Avoid having aborted requests hang

    commit d853667 upstream.

    We need to call scsi_done() for commands after we abort them.

    Signed-off-by: Bart Van Assche <[email protected]>
    Acked-by: David Dillow <[email protected]>
    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7846edb
Author: Bart Van Assche <[email protected]>
Date:   Fri Aug 24 10:27:54 2012 +0000

    IB/srp: Fix use-after-free in srp_reset_req()

    commit 9b796d0 upstream.

    srp_free_req() uses the scsi_cmnd structure contents to unmap
    buffers, so we must invoke srp_free_req() before we release
    ownership of that structure.

    Signed-off-by: Bart Van Assche <[email protected]>
    Acked-by: David Dillow <[email protected]>
    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 0a44207
Author: Patrick McHardy <[email protected]>
Date:   Thu Aug 30 07:01:30 2012 +0000

    IPoIB: Fix use-after-free of multicast object

    commit bea1e22 upstream.

    Fix a crash in ipoib_mcast_join_task().  (with help from Or Gerlitz)

    Commit c8c2afe ("IPoIB: Use rtnl lock/unlock when changing device
    flags") added a call to rtnl_lock() in ipoib_mcast_join_task(), which
    is run from the ipoib_workqueue, and hence the workqueue can't be
    flushed from the context of ipoib_stop().

    In the current code, ipoib_stop() (which doesn't flush the workqueue)
    calls ipoib_mcast_dev_flush(), which goes and deletes all the
    multicast entries.  This takes place without any synchronization with
    a possible running instance of ipoib_mcast_join_task() for the same
    ipoib device, leading to a crash due to NULL pointer dereference.

    Fix this by making sure that the workqueue is flushed before
    ipoib_mcast_dev_flush() is called.  To make that possible, we move the
    RTNL-lock wrapped code to ipoib_mcast_join_finish().

    Signed-off-by: Patrick McHardy <[email protected]>
    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d125a7e
Author: Wei Yongjun <[email protected]>
Date:   Fri Sep 21 15:09:47 2012 +0800

    can: mscan-mpc5xxx: fix return value check in mpc512x_can_get_clock()

    commit f61bd05 upstream.

    In case of error, the function clk_get() returns ERR_PTR()
    and never returns NULL pointer. The NULL test in the error
    handling should be replaced with IS_ERR().

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

    Signed-off-by: Wei Yongjun <[email protected]>
    Acked-by: Wolfgang Grandegger <[email protected]>
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c07ad5e
Author: Stephen M. Cameron <[email protected]>
Date:   Thu Jul 26 11:34:10 2012 -0500

    SCSI: hpsa: Use LUN reset instead of target reset

    commit 21e89af upstream.

    It turns out Smart Array logical drives do not support target
    reset and when the target reset fails, the logical drive will
    be taken off line.  Symptoms look like this:

    hpsa 0000:03:00.0: Abort request on C1:B0:T0:L0
    hpsa 0000:03:00.0: resetting device 1:0:0:0
    hpsa 0000:03:00.0: cp ffff880037c56000 is reported invalid (probably means target device no longer present)
    hpsa 0000:03:00.0: resetting device failed.
    sd 1:0:0:0: Device offlined - not ready after error recovery
    sd 1:0:0:0: rejecting I/O to offline device
    EXT3-fs error (device sdb1): read_block_bitmap:

    LUN reset is supported though, and is what we should be using.
    Target reset is also disruptive in shared SAS situations,
    for example, an external MSA1210m which does support target
    reset attached to Smart Arrays in multiple hosts -- a target
    reset from one host is disruptive to other hosts as all LUNs
    on the target will be reset and will abort all outstanding i/os
    back to all the attached hosts.  So we should use LUN reset,
    not target reset.

    Tested this with Smart Array logical drives and with tape drives.
    Not sure how this bug survived since 2009, except it must be very
    rare for a Smart Array to require more than 30s to complete a request.

    Signed-off-by: Stephen M. Cameron <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a3b1f83
Author: Benjamin Herrenschmidt <[email protected]>
Date:   Mon Jul 30 11:33:05 2012 +1000

    SCSI: ibmvscsi: Fix host config length field overflow

    commit 225c569 upstream.

    The length field in the host config packet is only 16-bit long, so
    passing it 0x10000 (64K which is our standard PAGE_SIZE) doesn't
    work and result in an empty config from the server.

    Signed-off-by: Benjamin Herrenschmidt <[email protected]>
    Acked-by: Robert Jennings <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 079c1ed
Author: Artem Bityutskiy <[email protected]>
Date:   Sat Aug 18 14:11:42 2012 +0200

    UBI: fix autoresize handling in R/O mode

    commit abb3e01 upstream.

    Currently UBI fails in autoresize when it is in R/O mode (e.g., because the
    underlying MTD device is R/O). This patch fixes the issue - we just skip
    autoresize and print a warning.

    Reported-by: Pali Rohár <[email protected]>
    Signed-off-by: Artem Bityutskiy <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e54195a
Author: Russ Gorby <[email protected]>
Date:   Mon Aug 13 13:45:30 2012 +0100

    n_gsm: memory leak in uplink error path

    commit 88ed2a6 upstream.

    Uplink (TX) network data will go through gsm_dlci_data_output_framed
    there is a bug where if memory allocation fails, the skb which
    has already been pulled off the list will be lost.

    In addition TX skbs were being processed in LIFO order

    Fixed the memory leak, and changed to FIFO order processing

    Signed-off-by: Russ Gorby <[email protected]>
    Tested-by: Kappel, LaurentX <[email protected]>
    Signed-off-by: Alan Cox <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a4e92d2
Author: Michael Spang <[email protected]>
Date:   Fri Sep 14 13:05:49 2012 -0400

    Increase XHCI suspend timeout to 16ms

    commit a6e097d upstream.

    The Intel XHCI specification says that after clearing the run/stop bit
    the controller may take up to 16ms to halt. We've seen a device take
    14ms, which with the current timeout of 10ms causes the kernel to
    abort the suspend. Increasing the timeout to the recommended value
    fixes the problem.

    This patch should be backported to kernels as old as 2.6.37, that
    contain the commit 5535b1d "USB: xHCI:
    PCI power management implementation".

    Signed-off-by: Michael Spang <[email protected]>
    Signed-off-by: Sarah Sharp <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7c36d46
Author: Denys Vlasenko <[email protected]>
Date:   Wed Sep 26 11:34:50 2012 +1000

    coredump: prevent double-free on an error path in core dumper

    commit f34f9d1 upstream.

    In !CORE_DUMP_USE_REGSET case, if elf_note_info_init fails to allocate
    memory for info->fields, it frees already allocated stuff and returns
    error to its caller, fill_note_info.  Which in turn returns error to its
    caller, elf_core_dump.  Which jumps to cleanup label and calls
    free_note_info, which will happily try to free all info->fields again.
    BOOM.

    This is the fix.

    Signed-off-by: Oleg Nesterov <[email protected]>
    Signed-off-by: Denys Vlasenko <[email protected]>
    Cc: Venu Byravarasu <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 9ce5f86
Author: Russ Gorby <[email protected]>
Date:   Mon Aug 13 13:44:40 2012 +0100

    n_gsm: added interlocking for gsm_data_lock for certain code paths

    commit 5e44708 upstream.

    There were some locking holes in the management of the MUX's
    message queue for 2 code paths:
    1) gsmld_write_wakeup
    2) receipt of CMD_FCON flow-control message
    In both cases gsm_data_kick is called w/o locking so it can collide
    with other other instances of gsm_data_kick (pulling messages tx_tail)
    or potentially other instances of __gsm_data_queu (adding messages to tx_head)

    Changed to take the tx_lock in these 2 cases

    Signed-off-by: Russ Gorby <[email protected]>
    Tested-by: Yin, Fengwei <[email protected]>
    Signed-off-by: Alan Cox <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 9c1ce83
Author: Sarah Sharp <[email protected]>
Date:   Wed Sep 19 16:27:26 2012 -0700

    xhci: Intel Panther Point BEI quirk.

    commit 80fab3b upstream.

    When a device with an isochronous endpoint is behind a hub plugged into
    the Intel Panther Point xHCI host controller, and the driver submits
    multiple frames per URB, the xHCI driver will set the Block Event
    Interrupt (BEI) flag on all but the last TD for the URB.  This causes
    the host controller to place an event on the event ring, but not send an
    interrupt.  When the last TD for the URB completes, BEI is cleared, and
    we get an interrupt for the whole URB.

    However, under a Panther Point xHCI host controller, if the parent hub
    is unplugged when one or more events from transfers with BEI set are on
    the event ring, a port status change event is placed on the event ring,
    but no interrupt is generated.  This means URBs stop completing, and the
    USB device disconnect is not noticed.  Something like a USB headset will
    cause mplayer to hang when the device is disconnected.

    If another transfer is sent (such as running `sudo lsusb -v`), the next
    transfer event seems to "unstick" the event ring, the xHCI driver gets
    an interrupt, and the disconnect is reported to the USB core.

    The fix is not to use the BEI flag under the Panther Point xHCI host.
    This will impact power consumption and system responsiveness, because
    the xHCI driver will receive an interrupt for every frame in all
    isochronous URBs instead of once per URB.

    Intel chipset developers confirm that this bug will be hit if the BEI
    flag is used on any endpoint, not just ones that are behind a hub.

    This patch should be backported to kernels as old as 3.0, that contain
    the commit 69e848c "Intel xhci: Support
    EHCI/xHCI port switching."

    Signed-off-by: Sarah Sharp <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c19d52a
Author: Khalid Aziz <[email protected]>
Date:   Mon Sep 10 12:52:42 2012 -0600

    firmware: Add missing attributes to EFI variable attribute print out from sysfs

    commit 7083909 upstream.

    Some of the EFI variable attributes are missing from print out from
    /sys/firmware/efi/vars/*/attributes. This patch adds those in. It also
    updates code to use pre-defined constants for masking current value
    of attributes.

    Signed-off-by: Khalid Aziz <[email protected]>
    Reviewed-by: Kees Cook <[email protected]>
    Acked-by: Matthew Garrett <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit f39a3e8
Author: Larry Finger <[email protected]>
Date:   Wed Sep 26 12:32:02 2012 -0500

    b43legacy: Fix crash on unload when firmware not available

    commit 2d838bb upstream.

    When b43legacy is loaded without the firmware being available, a following
    unload generates a kernel NULL pointer dereference BUG as follows:

    [  214.330789] BUG: unable to handle kernel NULL pointer dereference at 0000004c
    [  214.330997] IP: [<c104c395>] drain_workqueue+0x15/0x170
    [  214.331179] *pde = 00000000
    [  214.331311] Oops: 0000 [#1] SMP
    [  214.331471] Modules linked in: b43legacy(-) ssb pcmcia mac80211 cfg80211 af_packet mperf arc4 ppdev sr_mod cdrom sg shpchp yenta_socket pcmcia_rsrc pci_hotplug pcmcia_core battery parport_pc parport floppy container ac button edd autofs4 ohci_hcd ehci_hcd usbcore usb_common thermal processor scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc scsi_dh_alua scsi_dh fan thermal_sys hwmon ata_generic pata_ali libata [last unloaded: cfg80211]
    [  214.333421] Pid: 3639, comm: modprobe Not tainted 3.6.0-rc6-wl+ #163 Source Technology VIC 9921/ALI Based Notebook
    [  214.333580] EIP: 0060:[<c104c395>] EFLAGS: 00010246 CPU: 0
    [  214.333687] EIP is at drain_workqueue+0x15/0x170
    [  214.333788] EAX: c162ac40 EBX: cdfb8360 ECX: 0000002a EDX: 00002a2a
    [  214.333890] ESI: 00000000 EDI: 00000000 EBP: cd767e7c ESP: cd767e5c
    [  214.333957]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
    [  214.333957] CR0: 8005003b CR2: 0000004c CR3: 0c96a000 CR4: 00000090
    [  214.333957] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
    [  214.333957] DR6: ffff0ff0 DR7: 00000400
    [  214.333957] Process modprobe (pid: 3639, ti=cd766000 task=cf802e90 task.ti=cd766000)
    [  214.333957] Stack:
    [  214.333957]  00000292 cd767e74 c12c5e09 00000296 00000296 cdfb8360 cdfb9220 00000000
    [  214.333957]  cd767e90 c104c4fd cdfb8360 cdfb9220 cd682800 cd767ea4 d0c10184 cd682800
    [  214.333957]  cd767ea4 cba31064 cd767eb8 d0867908 cba31064 d087e09c cd96f034 cd767ec4
    [  214.333957] Call Trace:
    [  214.333957]  [<c12c5e09>] ? skb_dequeue+0x49/0x60
    [  214.333957]  [<c104c4fd>] destroy_workqueue+0xd/0x150
    [  214.333957]  [<d0c10184>] ieee80211_unregister_hw+0xc4/0x100 [mac80211]
    [  214.333957]  [<d0867908>] b43legacy_remove+0x78/0x80 [b43legacy]
    [  214.333957]  [<d083654d>] ssb_device_remove+0x1d/0x30 [ssb]
    [  214.333957]  [<c126f15a>] __device_release_driver+0x5a/0xb0
    [  214.333957]  [<c126fb07>] driver_detach+0x87/0x90
    [  214.333957]  [<c126ef4c>] bus_remove_driver+0x6c/0xe0
    [  214.333957]  [<c1270120>] driver_unregister+0x40/0x70
    [  214.333957]  [<d083686b>] ssb_driver_unregister+0xb/0x10 [ssb]
    [  214.333957]  [<d087c488>] b43legacy_exit+0xd/0xf [b43legacy]
    [  214.333957]  [<c1089dde>] sys_delete_module+0x14e/0x2b0
    [  214.333957]  [<c110a4a7>] ? vfs_write+0xf7/0x150
    [  214.333957]  [<c1240050>] ? tty_write_lock+0x50/0x50
    [  214.333957]  [<c110a6f8>] ? sys_write+0x38/0x70
    [  214.333957]  [<c1397c55>] syscall_call+0x7/0xb
    [  214.333957] Code: bc 27 00 00 00 00 a1 74 61 56 c1 55 89 e5 e8 a3 fc ff ff 5d c3 90 55 89 e5 57 56 89 c6 53 b8 40 ac 62 c1 83 ec 14 e8 bb b7 34 00 <8b> 46 4c 8d 50 01 85 c0 89 56 4c 75 03 83 0e 40 80 05 40 ac 62
    [  214.333957] EIP: [<c104c395>] drain_workqueue+0x15/0x170 SS:ESP 0068:cd767e5c
    [  214.333957] CR2: 000000000000004c
    [  214.341110] ---[ end trace c7e90ec026d875a6 ]---Index: wireless-testing/drivers/net/wireless/b43legacy/main.c

    The problem is fixed by making certain that the ucode pointer is not NULL
    before deregistering the driver in mac80211.

    Signed-off-by: Larry Finger <[email protected]>
    Signed-off-by: John W. Linville <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d482e8f
Author: Flavio Leitner <[email protected]>
Date:   Fri Sep 21 21:04:34 2012 -0300

    serial: set correct baud_base for EXSYS EX-41092 Dual 16950

    commit 26e8220 upstream.

    Apparently the same card model has two IDs, so this patch
    complements the commit 39aced6
    adding the missing one.

    Signed-off-by: Flavio Leitner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit f580d51
Author: Linus Walleij <[email protected]>
Date:   Wed Sep 26 17:21:36 2012 +0200

    serial: pl011: handle corruption at high clock speeds

    commit c5dd553 upstream.

    This works around a few glitches in the ST version of the PL011
    serial driver when using very high baud rates, as we do in the
    Ux500: 3, 3.25, 4 and 4.05 Mbps.

    Problem Observed/rootcause:

    When using high baud-rates, and the baudrate*8 is getting close to
    the provided clock frequency (so a division factor close to 1), when
    using bursts of characters (so they are abutted), then it seems as if
    there is not enough time to detect the beginning of the start-bit which
    is a timing reference for the entire character, and thus the sampling
    moment of character bits is moving towards the end of each bit, instead
    of the middle.

    Fix:
    Increase slightly the RX baud rate of the UART above the theoretical
    baudrate by 5%. This will definitely give more margin time to the
    UART_RX to correctly sample the data at the middle of the bit period.

    Also fix the ages old copy-paste error in the very stressed comment,
    it's referencing the registers used in the PL010 driver rather than
    the PL011 ones.

    Signed-off-by: Guillaume Jaunet <[email protected]>
    Signed-off-by: Christophe Arnal <[email protected]>
    Signed-off-by: Matthias Locher <[email protected]>
    Signed-off-by: Rajanikanth HV <[email protected]>
    Cc: Bibek Basu <[email protected]>
    Cc: Par-Gunnar Hjalmdahl <[email protected]>
    Signed-off-by: Linus Walleij <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 63959b0
Author: Jiri Slaby <[email protected]>
Date:   Tue Aug 7 21:47:39 2012 +0200

    TTY: ttyprintk, don't touch behind tty->write_buf

    commit ee8b593 upstream.

    If a user provides a buffer larger than a tty->write_buf chunk and
    passes '\r' at the end of the buffer, we touch an out-of-bound memory.

    Add a check there to prevent this.

    Signed-off-by: Jiri Slaby <[email protected]>
    Cc: Samo Pogacnik <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 0950902
Author: Stanislav Kozina <[email protected]>
Date:   Thu Aug 16 12:01:47 2012 +0100

    Remove BUG_ON from n_tty_read()

    commit e9490e9 upstream.

    Change the BUG_ON to WARN_ON and return in case of tty->read_buf==NULL. We want to track a
    couple of long standing reports of this but at the same time we can avoid killing the box.

    Signed-off-by: Stanislav Kozina <[email protected]>
    Signed-off-by: Alan Cox <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 8455d77
Author: Ian Abbott <[email protected]>
Date:   Wed Sep 19 19:37:39 2012 +0100

    staging: comedi: fix memory leak for saved channel list

    commit c8cad4c upstream.

    When `do_cmd_ioctl()` allocates memory for the kernel copy of a channel
    list, it frees any previously allocated channel list in
    `async->cmd.chanlist` and replaces it with the new one.  However, if the
    device is ever removed (or "detached") the cleanup code in
    `cleanup_device()` in "drivers.c" does not free this memory so it is
    lost.

    A sensible place to free the kernel copy of the channel list is in
    `do_become_nonbusy()` as at that point the comedi asynchronous command
    associated with the channel list is no longer valid.  Free the channel
    list in `do_become_nonbusy()` instead of `do_cmd_ioctl()` and clear the
    pointer to prevent it being freed more than once.

    Note that `cleanup_device()` could be called at an inappropriate time
    while the comedi device is open, but that's a separate bug not related
    to this this patch.

    Signed-off-by: Ian Abbott <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 03acba6
Author: Ian Abbott <[email protected]>
Date:   Tue Sep 18 19:46:58 2012 +0100

    staging: comedi: don't dereference user memory for INSN_INTTRIG

    commit 5d06e3d upstream.

    `parse_insn()` is dereferencing the user-space pointer `insn->data`
    directly when handling the `INSN_INTTRIG` comedi instruction.  It
    shouldn't be using `insn->data` at all; it should be using the separate
    `data` pointer passed to the function.  Fix it.

    Signed-off-by: Ian Abbott <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e451b6d
Author: Ian Abbott <[email protected]>
Date:   Thu Sep 27 17:45:27 2012 +0100

    staging: comedi: jr3_pci: fix iomem dereference

    commit e187895 upstream.

    Correct a direct dereference of I/O memory to use an appropriate I/O
    memory access function.  Note that the pointer being dereferenced is not
    currently tagged with `__iomem` but I plan to correct that for 3.7.

    Signed-off-by: Ian Abbott <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 99f7fee
Author: Ian Abbott <[email protected]>
Date:   Mon Sep 24 17:20:52 2012 +0100

    staging: comedi: s626: don't dereference insn->data

    commit b655c2c upstream.

    `s626_enc_insn_config()` is incorrectly dereferencing `insn->data` which
    is a pointer to user memory.  It should be dereferencing the separate
    `data` parameter that points to a copy of the data in kernel memory.

    Signed-off-by: Ian Abbott <[email protected]>
    Reviewed-by: H Hartley Sweeten <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit bf26fa2
Author: Ben Hutchings <[email protected]>
Date:   Sun Sep 16 04:18:50 2012 +0100

    staging: speakup_soft: Fix reading of init string

    commit 40fe4f8 upstream.

    softsynth_read() reads a character at a time from the init string;
    when it finds the null terminator it sets the initialized flag but
    then repeats the last character.

    Additionally, if the read() buffer is not big enough for the init
    string, the next read() will start reading from the beginning again.
    So the caller may never progress to reading anything else.

    Replace the simple initialized flag with the current position in
    the init string, carried over between calls.  Switch to reading
    real data once this reaches the null terminator.

    (This assumes that the length of the init string can't change, which
    seems to be the case.  Really, the string and position belong together
    in a per-file private struct.)

    Tested-by: Samuel Thibault <[email protected]>
    Signed-off-by: Ben Hutchings <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit bd6a0fa
Author: Bjørn Mork <[email protected]>
Date:   Wed Sep 19 22:02:03 2012 +0200

    USB: qcaux: add Pantech vendor class match

    commit c638eb2 upstream.

    The three Pantech devices UML190 (106c:3716), UML290 (106c:3718) and
    P4200 (106c:3721) all use the same subclasses to identify vendor
    specific functions.  Replace the existing device specific entries
    with generic vendor matching, adding support for the P4200.

    Signed-off-by: Bjørn Mork <[email protected]>
    Cc: Thomas Schäfer <[email protected]>
    Acked-by: Dan Williams <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 3f72cbc
Author: Antonio Ospite <[email protected]>
Date:   Sun Sep 23 09:57:25 2012 +0200

    USB: ftdi_sio: add TIAO USB Multi-Protocol Adapter (TUMPA) support

    commit 54575b0 upstream.

    TIAO/DIYGADGET USB Multi-Protocol Adapter (TUMPA) is an FTDI FT2232H
    based device which provides an easily accessible JTAG, SPI, I2C, serial
    breakout.

    http://www.diygadget.com/tiao-usb-multi-protocol-adapter-jtag-spi-i2c-serial.html
    http://www.tiaowiki.com/w/TIAO_USB_Multi_Protocol_Adapter_User%27s_Manual

    FTDI FT2232H provides two serial channels (A and B), but on the TUMPA
    channel A is dedicated to JTAG/SPI while channel B can be used for
    UART/RS-232: use the ftdi_jtag_quirk to expose only channel B as
    a usb-serial interface to userspace.

    Signed-off-by: Antonio Ospite <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 952c5d8
Author: Bjørn Mork <[email protected]>
Date:   Wed Sep 19 22:02:12 2012 +0200

    USB: option: blacklist QMI interface on ZTE MF683

    commit 160c942 upstream.

    Interface #5 on ZTE MF683 is a QMI/wwan interface.

    Signed-off-by: Bjørn Mork <[email protected]>
    Cc: Shawn J. Goff <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7da444a
Author: Mike Snitzer <[email protected]>
Date:   Wed Sep 26 23:45:42 2012 +0100

    dm: handle requests beyond end of device instead of using BUG_ON

    commit ba1cbad upstream.

    The access beyond the end of device BUG_ON that was introduced to
    dm_request_fn via commit 29e4013 ("dm: implement
    REQ_FLUSH/FUA support for request-based dm") was an overly
    drastic (but simple) response to this situation.

    I have received a report that this BUG_ON was hit and now think
    it would be better to use dm_kill_unmapped_request() to fail the clone
    and original request with -EIO.

    map_request() will assign the valid target returned by
    dm_table_find_target to tio->ti.  But when the target
    isn't valid tio->ti is never assigned (because map_request isn't
    called); so add a check for tio->ti != NULL to dm_done().

    Reported-by: Mike Christie <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Jun'ichi Nomura <[email protected]>
    Signed-off-by: Alasdair G Kergon <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d2212d2
Author: Miklos Szeredi <[email protected]>
Date:   Mon Sep 17 22:23:30 2012 +0200

    vfs: dcache: fix deadlock in tree traversal

    commit 8110e16 upstream.

    IBM reported a deadlock in select_parent().  This was found to be caused
    by taking rename_lock when already locked when restarting the tree
    traversal.

    There are two cases when the traversal needs to be restarted:

     1) concurrent d_move(); this can only happen when not already locked,
        since taking rename_lock protects against concurrent d_move().

     2) racing with final d_put() on child just at the moment of ascending
        to parent; rename_lock doesn't protect against this rare race, so it
        can happen when already locked.

    Because of case 2, we need to be able to handle restarting the traversal
    when rename_lock is already held.  This patch fixes all three callers of
    try_to_ascend().

    IBM reported that the deadlock is gone with this patch.

    [ I rewrote the patch to be smaller and just do the "goto again" if the
      lock was already held, but credit goes to Miklos for the real work.
       - Linus ]

    Signed-off-by: Miklos Szeredi <[email protected]>
    Cc: Al Viro <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
synergydev referenced this issue in KangBangKreations/KangBanged-7x30 Nov 17, 2012
commit 89d2d13
Author: Greg Kroah-Hartman <[email protected]>
Date:   Sat Nov 17 13:14:48 2012 -0800

    Linux 3.0.52

commit 0933714
Author: Takashi Iwai <[email protected]>
Date:   Tue Nov 13 11:22:48 2012 +0100

    ALSA: usb-audio: Fix mutex deadlock at disconnection

    commit 10e4423 upstream.

    The recent change for USB-audio disconnection race fixes introduced a
    mutex deadlock again.  There is a circular dependency between
    chip->shutdown_rwsem and pcm->open_mutex, depicted like below, when a
    device is opened during the disconnection operation:

    A. snd_usb_audio_disconnect() ->
         card.c::register_mutex ->
           chip->shutdown_rwsem (write) ->
             snd_card_disconnect() ->
               pcm.c::register_mutex ->
                 pcm->open_mutex

    B. snd_pcm_open() ->
         pcm->open_mutex ->
           snd_usb_pcm_open() ->
             chip->shutdown_rwsem (read)

    Since the chip->shutdown_rwsem protection in the case A is required
    only for turning on the chip->shutdown flag and it doesn't have to be
    taken for the whole operation, we can reduce its window in
    snd_usb_audio_disconnect().

    Reported-by: Jiri Slaby <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit aaf238b
Author: Takashi Iwai <[email protected]>
Date:   Thu Nov 8 14:36:18 2012 +0100

    ALSA: Fix card refcount unbalance

    commit 8bb4d9c upstream.

    There are uncovered cases whether the card refcount introduced by the
    commit a0830db isn't properly increased or decreased:
    - OSS PCM and mixer success paths
    - When lookup function gets NULL

    This patch fixes these places.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50251

    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 919609d
Author: Roland Dreier <[email protected]>
Date:   Wed Jul 20 06:22:21 2011 -0700

    intel-iommu: Fix AB-BA lockdep report

    commit 3e7abe2 upstream.

    When unbinding a device so that I could pass it through to a KVM VM, I
    got the lockdep report below.  It looks like a legitimate lock
    ordering problem:

     - domain_context_mapping_one() takes iommu->lock and calls
       iommu_support_dev_iotlb(), which takes device_domain_lock (inside
       iommu->lock).

     - domain_remove_one_dev_info() starts by taking device_domain_lock
       then takes iommu->lock inside it (near the end of the function).

    So this is the classic AB-BA deadlock.  It looks like a safe fix is to
    simply release device_domain_lock a bit earlier, since as far as I can
    tell, it doesn't protect any of the stuff accessed at the end of
    domain_remove_one_dev_info() anyway.

    BTW, the use of device_domain_lock looks a bit unsafe to me... it's
    at least not obvious to me why we aren't vulnerable to the race below:

      iommu_support_dev_iotlb()
                                              domain_remove_dev_info()

      lock device_domain_lock
        find info
      unlock device_domain_lock

                                              lock device_domain_lock
                                                find same info
                                              unlock device_domain_lock

                                              free_devinfo_mem(info)

      do stuff with info after it's free

    However I don't understand the locking here well enough to know if
    this is a real problem, let alone what the best fix is.

    Anyway here's the full lockdep output that prompted all of this:

         =======================================================
         [ INFO: possible circular locking dependency detected ]
         2.6.39.1+ #1
         -------------------------------------------------------
         bash/13954 is trying to acquire lock:
          (&(&iommu->lock)->rlock){......}, at: [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230

         but task is already holding lock:
          (device_domain_lock){-.-...}, at: [<ffffffff812f6508>] domain_remove_one_dev_info+0x208/0x230

         which lock already depends on the new lock.

         the existing dependency chain (in reverse order) is:

         -> #1 (device_domain_lock){-.-...}:
                [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
                [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
                [<ffffffff812f8350>] domain_context_mapping_one+0x600/0x750
                [<ffffffff812f84df>] domain_context_mapping+0x3f/0x120
                [<ffffffff812f9175>] iommu_prepare_identity_map+0x1c5/0x1e0
                [<ffffffff81ccf1ca>] intel_iommu_init+0x88e/0xb5e
                [<ffffffff81cab204>] pci_iommu_init+0x16/0x41
                [<ffffffff81002165>] do_one_initcall+0x45/0x190
                [<ffffffff81ca3d3f>] kernel_init+0xe3/0x168
                [<ffffffff8157ac24>] kernel_thread_helper+0x4/0x10

         -> #0 (&(&iommu->lock)->rlock){......}:
                [<ffffffff8109bf3e>] __lock_acquire+0x195e/0x1e10
                [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
                [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
                [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230
                [<ffffffff812f8b42>] device_notifier+0x72/0x90
                [<ffffffff8157555c>] notifier_call_chain+0x8c/0xc0
                [<ffffffff81089768>] __blocking_notifier_call_chain+0x78/0xb0
                [<ffffffff810897b6>] blocking_notifier_call_chain+0x16/0x20
                [<ffffffff81373a5c>] __device_release_driver+0xbc/0xe0
                [<ffffffff81373ccf>] device_release_driver+0x2f/0x50
                [<ffffffff81372ee3>] driver_unbind+0xa3/0xc0
                [<ffffffff813724ac>] drv_attr_store+0x2c/0x30
                [<ffffffff811e4506>] sysfs_write_file+0xe6/0x170
                [<ffffffff8117569e>] vfs_write+0xce/0x190
                [<ffffffff811759e4>] sys_write+0x54/0xa0
                [<ffffffff81579a82>] system_call_fastpath+0x16/0x1b

         other info that might help us debug this:

         6 locks held by bash/13954:
          #0:  (&buffer->mutex){+.+.+.}, at: [<ffffffff811e4464>] sysfs_write_file+0x44/0x170
          #1:  (s_active#3){++++.+}, at: [<ffffffff811e44ed>] sysfs_write_file+0xcd/0x170
          #2:  (&__lockdep_no_validate__){+.+.+.}, at: [<ffffffff81372edb>] driver_unbind+0x9b/0xc0
          #3:  (&__lockdep_no_validate__){+.+.+.}, at: [<ffffffff81373cc7>] device_release_driver+0x27/0x50
          #4:  (&(&priv->bus_notifier)->rwsem){.+.+.+}, at: [<ffffffff8108974f>] __blocking_notifier_call_chain+0x5f/0xb0
          #5:  (device_domain_lock){-.-...}, at: [<ffffffff812f6508>] domain_remove_one_dev_info+0x208/0x230

         stack backtrace:
         Pid: 13954, comm: bash Not tainted 2.6.39.1+ #1
         Call Trace:
          [<ffffffff810993a7>] print_circular_bug+0xf7/0x100
          [<ffffffff8109bf3e>] __lock_acquire+0x195e/0x1e10
          [<ffffffff810972bd>] ? trace_hardirqs_off+0xd/0x10
          [<ffffffff8109d57d>] ? trace_hardirqs_on_caller+0x13d/0x180
          [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
          [<ffffffff812f6421>] ? domain_remove_one_dev_info+0x121/0x230
          [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
          [<ffffffff812f6421>] ? domain_remove_one_dev_info+0x121/0x230
          [<ffffffff810972bd>] ? trace_hardirqs_off+0xd/0x10
          [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230
          [<ffffffff812f8b42>] device_notifier+0x72/0x90
          [<ffffffff8157555c>] notifier_call_chain+0x8c/0xc0
          [<ffffffff81089768>] __blocking_notifier_call_chain+0x78/0xb0
          [<ffffffff810897b6>] blocking_notifier_call_chain+0x16/0x20
          [<ffffffff81373a5c>] __device_release_driver+0xbc/0xe0
          [<ffffffff81373ccf>] device_release_driver+0x2f/0x50
          [<ffffffff81372ee3>] driver_unbind+0xa3/0xc0
          [<ffffffff813724ac>] drv_attr_store+0x2c/0x30
          [<ffffffff811e4506>] sysfs_write_file+0xe6/0x170
          [<ffffffff8117569e>] vfs_write+0xce/0x190
          [<ffffffff811759e4>] sys_write+0x54/0xa0
          [<ffffffff81579a82>] system_call_fastpath+0x16/0x1b

    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: David Woodhouse <[email protected]>
    Cc: Steven Rostedt <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 11b34bb
Author: Dave Chinner <[email protected]>
Date:   Fri Nov 2 11:38:44 2012 +1100

    xfs: fix reading of wrapped log data

    commit 6ce377a upstream.

    Commit 4439647 ("xfs: reset buffer pointers before freeing them") in
    3.0-rc1 introduced a regression when recovering log buffers that
    wrapped around the end of log. The second part of the log buffer at
    the start of the physical log was being read into the header buffer
    rather than the data buffer, and hence recovery was seeing garbage
    in the data buffer when it got to the region of the log buffer that
    was incorrectly read.

    Reported-by: Torsten Kaiser <[email protected]>
    Signed-off-by: Dave Chinner <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Mark Tinguely <[email protected]>
    Signed-off-by: Ben Myers <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 87725c3
Author: Johan Hovold <[email protected]>
Date:   Thu Nov 8 18:28:59 2012 +0100

    USB: mos7840: remove unused variable

    Fix warning about unused variable introduced by commit e681b66
    ("USB: mos7840: remove invalid disconnect handling") upstream.

    A subsequent fix which removed the disconnect function got rid of the
    warning but that one was only backported to v3.6.

    Reported-by: Jiri Slaby <[email protected]>
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b7832d4
Author: Daniel Vetter <[email protected]>
Date:   Sun Oct 21 12:52:39 2012 +0200

    drm/i915: clear the entire sdvo infoframe buffer

    commit b6e0e54 upstream.

    Like in the case of native hdmi, which is fixed already in

    commit adf00b2
    Author: Paulo Zanoni <[email protected]>
    Date:   Tue Sep 25 13:23:34 2012 -0300

        drm/i915: make sure we write all the DIP data bytes

    we need to clear the entire sdvo buffer to avoid upsetting the
    display.

    Since infoframe buffer writing is now a bit more elaborate, extract it
    into it's own function. This will be useful if we ever get around to
    properly update the ELD for sdvo. Also #define proper names for the
    two buffer indexes with fixed usage.

    v2: Cite the right commit above, spotted by Paulo Zanoni.

    v3: I'm too stupid to paste the right commit.

    v4: Ben Hutchings noticed that I've failed to handle an underflow in
    my loop logic, breaking it for i >= length + 8. Since I've just lost C
    programmer license, use his solution. Also, make the frustrated 0-base
    buffer size a notch more clear.

    Reported-and-tested-by: Jürg Billeter <[email protected]>
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=25732
    Cc: Paulo Zanoni <[email protected]>
    Cc: Ben Hutchings <[email protected]>
    Reviewed-by: Rodrigo Vivi <[email protected]>
    Signed-off-by: Daniel Vetter <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 9615dee
Author: Daniel Vetter <[email protected]>
Date:   Sat May 12 20:22:00 2012 +0200

    drm/i915: fixup infoframe support for sdvo

    commit 81014b9 upstream.

    At least the worst offenders:
    - SDVO specifies that the encoder should compute the ecc. Testing also
      shows that we must not send the ecc field, so copy the dip_infoframe
      struct to a temporay place and avoid the ecc field. This way the avi
      infoframe is exactly 17 bytes long, which agrees with what the spec
      mandates as a minimal storage capacity (with the ecc field it would
      be 18 bytes).
    - Only 17 when sending the avi infoframe. The SDVO spec explicitly
      says that sending more data than what the device announces results
      in undefined behaviour.
    - Add __attribute__((packed)) to the avi and spd infoframes, for
      otherwise they're wrongly aligned. Noticed because the avi infoframe
      ended up being 18 bytes large instead of 17. We haven't noticed this
      yet because we don't use the uint16_t fields yet (which are the only
      ones that would be wrongly aligned).

    This regression has been introduce by

    3c17fe4 is the first bad commit
    commit 3c17fe4
    Author: David Härdeman <[email protected]>
    Date:   Fri Sep 24 21:44:32 2010 +0200

        i915: enable AVI infoframe for intel_hdmi.c [v4]

    Patch tested on my g33 with a sdvo hdmi adaptor.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=25732
    Tested-by: Peter Ross <[email protected]> (G35 SDVO-HDMI)
    Reviewed-by: Eugeni Dodonov <[email protected]>
    Signed-Off-by: Daniel Vetter <[email protected]>
    Cc: Ben Hutchings <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d18edec
Author: Thomas Hellstrom <[email protected]>
Date:   Fri Nov 9 10:05:57 2012 +0100

    drm/vmwgfx: Fix hibernation device reset

    commit 95e8f6a upstream.

    The device would not reset properly when resuming from hibernation.

    Signed-off-by: Thomas Hellstrom <[email protected]>
    Reviewed-by: Brian Paul <[email protected]>
    Reviewed-by: Dmitry Torokhov <[email protected]>
    Cc: [email protected]
    Signed-off-by: Dave Airlie <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 2f56580
Author: Thomas Gleixner <[email protected]>
Date:   Tue Oct 23 22:29:38 2012 +0200

    futex: Handle futex_pi OWNER_DIED take over correctly

    commit 59fa624 upstream.

    Siddhesh analyzed a failure in the take over of pi futexes in case the
    owner died and provided a workaround.
    See: http://sourceware.org/bugzilla/show_bug.cgi?id=14076

    The detailed problem analysis shows:

    Futex F is initialized with PTHREAD_PRIO_INHERIT and
    PTHREAD_MUTEX_ROBUST_NP attributes.

    T1 lock_futex_pi(F);

    T2 lock_futex_pi(F);
       --> T2 blocks on the futex and creates pi_state which is associated
           to T1.

    T1 exits
       --> exit_robust_list() runs
           --> Futex F userspace value TID field is set to 0 and
               FUTEX_OWNER_DIED bit is set.

    T3 lock_futex_pi(F);
       --> Succeeds due to the check for F's userspace TID field == 0
       --> Claims ownership of the futex and sets its own TID into the
           userspace TID field of futex F
       --> returns to user space

    T1 --> exit_pi_state_list()
           --> Transfers pi_state to waiter T2 and wakes T2 via
           	   rt_mutex_unlock(&pi_state->mutex)

    T2 --> acquires pi_state->mutex and gains real ownership of the
           pi_state
       --> Claims ownership of the futex and sets its own TID into the
           userspace TID field of futex F
       --> returns to user space

    T3 --> observes inconsistent state

    This problem is independent of UP/SMP, preemptible/non preemptible
    kernels, or process shared vs. private. The only difference is that
    certain configurations are more likely to expose it.

    So as Siddhesh correctly analyzed the following check in
    futex_lock_pi_atomic() is the culprit:

    	if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {

    We check the userspace value for a TID value of 0 and take over the
    futex unconditionally if that's true.

    AFAICT this check is there as it is correct for a different corner
    case of futexes: the WAITERS bit became stale.

    Now the proposed change

    -	if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {
    +       if (unlikely(ownerdied ||
    +                       !(curval & (FUTEX_TID_MASK | FUTEX_WAITERS)))) {

    solves the problem, but it's not obvious why and it wreckages the
    "stale WAITERS bit" case.

    What happens is, that due to the WAITERS bit being set (T2 is blocked
    on that futex) it enforces T3 to go through lookup_pi_state(), which
    in the above case returns an existing pi_state and therefor forces T3
    to legitimately fight with T2 over the ownership of the pi_state (via
    pi_state->mutex). Probelm solved!

    Though that does not work for the "WAITERS bit is stale" problem
    because if lookup_pi_state() does not find existing pi_state it
    returns -ERSCH (due to TID == 0) which causes futex_lock_pi() to
    return -ESRCH to user space because the OWNER_DIED bit is not set.

    Now there is a different solution to that problem. Do not look at the
    user space value at all and enforce a lookup of possibly available
    pi_state. If pi_state can be found, then the new incoming locker T3
    blocks on that pi_state and legitimately races with T2 to acquire the
    rt_mutex and the pi_state and therefor the proper ownership of the
    user space futex.

    lookup_pi_state() has the correct order of checks. It first tries to
    find a pi_state associated with the user space futex and only if that
    fails it checks for futex TID value = 0. If no pi_state is available
    nothing can create new state at that point because this happens with
    the hash bucket lock held.

    So the above scenario changes to:

    T1 lock_futex_pi(F);

    T2 lock_futex_pi(F);
       --> T2 blocks on the futex and creates pi_state which is associated
           to T1.

    T1 exits
       --> exit_robust_list() runs
           --> Futex F userspace value TID field is set to 0 and
               FUTEX_OWNER_DIED bit is set.

    T3 lock_futex_pi(F);
       --> Finds pi_state and blocks on pi_state->rt_mutex

    T1 --> exit_pi_state_list()
           --> Transfers pi_state to waiter T2 and wakes it via
           	   rt_mutex_unlock(&pi_state->mutex)

    T2 --> acquires pi_state->mutex and gains ownership of the pi_state
       --> Claims ownership of the futex and sets its own TID into the
           userspace TID field of futex F
       --> returns to user space

    This covers all gazillion points on which T3 might come in between
    T1's exit_robust_list() clearing the TID field and T2 fixing it up. It
    also solves the "WAITERS bit stale" problem by forcing the take over.

    Another benefit of changing the code this way is that it makes it less
    dependent on untrusted user space values and therefor minimizes the
    possible wreckage which might be inflicted.

    As usual after staring for too long at the futex code my brain hurts
    so much that I really want to ditch that whole optimization of
    avoiding the syscall for the non contended case for PI futexes and rip
    out the maze of corner case handling code. Unfortunately we can't as
    user space relies on that existing behaviour, but at least thinking
    about it helps me to preserve my mental sanity. Maybe we should
    nevertheless :)

    Reported-and-tested-by: Siddhesh Poyarekar <[email protected]>
    Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1210232138540.2756@ionos
    Acked-by: Darren Hart <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 2e570a4
Author: Hannes Frederic Sowa <[email protected]>
Date:   Tue Nov 6 16:18:41 2012 +0000

    ipv6: send unsolicited neighbour advertisements to all-nodes

    [ Upstream commit 60713a0 ]

    As documented in RFC4861 (Neighbor Discovery for IP version 6) 7.2.6.,
    unsolicited neighbour advertisements should be sent to the all-nodes
    multicast address.

    Signed-off-by: Hannes Frederic Sowa <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 5a3e425
Author: Tom Parkin <[email protected]>
Date:   Mon Oct 29 23:41:48 2012 +0000

    l2tp: fix oops in l2tp_eth_create() error path

    [ Upstream commit 7893363 ]

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

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

    Signed-off-by: Tom Parkin <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 798c7db
Author: Jesper Dangaard Brouer <[email protected]>
Date:   Wed Oct 31 02:45:32 2012 +0000

    net: fix divide by zero in tcp algorithm illinois

    [ Upstream commit 8f363b7 ]

    Reading TCP stats when using TCP Illinois congestion control algorithm
    can cause a divide by zero kernel oops.

    The division by zero occur in tcp_illinois_info() at:
     do_div(t, ca->cnt_rtt);
    where ca->cnt_rtt can become zero (when rtt_reset is called)

    Steps to Reproduce:
     1. Register tcp_illinois:
         # sysctl -w net.ipv4.tcp_congestion_control=illinois
     2. Monitor internal TCP information via command "ss -i"
         # watch -d ss -i
     3. Establish new TCP conn to machine

    Either it fails at the initial conn, or else it needs to wait
    for a loss or a reset.

    This is only related to reading stats.  The function avg_delay() also
    performs the same divide, but is guarded with a (ca->cnt_rtt > 0) at its
    calling point in update_params().  Thus, simply fix tcp_illinois_info().

    Function tcp_illinois_info() / get_info() is called without
    socket lock.  Thus, eliminate any race condition on ca->cnt_rtt
    by using a local stack variable.  Simply reuse info.tcpv_rttcnt,
    as its already set to ca->cnt_rtt.
    Function avg_delay() is not affected by this race condition, as
    its called with the socket lock.

    Cc: Petr Matousek <[email protected]>
    Signed-off-by: Jesper Dangaard Brouer <[email protected]>
    Acked-by: Eric Dumazet <[email protected]>
    Acked-by: Stephen Hemminger <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 690bfe5
Author: Hemant Kumar <[email protected]>
Date:   Thu Oct 25 18:17:54 2012 +0000

    net: usb: Fix memory leak on Tx data path

    [ Upstream commit 39707c2 ]

    Driver anchors the tx urbs and defers the urb submission if
    a transmit request comes when the interface is suspended.
    Anchoring urb increments the urb reference count. These
    deferred urbs are later accessed by calling usb_get_from_anchor()
    for submission during interface resume. usb_get_from_anchor()
    unanchors the urb but urb reference count remains same.
    This causes the urb reference count to remain non-zero
    after usb_free_urb() gets called and urb never gets freed.
    Hence call usb_put_urb() after anchoring the urb to properly
    balance the reference count for these deferred urbs. Also,
    unanchor these deferred urbs during disconnect, to free them
    up.

    Signed-off-by: Hemant Kumar <[email protected]>
    Acked-by: Oliver Neukum <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit db138ef
Author: Li RongQing <[email protected]>
Date:   Wed Oct 24 14:01:18 2012 +0800

    ipv6: Set default hoplimit as zero.

    [ Upstream commit 14edd87 ]

    Commit a02e4b7(Demark default hoplimit as zero) only changes the
    hoplimit checking condition and default value in ip6_dst_hoplimit, not
    zeros all hoplimit default value.

    Keep the zeroing ip6_template_metrics[RTAX_HOPLIMIT - 1] to force it as
    const, cause as a37e6e3(net: force dst_default_metrics to const
    section)

    Signed-off-by: Li RongQing <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 3297d60
Author: Eric Dumazet <[email protected]>
Date:   Thu Oct 18 09:14:12 2012 +0000

    tcp: fix FIONREAD/SIOCINQ

    [ Upstream commit a3374c4 ]

    tcp_ioctl() tries to take into account if tcp socket received a FIN
    to report correct number bytes in receive queue.

    But its flaky because if the application ate the last skb,
    we return 1 insteKroah-Hartman <[email protected]>

commit 4d02840
Author: Trond Myklebust <[email protected]>
Date:   Wed Aug 22 16:08:17 2012 -0400

    NFS: Fix Oopses in nfs_lookup_revalidate and nfs4_lookup_revalidate

    [Fixed upstream as part of 0b728e1, but that's a much larger patch,
    this is only the nfs portion backported as needed.]

    Fix the following Oops in 3.5.1:

     BUG: unable to handle kernel NULL pointer dereference at 0000000000000038
     IP: [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs]
     PGD 337c63067 PUD 0
     Oops: 0000 [#1] SMP
     CPU 5
     Modules linked in: nfs fscache nfsd lockd nfs_acl auth_rpcgss sunrpc af_packet binfmt_misc cpufreq_conservative cpufreq_userspace cpufreq_powersave dm_mod acpi_cpufreq mperf coretemp gpio_ich kvm_intel joydev kvm ioatdma hid_generic igb lpc_ich i7core_edac edac_core ptp serio_raw dca pcspkr i2c_i801 mfd_core sg pps_core usbhid crc32c_intel microcode button autofs4 uhci_hcd ttm drm_kms_helper drm i2c_algo_bit sysimgblt sysfillrect syscopyarea ehci_hcd usbcore usb_common scsi_dh_rdac scsi_dh_emc scsi_dh_hp_sw scsi_dh_alua scsi_dh edd fan ata_piix thermal processor thermal_sys

     Pid: 30431, comm: java Not tainted 3.5.1-2-default #1 Supermicro X8DTT/X8DTT
     RIP: 0010:[<ffffffffa03789cd>]  [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs]
     RSP: 0018:ffff8801b418bd38  EFLAGS: 00010292
     RAX: 00000000fffffff6 RBX: ffff88032016d800 RCX: 0000000000000020
     RDX: ffffffff00000000 RSI: 0000000000000000 RDI: ffff8801824a7b00
     RBP: ffff8801b418bdf8 R08: 7fffff0034323030 R09: fffffffff04c03ed
     R10: ffff8801824a7b00 R11: 0000000000000002 R12: ffff8801824a7b00
     R13: ffff8801824a7b00 R14: 0000000000000000 R15: ffff8803201725d0
     FS:  00002b53a46cb700(0000) GS:ffff88033fc20000(0000) knlGS:0000000000000000
     CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
     CR2: 0000000000000038 CR3: 000000020a426000 CR4: 00000000000007e0
     DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
     DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
     Process java (pid: 30431, threadinfo ffff8801b418a000, task ffff8801b5d20600)
     Stack:
      ffff8801b418be44 ffff88032016d800 ffff8801b418bdf8 0000000000000000
      ffff8801824a7b00 ffff8801b418bdd7 ffff8803201725d0 ffffffff8116a9c0
      ffff8801b5c38dc0 0000000000000007 ffff88032016d800 0000000000000000
     Call Trace:
      [<ffffffff8116a9c0>] lookup_dcache+0x80/0xe0
      [<ffffffff8116aa43>] __lookup_hash+0x23/0x90
      [<ffffffff8116b4a5>] lookup_one_len+0xc5/0x100
      [<ffffffffa03869a3>] nfs_sillyrename+0xe3/0x210 [nfs]
      [<ffffffff8116cadf>] vfs_unlink.part.25+0x7f/0xe0
      [<ffffffff8116f22c>] do_unlinkat+0x1ac/0x1d0
      [<ffffffff815717b9>] system_call_fastpath+0x16/0x1b
      [<00002b5348b5f527>] 0x2b5348b5f526
     Code: ec 38 b8 f6 ff ff ff 4c 89 64 24 18 4c 89 74 24 28 49 89 fc 48 89 5c 24 08 48 89 6c 24 10 49 89 f6 4c 89 6c 24 20 4c 89 7c 24 30 <f6> 46 38 40 0f 85 d1 00 00 00 e8 c4 c4 df e0 48 8b 58 30 49 89
     RIP  [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs]
      RSP <ffff8801b418bd38>
     CR2: 0000000000000038
     ---[ end trace 845113ed191985dd ]---

    This Oops affects 3.5 kernels and older, and is due to lookup_one_len()
    calling down to the dentry revalidation code with a NULL pointer
    to struct nameidata.

    It is fixed upstream by commit 0b728e1 (stop passing nameidata *
    to ->d_revalidate())

    Reported-by: Richard Ems <[email protected]>
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 095a518
Author: NeilBrown <[email protected]>
Date:   Wed Oct 31 12:16:01 2012 +1100

    NFS: fix bug in legacy DNS resolver.

    commit 8d96b10 upstream.

    The DNS resolver's use of the sunrpc cache involves a 'ttl' number
    (relatafe890f953f7f23424045cdad31d3e4
         "sunrpc: use seconds since boot in expiry cache"

    and I managed to break it.  The effect is that any TTL is interpreted
    as 0, and nothing useful gets into the cache.

    This patch removes the use of get_expiry() - which really expects an
    expiry time - and uses get_uint() instead, treating the int correctly
    as a ttl.

    This fixes a regression that has been present since 2.6.37, causing
    certain NFS accesses in certain environments to incorrectly fail.

    Reported-by: Chuck Lever <[email protected]>
    Tested-by: Chuck Lever <[email protected]>
    Signed-off-by: NeilBrown <[email protected]>
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 110d3a2
Author: J. Bruce Fields <[email protected]>
Date:   Tue Jun 12 16:54:16 2012 -0400

    nfsd: add get_uint for u32's

    commit a007c4c upstream.

    I don't think there's a practical difference for the range of values
    these interfaces should see, but it would be safer to be unambiguous.

    Signed-off-by: J. Bruce Fields <[email protected]>
    Cc: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit f354d0c
Author: Trond Myklebust <[email protected]>
Date:   Mon Oct 29 18:53:23 2012 -0400

    NFSv4: nfs4_locku_done must release the sequence id

    commit 2b1bc30 upstream.

    If the state recovery machinery is triggered by the call to
    nfs4_async_handle_error() then we can deadlock.

    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 6fbd3cd
Author: Ben Hutchings <[email protected]>
Date:   Sun Oct 21 19:23:52 2012 +0100

    nfs: Show original device name verbatim in /proc/*/mount{s,info}

    commit 97a5486 upstream.

    Since commit c7f404b ('vfs: new superblock methods to override
    /proc/*/mount{s,info}'), nfs_path() is used to generate the mounted
    device name reported back to userland.

    nfs_path() always generates a trailing slash when the given dentry is
    the root of an NFS mount, but userland may expect the original device
    name to be returned verbatim (as it used to be).  Make this
    canonicalisation optional and change the callers accordingly.

    [[email protected]: use flag instead of bool argument]
    Reported-and-tested-by: Chris Hiestand <[email protected]>
    Reference: http://bugs.debian.org/669314
    Signed-off-by: Ben Hutchings <[email protected]>
    Signed-off-by: Jonathan Nieder <[email protected]>
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e4648b1
Author: Scott Mayhew <[email protected]>
Date:   Tue Oct 16 13:22:19 2012 -0400

    nfsv3: Make v3 mounts fail with ETIMEDOUTs instead EIO on mountd timeouts

    commit acce94e upstream.

    In very busy v3 environment, rpc.mountd can respond to the NULL
    procedure but not the MNT procedure in a timely manner causing
    the MNT procedure to time out. The problem is the mount system
    call returns EIO which causes the mount to fail, instead of
    ETIMEDOUT, which would cause the mount to be retried.

    This patch sets the RPC_TASK_SOFT|RPC_TASK_TIMEOUT flags to
    the rpc_call_sync() call in nfs_mount() which causes
    ETIMEDOUT to be returned on timed out connections.

    Signed-off-by: Steve Dickson <[email protected]>
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 9c750c9
Author: Antonio Q11: fix SSID copy on IBSS JOIN

    commit badecb0 upstream.

    The 'ssid' field of the cfg80211_ibss_params is a u8 pointer and
    its length is likely to be less than IEEE80211_MAX_SSID_LEN most
    of the time.

    This patch fixes the ssid copy in ieee80211_ibss_join() by using
    the SSID length to prevent it from reading beyond the string.

    Signed-off-by: Antonio Quartulli <[email protected]>
    [rewrapped commit message, small rewording]
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 03938ad
Author: Johannes Berg <[email protected]>
Date:   Fri Oct 26 00:33:36 2012 +0200

    mac80211: check management frame header length

    commit 4a4f1a5 upstream.

    Due to pskb_may_pull() checking the skb length, all
    non-management frames are checked on input whether
    their 802.11 header is fully present. Also add that
    check for management frames and remove a check that
    is now duplicate. This prevents accessing skb data
    beyond the frame end.

    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 2dda2bb
Author: Egbert Eich <[email protected]>
Date:   Wed Oct 24 18:29:49 2012 +0200

    DRM/Radeon: Fix Load Detection on legacy primary DAC.

    commit 83325d0 upstream.

    An uninitialized variable led to broken load detection.

    Signed-off-by: Egbert Eich <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 6f8acfd
Author: Javier Cardona <[email protected]>
Date:   Thu Oct 25 11:10:18 2012 -0700

    mac80211: don't inspect Sequence Control field on control frames

    commit f7fbf70 upstream.

    Per IEEE Std. 802.11-2012, Sec 8.2.4.4.1, the sequence Control field is
    not present in control frames.  We noticed this problem when processing
    Block Ack Requests.

    Signed-off-by: Javier Cardona <[email protected]>
    Signed-off-by: Javier Lopez <[email protected]>
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 4bdd5ed
Author: Johannes Berg <[email protected]>
Date:   Thu Oct 25 21:51:59 2012 +0200

    wireless: drop invalid mesh address extension frames

    commit 7dd111e upstream.

    The mesh header can have address extension by a 4th
    or a 5th and 6th address, but never both. Drop such
    frames in 802.11 -> 802.3 conversion along with any
    frames that have the wrong extension.

    Reviewed-by: Javier Cardona <[email protected]>
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 58bca02
Author: Felix Fietkau <[email protected]>
Date:   Wed Oct 17 13:56:19 2012 +0200

    cfg80211: fix antenna gain handling

    commit c4a9faf upstream.

    No driver initializes chan->max_antenna_gain to something sensible, and
    the only place where it is being used right now is inside ath9k. This
    leads to ath9k potentially using less tx power than it can use, which can
    decrease performance/range in some rare cases.

    Rather than going through every single driver, this patch initializes
    chan->orig_mag in wiphy_register(), ignoring whatever value the driver
    left in there. If a driver for some reason wishes to limit it independent
    from regulatory rulesets, it can do so internally.

    Signed-off-by: Felix Fietkau <[email protected]>
    Signed-off-by: Johannes Berg <[email protected]>
  purestorage.com>
Date:   Wed Oct 31 09:16:44 2012 -0700

    target: Don't return success from module_init() if setup fails

    commit 0d0f9df upstream.

    If the call to core_dev_release_virtual_lun0() fails, then nothing
    sets ret to anything other than 0, so even though everything is
    torn down and freed, target_core_init_configfs() will seem to succeed
    and the module will be loaded.  Fix this by passing the return value
    on up the chain.

    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Nicholas Bellinger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 4a7dfa5
Author: Stanislaw Gruszka <[email protected]>
Date:   Thu Oct 25 09:51:39 2012 +0200

    rt2800: validate step value for temperature compensation

    commit bf7e1ab upstream.

    Some hardware has correct (!= 0xff) value of tssi_bounds[4] in the
    EEPROM, but step is equal to 0xff. This results on ridiculous delta
    calculations and completely broke TX power settings.

    Reported-and-tested-by: Pavel Lucik <[email protected]>
    Signed-off-by: Stanislaw Gruszka <[email protected]>
    Acked-by: Ivo van Doorn <[email protected]>
    Signed-off-by: John W. Linville <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a699cd3
Author: Felix Fietkau <[email protected]>
Date:   Fri Oct 26 00:31:11 2012 +0200

    ath9k: fix stale pointers potentially causing access to free'd skbs

    commit 8c6e309 upstream.

    bf->bf_next is only while buffers are chained as part of an A-MPDU
    in the tx queue. When a tid queue is flushed (e.g. on tearing down
    an aggregation session), frames can be enqueued again as normal
    transmission, without bf_next being cleared. This can lead to the
    old pointer being dereferenced again later.

    This patch might fix crashes and "Failed to stop TX DMA!" messages.

    Signed-off-by: Felix Fietkau <[email protected]>
    Signed-off-by: John W. Linville <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
Juansheng referenced this issue in Andromadus/htc7x30-3.0 Nov 18, 2012
ath9k: fix stale pointers potentially causing access to free'd skbs

commit 8c6e309 upstream.

bf->bf_next is only while buffers are chained as part of an A-MPDU
in the tx queue. When a tid queue is flushed (e.g. on tearing down
an aggregation session), frames can be enqueued again as normal
transmission, without bf_next being cleared. This can lead to the
old pointer being dereferenced again later.

This patch might fix crashes and "Failed to stop TX DMA!" messages.

Signed-off-by: Felix Fietkau <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

rt2800: validate step value for temperature compensation

commit bf7e1ab upstream.

Some hardware has correct (!= 0xff) value of tssi_bounds[4] in the
EEPROM, but step is equal to 0xff. This results on ridiculous delta
calculations and completely broke TX power settings.

Reported-and-tested-by: Pavel Lucik <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Acked-by: Ivo van Doorn <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

target: Don't return success from module_init() if setup fails

commit 0d0f9df upstream.

If the call to core_dev_release_virtual_lun0() fails, then nothing
sets ret to anything other than 0, so even though everything is
torn down and freed, target_core_init_configfs() will seem to succeed
and the module will be loaded.  Fix this by passing the return value
on up the chain.

Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: Nicholas Bellinger <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

cfg80211: fix antenna gain handling

commit c4a9faf upstream.

No driver initializes chan->max_antenna_gain to something sensible, and
the only place where it is being used right now is inside ath9k. This
leads to ath9k potentially using less tx power than it can use, which can
decrease performance/range in some rare cases.

Rather than going through every single driver, this patch initializes
chan->orig_mag in wiphy_register(), ignoring whatever value the driver
left in there. If a driver for some reason wishes to limit it independent
from regulatory rulesets, it can do so internally.

Signed-off-by: Felix Fietkau <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

wireless: drop invalid mesh address extension frames

commit 7dd111e upstream.

The mesh header can have address extension by a 4th
or a 5th and 6th address, but never both. Drop such
frames in 802.11 -> 802.3 conversion along with any
frames that have the wrong extension.

Reviewed-by: Javier Cardona <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

mac80211: don't inspect Sequence Control field on control frames

commit f7fbf70 upstream.

Per IEEE Std. 802.11-2012, Sec 8.2.4.4.1, the sequence Control field is
not present in control frames.  We noticed this problem when processing
Block Ack Requests.

Signed-off-by: Javier Cardona <[email protected]>
Signed-off-by: Javier Lopez <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

DRM/Radeon: Fix Load Detection on legacy primary DAC.

commit 83325d0 upstream.

An uninitialized variable led to broken load detection.

Signed-off-by: Egbert Eich <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

mac80211: check management frame header length

commit 4a4f1a5 upstream.

Due to pskb_may_pull() checking the skb length, all
non-management frames are checked on input whether
their 802.11 header is fully present. Also add that
check for management frames and remove a check that
is now duplicate. This prevents accessing skb data
beyond the frame end.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

mac80211: fix SSID copy on IBSS JOIN

commit badecb0 upstream.

The 'ssid' field of the cfg80211_ibss_params is a u8 pointer and
its length is likely to be less than IEEE80211_MAX_SSID_LEN most
of the time.

This patch fixes the ssid copy in ieee80211_ibss_join() by using
the SSID length to prevent it from reading beyond the string.

Signed-off-by: Antonio Quartulli <[email protected]>
[rewrapped commit message, small rewording]
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfsv3: Make v3 mounts fail with ETIMEDOUTs instead EIO on mountd timeouts

commit acce94e upstream.

In very busy v3 environment, rpc.mountd can respond to the NULL
procedure but not the MNT procedure in a timely manner causing
the MNT procedure to time out. The problem is the mount system
call returns EIO which causes the mount to fail, instead of
ETIMEDOUT, which would cause the mount to be retried.

This patch sets the RPC_TASK_SOFT|RPC_TASK_TIMEOUT flags to
the rpc_call_sync() call in nfs_mount() which causes
ETIMEDOUT to be returned on timed out connections.

Signed-off-by: Steve Dickson <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfs: Show original device name verbatim in /proc/*/mount{s,info}

commit 97a5486 upstream.

Since commit c7f404b ('vfs: new superblock methods to override
/proc/*/mount{s,info}'), nfs_path() is used to generate the mounted
device name reported back to userland.

nfs_path() always generates a trailing slash when the given dentry is
the root of an NFS mount, but userland may expect the original device
name to be returned verbatim (as it used to be).  Make this
canonicalisation optional and change the callers accordingly.

[[email protected]: use flag instead of bool argument]
Reported-and-tested-by: Chris Hiestand <[email protected]>
Reference: http://bugs.debian.org/669314
Signed-off-by: Ben Hutchings <[email protected]>
Signed-off-by: Jonathan Nieder <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

NFSv4: nfs4_locku_done must release the sequence id

commit 2b1bc30 upstream.

If the state recovery machinery is triggered by the call to
nfs4_async_handle_error() then we can deadlock.

Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfsd: add get_uint for u32's

commit a007c4c upstream.

I don't think there's a practical difference for the range of values
these interfaces should see, but it would be safer to be unambiguous.

Signed-off-by: J. Bruce Fields <[email protected]>
Cc: Sasha Levin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

NFS: fix bug in legacy DNS resolver.

commit 8d96b10 upstream.

The DNS resolver's use of the sunrpc cache involves a 'ttl' number
(relative) rather that a timeout (absolute).  This confused me when
I wrote
  commit c5b29f8
     "sunrpc: use seconds since boot in expiry cache"

and I managed to break it.  The effect is that any TTL is interpreted
as 0, and nothing useful gets into the cache.

This patch removes the use of get_expiry() - which really expects an
expiry time - and uses get_uint() instead, treating the int correctly
as a ttl.

This fixes a regression that has been present since 2.6.37, causing
certain NFS accesses in certain environments to incorrectly fail.

Reported-by: Chuck Lever <[email protected]>
Tested-by: Chuck Lever <[email protected]>
Signed-off-by: NeilBrown <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

NFS: Fix Oopses in nfs_lookup_revalidate and nfs4_lookup_revalidate

[Fixed upstream as part of 0b728e1, but that's a much larger patch,
this is only the nfs portion backported as needed.]

Fix the following Oops in 3.5.1:

 BUG: unable to handle kernel NULL pointer dereference at 0000000000000038
 IP: [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs]
 PGD 337c63067 PUD 0
 Oops: 0000 [#1] SMP
 CPU 5
 Modules linked in: nfs fscache nfsd lockd nfs_acl auth_rpcgss sunrpc af_packet binfmt_misc cpufreq_conservative cpufreq_userspace cpufreq_powersave dm_mod acpi_cpufreq mperf coretemp gpio_ich kvm_intel joydev kvm ioatdma hid_generic igb lpc_ich i7core_edac edac_core ptp serio_raw dca pcspkr i2c_i801 mfd_core sg pps_core usbhid crc32c_intel microcode button autofs4 uhci_hcd ttm drm_kms_helper drm i2c_algo_bit sysimgblt sysfillrect syscopyarea ehci_hcd usbcore usb_common scsi_dh_rdac scsi_dh_emc scsi_dh_hp_sw scsi_dh_alua scsi_dh edd fan ata_piix thermal processor thermal_sys

 Pid: 30431, comm: java Not tainted 3.5.1-2-default #1 Supermicro X8DTT/X8DTT
 RIP: 0010:[<ffffffffa03789cd>]  [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs]
 RSP: 0018:ffff8801b418bd38  EFLAGS: 00010292
 RAX: 00000000fffffff6 RBX: ffff88032016d800 RCX: 0000000000000020
 RDX: ffffffff00000000 RSI: 0000000000000000 RDI: ffff8801824a7b00
 RBP: ffff8801b418bdf8 R08: 7fffff0034323030 R09: fffffffff04c03ed
 R10: ffff8801824a7b00 R11: 0000000000000002 R12: ffff8801824a7b00
 R13: ffff8801824a7b00 R14: 0000000000000000 R15: ffff8803201725d0
 FS:  00002b53a46cb700(0000) GS:ffff88033fc20000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 0000000000000038 CR3: 000000020a426000 CR4: 00000000000007e0
 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
 Process java (pid: 30431, threadinfo ffff8801b418a000, task ffff8801b5d20600)
 Stack:
  ffff8801b418be44 ffff88032016d800 ffff8801b418bdf8 0000000000000000
  ffff8801824a7b00 ffff8801b418bdd7 ffff8803201725d0 ffffffff8116a9c0
  ffff8801b5c38dc0 0000000000000007 ffff88032016d800 0000000000000000
 Call Trace:
  [<ffffffff8116a9c0>] lookup_dcache+0x80/0xe0
  [<ffffffff8116aa43>] __lookup_hash+0x23/0x90
  [<ffffffff8116b4a5>] lookup_one_len+0xc5/0x100
  [<ffffffffa03869a3>] nfs_sillyrename+0xe3/0x210 [nfs]
  [<ffffffff8116cadf>] vfs_unlink.part.25+0x7f/0xe0
  [<ffffffff8116f22c>] do_unlinkat+0x1ac/0x1d0
  [<ffffffff815717b9>] system_call_fastpath+0x16/0x1b
  [<00002b5348b5f527>] 0x2b5348b5f526
 Code: ec 38 b8 f6 ff ff ff 4c 89 64 24 18 4c 89 74 24 28 49 89 fc 48 89 5c 24 08 48 89 6c 24 10 49 89 f6 4c 89 6c 24 20 4c 89 7c 24 30 <f6> 46 38 40 0f 85 d1 00 00 00 e8 c4 c4 df e0 48 8b 58 30 49 89
 RIP  [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs]
  RSP <ffff8801b418bd38>
 CR2: 0000000000000038
 ---[ end trace 845113ed191985dd ]---

This Oops affects 3.5 kernels and older, and is due to lookup_one_len()
calling down to the dentry revalidation code with a NULL pointer
to struct nameidata.

It is fixed upstream by commit 0b728e1 (stop passing nameidata *
to ->d_revalidate())

Reported-by: Richard Ems <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm: restore open_count if drm_setup fails

commit 0f1cb1b upstream.

If drm_setup (called at first open) fails, the whole
open call has failed, so we should not keep the
open_count incremented.

Signed-off-by: Ilija Hadzic <[email protected]>
Reviewed-by: Thomas Hellstrom <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

hwmon: (w83627ehf) Force initial bank selection

commit 3300fb4 upstream.

Don't assume bank 0 is selected at device probe time. This may not be
the case. Force bank selection at first register access to guarantee
that we read the right registers upon driver loading.

Signed-off-by: Jean Delvare <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: PCM: Fix some races at disconnection

commit 9b0573c upstream.

Fix races at PCM disconnection:
- while a PCM device is being opened or closed
- while the PCM state is being changed without lock in prepare,
  hw_params, hw_free ops

Reported-by: Matthieu CASTET <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: Fix races at disconnection

commit 978520b upstream.

Close some races at disconnection of a USB audio device by adding the
chip->shutdown_mutex and chip->shutdown check at appropriate places.

The spots to put bandaids are:
- PCM prepare, hw_params and hw_free
- where the usb device is accessed for communication or get speed, in
 mixer.c and others; the device speed is now cached in subs->speed
 instead of accessing to chip->dev

The accesses in PCM open and close don't need the mutex protection
because these are already handled in the core PCM disconnection code.

The autosuspend/autoresume codes are still uncovered by this patch
because of possible mutex deadlocks.  They'll be covered by the
upcoming change to rwsem.

Also the mixer codes are untouched, too.  These will be fixed in
another patch, too.

Reported-by: Matthieu CASTET <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: Use rwsem for disconnect protection

commit 34f3c89 upstream.

Replace mutex with rwsem for codec->shutdown protection so that
concurrent accesses are allowed.

Also add the protection to snd_usb_autosuspend() and
snd_usb_autoresume(), too.

Reported-by: Matthieu CASTET <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: Fix races at disconnection in mixer_quirks.c

commit 888ea7d upstream.

Similar like the previous commit, cover with chip->shutdown_rwsem
and chip->shutdown checks.

Reported-by: Matthieu CASTET <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: Add a reference counter to card instance

commit a0830db upstream.

For more strict protection for wild disconnections, a refcount is
introduced to the card instance, and let it up/down when an object is
referred via snd_lookup_*() in the open ops.

The free-after-last-close check is also changed to check this refcount
instead of the empty list, too.

Reported-by: Matthieu CASTET <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: Avoid endless sleep after disconnect

commit 0914f79 upstream.

When disconnect callback is called, each component should wake up
sleepers and check card->shutdown flag for avoiding the endless sleep
blocking the proper resource release.

Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

sctp: fix call to SCTP_CMD_PROCESS_SACK in sctp_cmd_interpreter()

[ Upstream commit f6e80ab ]

Bug introduced by commit edfee03
(sctp: check src addr when processing SACK to update transport state)

Signed-off-by: Zijie Pan <[email protected]>
Signed-off-by: Nicolas Dichtel <[email protected]>
Acked-by: Vlad Yasevich <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

netlink: use kfree_rcu() in netlink_release()

[ Upstream commit 6d772ac ]

On some suspend/resume operations involving wimax device, we have
noticed some intermittent memory corruptions in netlink code.

Stéphane Marchesin tracked this corruption in netlink_update_listeners()
and suggested a patch.

It appears netlink_release() should use kfree_rcu() instead of kfree()
for the listeners structure as it may be used by other cpus using RCU
protection.

netlink_release() must set to NULL the listeners pointer when
it is about to be freed.

Also have to protect netlink_update_listeners() and
netlink_has_listeners() if listeners is NULL.

Add a nl_deref_protected() lockdep helper to properly document which
locks protects us.

Reported-by: Jonathan Kliegman <[email protected]>
Signed-off-by: Eric Dumazet <[email protected]>
Cc: Stéphane Marchesin <[email protected]>
Cc: Sam Leffler <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

tcp: fix FIONREAD/SIOCINQ

[ Upstream commit a3374c4 ]

tcp_ioctl() tries to take into account if tcp socket received a FIN
to report correct number bytes in receive queue.

But its flaky because if the application ate the last skb,
we return 1 instead of 0.

Correct way to detect that FIN was received is to test SOCK_DONE.

Reported-by: Elliot Hughes <[email protected]>
Signed-off-by: Eric Dumazet <[email protected]>
Cc: Neal Cardwell <[email protected]>
Cc: Tom Herbert <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ipv6: Set default hoplimit as zero.

[ Upstream commit 14edd87 ]

Commit a02e4b7(Demark default hoplimit as zero) only changes the
hoplimit checking condition and default value in ip6_dst_hoplimit, not
zeros all hoplimit default value.

Keep the zeroing ip6_template_metrics[RTAX_HOPLIMIT - 1] to force it as
const, cause as a37e6e3(net: force dst_default_metrics to const
section)

Signed-off-by: Li RongQing <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: usb: Fix memory leak on Tx data path

[ Upstream commit 39707c2 ]

Driver anchors the tx urbs and defers the urb submission if
a transmit request comes when the interface is suspended.
Anchoring urb increments the urb reference count. These
deferred urbs are later accessed by calling usb_get_from_anchor()
for submission during interface resume. usb_get_from_anchor()
unanchors the urb but urb reference count remains same.
This causes the urb reference count to remain non-zero
after usb_free_urb() gets called and urb never gets freed.
Hence call usb_put_urb() after anchoring the urb to properly
balance the reference count for these deferred urbs. Also,
unanchor these deferred urbs during disconnect, to free them
up.

Signed-off-by: Hemant Kumar <[email protected]>
Acked-by: Oliver Neukum <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: fix divide by zero in tcp algorithm illinois

[ Upstream commit 8f363b7 ]

Reading TCP stats when using TCP Illinois congestion control algorithm
can cause a divide by zero kernel oops.

The division by zero occur in tcp_illinois_info() at:
 do_div(t, ca->cnt_rtt);
where ca->cnt_rtt can become zero (when rtt_reset is called)

Steps to Reproduce:
 1. Register tcp_illinois:
     # sysctl -w net.ipv4.tcp_congestion_control=illinois
 2. Monitor internal TCP information via command "ss -i"
     # watch -d ss -i
 3. Establish new TCP conn to machine

Either it fails at the initial conn, or else it needs to wait
for a loss or a reset.

This is only related to reading stats.  The function avg_delay() also
performs the same divide, but is guarded with a (ca->cnt_rtt > 0) at its
calling point in update_params().  Thus, simply fix tcp_illinois_info().

Function tcp_illinois_info() / get_info() is called without
socket lock.  Thus, eliminate any race condition on ca->cnt_rtt
by using a local stack variable.  Simply reuse info.tcpv_rttcnt,
as its already set to ca->cnt_rtt.
Function avg_delay() is not affected by this race condition, as
its called with the socket lock.

Cc: Petr Matousek <[email protected]>
Signed-off-by: Jesper Dangaard Brouer <[email protected]>
Acked-by: Eric Dumazet <[email protected]>
Acked-by: Stephen Hemminger <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

l2tp: fix oops in l2tp_eth_create() error path

[ Upstream commit 7893363 ]

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

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

Signed-off-by: Tom Parkin <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ipv6: send unsolicited neighbour advertisements to all-nodes

[ Upstream commit 60713a0 ]

As documented in RFC4861 (Neighbor Discovery for IP version 6) 7.2.6.,
unsolicited neighbour advertisements should be sent to the all-nodes
multicast address.

Signed-off-by: Hannes Frederic Sowa <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

futex: Handle futex_pi OWNER_DIED take over correctly

commit 59fa624 upstream.

Siddhesh analyzed a failure in the take over of pi futexes in case the
owner died and provided a workaround.
See: http://sourceware.org/bugzilla/show_bug.cgi?id=14076

The detailed problem analysis shows:

Futex F is initialized with PTHREAD_PRIO_INHERIT and
PTHREAD_MUTEX_ROBUST_NP attributes.

T1 lock_futex_pi(F);

T2 lock_futex_pi(F);
   --> T2 blocks on the futex and creates pi_state which is associated
       to T1.

T1 exits
   --> exit_robust_list() runs
       --> Futex F userspace value TID field is set to 0 and
           FUTEX_OWNER_DIED bit is set.

T3 lock_futex_pi(F);
   --> Succeeds due to the check for F's userspace TID field == 0
   --> Claims ownership of the futex and sets its own TID into the
       userspace TID field of futex F
   --> returns to user space

T1 --> exit_pi_state_list()
       --> Transfers pi_state to waiter T2 and wakes T2 via
       	   rt_mutex_unlock(&pi_state->mutex)

T2 --> acquires pi_state->mutex and gains real ownership of the
       pi_state
   --> Claims ownership of the futex and sets its own TID into the
       userspace TID field of futex F
   --> returns to user space

T3 --> observes inconsistent state

This problem is independent of UP/SMP, preemptible/non preemptible
kernels, or process shared vs. private. The only difference is that
certain configurations are more likely to expose it.

So as Siddhesh correctly analyzed the following check in
futex_lock_pi_atomic() is the culprit:

	if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {

We check the userspace value for a TID value of 0 and take over the
futex unconditionally if that's true.

AFAICT this check is there as it is correct for a different corner
case of futexes: the WAITERS bit became stale.

Now the proposed change

-	if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {
+       if (unlikely(ownerdied ||
+                       !(curval & (FUTEX_TID_MASK | FUTEX_WAITERS)))) {

solves the problem, but it's not obvious why and it wreckages the
"stale WAITERS bit" case.

What happens is, that due to the WAITERS bit being set (T2 is blocked
on that futex) it enforces T3 to go through lookup_pi_state(), which
in the above case returns an existing pi_state and therefor forces T3
to legitimately fight with T2 over the ownership of the pi_state (via
pi_state->mutex). Probelm solved!

Though that does not work for the "WAITERS bit is stale" problem
because if lookup_pi_state() does not find existing pi_state it
returns -ERSCH (due to TID == 0) which causes futex_lock_pi() to
return -ESRCH to user space because the OWNER_DIED bit is not set.

Now there is a different solution to that problem. Do not look at the
user space value at all and enforce a lookup of possibly available
pi_state. If pi_state can be found, then the new incoming locker T3
blocks on that pi_state and legitimately races with T2 to acquire the
rt_mutex and the pi_state and therefor the proper ownership of the
user space futex.

lookup_pi_state() has the correct order of checks. It first tries to
find a pi_state associated with the user space futex and only if that
fails it checks for futex TID value = 0. If no pi_state is available
nothing can create new state at that point because this happens with
the hash bucket lock held.

So the above scenario changes to:

T1 lock_futex_pi(F);

T2 lock_futex_pi(F);
   --> T2 blocks on the futex and creates pi_state which is associated
       to T1.

T1 exits
   --> exit_robust_list() runs
       --> Futex F userspace value TID field is set to 0 and
           FUTEX_OWNER_DIED bit is set.

T3 lock_futex_pi(F);
   --> Finds pi_state and blocks on pi_state->rt_mutex

T1 --> exit_pi_state_list()
       --> Transfers pi_state to waiter T2 and wakes it via
       	   rt_mutex_unlock(&pi_state->mutex)

T2 --> acquires pi_state->mutex and gains ownership of the pi_state
   --> Claims ownership of the futex and sets its own TID into the
       userspace TID field of futex F
   --> returns to user space

This covers all gazillion points on which T3 might come in between
T1's exit_robust_list() clearing the TID field and T2 fixing it up. It
also solves the "WAITERS bit stale" problem by forcing the take over.

Another benefit of changing the code this way is that it makes it less
dependent on untrusted user space values and therefor minimizes the
possible wreckage which might be inflicted.

As usual after staring for too long at the futex code my brain hurts
so much that I really want to ditch that whole optimization of
avoiding the syscall for the non contended case for PI futexes and rip
out the maze of corner case handling code. Unfortunately we can't as
user space relies on that existing behaviour, but at least thinking
about it helps me to preserve my mental sanity. Maybe we should
nevertheless :)

Reported-and-tested-by: Siddhesh Poyarekar <[email protected]>
Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1210232138540.2756@ionos
Acked-by: Darren Hart <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/vmwgfx: Fix hibernation device reset

commit 95e8f6a upstream.

The device would not reset properly when resuming from hibernation.

Signed-off-by: Thomas Hellstrom <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Dmitry Torokhov <[email protected]>
Cc: [email protected]
Signed-off-by: Dave Airlie <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/i915: fixup infoframe support for sdvo

commit 81014b9 upstream.

At least the worst offenders:
- SDVO specifies that the encoder should compute the ecc. Testing also
  shows that we must not send the ecc field, so copy the dip_infoframe
  struct to a temporay place and avoid the ecc field. This way the avi
  infoframe is exactly 17 bytes long, which agrees with what the spec
  mandates as a minimal storage capacity (with the ecc field it would
  be 18 bytes).
- Only 17 when sending the avi infoframe. The SDVO spec explicitly
  says that sending more data than what the device announces results
  in undefined behaviour.
- Add __attribute__((packed)) to the avi and spd infoframes, for
  otherwise they're wrongly aligned. Noticed because the avi infoframe
  ended up being 18 bytes large instead of 17. We haven't noticed this
  yet because we don't use the uint16_t fields yet (which are the only
  ones that would be wrongly aligned).

This regression has been introduce by

3c17fe4 is the first bad commit
commit 3c17fe4
Author: David Härdeman <[email protected]>
Date:   Fri Sep 24 21:44:32 2010 +0200

    i915: enable AVI infoframe for intel_hdmi.c [v4]

Patch tested on my g33 with a sdvo hdmi adaptor.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=25732
Tested-by: Peter Ross <[email protected]> (G35 SDVO-HDMI)
Reviewed-by: Eugeni Dodonov <[email protected]>
Signed-Off-by: Daniel Vetter <[email protected]>
Cc: Ben Hutchings <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/i915: clear the entire sdvo infoframe buffer

commit b6e0e54 upstream.

Like in the case of native hdmi, which is fixed already in

commit adf00b2
Author: Paulo Zanoni <[email protected]>
Date:   Tue Sep 25 13:23:34 2012 -0300

    drm/i915: make sure we write all the DIP data bytes

we need to clear the entire sdvo buffer to avoid upsetting the
display.

Since infoframe buffer writing is now a bit more elaborate, extract it
into it's own function. This will be useful if we ever get around to
properly update the ELD for sdvo. Also #define proper names for the
two buffer indexes with fixed usage.

v2: Cite the right commit above, spotted by Paulo Zanoni.

v3: I'm too stupid to paste the right commit.

v4: Ben Hutchings noticed that I've failed to handle an underflow in
my loop logic, breaking it for i >= length + 8. Since I've just lost C
programmer license, use his solution. Also, make the frustrated 0-base
buffer size a notch more clear.

Reported-and-tested-by: Jürg Billeter <[email protected]>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=25732
Cc: Paulo Zanoni <[email protected]>
Cc: Ben Hutchings <[email protected]>
Reviewed-by: Rodrigo Vivi <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: mos7840: remove unused variable

Fix warning about unused variable introduced by commit e681b66
("USB: mos7840: remove invalid disconnect handling") upstream.

A subsequent fix which removed the disconnect function got rid of the
warning but that one was only backported to v3.6.

Reported-by: Jiri Slaby <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

xfs: fix reading of wrapped log data

commit 6ce377a upstream.

Commit 4439647 ("xfs: reset buffer pointers before freeing them") in
3.0-rc1 introduced a regression when recovering log buffers that
wrapped around the end of log. The second part of the log buffer at
the start of the physical log was being read into the header buffer
rather than the data buffer, and hence recovery was seeing garbage
in the data buffer when it got to the region of the log buffer that
was incorrectly read.

Reported-by: Torsten Kaiser <[email protected]>
Signed-off-by: Dave Chinner <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Mark Tinguely <[email protected]>
Signed-off-by: Ben Myers <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

intel-iommu: Fix AB-BA lockdep report

commit 3e7abe2 upstream.

When unbinding a device so that I could pass it through to a KVM VM, I
got the lockdep report below.  It looks like a legitimate lock
ordering problem:

 - domain_context_mapping_one() takes iommu->lock and calls
   iommu_support_dev_iotlb(), which takes device_domain_lock (inside
   iommu->lock).

 - domain_remove_one_dev_info() starts by taking device_domain_lock
   then takes iommu->lock inside it (near the end of the function).

So this is the classic AB-BA deadlock.  It looks like a safe fix is to
simply release device_domain_lock a bit earlier, since as far as I can
tell, it doesn't protect any of the stuff accessed at the end of
domain_remove_one_dev_info() anyway.

BTW, the use of device_domain_lock looks a bit unsafe to me... it's
at least not obvious to me why we aren't vulnerable to the race below:

  iommu_support_dev_iotlb()
                                          domain_remove_dev_info()

  lock device_domain_lock
    find info
  unlock device_domain_lock

                                          lock device_domain_lock
                                            find same info
                                          unlock device_domain_lock

                                          free_devinfo_mem(info)

  do stuff with info after it's free

However I don't understand the locking here well enough to know if
this is a real problem, let alone what the best fix is.

Anyway here's the full lockdep output that prompted all of this:

     =======================================================
     [ INFO: possible circular locking dependency detected ]
     2.6.39.1+ #1
     -------------------------------------------------------
     bash/13954 is trying to acquire lock:
      (&(&iommu->lock)->rlock){......}, at: [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230

     but task is already holding lock:
      (device_domain_lock){-.-...}, at: [<ffffffff812f6508>] domain_remove_one_dev_info+0x208/0x230

     which lock already depends on the new lock.

     the existing dependency chain (in reverse order) is:

     -> #1 (device_domain_lock){-.-...}:
            [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
            [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
            [<ffffffff812f8350>] domain_context_mapping_one+0x600/0x750
            [<ffffffff812f84df>] domain_context_mapping+0x3f/0x120
            [<ffffffff812f9175>] iommu_prepare_identity_map+0x1c5/0x1e0
            [<ffffffff81ccf1ca>] intel_iommu_init+0x88e/0xb5e
            [<ffffffff81cab204>] pci_iommu_init+0x16/0x41
            [<ffffffff81002165>] do_one_initcall+0x45/0x190
            [<ffffffff81ca3d3f>] kernel_init+0xe3/0x168
            [<ffffffff8157ac24>] kernel_thread_helper+0x4/0x10

     -> #0 (&(&iommu->lock)->rlock){......}:
            [<ffffffff8109bf3e>] __lock_acquire+0x195e/0x1e10
            [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
            [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
            [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230
            [<ffffffff812f8b42>] device_notifier+0x72/0x90
            [<ffffffff8157555c>] notifier_call_chain+0x8c/0xc0
            [<ffffffff81089768>] __blocking_notifier_call_chain+0x78/0xb0
            [<ffffffff810897b6>] blocking_notifier_call_chain+0x16/0x20
            [<ffffffff81373a5c>] __device_release_driver+0xbc/0xe0
            [<ffffffff81373ccf>] device_release_driver+0x2f/0x50
            [<ffffffff81372ee3>] driver_unbind+0xa3/0xc0
            [<ffffffff813724ac>] drv_attr_store+0x2c/0x30
            [<ffffffff811e4506>] sysfs_write_file+0xe6/0x170
            [<ffffffff8117569e>] vfs_write+0xce/0x190
            [<ffffffff811759e4>] sys_write+0x54/0xa0
            [<ffffffff81579a82>] system_call_fastpath+0x16/0x1b

     other info that might help us debug this:

     6 locks held by bash/13954:
      #0:  (&buffer->mutex){+.+.+.}, at: [<ffffffff811e4464>] sysfs_write_file+0x44/0x170
      #1:  (s_active#3){++++.+}, at: [<ffffffff811e44ed>] sysfs_write_file+0xcd/0x170
      #2:  (&__lockdep_no_validate__){+.+.+.}, at: [<ffffffff81372edb>] driver_unbind+0x9b/0xc0
      #3:  (&__lockdep_no_validate__){+.+.+.}, at: [<ffffffff81373cc7>] device_release_driver+0x27/0x50
      #4:  (&(&priv->bus_notifier)->rwsem){.+.+.+}, at: [<ffffffff8108974f>] __blocking_notifier_call_chain+0x5f/0xb0
      #5:  (device_domain_lock){-.-...}, at: [<ffffffff812f6508>] domain_remove_one_dev_info+0x208/0x230

     stack backtrace:
     Pid: 13954, comm: bash Not tainted 2.6.39.1+ #1
     Call Trace:
      [<ffffffff810993a7>] print_circular_bug+0xf7/0x100
      [<ffffffff8109bf3e>] __lock_acquire+0x195e/0x1e10
      [<ffffffff810972bd>] ? trace_hardirqs_off+0xd/0x10
      [<ffffffff8109d57d>] ? trace_hardirqs_on_caller+0x13d/0x180
      [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
      [<ffffffff812f6421>] ? domain_remove_one_dev_info+0x121/0x230
      [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
      [<ffffffff812f6421>] ? domain_remove_one_dev_info+0x121/0x230
      [<ffffffff810972bd>] ? trace_hardirqs_off+0xd/0x10
      [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230
      [<ffffffff812f8b42>] device_notifier+0x72/0x90
      [<ffffffff8157555c>] notifier_call_chain+0x8c/0xc0
      [<ffffffff81089768>] __blocking_notifier_call_chain+0x78/0xb0
      [<ffffffff810897b6>] blocking_notifier_call_chain+0x16/0x20
      [<ffffffff81373a5c>] __device_release_driver+0xbc/0xe0
      [<ffffffff81373ccf>] device_release_driver+0x2f/0x50
      [<ffffffff81372ee3>] driver_unbind+0xa3/0xc0
      [<ffffffff813724ac>] drv_attr_store+0x2c/0x30
      [<ffffffff811e4506>] sysfs_write_file+0xe6/0x170
      [<ffffffff8117569e>] vfs_write+0xce/0x190
      [<ffffffff811759e4>] sys_write+0x54/0xa0
      [<ffffffff81579a82>] system_call_fastpath+0x16/0x1b

Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
Cc: Steven Rostedt <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: Fix card refcount unbalance

commit 8bb4d9c upstream.

There are uncovered cases whether the card refcount introduced by the
commit a0830db isn't properly increased or decreased:
- OSS PCM and mixer success paths
- When lookup function gets NULL

This patch fixes these places.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50251

Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: Fix mutex deadlock at disconnection

commit 10e4423 upstream.

The recent change for USB-audio disconnection race fixes introduced a
mutex deadlock again.  There is a circular dependency between
chip->shutdown_rwsem and pcm->open_mutex, depicted like below, when a
device is opened during the disconnection operation:

A. snd_usb_audio_disconnect() ->
     card.c::register_mutex ->
       chip->shutdown_rwsem (write) ->
         snd_card_disconnect() ->
           pcm.c::register_mutex ->
             pcm->open_mutex

B. snd_pcm_open() ->
     pcm->open_mutex ->
       snd_usb_pcm_open() ->
         chip->shutdown_rwsem (read)

Since the chip->shutdown_rwsem protection in the case A is required
only for turning on the chip->shutdown flag and it doesn't have to be
taken for the whole operation, we can reduce its window in
snd_usb_audio_disconnect().

Reported-by: Jiri Slaby <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Juansheng referenced this issue in Andromadus/htc7x30-3.0 Dec 15, 2012
Dove: Attempt to fix PMU/RTC interrupts

commit 5d3df93 upstream.

Fix the acknowledgement of PMU interrupts on Dove: some Dove hardware
has not been sensibly designed so that interrupts can be handled in a
race free manner.  The PMU is one such instance.

The pending (aka 'cause') register is a bunch of RW bits, meaning that
these bits can be both cleared and set by software (confirmed on the
Armada-510 on the cubox.)

Hardware sets the appropriate bit when an interrupt is asserted, and
software is required to clear the bits which are to be processed.  If
we write ~(1 << bit), then we end up asserting every other interrupt
except the one we're processing.  So, we need to do a read-modify-write
cycle to clear the asserted bit.

However, any interrupts which occur in the middle of this cycle will
also be written back as zero, which will also clear the new interrupts.

The upshot of this is: there is _no_ way to safely clear down interrupts
in this register (and other similarly behaving interrupt pending
registers on this device.)  The patch below at least stops us creating
new interrupts.

Signed-off-by: Russell King <[email protected]>
Signed-off-by: Jason Cooper <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Dove: Fix irq_to_pmu()

commit d356cf5 upstream.

PMU interrupts start at IRQ_DOVE_PMU_START, not IRQ_DOVE_PMU_START + 1.
Fix the condition.  (It may have been less likely to occur had the code
been written "if (irq >= IRQ_DOVE_PMU_START" which imho is the easier
to understand notation, and matches the normal way of thinking about
these things.)

Signed-off-by: Russell King <[email protected]>
Signed-off-by: Jason Cooper <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

mm/vmemmap: fix wrong use of virt_to_page

commit ae64ffc upstream.

I enable CONFIG_DEBUG_VIRTUAL and CONFIG_SPARSEMEM_VMEMMAP, when doing
memory hotremove, there is a kernel BUG at arch/x86/mm/physaddr.c:20.

It is caused by free_section_usemap()->virt_to_page(), virt_to_page() is
only used for kernel direct mapping address, but sparse-vmemmap uses
vmemmap address, so it is going wrong here.

  ------------[ cut here ]------------
  kernel BUG at arch/x86/mm/physaddr.c:20!
  invalid opcode: 0000 [#1] SMP
  Modules linked in: acpihp_drv acpihp_slot edd cpufreq_conservative cpufreq_userspace cpufreq_powersave acpi_cpufreq mperf fuse vfat fat loop dm_mod coretemp kvm crc32c_intel ipv6 ixgbe igb iTCO_wdt i7core_edac edac_core pcspkr iTCO_vendor_support ioatdma microcode joydev sr_mod i2c_i801 dca lpc_ich mfd_core mdio tpm_tis i2c_core hid_generic tpm cdrom sg tpm_bios rtc_cmos button ext3 jbd mbcache usbhid hid uhci_hcd ehci_hcd usbcore usb_common sd_mod crc_t10dif processor thermal_sys hwmon scsi_dh_alua scsi_dh_hp_sw scsi_dh_rdac scsi_dh_emc scsi_dh ata_generic ata_piix libata megaraid_sas scsi_mod
  CPU 39
  Pid: 6454, comm: sh Not tainted 3.7.0-rc1-acpihp-final+ #45 QCI QSSC-S4R/QSSC-S4R
  RIP: 0010:[<ffffffff8103c908>]  [<ffffffff8103c908>] __phys_addr+0x88/0x90
  RSP: 0018:ffff8804440d7c08  EFLAGS: 00010006
  RAX: 0000000000000006 RBX: ffffea0012000000 RCX: 000000000000002c
  ...

Signed-off-by: Jianguo Wu <[email protected]>
Signed-off-by: Jiang Liu <[email protected]>
Reviewd-by: Wen Congyang <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Reviewed-by: Yasuaki Ishimatsu <[email protected]>
Reviewed-by: Michal Hocko <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

mm: soft offline: split thp at the beginning of soft_offline_page()

commit 783657a upstream.

When we try to soft-offline a thp tail page, put_page() is called on the
tail page unthinkingly and VM_BUG_ON is triggered in put_compound_page().

This patch splits thp before going into the main body of soft-offlining.

Signed-off-by: Naoya Horiguchi <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Wu Fengguang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

workqueue: exit rescuer_thread() as TASK_RUNNING

commit 412d32e upstream.

A rescue thread exiting TASK_INTERRUPTIBLE can lead to a task scheduling
off, never to be seen again.  In the case where this occurred, an exiting
thread hit reiserfs homebrew conditional resched while holding a mutex,
bringing the box to its knees.

PID: 18105  TASK: ffff8807fd412180  CPU: 5   COMMAND: "kdmflush"
 #0 [ffff8808157e7670] schedule at ffffffff8143f489
 #1 [ffff8808157e77b8] reiserfs_get_block at ffffffffa038ab2d [reiserfs]
 #2 [ffff8808157e79a8] __block_write_begin at ffffffff8117fb14
 #3 [ffff8808157e7a98] reiserfs_write_begin at ffffffffa0388695 [reiserfs]
 #4 [ffff8808157e7ad8] generic_perform_write at ffffffff810ee9e2
 #5 [ffff8808157e7b58] generic_file_buffered_write at ffffffff810eeb41
 #6 [ffff8808157e7ba8] __generic_file_aio_write at ffffffff810f1a3a
 #7 [ffff8808157e7c58] generic_file_aio_write at ffffffff810f1c88
 #8 [ffff8808157e7cc8] do_sync_write at ffffffff8114f850
 #9 [ffff8808157e7dd8] do_acct_process at ffffffff810a268f
    [exception RIP: kernel_thread_helper]
    RIP: ffffffff8144a5c0  RSP: ffff8808157e7f58  RFLAGS: 00000202
    RAX: 0000000000000000  RBX: 0000000000000000  RCX: 0000000000000000
    RDX: 0000000000000000  RSI: ffffffff8107af60  RDI: ffff8803ee491d18
    RBP: 0000000000000000   R8: 0000000000000000   R9: 0000000000000000
    R10: 0000000000000000  R11: 0000000000000000  R12: 0000000000000000
    R13: 0000000000000000  R14: 0000000000000000  R15: 0000000000000000
    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018

Signed-off-by: Mike Galbraith <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Revert "sched, autogroup: Stop going ahead if autogroup is disabled"

commit fd8ef11 upstream.

This reverts commit 800d4d3.

Between commits 8323f26 ("sched: Fix race in task_group()") and
800d4d3 ("sched, autogroup: Stop going ahead if autogroup is
disabled"), autogroup is a wreck.

With both applied, all you have to do to crash a box is disable
autogroup during boot up, then reboot..  boom, NULL pointer dereference
due to commit 800d4d3 not allowing autogroup to move things, and
commit 8323f26 making that the only way to switch runqueues:

  BUG: unable to handle kernel NULL pointer dereference at           (null)
  IP: [<ffffffff81063ac0>] effective_load.isra.43+0x50/0x90
  Pid: 7047, comm: systemd-user-se Not tainted 3.6.8-smp #7 MEDIONPC MS-7502/MS-7502
  RIP: effective_load.isra.43+0x50/0x90
  Process systemd-user-se (pid: 7047, threadinfo ffff880221dde000, task ffff88022618b3a0)
  Call Trace:
    select_task_rq_fair+0x255/0x780
    try_to_wake_up+0x156/0x2c0
    wake_up_state+0xb/0x10
    signal_wake_up+0x28/0x40
    complete_signal+0x1d6/0x250
    __send_signal+0x170/0x310
    send_signal+0x40/0x80
    do_send_sig_info+0x47/0x90
    group_send_sig_info+0x4a/0x70
    kill_pid_info+0x3a/0x60
    sys_kill+0x97/0x1a0
    ? vfs_read+0x120/0x160
    ? sys_read+0x45/0x90
    system_call_fastpath+0x16/0x1b
  Code: 49 0f af 41 50 31 d2 49 f7 f0 48 83 f8 01 48 0f 46 c6 48 2b 07 48 8b bf 40 01 00 00 48 85 ff 74 3a 45 31 c0 48 8b 8f 50 01 00 00 <48> 8b 11 4c 8b 89 80 00 00 00 49 89 d2 48 01 d0 45 8b 59 58 4c
  RIP  [<ffffffff81063ac0>] effective_load.isra.43+0x50/0x90
   RSP <ffff880221ddfbd8>
  CR2: 0000000000000000

Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Ingo Molnar <[email protected]>
Cc: Yong Zhang <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

route: release dst_entry.hh_cache when handling redirects

Stable-3.0 commit 42ab531 (ipv4: fix redirect handling) was
backport of mainline commit 9cc20b2 from 3.2-rc3 where hh
member of struct dst_entry was already gone.

However, in 3.0 we still have it and we have to clean it as
well, otherwise it keeps pointing to the cleaned up (and
unusable) hh_cache entry and packets cannot be sent out.

Signed-off-by: Michal Kubecek <[email protected]>
Cc: Eric Dumazet <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ACPI: missing break

commit 879dca0 upstream.

We handle NOTIFY_THROTTLING so don't then fall through to unsupported event.

Signed-off-by: Alan Cox <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
Signed-off-by: Peter Huewe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

i915: Quirk no_lvds on Gigabyte GA-D525TUD ITX motherboard

commit a51d4ed upstream.

This board is incorrectly detected as having an LVDS connector,
resulting in the VGA output (the only available output on the board)
showing the console only in the top-left 1024x768 pixels, and an extra
LVDS connector appearing in X.

It's a desktop Mini-ITX board using an Atom D525 CPU with an NM10
chipset.

I've had this board for about a year, but this is the first time I
noticed the issue because I've been running it headless for most of its
life.

Signed-off-by: Calvin Walton <[email protected]>
Signed-off-by: Peter Huewe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/i915: Add no-lvds quirk for Supermicro X7SPA-H

commit c31407a upstream.

Reported-and-tested-by: Francois Tigeot <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55375
Signed-off-by: Chris Wilson <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Signed-off-by: Peter Huewe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

scsi: Silence unnecessary warnings about ioctl to partition

commit 6d93592 upstream.

Sometimes, warnings about ioctls to partition happen often enough that they
form majority of the warnings in the kernel log and users complain. In some
cases warnings are about ioctls such as SG_IO so it's not good to get rid of
the warnings completely as they can ease debugging of userspace problems
when ioctl is refused.

Since I have seen warnings from lots of commands, including some proprietary
userspace applications, I don't think disallowing the ioctls for processes
with CAP_SYS_RAWIO will happen in the near future if ever. So lets just
stop warning for processes with CAP_SYS_RAWIO for which ioctl is allowed.

Acked-by: Paolo Bonzini <[email protected]>
CC: James Bottomley <[email protected]>
CC: [email protected]
Signed-off-by: Jan Kara <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
Cc: Satoru Takeuchi <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Jerl92 pushed a commit to Jerl92/htc7x30-3.0 that referenced this issue Jan 24, 2013
vfs: dcache: fix deadlock in tree traversal

commit 8110e16 upstream.

IBM reported a deadlock in select_parent().  This was found to be caused
by taking rename_lock when already locked when restarting the tree
traversal.

There are two cases when the traversal needs to be restarted:

 1) concurrent d_move(); this can only happen when not already locked,
    since taking rename_lock protects against concurrent d_move().

 2) racing with final d_put() on child just at the moment of ascending
    to parent; rename_lock doesn't protect against this rare race, so it
    can happen when already locked.

Because of case 2, we need to be able to handle restarting the traversal
when rename_lock is already held.  This patch fixes all three callers of
try_to_ascend().

IBM reported that the deadlock is gone with this patch.

[ I rewrote the patch to be smaller and just do the "goto again" if the
  lock was already held, but credit goes to Miklos for the real work.
   - Linus ]

Signed-off-by: Miklos Szeredi <[email protected]>
Cc: Al Viro <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

dm: handle requests beyond end of device instead of using BUG_ON

commit ba1cbad upstream.

The access beyond the end of device BUG_ON that was introduced to
dm_request_fn via commit 29e4013 ("dm: implement
REQ_FLUSH/FUA support for request-based dm") was an overly
drastic (but simple) response to this situation.

I have received a report that this BUG_ON was hit and now think
it would be better to use dm_kill_unmapped_request() to fail the clone
and original request with -EIO.

map_request() will assign the valid target returned by
dm_table_find_target to tio->ti.  But when the target
isn't valid tio->ti is never assigned (because map_request isn't
called); so add a check for tio->ti != NULL to dm_done().

Reported-by: Mike Christie <[email protected]>
Signed-off-by: Mike Snitzer <[email protected]>
Signed-off-by: Jun'ichi Nomura <[email protected]>
Signed-off-by: Alasdair G Kergon <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: option: blacklist QMI interface on ZTE MF683

commit 160c942 upstream.

Interface Flemmard#5 on ZTE MF683 is a QMI/wwan interface.

Signed-off-by: Bjørn Mork <[email protected]>
Cc: Shawn J. Goff <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: ftdi_sio: add TIAO USB Multi-Protocol Adapter (TUMPA) support

commit 54575b0 upstream.

TIAO/DIYGADGET USB Multi-Protocol Adapter (TUMPA) is an FTDI FT2232H
based device which provides an easily accessible JTAG, SPI, I2C, serial
breakout.

http://www.diygadget.com/tiao-usb-multi-protocol-adapter-jtag-spi-i2c-serial.html
http://www.tiaowiki.com/w/TIAO_USB_Multi_Protocol_Adapter_User%27s_Manual

FTDI FT2232H provides two serial channels (A and B), but on the TUMPA
channel A is dedicated to JTAG/SPI while channel B can be used for
UART/RS-232: use the ftdi_jtag_quirk to expose only channel B as
a usb-serial interface to userspace.

Signed-off-by: Antonio Ospite <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: qcaux: add Pantech vendor class match

commit c638eb2 upstream.

The three Pantech devices UML190 (106c:3716), UML290 (106c:3718) and
P4200 (106c:3721) all use the same subclasses to identify vendor
specific functions.  Replace the existing device specific entries
with generic vendor matching, adding support for the P4200.

Signed-off-by: Bjørn Mork <[email protected]>
Cc: Thomas Schäfer <[email protected]>
Acked-by: Dan Williams <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

staging: speakup_soft: Fix reading of init string

commit 40fe4f8 upstream.

softsynth_read() reads a character at a time from the init string;
when it finds the null terminator it sets the initialized flag but
then repeats the last character.

Additionally, if the read() buffer is not big enough for the init
string, the next read() will start reading from the beginning again.
So the caller may never progress to reading anything else.

Replace the simple initialized flag with the current position in
the init string, carried over between calls.  Switch to reading
real data once this reaches the null terminator.

(This assumes that the length of the init string can't change, which
seems to be the case.  Really, the string and position belong together
in a per-file private struct.)

Tested-by: Samuel Thibault <[email protected]>
Signed-off-by: Ben Hutchings <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

staging: comedi: s626: don't dereference insn->data

commit b655c2c upstream.

`s626_enc_insn_config()` is incorrectly dereferencing `insn->data` which
is a pointer to user memory.  It should be dereferencing the separate
`data` parameter that points to a copy of the data in kernel memory.

Signed-off-by: Ian Abbott <[email protected]>
Reviewed-by: H Hartley Sweeten <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

staging: comedi: jr3_pci: fix iomem dereference

commit e187895 upstream.

Correct a direct dereference of I/O memory to use an appropriate I/O
memory access function.  Note that the pointer being dereferenced is not
currently tagged with `__iomem` but I plan to correct that for 3.7.

Signed-off-by: Ian Abbott <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

staging: comedi: don't dereference user memory for INSN_INTTRIG

commit 5d06e3d upstream.

`parse_insn()` is dereferencing the user-space pointer `insn->data`
directly when handling the `INSN_INTTRIG` comedi instruction.  It
shouldn't be using `insn->data` at all; it should be using the separate
`data` pointer passed to the function.  Fix it.

Signed-off-by: Ian Abbott <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

staging: comedi: fix memory leak for saved channel list

commit c8cad4c upstream.

When `do_cmd_ioctl()` allocates memory for the kernel copy of a channel
list, it frees any previously allocated channel list in
`async->cmd.chanlist` and replaces it with the new one.  However, if the
device is ever removed (or "detached") the cleanup code in
`cleanup_device()` in "drivers.c" does not free this memory so it is
lost.

A sensible place to free the kernel copy of the channel list is in
`do_become_nonbusy()` as at that point the comedi asynchronous command
associated with the channel list is no longer valid.  Free the channel
list in `do_become_nonbusy()` instead of `do_cmd_ioctl()` and clear the
pointer to prevent it being freed more than once.

Note that `cleanup_device()` could be called at an inappropriate time
while the comedi device is open, but that's a separate bug not related
to this this patch.

Signed-off-by: Ian Abbott <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Remove BUG_ON from n_tty_read()

commit e9490e9 upstream.

Change the BUG_ON to WARN_ON and return in case of tty->read_buf==NULL. We want to track a
couple of long standing reports of this but at the same time we can avoid killing the box.

Signed-off-by: Stanislav Kozina <[email protected]>
Signed-off-by: Alan Cox <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

TTY: ttyprintk, don't touch behind tty->write_buf

commit ee8b593 upstream.

If a user provides a buffer larger than a tty->write_buf chunk and
passes '\r' at the end of the buffer, we touch an out-of-bound memory.

Add a check there to prevent this.

Signed-off-by: Jiri Slaby <[email protected]>
Cc: Samo Pogacnik <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

serial: pl011: handle corruption at high clock speeds

commit c5dd553 upstream.

This works around a few glitches in the ST version of the PL011
serial driver when using very high baud rates, as we do in the
Ux500: 3, 3.25, 4 and 4.05 Mbps.

Problem Observed/rootcause:

When using high baud-rates, and the baudrate*8 is getting close to
the provided clock frequency (so a division factor close to 1), when
using bursts of characters (so they are abutted), then it seems as if
there is not enough time to detect the beginning of the start-bit which
is a timing reference for the entire character, and thus the sampling
moment of character bits is moving towards the end of each bit, instead
of the middle.

Fix:
Increase slightly the RX baud rate of the UART above the theoretical
baudrate by 5%. This will definitely give more margin time to the
UART_RX to correctly sample the data at the middle of the bit period.

Also fix the ages old copy-paste error in the very stressed comment,
it's referencing the registers used in the PL010 driver rather than
the PL011 ones.

Signed-off-by: Guillaume Jaunet <[email protected]>
Signed-off-by: Christophe Arnal <[email protected]>
Signed-off-by: Matthias Locher <[email protected]>
Signed-off-by: Rajanikanth HV <[email protected]>
Cc: Bibek Basu <[email protected]>
Cc: Par-Gunnar Hjalmdahl <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

serial: set correct baud_base for EXSYS EX-41092 Dual 16950

commit 26e8220 upstream.

Apparently the same card model has two IDs, so this patch
complements the commit 39aced6
adding the missing one.

Signed-off-by: Flavio Leitner <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

b43legacy: Fix crash on unload when firmware not available

commit 2d838bb upstream.

When b43legacy is loaded without the firmware being available, a following
unload generates a kernel NULL pointer dereference BUG as follows:

[  214.330789] BUG: unable to handle kernel NULL pointer dereference at 0000004c
[  214.330997] IP: [<c104c395>] drain_workqueue+0x15/0x170
[  214.331179] *pde = 00000000
[  214.331311] Oops: 0000 [Flemmard#1] SMP
[  214.331471] Modules linked in: b43legacy(-) ssb pcmcia mac80211 cfg80211 af_packet mperf arc4 ppdev sr_mod cdrom sg shpchp yenta_socket pcmcia_rsrc pci_hotplug pcmcia_core battery parport_pc parport floppy container ac button edd autofs4 ohci_hcd ehci_hcd usbcore usb_common thermal processor scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc scsi_dh_alua scsi_dh fan thermal_sys hwmon ata_generic pata_ali libata [last unloaded: cfg80211]
[  214.333421] Pid: 3639, comm: modprobe Not tainted 3.6.0-rc6-wl+ #163 Source Technology VIC 9921/ALI Based Notebook
[  214.333580] EIP: 0060:[<c104c395>] EFLAGS: 00010246 CPU: 0
[  214.333687] EIP is at drain_workqueue+0x15/0x170
[  214.333788] EAX: c162ac40 EBX: cdfb8360 ECX: 0000002a EDX: 00002a2a
[  214.333890] ESI: 00000000 EDI: 00000000 EBP: cd767e7c ESP: cd767e5c
[  214.333957]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
[  214.333957] CR0: 8005003b CR2: 0000004c CR3: 0c96a000 CR4: 00000090
[  214.333957] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
[  214.333957] DR6: ffff0ff0 DR7: 00000400
[  214.333957] Process modprobe (pid: 3639, ti=cd766000 task=cf802e90 task.ti=cd766000)
[  214.333957] Stack:
[  214.333957]  00000292 cd767e74 c12c5e09 00000296 00000296 cdfb8360 cdfb9220 00000000
[  214.333957]  cd767e90 c104c4fd cdfb8360 cdfb9220 cd682800 cd767ea4 d0c10184 cd682800
[  214.333957]  cd767ea4 cba31064 cd767eb8 d0867908 cba31064 d087e09c cd96f034 cd767ec4
[  214.333957] Call Trace:
[  214.333957]  [<c12c5e09>] ? skb_dequeue+0x49/0x60
[  214.333957]  [<c104c4fd>] destroy_workqueue+0xd/0x150
[  214.333957]  [<d0c10184>] ieee80211_unregister_hw+0xc4/0x100 [mac80211]
[  214.333957]  [<d0867908>] b43legacy_remove+0x78/0x80 [b43legacy]
[  214.333957]  [<d083654d>] ssb_device_remove+0x1d/0x30 [ssb]
[  214.333957]  [<c126f15a>] __device_release_driver+0x5a/0xb0
[  214.333957]  [<c126fb07>] driver_detach+0x87/0x90
[  214.333957]  [<c126ef4c>] bus_remove_driver+0x6c/0xe0
[  214.333957]  [<c1270120>] driver_unregister+0x40/0x70
[  214.333957]  [<d083686b>] ssb_driver_unregister+0xb/0x10 [ssb]
[  214.333957]  [<d087c488>] b43legacy_exit+0xd/0xf [b43legacy]
[  214.333957]  [<c1089dde>] sys_delete_module+0x14e/0x2b0
[  214.333957]  [<c110a4a7>] ? vfs_write+0xf7/0x150
[  214.333957]  [<c1240050>] ? tty_write_lock+0x50/0x50
[  214.333957]  [<c110a6f8>] ? sys_write+0x38/0x70
[  214.333957]  [<c1397c55>] syscall_call+0x7/0xb
[  214.333957] Code: bc 27 00 00 00 00 a1 74 61 56 c1 55 89 e5 e8 a3 fc ff ff 5d c3 90 55 89 e5 57 56 89 c6 53 b8 40 ac 62 c1 83 ec 14 e8 bb b7 34 00 <8b> 46 4c 8d 50 01 85 c0 89 56 4c 75 03 83 0e 40 80 05 40 ac 62
[  214.333957] EIP: [<c104c395>] drain_workqueue+0x15/0x170 SS:ESP 0068:cd767e5c
[  214.333957] CR2: 000000000000004c
[  214.341110] ---[ end trace c7e90ec026d875a6 ]---Index: wireless-testing/drivers/net/wireless/b43legacy/main.c

The problem is fixed by making certain that the ucode pointer is not NULL
before deregistering the driver in mac80211.

Signed-off-by: Larry Finger <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

firmware: Add missing attributes to EFI variable attribute print out from sysfs

commit 7083909 upstream.

Some of the EFI variable attributes are missing from print out from
/sys/firmware/efi/vars/*/attributes. This patch adds those in. It also
updates code to use pre-defined constants for masking current value
of attributes.

Signed-off-by: Khalid Aziz <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Acked-by: Matthew Garrett <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

xhci: Intel Panther Point BEI quirk.

commit 80fab3b upstream.

When a device with an isochronous endpoint is behind a hub plugged into
the Intel Panther Point xHCI host controller, and the driver submits
multiple frames per URB, the xHCI driver will set the Block Event
Interrupt (BEI) flag on all but the last TD for the URB.  This causes
the host controller to place an event on the event ring, but not send an
interrupt.  When the last TD for the URB completes, BEI is cleared, and
we get an interrupt for the whole URB.

However, under a Panther Point xHCI host controller, if the parent hub
is unplugged when one or more events from transfers with BEI set are on
the event ring, a port status change event is placed on the event ring,
but no interrupt is generated.  This means URBs stop completing, and the
USB device disconnect is not noticed.  Something like a USB headset will
cause mplayer to hang when the device is disconnected.

If another transfer is sent (such as running `sudo lsusb -v`), the next
transfer event seems to "unstick" the event ring, the xHCI driver gets
an interrupt, and the disconnect is reported to the USB core.

The fix is not to use the BEI flag under the Panther Point xHCI host.
This will impact power consumption and system responsiveness, because
the xHCI driver will receive an interrupt for every frame in all
isochronous URBs instead of once per URB.

Intel chipset developers confirm that this bug will be hit if the BEI
flag is used on any endpoint, not just ones that are behind a hub.

This patch should be backported to kernels as old as 3.0, that contain
the commit 69e848c "Intel xhci: Support
EHCI/xHCI port switching."

Signed-off-by: Sarah Sharp <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

n_gsm: added interlocking for gsm_data_lock for certain code paths

commit 5e44708 upstream.

There were some locking holes in the management of the MUX's
message queue for 2 code paths:
1) gsmld_write_wakeup
2) receipt of CMD_FCON flow-control message
In both cases gsm_data_kick is called w/o locking so it can collide
with other other instances of gsm_data_kick (pulling messages tx_tail)
or potentially other instances of __gsm_data_queu (adding messages to tx_head)

Changed to take the tx_lock in these 2 cases

Signed-off-by: Russ Gorby <[email protected]>
Tested-by: Yin, Fengwei <[email protected]>
Signed-off-by: Alan Cox <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

coredump: prevent double-free on an error path in core dumper

commit f34f9d1 upstream.

In !CORE_DUMP_USE_REGSET case, if elf_note_info_init fails to allocate
memory for info->fields, it frees already allocated stuff and returns
error to its caller, fill_note_info.  Which in turn returns error to its
caller, elf_core_dump.  Which jumps to cleanup label and calls
free_note_info, which will happily try to free all info->fields again.
BOOM.

This is the fix.

Signed-off-by: Oleg Nesterov <[email protected]>
Signed-off-by: Denys Vlasenko <[email protected]>
Cc: Venu Byravarasu <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Increase XHCI suspend timeout to 16ms

commit a6e097d upstream.

The Intel XHCI specification says that after clearing the run/stop bit
the controller may take up to 16ms to halt. We've seen a device take
14ms, which with the current timeout of 10ms causes the kernel to
abort the suspend. Increasing the timeout to the recommended value
fixes the problem.

This patch should be backported to kernels as old as 2.6.37, that
contain the commit 5535b1d "USB: xHCI:
PCI power management implementation".

Signed-off-by: Michael Spang <[email protected]>
Signed-off-by: Sarah Sharp <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

n_gsm: memory leak in uplink error path

commit 88ed2a6 upstream.

Uplink (TX) network data will go through gsm_dlci_data_output_framed
there is a bug where if memory allocation fails, the skb which
has already been pulled off the list will be lost.

In addition TX skbs were being processed in LIFO order

Fixed the memory leak, and changed to FIFO order processing

Signed-off-by: Russ Gorby <[email protected]>
Tested-by: Kappel, LaurentX <[email protected]>
Signed-off-by: Alan Cox <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

UBI: fix autoresize handling in R/O mode

commit abb3e01 upstream.

Currently UBI fails in autoresize when it is in R/O mode (e.g., because the
underlying MTD device is R/O). This patch fixes the issue - we just skip
autoresize and print a warning.

Reported-by: Pali Rohár <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

SCSI: ibmvscsi: Fix host config length field overflow

commit 225c569 upstream.

The length field in the host config packet is only 16-bit long, so
passing it 0x10000 (64K which is our standard PAGE_SIZE) doesn't
work and result in an empty config from the server.

Signed-off-by: Benjamin Herrenschmidt <[email protected]>
Acked-by: Robert Jennings <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

SCSI: hpsa: Use LUN reset instead of target reset

commit 21e89af upstream.

It turns out Smart Array logical drives do not support target
reset and when the target reset fails, the logical drive will
be taken off line.  Symptoms look like this:

hpsa 0000:03:00.0: Abort request on C1:B0:T0:L0
hpsa 0000:03:00.0: resetting device 1:0:0:0
hpsa 0000:03:00.0: cp ffff880037c56000 is reported invalid (probably means target device no longer present)
hpsa 0000:03:00.0: resetting device failed.
sd 1:0:0:0: Device offlined - not ready after error recovery
sd 1:0:0:0: rejecting I/O to offline device
EXT3-fs error (device sdb1): read_block_bitmap:

LUN reset is supported though, and is what we should be using.
Target reset is also disruptive in shared SAS situations,
for example, an external MSA1210m which does support target
reset attached to Smart Arrays in multiple hosts -- a target
reset from one host is disruptive to other hosts as all LUNs
on the target will be reset and will abort all outstanding i/os
back to all the attached hosts.  So we should use LUN reset,
not target reset.

Tested this with Smart Array logical drives and with tape drives.
Not sure how this bug survived since 2009, except it must be very
rare for a Smart Array to require more than 30s to complete a request.

Signed-off-by: Stephen M. Cameron <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

can: mscan-mpc5xxx: fix return value check in mpc512x_can_get_clock()

commit f61bd05 upstream.

In case of error, the function clk_get() returns ERR_PTR()
and never returns NULL pointer. The NULL test in the error
handling should be replaced with IS_ERR().

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

Signed-off-by: Wei Yongjun <[email protected]>
Acked-by: Wolfgang Grandegger <[email protected]>
Signed-off-by: Marc Kleine-Budde <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

IPoIB: Fix use-after-free of multicast object

commit bea1e22 upstream.

Fix a crash in ipoib_mcast_join_task().  (with help from Or Gerlitz)

Commit c8c2afe ("IPoIB: Use rtnl lock/unlock when changing device
flags") added a call to rtnl_lock() in ipoib_mcast_join_task(), which
is run from the ipoib_workqueue, and hence the workqueue can't be
flushed from the context of ipoib_stop().

In the current code, ipoib_stop() (which doesn't flush the workqueue)
calls ipoib_mcast_dev_flush(), which goes and deletes all the
multicast entries.  This takes place without any synchronization with
a possible running instance of ipoib_mcast_join_task() for the same
ipoib device, leading to a crash due to NULL pointer dereference.

Fix this by making sure that the workqueue is flushed before
ipoib_mcast_dev_flush() is called.  To make that possible, we move the
RTNL-lock wrapped code to ipoib_mcast_join_finish().

Signed-off-by: Patrick McHardy <[email protected]>
Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

IB/srp: Fix use-after-free in srp_reset_req()

commit 9b796d0 upstream.

srp_free_req() uses the scsi_cmnd structure contents to unmap
buffers, so we must invoke srp_free_req() before we release
ownership of that structure.

Signed-off-by: Bart Van Assche <[email protected]>
Acked-by: David Dillow <[email protected]>
Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

IB/srp: Avoid having aborted requests hang

commit d853667 upstream.

We need to call scsi_done() for commands after we abort them.

Signed-off-by: Bart Van Assche <[email protected]>
Acked-by: David Dillow <[email protected]>
Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

isci: fix isci_pci_probe() generates warning on efi failure path

commit 6d70a74 upstream.

The oem parameter image embedded in the efi variable is at an offset
from the start of the variable.  However, in the failure path we try to
free the 'orom' pointer which is only valid when the paramaters are
being read from the legacy option-rom space.

Since failure to load the oem parameters is unlikely and we keep the
memory around in the success case just defer all de-allocation to devm.

Reported-by: Don Morris <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

x86/alternatives: Fix p6 nops on non-modular kernels

commit cb09cad upstream.

Probably a leftover from the early days of self-patching, p6nops
are marked __initconst_or_module, which causes them to be
discarded in a non-modular kernel.  If something later triggers
patching, it will overwrite kernel code with garbage.

Reported-by: Tomas Racek <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>
Cc: Michael Tokarev <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Marcelo Tosatti <[email protected]>
Cc: [email protected]
Cc: Anthony Liguori <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Alan Cox <[email protected]>
Cc: Alan Cox <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
Cc: Ben Jencks <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

PCI: honor child buses add_size in hot plug configuration

commit be76891 upstream.

git commit c8adf9a
    "PCI: pre-allocate additional resources to devices only after
	successful allocation of essential resources."

fails to take into consideration the optional-resources needed by children
devices while calculating the optional-resource needed by the bridge.

This can be a problem on some setup. For example, if a hotplug bridge has 8
children hotplug bridges, the bridge should have enough resources to accomodate
the hotplug requirements for each of its children hotplug bridges.  Currently
this is not the case.

This patch fixes the problem.

Signed-off-by: Yinghai Lu <[email protected]>
Reviewed-by: Ram Pai <[email protected]>
Signed-off-by: Jesse Barnes <[email protected]>
Cc: Andrew Worsley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

SCSI: scsi_remove_target: fix softlockup regression on hot remove

commit bc3f02a upstream.

John reports:
 BUG: soft lockup - CPU#2 stuck for 23s! [kworker/u:8:2202]
 [..]
 Call Trace:
  [<ffffffff8141782a>] scsi_remove_target+0xda/0x1f0
  [<ffffffff81421de5>] sas_rphy_remove+0x55/0x60
  [<ffffffff81421e01>] sas_rphy_delete+0x11/0x20
  [<ffffffff81421e35>] sas_port_delete+0x25/0x160
  [<ffffffff814549a3>] mptsas_del_end_device+0x183/0x270

...introduced by commit 3b661a9 "[SCSI] fix hot unplug vs async scan race".

Don't restart lookup of more stargets in the multi-target case, just
arrange to traverse the list once, on the assumption that new targets
are always added at the end.  There is no guarantee that the target will
change state in scsi_target_reap() so we can end up spinning if we
restart.

Acked-by: Jack Wang <[email protected]>
LKML-Reference: <CAEhu1-6wq1YsNiscGMwP4ud0Q+MrViRzv=kcWCQSBNc8c68N5Q@mail.gmail.com>
Reported-by: John Drescher <[email protected]>
Tested-by: John Drescher <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

SCSI: scsi_dh_alua: Enable STPG for unavailable ports

commit e47f897 upstream.

A quote from SPC-4: "While in the unavailable primary target port
asymmetric access state, the device server shall support those of
the following commands that it supports while in the active/optimized
state: [ ... ] d) SET TARGET PORT GROUPS; [ ... ]". Hence enable
sending STPG to a target port group that is in the unavailable state.

Signed-off-by: Bart Van Assche <[email protected]>
Reviewed-by: Mike Christie <[email protected]>
Acked-by: Hannes Reinecke <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Linux 3.0.45
Jerl92 pushed a commit to Jerl92/htc7x30-3.0 that referenced this issue Jan 24, 2013
ath9k: fix stale pointers potentially causing access to free'd skbs

commit 8c6e309 upstream.

bf->bf_next is only while buffers are chained as part of an A-MPDU
in the tx queue. When a tid queue is flushed (e.g. on tearing down
an aggregation session), frames can be enqueued again as normal
transmission, without bf_next being cleared. This can lead to the
old pointer being dereferenced again later.

This patch might fix crashes and "Failed to stop TX DMA!" messages.

Signed-off-by: Felix Fietkau <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

rt2800: validate step value for temperature compensation

commit bf7e1ab upstream.

Some hardware has correct (!= 0xff) value of tssi_bounds[4] in the
EEPROM, but step is equal to 0xff. This results on ridiculous delta
calculations and completely broke TX power settings.

Reported-and-tested-by: Pavel Lucik <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Acked-by: Ivo van Doorn <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

target: Don't return success from module_init() if setup fails

commit 0d0f9df upstream.

If the call to core_dev_release_virtual_lun0() fails, then nothing
sets ret to anything other than 0, so even though everything is
torn down and freed, target_core_init_configfs() will seem to succeed
and the module will be loaded.  Fix this by passing the return value
on up the chain.

Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: Nicholas Bellinger <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

cfg80211: fix antenna gain handling

commit c4a9faf upstream.

No driver initializes chan->max_antenna_gain to something sensible, and
the only place where it is being used right now is inside ath9k. This
leads to ath9k potentially using less tx power than it can use, which can
decrease performance/range in some rare cases.

Rather than going through every single driver, this patch initializes
chan->orig_mag in wiphy_register(), ignoring whatever value the driver
left in there. If a driver for some reason wishes to limit it independent
from regulatory rulesets, it can do so internally.

Signed-off-by: Felix Fietkau <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

wireless: drop invalid mesh address extension frames

commit 7dd111e upstream.

The mesh header can have address extension by a 4th
or a 5th and 6th address, but never both. Drop such
frames in 802.11 -> 802.3 conversion along with any
frames that have the wrong extension.

Reviewed-by: Javier Cardona <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

mac80211: don't inspect Sequence Control field on control frames

commit f7fbf70 upstream.

Per IEEE Std. 802.11-2012, Sec 8.2.4.4.1, the sequence Control field is
not present in control frames.  We noticed this problem when processing
Block Ack Requests.

Signed-off-by: Javier Cardona <[email protected]>
Signed-off-by: Javier Lopez <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

DRM/Radeon: Fix Load Detection on legacy primary DAC.

commit 83325d0 upstream.

An uninitialized variable led to broken load detection.

Signed-off-by: Egbert Eich <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

mac80211: check management frame header length

commit 4a4f1a5 upstream.

Due to pskb_may_pull() checking the skb length, all
non-management frames are checked on input whether
their 802.11 header is fully present. Also add that
check for management frames and remove a check that
is now duplicate. This prevents accessing skb data
beyond the frame end.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

mac80211: fix SSID copy on IBSS JOIN

commit badecb0 upstream.

The 'ssid' field of the cfg80211_ibss_params is a u8 pointer and
its length is likely to be less than IEEE80211_MAX_SSID_LEN most
of the time.

This patch fixes the ssid copy in ieee80211_ibss_join() by using
the SSID length to prevent it from reading beyond the string.

Signed-off-by: Antonio Quartulli <[email protected]>
[rewrapped commit message, small rewording]
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfsv3: Make v3 mounts fail with ETIMEDOUTs instead EIO on mountd timeouts

commit acce94e upstream.

In very busy v3 environment, rpc.mountd can respond to the NULL
procedure but not the MNT procedure in a timely manner causing
the MNT procedure to time out. The problem is the mount system
call returns EIO which causes the mount to fail, instead of
ETIMEDOUT, which would cause the mount to be retried.

This patch sets the RPC_TASK_SOFT|RPC_TASK_TIMEOUT flags to
the rpc_call_sync() call in nfs_mount() which causes
ETIMEDOUT to be returned on timed out connections.

Signed-off-by: Steve Dickson <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfs: Show original device name verbatim in /proc/*/mount{s,info}

commit 97a5486 upstream.

Since commit c7f404b ('vfs: new superblock methods to override
/proc/*/mount{s,info}'), nfs_path() is used to generate the mounted
device name reported back to userland.

nfs_path() always generates a trailing slash when the given dentry is
the root of an NFS mount, but userland may expect the original device
name to be returned verbatim (as it used to be).  Make this
canonicalisation optional and change the callers accordingly.

[[email protected]: use flag instead of bool argument]
Reported-and-tested-by: Chris Hiestand <[email protected]>
Reference: http://bugs.debian.org/669314
Signed-off-by: Ben Hutchings <[email protected]>
Signed-off-by: Jonathan Nieder <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

NFSv4: nfs4_locku_done must release the sequence id

commit 2b1bc30 upstream.

If the state recovery machinery is triggered by the call to
nfs4_async_handle_error() then we can deadlock.

Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfsd: add get_uint for u32's

commit a007c4c upstream.

I don't think there's a practical difference for the range of values
these interfaces should see, but it would be safer to be unambiguous.

Signed-off-by: J. Bruce Fields <[email protected]>
Cc: Sasha Levin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

NFS: fix bug in legacy DNS resolver.

commit 8d96b10 upstream.

The DNS resolver's use of the sunrpc cache involves a 'ttl' number
(relative) rather that a timeout (absolute).  This confused me when
I wrote
  commit c5b29f8
     "sunrpc: use seconds since boot in expiry cache"

and I managed to break it.  The effect is that any TTL is interpreted
as 0, and nothing useful gets into the cache.

This patch removes the use of get_expiry() - which really expects an
expiry time - and uses get_uint() instead, treating the int correctly
as a ttl.

This fixes a regression that has been present since 2.6.37, causing
certain NFS accesses in certain environments to incorrectly fail.

Reported-by: Chuck Lever <[email protected]>
Tested-by: Chuck Lever <[email protected]>
Signed-off-by: NeilBrown <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

NFS: Fix Oopses in nfs_lookup_revalidate and nfs4_lookup_revalidate

[Fixed upstream as part of 0b728e1, but that's a much larger patch,
this is only the nfs portion backported as needed.]

Fix the following Oops in 3.5.1:

 BUG: unable to handle kernel NULL pointer dereference at 0000000000000038
 IP: [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs]
 PGD 337c63067 PUD 0
 Oops: 0000 [Flemmard#1] SMP
 CPU 5
 Modules linked in: nfs fscache nfsd lockd nfs_acl auth_rpcgss sunrpc af_packet binfmt_misc cpufreq_conservative cpufreq_userspace cpufreq_powersave dm_mod acpi_cpufreq mperf coretemp gpio_ich kvm_intel joydev kvm ioatdma hid_generic igb lpc_ich i7core_edac edac_core ptp serio_raw dca pcspkr i2c_i801 mfd_core sg pps_core usbhid crc32c_intel microcode button autofs4 uhci_hcd ttm drm_kms_helper drm i2c_algo_bit sysimgblt sysfillrect syscopyarea ehci_hcd usbcore usb_common scsi_dh_rdac scsi_dh_emc scsi_dh_hp_sw scsi_dh_alua scsi_dh edd fan ata_piix thermal processor thermal_sys

 Pid: 30431, comm: java Not tainted 3.5.1-2-default Flemmard#1 Supermicro X8DTT/X8DTT
 RIP: 0010:[<ffffffffa03789cd>]  [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs]
 RSP: 0018:ffff8801b418bd38  EFLAGS: 00010292
 RAX: 00000000fffffff6 RBX: ffff88032016d800 RCX: 0000000000000020
 RDX: ffffffff00000000 RSI: 0000000000000000 RDI: ffff8801824a7b00
 RBP: ffff8801b418bdf8 R08: 7fffff0034323030 R09: fffffffff04c03ed
 R10: ffff8801824a7b00 R11: 0000000000000002 R12: ffff8801824a7b00
 R13: ffff8801824a7b00 R14: 0000000000000000 R15: ffff8803201725d0
 FS:  00002b53a46cb700(0000) GS:ffff88033fc20000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 0000000000000038 CR3: 000000020a426000 CR4: 00000000000007e0
 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
 Process java (pid: 30431, threadinfo ffff8801b418a000, task ffff8801b5d20600)
 Stack:
  ffff8801b418be44 ffff88032016d800 ffff8801b418bdf8 0000000000000000
  ffff8801824a7b00 ffff8801b418bdd7 ffff8803201725d0 ffffffff8116a9c0
  ffff8801b5c38dc0 0000000000000007 ffff88032016d800 0000000000000000
 Call Trace:
  [<ffffffff8116a9c0>] lookup_dcache+0x80/0xe0
  [<ffffffff8116aa43>] __lookup_hash+0x23/0x90
  [<ffffffff8116b4a5>] lookup_one_len+0xc5/0x100
  [<ffffffffa03869a3>] nfs_sillyrename+0xe3/0x210 [nfs]
  [<ffffffff8116cadf>] vfs_unlink.part.25+0x7f/0xe0
  [<ffffffff8116f22c>] do_unlinkat+0x1ac/0x1d0
  [<ffffffff815717b9>] system_call_fastpath+0x16/0x1b
  [<00002b5348b5f527>] 0x2b5348b5f526
 Code: ec 38 b8 f6 ff ff ff 4c 89 64 24 18 4c 89 74 24 28 49 89 fc 48 89 5c 24 08 48 89 6c 24 10 49 89 f6 4c 89 6c 24 20 4c 89 7c 24 30 <f6> 46 38 40 0f 85 d1 00 00 00 e8 c4 c4 df e0 48 8b 58 30 49 89
 RIP  [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs]
  RSP <ffff8801b418bd38>
 CR2: 0000000000000038
 ---[ end trace 845113ed191985dd ]---

This Oops affects 3.5 kernels and older, and is due to lookup_one_len()
calling down to the dentry revalidation code with a NULL pointer
to struct nameidata.

It is fixed upstream by commit 0b728e1 (stop passing nameidata *
to ->d_revalidate())

Reported-by: Richard Ems <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm: restore open_count if drm_setup fails

commit 0f1cb1b upstream.

If drm_setup (called at first open) fails, the whole
open call has failed, so we should not keep the
open_count incremented.

Signed-off-by: Ilija Hadzic <[email protected]>
Reviewed-by: Thomas Hellstrom <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

hwmon: (w83627ehf) Force initial bank selection

commit 3300fb4 upstream.

Don't assume bank 0 is selected at device probe time. This may not be
the case. Force bank selection at first register access to guarantee
that we read the right registers upon driver loading.

Signed-off-by: Jean Delvare <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: PCM: Fix some races at disconnection

commit 9b0573c upstream.

Fix races at PCM disconnection:
- while a PCM device is being opened or closed
- while the PCM state is being changed without lock in prepare,
  hw_params, hw_free ops

Reported-by: Matthieu CASTET <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: Fix races at disconnection

commit 978520b upstream.

Close some races at disconnection of a USB audio device by adding the
chip->shutdown_mutex and chip->shutdown check at appropriate places.

The spots to put bandaids are:
- PCM prepare, hw_params and hw_free
- where the usb device is accessed for communication or get speed, in
 mixer.c and others; the device speed is now cached in subs->speed
 instead of accessing to chip->dev

The accesses in PCM open and close don't need the mutex protection
because these are already handled in the core PCM disconnection code.

The autosuspend/autoresume codes are still uncovered by this patch
because of possible mutex deadlocks.  They'll be covered by the
upcoming change to rwsem.

Also the mixer codes are untouched, too.  These will be fixed in
another patch, too.

Reported-by: Matthieu CASTET <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: Use rwsem for disconnect protection

commit 34f3c89 upstream.

Replace mutex with rwsem for codec->shutdown protection so that
concurrent accesses are allowed.

Also add the protection to snd_usb_autosuspend() and
snd_usb_autoresume(), too.

Reported-by: Matthieu CASTET <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: Fix races at disconnection in mixer_quirks.c

commit 888ea7d upstream.

Similar like the previous commit, cover with chip->shutdown_rwsem
and chip->shutdown checks.

Reported-by: Matthieu CASTET <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: Add a reference counter to card instance

commit a0830db upstream.

For more strict protection for wild disconnections, a refcount is
introduced to the card instance, and let it up/down when an object is
referred via snd_lookup_*() in the open ops.

The free-after-last-close check is also changed to check this refcount
instead of the empty list, too.

Reported-by: Matthieu CASTET <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: Avoid endless sleep after disconnect

commit 0914f79 upstream.

When disconnect callback is called, each component should wake up
sleepers and check card->shutdown flag for avoiding the endless sleep
blocking the proper resource release.

Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

sctp: fix call to SCTP_CMD_PROCESS_SACK in sctp_cmd_interpreter()

[ Upstream commit f6e80ab ]

Bug introduced by commit edfee03
(sctp: check src addr when processing SACK to update transport state)

Signed-off-by: Zijie Pan <[email protected]>
Signed-off-by: Nicolas Dichtel <[email protected]>
Acked-by: Vlad Yasevich <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

netlink: use kfree_rcu() in netlink_release()

[ Upstream commit 6d772ac ]

On some suspend/resume operations involving wimax device, we have
noticed some intermittent memory corruptions in netlink code.

Stéphane Marchesin tracked this corruption in netlink_update_listeners()
and suggested a patch.

It appears netlink_release() should use kfree_rcu() instead of kfree()
for the listeners structure as it may be used by other cpus using RCU
protection.

netlink_release() must set to NULL the listeners pointer when
it is about to be freed.

Also have to protect netlink_update_listeners() and
netlink_has_listeners() if listeners is NULL.

Add a nl_deref_protected() lockdep helper to properly document which
locks protects us.

Reported-by: Jonathan Kliegman <[email protected]>
Signed-off-by: Eric Dumazet <[email protected]>
Cc: Stéphane Marchesin <[email protected]>
Cc: Sam Leffler <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

tcp: fix FIONREAD/SIOCINQ

[ Upstream commit a3374c4 ]

tcp_ioctl() tries to take into account if tcp socket received a FIN
to report correct number bytes in receive queue.

But its flaky because if the application ate the last skb,
we return 1 instead of 0.

Correct way to detect that FIN was received is to test SOCK_DONE.

Reported-by: Elliot Hughes <[email protected]>
Signed-off-by: Eric Dumazet <[email protected]>
Cc: Neal Cardwell <[email protected]>
Cc: Tom Herbert <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ipv6: Set default hoplimit as zero.

[ Upstream commit 14edd87 ]

Commit a02e4b7(Demark default hoplimit as zero) only changes the
hoplimit checking condition and default value in ip6_dst_hoplimit, not
zeros all hoplimit default value.

Keep the zeroing ip6_template_metrics[RTAX_HOPLIMIT - 1] to force it as
const, cause as a37e6e3(net: force dst_default_metrics to const
section)

Signed-off-by: Li RongQing <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: usb: Fix memory leak on Tx data path

[ Upstream commit 39707c2 ]

Driver anchors the tx urbs and defers the urb submission if
a transmit request comes when the interface is suspended.
Anchoring urb increments the urb reference count. These
deferred urbs are later accessed by calling usb_get_from_anchor()
for submission during interface resume. usb_get_from_anchor()
unanchors the urb but urb reference count remains same.
This causes the urb reference count to remain non-zero
after usb_free_urb() gets called and urb never gets freed.
Hence call usb_put_urb() after anchoring the urb to properly
balance the reference count for these deferred urbs. Also,
unanchor these deferred urbs during disconnect, to free them
up.

Signed-off-by: Hemant Kumar <[email protected]>
Acked-by: Oliver Neukum <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: fix divide by zero in tcp algorithm illinois

[ Upstream commit 8f363b7 ]

Reading TCP stats when using TCP Illinois congestion control algorithm
can cause a divide by zero kernel oops.

The division by zero occur in tcp_illinois_info() at:
 do_div(t, ca->cnt_rtt);
where ca->cnt_rtt can become zero (when rtt_reset is called)

Steps to Reproduce:
 1. Register tcp_illinois:
     # sysctl -w net.ipv4.tcp_congestion_control=illinois
 2. Monitor internal TCP information via command "ss -i"
     # watch -d ss -i
 3. Establish new TCP conn to machine

Either it fails at the initial conn, or else it needs to wait
for a loss or a reset.

This is only related to reading stats.  The function avg_delay() also
performs the same divide, but is guarded with a (ca->cnt_rtt > 0) at its
calling point in update_params().  Thus, simply fix tcp_illinois_info().

Function tcp_illinois_info() / get_info() is called without
socket lock.  Thus, eliminate any race condition on ca->cnt_rtt
by using a local stack variable.  Simply reuse info.tcpv_rttcnt,
as its already set to ca->cnt_rtt.
Function avg_delay() is not affected by this race condition, as
its called with the socket lock.

Cc: Petr Matousek <[email protected]>
Signed-off-by: Jesper Dangaard Brouer <[email protected]>
Acked-by: Eric Dumazet <[email protected]>
Acked-by: Stephen Hemminger <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

l2tp: fix oops in l2tp_eth_create() error path

[ Upstream commit 7893363 ]

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

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

Signed-off-by: Tom Parkin <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ipv6: send unsolicited neighbour advertisements to all-nodes

[ Upstream commit 60713a0 ]

As documented in RFC4861 (Neighbor Discovery for IP version 6) 7.2.6.,
unsolicited neighbour advertisements should be sent to the all-nodes
multicast address.

Signed-off-by: Hannes Frederic Sowa <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

futex: Handle futex_pi OWNER_DIED take over correctly

commit 59fa624 upstream.

Siddhesh analyzed a failure in the take over of pi futexes in case the
owner died and provided a workaround.
See: http://sourceware.org/bugzilla/show_bug.cgi?id=14076

The detailed problem analysis shows:

Futex F is initialized with PTHREAD_PRIO_INHERIT and
PTHREAD_MUTEX_ROBUST_NP attributes.

T1 lock_futex_pi(F);

T2 lock_futex_pi(F);
   --> T2 blocks on the futex and creates pi_state which is associated
       to T1.

T1 exits
   --> exit_robust_list() runs
       --> Futex F userspace value TID field is set to 0 and
           FUTEX_OWNER_DIED bit is set.

T3 lock_futex_pi(F);
   --> Succeeds due to the check for F's userspace TID field == 0
   --> Claims ownership of the futex and sets its own TID into the
       userspace TID field of futex F
   --> returns to user space

T1 --> exit_pi_state_list()
       --> Transfers pi_state to waiter T2 and wakes T2 via
       	   rt_mutex_unlock(&pi_state->mutex)

T2 --> acquires pi_state->mutex and gains real ownership of the
       pi_state
   --> Claims ownership of the futex and sets its own TID into the
       userspace TID field of futex F
   --> returns to user space

T3 --> observes inconsistent state

This problem is independent of UP/SMP, preemptible/non preemptible
kernels, or process shared vs. private. The only difference is that
certain configurations are more likely to expose it.

So as Siddhesh correctly analyzed the following check in
futex_lock_pi_atomic() is the culprit:

	if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {

We check the userspace value for a TID value of 0 and take over the
futex unconditionally if that's true.

AFAICT this check is there as it is correct for a different corner
case of futexes: the WAITERS bit became stale.

Now the proposed change

-	if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {
+       if (unlikely(ownerdied ||
+                       !(curval & (FUTEX_TID_MASK | FUTEX_WAITERS)))) {

solves the problem, but it's not obvious why and it wreckages the
"stale WAITERS bit" case.

What happens is, that due to the WAITERS bit being set (T2 is blocked
on that futex) it enforces T3 to go through lookup_pi_state(), which
in the above case returns an existing pi_state and therefor forces T3
to legitimately fight with T2 over the ownership of the pi_state (via
pi_state->mutex). Probelm solved!

Though that does not work for the "WAITERS bit is stale" problem
because if lookup_pi_state() does not find existing pi_state it
returns -ERSCH (due to TID == 0) which causes futex_lock_pi() to
return -ESRCH to user space because the OWNER_DIED bit is not set.

Now there is a different solution to that problem. Do not look at the
user space value at all and enforce a lookup of possibly available
pi_state. If pi_state can be found, then the new incoming locker T3
blocks on that pi_state and legitimately races with T2 to acquire the
rt_mutex and the pi_state and therefor the proper ownership of the
user space futex.

lookup_pi_state() has the correct order of checks. It first tries to
find a pi_state associated with the user space futex and only if that
fails it checks for futex TID value = 0. If no pi_state is available
nothing can create new state at that point because this happens with
the hash bucket lock held.

So the above scenario changes to:

T1 lock_futex_pi(F);

T2 lock_futex_pi(F);
   --> T2 blocks on the futex and creates pi_state which is associated
       to T1.

T1 exits
   --> exit_robust_list() runs
       --> Futex F userspace value TID field is set to 0 and
           FUTEX_OWNER_DIED bit is set.

T3 lock_futex_pi(F);
   --> Finds pi_state and blocks on pi_state->rt_mutex

T1 --> exit_pi_state_list()
       --> Transfers pi_state to waiter T2 and wakes it via
       	   rt_mutex_unlock(&pi_state->mutex)

T2 --> acquires pi_state->mutex and gains ownership of the pi_state
   --> Claims ownership of the futex and sets its own TID into the
       userspace TID field of futex F
   --> returns to user space

This covers all gazillion points on which T3 might come in between
T1's exit_robust_list() clearing the TID field and T2 fixing it up. It
also solves the "WAITERS bit stale" problem by forcing the take over.

Another benefit of changing the code this way is that it makes it less
dependent on untrusted user space values and therefor minimizes the
possible wreckage which might be inflicted.

As usual after staring for too long at the futex code my brain hurts
so much that I really want to ditch that whole optimization of
avoiding the syscall for the non contended case for PI futexes and rip
out the maze of corner case handling code. Unfortunately we can't as
user space relies on that existing behaviour, but at least thinking
about it helps me to preserve my mental sanity. Maybe we should
nevertheless :)

Reported-and-tested-by: Siddhesh Poyarekar <[email protected]>
Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1210232138540.2756@ionos
Acked-by: Darren Hart <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/vmwgfx: Fix hibernation device reset

commit 95e8f6a upstream.

The device would not reset properly when resuming from hibernation.

Signed-off-by: Thomas Hellstrom <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Dmitry Torokhov <[email protected]>
Cc: [email protected]
Signed-off-by: Dave Airlie <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/i915: fixup infoframe support for sdvo

commit 81014b9 upstream.

At least the worst offenders:
- SDVO specifies that the encoder should compute the ecc. Testing also
  shows that we must not send the ecc field, so copy the dip_infoframe
  struct to a temporay place and avoid the ecc field. This way the avi
  infoframe is exactly 17 bytes long, which agrees with what the spec
  mandates as a minimal storage capacity (with the ecc field it would
  be 18 bytes).
- Only 17 when sending the avi infoframe. The SDVO spec explicitly
  says that sending more data than what the device announces results
  in undefined behaviour.
- Add __attribute__((packed)) to the avi and spd infoframes, for
  otherwise they're wrongly aligned. Noticed because the avi infoframe
  ended up being 18 bytes large instead of 17. We haven't noticed this
  yet because we don't use the uint16_t fields yet (which are the only
  ones that would be wrongly aligned).

This regression has been introduce by

3c17fe4 is the first bad commit
commit 3c17fe4
Author: David Härdeman <[email protected]>
Date:   Fri Sep 24 21:44:32 2010 +0200

    i915: enable AVI infoframe for intel_hdmi.c [v4]

Patch tested on my g33 with a sdvo hdmi adaptor.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=25732
Tested-by: Peter Ross <[email protected]> (G35 SDVO-HDMI)
Reviewed-by: Eugeni Dodonov <[email protected]>
Signed-Off-by: Daniel Vetter <[email protected]>
Cc: Ben Hutchings <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/i915: clear the entire sdvo infoframe buffer

commit b6e0e54 upstream.

Like in the case of native hdmi, which is fixed already in

commit adf00b2
Author: Paulo Zanoni <[email protected]>
Date:   Tue Sep 25 13:23:34 2012 -0300

    drm/i915: make sure we write all the DIP data bytes

we need to clear the entire sdvo buffer to avoid upsetting the
display.

Since infoframe buffer writing is now a bit more elaborate, extract it
into it's own function. This will be useful if we ever get around to
properly update the ELD for sdvo. Also #define proper names for the
two buffer indexes with fixed usage.

v2: Cite the right commit above, spotted by Paulo Zanoni.

v3: I'm too stupid to paste the right commit.

v4: Ben Hutchings noticed that I've failed to handle an underflow in
my loop logic, breaking it for i >= length + 8. Since I've just lost C
programmer license, use his solution. Also, make the frustrated 0-base
buffer size a notch more clear.

Reported-and-tested-by: Jürg Billeter <[email protected]>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=25732
Cc: Paulo Zanoni <[email protected]>
Cc: Ben Hutchings <[email protected]>
Reviewed-by: Rodrigo Vivi <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: mos7840: remove unused variable

Fix warning about unused variable introduced by commit e681b66
("USB: mos7840: remove invalid disconnect handling") upstream.

A subsequent fix which removed the disconnect function got rid of the
warning but that one was only backported to v3.6.

Reported-by: Jiri Slaby <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

xfs: fix reading of wrapped log data

commit 6ce377a upstream.

Commit 4439647 ("xfs: reset buffer pointers before freeing them") in
3.0-rc1 introduced a regression when recovering log buffers that
wrapped around the end of log. The second part of the log buffer at
the start of the physical log was being read into the header buffer
rather than the data buffer, and hence recovery was seeing garbage
in the data buffer when it got to the region of the log buffer that
was incorrectly read.

Reported-by: Torsten Kaiser <[email protected]>
Signed-off-by: Dave Chinner <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Mark Tinguely <[email protected]>
Signed-off-by: Ben Myers <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

intel-iommu: Fix AB-BA lockdep report

commit 3e7abe2 upstream.

When unbinding a device so that I could pass it through to a KVM VM, I
got the lockdep report below.  It looks like a legitimate lock
ordering problem:

 - domain_context_mapping_one() takes iommu->lock and calls
   iommu_support_dev_iotlb(), which takes device_domain_lock (inside
   iommu->lock).

 - domain_remove_one_dev_info() starts by taking device_domain_lock
   then takes iommu->lock inside it (near the end of the function).

So this is the classic AB-BA deadlock.  It looks like a safe fix is to
simply release device_domain_lock a bit earlier, since as far as I can
tell, it doesn't protect any of the stuff accessed at the end of
domain_remove_one_dev_info() anyway.

BTW, the use of device_domain_lock looks a bit unsafe to me... it's
at least not obvious to me why we aren't vulnerable to the race below:

  iommu_support_dev_iotlb()
                                          domain_remove_dev_info()

  lock device_domain_lock
    find info
  unlock device_domain_lock

                                          lock device_domain_lock
                                            find same info
                                          unlock device_domain_lock

                                          free_devinfo_mem(info)

  do stuff with info after it's free

However I don't understand the locking here well enough to know if
this is a real problem, let alone what the best fix is.

Anyway here's the full lockdep output that prompted all of this:

     =======================================================
     [ INFO: possible circular locking dependency detected ]
     2.6.39.1+ Flemmard#1
     -------------------------------------------------------
     bash/13954 is trying to acquire lock:
      (&(&iommu->lock)->rlock){......}, at: [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230

     but task is already holding lock:
      (device_domain_lock){-.-...}, at: [<ffffffff812f6508>] domain_remove_one_dev_info+0x208/0x230

     which lock already depends on the new lock.

     the existing dependency chain (in reverse order) is:

     -> Flemmard#1 (device_domain_lock){-.-...}:
            [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
            [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
            [<ffffffff812f8350>] domain_context_mapping_one+0x600/0x750
            [<ffffffff812f84df>] domain_context_mapping+0x3f/0x120
            [<ffffffff812f9175>] iommu_prepare_identity_map+0x1c5/0x1e0
            [<ffffffff81ccf1ca>] intel_iommu_init+0x88e/0xb5e
            [<ffffffff81cab204>] pci_iommu_init+0x16/0x41
            [<ffffffff81002165>] do_one_initcall+0x45/0x190
            [<ffffffff81ca3d3f>] kernel_init+0xe3/0x168
            [<ffffffff8157ac24>] kernel_thread_helper+0x4/0x10

     -> #0 (&(&iommu->lock)->rlock){......}:
            [<ffffffff8109bf3e>] __lock_acquire+0x195e/0x1e10
            [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
            [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
            [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230
            [<ffffffff812f8b42>] device_notifier+0x72/0x90
            [<ffffffff8157555c>] notifier_call_chain+0x8c/0xc0
            [<ffffffff81089768>] __blocking_notifier_call_chain+0x78/0xb0
            [<ffffffff810897b6>] blocking_notifier_call_chain+0x16/0x20
            [<ffffffff81373a5c>] __device_release_driver+0xbc/0xe0
            [<ffffffff81373ccf>] device_release_driver+0x2f/0x50
            [<ffffffff81372ee3>] driver_unbind+0xa3/0xc0
            [<ffffffff813724ac>] drv_attr_store+0x2c/0x30
            [<ffffffff811e4506>] sysfs_write_file+0xe6/0x170
            [<ffffffff8117569e>] vfs_write+0xce/0x190
            [<ffffffff811759e4>] sys_write+0x54/0xa0
            [<ffffffff81579a82>] system_call_fastpath+0x16/0x1b

     other info that might help us debug this:

     6 locks held by bash/13954:
      #0:  (&buffer->mutex){+.+.+.}, at: [<ffffffff811e4464>] sysfs_write_file+0x44/0x170
      Flemmard#1:  (s_active#3){++++.+}, at: [<ffffffff811e44ed>] sysfs_write_file+0xcd/0x170
      Flemmard#2:  (&__lockdep_no_validate__){+.+.+.}, at: [<ffffffff81372edb>] driver_unbind+0x9b/0xc0
      Flemmard#3:  (&__lockdep_no_validate__){+.+.+.}, at: [<ffffffff81373cc7>] device_release_driver+0x27/0x50
      Flemmard#4:  (&(&priv->bus_notifier)->rwsem){.+.+.+}, at: [<ffffffff8108974f>] __blocking_notifier_call_chain+0x5f/0xb0
      Flemmard#5:  (device_domain_lock){-.-...}, at: [<ffffffff812f6508>] domain_remove_one_dev_info+0x208/0x230

     stack backtrace:
     Pid: 13954, comm: bash Not tainted 2.6.39.1+ Flemmard#1
     Call Trace:
      [<ffffffff810993a7>] print_circular_bug+0xf7/0x100
      [<ffffffff8109bf3e>] __lock_acquire+0x195e/0x1e10
      [<ffffffff810972bd>] ? trace_hardirqs_off+0xd/0x10
      [<ffffffff8109d57d>] ? trace_hardirqs_on_caller+0x13d/0x180
      [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
      [<ffffffff812f6421>] ? domain_remove_one_dev_info+0x121/0x230
      [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
      [<ffffffff812f6421>] ? domain_remove_one_dev_info+0x121/0x230
      [<ffffffff810972bd>] ? trace_hardirqs_off+0xd/0x10
      [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230
      [<ffffffff812f8b42>] device_notifier+0x72/0x90
      [<ffffffff8157555c>] notifier_call_chain+0x8c/0xc0
      [<ffffffff81089768>] __blocking_notifier_call_chain+0x78/0xb0
      [<ffffffff810897b6>] blocking_notifier_call_chain+0x16/0x20
      [<ffffffff81373a5c>] __device_release_driver+0xbc/0xe0
      [<ffffffff81373ccf>] device_release_driver+0x2f/0x50
      [<ffffffff81372ee3>] driver_unbind+0xa3/0xc0
      [<ffffffff813724ac>] drv_attr_store+0x2c/0x30
      [<ffffffff811e4506>] sysfs_write_file+0xe6/0x170
      [<ffffffff8117569e>] vfs_write+0xce/0x190
      [<ffffffff811759e4>] sys_write+0x54/0xa0
      [<ffffffff81579a82>] system_call_fastpath+0x16/0x1b

Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
Cc: Steven Rostedt <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: Fix card refcount unbalance

commit 8bb4d9c upstream.

There are uncovered cases whether the card refcount introduced by the
commit a0830db isn't properly increased or decreased:
- OSS PCM and mixer success paths
- When lookup function gets NULL

This patch fixes these places.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50251

Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: Fix mutex deadlock at disconnection

commit 10e4423 upstream.

The recent change for USB-audio disconnection race fixes introduced a
mutex deadlock again.  There is a circular dependency between
chip->shutdown_rwsem and pcm->open_mutex, depicted like below, when a
device is opened during the disconnection operation:

A. snd_usb_audio_disconnect() ->
     card.c::register_mutex ->
       chip->shutdown_rwsem (write) ->
         snd_card_disconnect() ->
           pcm.c::register_mutex ->
             pcm->open_mutex

B. snd_pcm_open() ->
     pcm->open_mutex ->
       snd_usb_pcm_open() ->
         chip->shutdown_rwsem (read)

Since the chip->shutdown_rwsem protection in the case A is required
only for turning on the chip->shutdown flag and it doesn't have to be
taken for the whole operation, we can reduce its window in
snd_usb_audio_disconnect().

Reported-by: Jiri Slaby <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Jerl92 pushed a commit to Jerl92/htc7x30-3.0 that referenced this issue Jan 24, 2013
Dove: Attempt to fix PMU/RTC interrupts

commit 5d3df93 upstream.

Fix the acknowledgement of PMU interrupts on Dove: some Dove hardware
has not been sensibly designed so that interrupts can be handled in a
race free manner.  The PMU is one such instance.

The pending (aka 'cause') register is a bunch of RW bits, meaning that
these bits can be both cleared and set by software (confirmed on the
Armada-510 on the cubox.)

Hardware sets the appropriate bit when an interrupt is asserted, and
software is required to clear the bits which are to be processed.  If
we write ~(1 << bit), then we end up asserting every other interrupt
except the one we're processing.  So, we need to do a read-modify-write
cycle to clear the asserted bit.

However, any interrupts which occur in the middle of this cycle will
also be written back as zero, which will also clear the new interrupts.

The upshot of this is: there is _no_ way to safely clear down interrupts
in this register (and other similarly behaving interrupt pending
registers on this device.)  The patch below at least stops us creating
new interrupts.

Signed-off-by: Russell King <[email protected]>
Signed-off-by: Jason Cooper <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Dove: Fix irq_to_pmu()

commit d356cf5 upstream.

PMU interrupts start at IRQ_DOVE_PMU_START, not IRQ_DOVE_PMU_START + 1.
Fix the condition.  (It may have been less likely to occur had the code
been written "if (irq >= IRQ_DOVE_PMU_START" which imho is the easier
to understand notation, and matches the normal way of thinking about
these things.)

Signed-off-by: Russell King <[email protected]>
Signed-off-by: Jason Cooper <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

mm/vmemmap: fix wrong use of virt_to_page

commit ae64ffc upstream.

I enable CONFIG_DEBUG_VIRTUAL and CONFIG_SPARSEMEM_VMEMMAP, when doing
memory hotremove, there is a kernel BUG at arch/x86/mm/physaddr.c:20.

It is caused by free_section_usemap()->virt_to_page(), virt_to_page() is
only used for kernel direct mapping address, but sparse-vmemmap uses
vmemmap address, so it is going wrong here.

  ------------[ cut here ]------------
  kernel BUG at arch/x86/mm/physaddr.c:20!
  invalid opcode: 0000 [Flemmard#1] SMP
  Modules linked in: acpihp_drv acpihp_slot edd cpufreq_conservative cpufreq_userspace cpufreq_powersave acpi_cpufreq mperf fuse vfat fat loop dm_mod coretemp kvm crc32c_intel ipv6 ixgbe igb iTCO_wdt i7core_edac edac_core pcspkr iTCO_vendor_support ioatdma microcode joydev sr_mod i2c_i801 dca lpc_ich mfd_core mdio tpm_tis i2c_core hid_generic tpm cdrom sg tpm_bios rtc_cmos button ext3 jbd mbcache usbhid hid uhci_hcd ehci_hcd usbcore usb_common sd_mod crc_t10dif processor thermal_sys hwmon scsi_dh_alua scsi_dh_hp_sw scsi_dh_rdac scsi_dh_emc scsi_dh ata_generic ata_piix libata megaraid_sas scsi_mod
  CPU 39
  Pid: 6454, comm: sh Not tainted 3.7.0-rc1-acpihp-final+ #45 QCI QSSC-S4R/QSSC-S4R
  RIP: 0010:[<ffffffff8103c908>]  [<ffffffff8103c908>] __phys_addr+0x88/0x90
  RSP: 0018:ffff8804440d7c08  EFLAGS: 00010006
  RAX: 0000000000000006 RBX: ffffea0012000000 RCX: 000000000000002c
  ...

Signed-off-by: Jianguo Wu <[email protected]>
Signed-off-by: Jiang Liu <[email protected]>
Reviewd-by: Wen Congyang <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Reviewed-by: Yasuaki Ishimatsu <[email protected]>
Reviewed-by: Michal Hocko <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

mm: soft offline: split thp at the beginning of soft_offline_page()

commit 783657a upstream.

When we try to soft-offline a thp tail page, put_page() is called on the
tail page unthinkingly and VM_BUG_ON is triggered in put_compound_page().

This patch splits thp before going into the main body of soft-offlining.

Signed-off-by: Naoya Horiguchi <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Wu Fengguang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

workqueue: exit rescuer_thread() as TASK_RUNNING

commit 412d32e upstream.

A rescue thread exiting TASK_INTERRUPTIBLE can lead to a task scheduling
off, never to be seen again.  In the case where this occurred, an exiting
thread hit reiserfs homebrew conditional resched while holding a mutex,
bringing the box to its knees.

PID: 18105  TASK: ffff8807fd412180  CPU: 5   COMMAND: "kdmflush"
 #0 [ffff8808157e7670] schedule at ffffffff8143f489
 Flemmard#1 [ffff8808157e77b8] reiserfs_get_block at ffffffffa038ab2d [reiserfs]
 Flemmard#2 [ffff8808157e79a8] __block_write_begin at ffffffff8117fb14
 Flemmard#3 [ffff8808157e7a98] reiserfs_write_begin at ffffffffa0388695 [reiserfs]
 Flemmard#4 [ffff8808157e7ad8] generic_perform_write at ffffffff810ee9e2
 Flemmard#5 [ffff8808157e7b58] generic_file_buffered_write at ffffffff810eeb41
 #6 [ffff8808157e7ba8] __generic_file_aio_write at ffffffff810f1a3a
 #7 [ffff8808157e7c58] generic_file_aio_write at ffffffff810f1c88
 #8 [ffff8808157e7cc8] do_sync_write at ffffffff8114f850
 #9 [ffff8808157e7dd8] do_acct_process at ffffffff810a268f
    [exception RIP: kernel_thread_helper]
    RIP: ffffffff8144a5c0  RSP: ffff8808157e7f58  RFLAGS: 00000202
    RAX: 0000000000000000  RBX: 0000000000000000  RCX: 0000000000000000
    RDX: 0000000000000000  RSI: ffffffff8107af60  RDI: ffff8803ee491d18
    RBP: 0000000000000000   R8: 0000000000000000   R9: 0000000000000000
    R10: 0000000000000000  R11: 0000000000000000  R12: 0000000000000000
    R13: 0000000000000000  R14: 0000000000000000  R15: 0000000000000000
    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018

Signed-off-by: Mike Galbraith <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Revert "sched, autogroup: Stop going ahead if autogroup is disabled"

commit fd8ef11 upstream.

This reverts commit 800d4d3.

Between commits 8323f26 ("sched: Fix race in task_group()") and
800d4d3 ("sched, autogroup: Stop going ahead if autogroup is
disabled"), autogroup is a wreck.

With both applied, all you have to do to crash a box is disable
autogroup during boot up, then reboot..  boom, NULL pointer dereference
due to commit 800d4d3 not allowing autogroup to move things, and
commit 8323f26 making that the only way to switch runqueues:

  BUG: unable to handle kernel NULL pointer dereference at           (null)
  IP: [<ffffffff81063ac0>] effective_load.isra.43+0x50/0x90
  Pid: 7047, comm: systemd-user-se Not tainted 3.6.8-smp #7 MEDIONPC MS-7502/MS-7502
  RIP: effective_load.isra.43+0x50/0x90
  Process systemd-user-se (pid: 7047, threadinfo ffff880221dde000, task ffff88022618b3a0)
  Call Trace:
    select_task_rq_fair+0x255/0x780
    try_to_wake_up+0x156/0x2c0
    wake_up_state+0xb/0x10
    signal_wake_up+0x28/0x40
    complete_signal+0x1d6/0x250
    __send_signal+0x170/0x310
    send_signal+0x40/0x80
    do_send_sig_info+0x47/0x90
    group_send_sig_info+0x4a/0x70
    kill_pid_info+0x3a/0x60
    sys_kill+0x97/0x1a0
    ? vfs_read+0x120/0x160
    ? sys_read+0x45/0x90
    system_call_fastpath+0x16/0x1b
  Code: 49 0f af 41 50 31 d2 49 f7 f0 48 83 f8 01 48 0f 46 c6 48 2b 07 48 8b bf 40 01 00 00 48 85 ff 74 3a 45 31 c0 48 8b 8f 50 01 00 00 <48> 8b 11 4c 8b 89 80 00 00 00 49 89 d2 48 01 d0 45 8b 59 58 4c
  RIP  [<ffffffff81063ac0>] effective_load.isra.43+0x50/0x90
   RSP <ffff880221ddfbd8>
  CR2: 0000000000000000

Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Ingo Molnar <[email protected]>
Cc: Yong Zhang <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

route: release dst_entry.hh_cache when handling redirects

Stable-3.0 commit 42ab531 (ipv4: fix redirect handling) was
backport of mainline commit 9cc20b2 from 3.2-rc3 where hh
member of struct dst_entry was already gone.

However, in 3.0 we still have it and we have to clean it as
well, otherwise it keeps pointing to the cleaned up (and
unusable) hh_cache entry and packets cannot be sent out.

Signed-off-by: Michal Kubecek <[email protected]>
Cc: Eric Dumazet <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ACPI: missing break

commit 879dca0 upstream.

We handle NOTIFY_THROTTLING so don't then fall through to unsupported event.

Signed-off-by: Alan Cox <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
Signed-off-by: Peter Huewe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

i915: Quirk no_lvds on Gigabyte GA-D525TUD ITX motherboard

commit a51d4ed upstream.

This board is incorrectly detected as having an LVDS connector,
resulting in the VGA output (the only available output on the board)
showing the console only in the top-left 1024x768 pixels, and an extra
LVDS connector appearing in X.

It's a desktop Mini-ITX board using an Atom D525 CPU with an NM10
chipset.

I've had this board for about a year, but this is the first time I
noticed the issue because I've been running it headless for most of its
life.

Signed-off-by: Calvin Walton <[email protected]>
Signed-off-by: Peter Huewe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/i915: Add no-lvds quirk for Supermicro X7SPA-H

commit c31407a upstream.

Reported-and-tested-by: Francois Tigeot <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55375
Signed-off-by: Chris Wilson <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Signed-off-by: Peter Huewe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

scsi: Silence unnecessary warnings about ioctl to partition

commit 6d93592 upstream.

Sometimes, warnings about ioctls to partition happen often enough that they
form majority of the warnings in the kernel log and users complain. In some
cases warnings are about ioctls such as SG_IO so it's not good to get rid of
the warnings completely as they can ease debugging of userspace problems
when ioctl is refused.

Since I have seen warnings from lots of commands, including some proprietary
userspace applications, I don't think disallowing the ioctls for processes
with CAP_SYS_RAWIO will happen in the near future if ever. So lets just
stop warning for processes with CAP_SYS_RAWIO for which ioctl is allowed.

Acked-by: Paolo Bonzini <[email protected]>
CC: James Bottomley <[email protected]>
CC: [email protected]
Signed-off-by: Jan Kara <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
Cc: Satoru Takeuchi <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Juansheng referenced this issue in Juansheng/kernel_htc_vision Jan 26, 2013
ath9k: fix stale pointers potentially causing access to free'd skbs

commit 8c6e309 upstream.

bf->bf_next is only while buffers are chained as part of an A-MPDU
in the tx queue. When a tid queue is flushed (e.g. on tearing down
an aggregation session), frames can be enqueued again as normal
transmission, without bf_next being cleared. This can lead to the
old pointer being dereferenced again later.

This patch might fix crashes and "Failed to stop TX DMA!" messages.

Signed-off-by: Felix Fietkau <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

rt2800: validate step value for temperature compensation

commit bf7e1ab upstream.

Some hardware has correct (!= 0xff) value of tssi_bounds[4] in the
EEPROM, but step is equal to 0xff. This results on ridiculous delta
calculations and completely broke TX power settings.

Reported-and-tested-by: Pavel Lucik <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Acked-by: Ivo van Doorn <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

target: Don't return success from module_init() if setup fails

commit 0d0f9df upstream.

If the call to core_dev_release_virtual_lun0() fails, then nothing
sets ret to anything other than 0, so even though everything is
torn down and freed, target_core_init_configfs() will seem to succeed
and the module will be loaded.  Fix this by passing the return value
on up the chain.

Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: Nicholas Bellinger <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

cfg80211: fix antenna gain handling

commit c4a9faf upstream.

No driver initializes chan->max_antenna_gain to something sensible, and
the only place where it is being used right now is inside ath9k. This
leads to ath9k potentially using less tx power than it can use, which can
decrease performance/range in some rare cases.

Rather than going through every single driver, this patch initializes
chan->orig_mag in wiphy_register(), ignoring whatever value the driver
left in there. If a driver for some reason wishes to limit it independent
from regulatory rulesets, it can do so internally.

Signed-off-by: Felix Fietkau <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

wireless: drop invalid mesh address extension frames

commit 7dd111e upstream.

The mesh header can have address extension by a 4th
or a 5th and 6th address, but never both. Drop such
frames in 802.11 -> 802.3 conversion along with any
frames that have the wrong extension.

Reviewed-by: Javier Cardona <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

mac80211: don't inspect Sequence Control field on control frames

commit f7fbf70 upstream.

Per IEEE Std. 802.11-2012, Sec 8.2.4.4.1, the sequence Control field is
not present in control frames.  We noticed this problem when processing
Block Ack Requests.

Signed-off-by: Javier Cardona <[email protected]>
Signed-off-by: Javier Lopez <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

DRM/Radeon: Fix Load Detection on legacy primary DAC.

commit 83325d0 upstream.

An uninitialized variable led to broken load detection.

Signed-off-by: Egbert Eich <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

mac80211: check management frame header length

commit 4a4f1a5 upstream.

Due to pskb_may_pull() checking the skb length, all
non-management frames are checked on input whether
their 802.11 header is fully present. Also add that
check for management frames and remove a check that
is now duplicate. This prevents accessing skb data
beyond the frame end.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

mac80211: fix SSID copy on IBSS JOIN

commit badecb0 upstream.

The 'ssid' field of the cfg80211_ibss_params is a u8 pointer and
its length is likely to be less than IEEE80211_MAX_SSID_LEN most
of the time.

This patch fixes the ssid copy in ieee80211_ibss_join() by using
the SSID length to prevent it from reading beyond the string.

Signed-off-by: Antonio Quartulli <[email protected]>
[rewrapped commit message, small rewording]
Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfsv3: Make v3 mounts fail with ETIMEDOUTs instead EIO on mountd timeouts

commit acce94e upstream.

In very busy v3 environment, rpc.mountd can respond to the NULL
procedure but not the MNT procedure in a timely manner causing
the MNT procedure to time out. The problem is the mount system
call returns EIO which causes the mount to fail, instead of
ETIMEDOUT, which would cause the mount to be retried.

This patch sets the RPC_TASK_SOFT|RPC_TASK_TIMEOUT flags to
the rpc_call_sync() call in nfs_mount() which causes
ETIMEDOUT to be returned on timed out connections.

Signed-off-by: Steve Dickson <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfs: Show original device name verbatim in /proc/*/mount{s,info}

commit 97a5486 upstream.

Since commit c7f404b ('vfs: new superblock methods to override
/proc/*/mount{s,info}'), nfs_path() is used to generate the mounted
device name reported back to userland.

nfs_path() always generates a trailing slash when the given dentry is
the root of an NFS mount, but userland may expect the original device
name to be returned verbatim (as it used to be).  Make this
canonicalisation optional and change the callers accordingly.

[[email protected]: use flag instead of bool argument]
Reported-and-tested-by: Chris Hiestand <[email protected]>
Reference: http://bugs.debian.org/669314
Signed-off-by: Ben Hutchings <[email protected]>
Signed-off-by: Jonathan Nieder <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

NFSv4: nfs4_locku_done must release the sequence id

commit 2b1bc30 upstream.

If the state recovery machinery is triggered by the call to
nfs4_async_handle_error() then we can deadlock.

Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

nfsd: add get_uint for u32's

commit a007c4c upstream.

I don't think there's a practical difference for the range of values
these interfaces should see, but it would be safer to be unambiguous.

Signed-off-by: J. Bruce Fields <[email protected]>
Cc: Sasha Levin <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

NFS: fix bug in legacy DNS resolver.

commit 8d96b10 upstream.

The DNS resolver's use of the sunrpc cache involves a 'ttl' number
(relative) rather that a timeout (absolute).  This confused me when
I wrote
  commit c5b29f8
     "sunrpc: use seconds since boot in expiry cache"

and I managed to break it.  The effect is that any TTL is interpreted
as 0, and nothing useful gets into the cache.

This patch removes the use of get_expiry() - which really expects an
expiry time - and uses get_uint() instead, treating the int correctly
as a ttl.

This fixes a regression that has been present since 2.6.37, causing
certain NFS accesses in certain environments to incorrectly fail.

Reported-by: Chuck Lever <[email protected]>
Tested-by: Chuck Lever <[email protected]>
Signed-off-by: NeilBrown <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

NFS: Fix Oopses in nfs_lookup_revalidate and nfs4_lookup_revalidate

[Fixed upstream as part of 0b728e1, but that's a much larger patch,
this is only the nfs portion backported as needed.]

Fix the following Oops in 3.5.1:

 BUG: unable to handle kernel NULL pointer dereference at 0000000000000038
 IP: [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs]
 PGD 337c63067 PUD 0
 Oops: 0000 [#1] SMP
 CPU 5
 Modules linked in: nfs fscache nfsd lockd nfs_acl auth_rpcgss sunrpc af_packet binfmt_misc cpufreq_conservative cpufreq_userspace cpufreq_powersave dm_mod acpi_cpufreq mperf coretemp gpio_ich kvm_intel joydev kvm ioatdma hid_generic igb lpc_ich i7core_edac edac_core ptp serio_raw dca pcspkr i2c_i801 mfd_core sg pps_core usbhid crc32c_intel microcode button autofs4 uhci_hcd ttm drm_kms_helper drm i2c_algo_bit sysimgblt sysfillrect syscopyarea ehci_hcd usbcore usb_common scsi_dh_rdac scsi_dh_emc scsi_dh_hp_sw scsi_dh_alua scsi_dh edd fan ata_piix thermal processor thermal_sys

 Pid: 30431, comm: java Not tainted 3.5.1-2-default #1 Supermicro X8DTT/X8DTT
 RIP: 0010:[<ffffffffa03789cd>]  [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs]
 RSP: 0018:ffff8801b418bd38  EFLAGS: 00010292
 RAX: 00000000fffffff6 RBX: ffff88032016d800 RCX: 0000000000000020
 RDX: ffffffff00000000 RSI: 0000000000000000 RDI: ffff8801824a7b00
 RBP: ffff8801b418bdf8 R08: 7fffff0034323030 R09: fffffffff04c03ed
 R10: ffff8801824a7b00 R11: 0000000000000002 R12: ffff8801824a7b00
 R13: ffff8801824a7b00 R14: 0000000000000000 R15: ffff8803201725d0
 FS:  00002b53a46cb700(0000) GS:ffff88033fc20000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 0000000000000038 CR3: 000000020a426000 CR4: 00000000000007e0
 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
 Process java (pid: 30431, threadinfo ffff8801b418a000, task ffff8801b5d20600)
 Stack:
  ffff8801b418be44 ffff88032016d800 ffff8801b418bdf8 0000000000000000
  ffff8801824a7b00 ffff8801b418bdd7 ffff8803201725d0 ffffffff8116a9c0
  ffff8801b5c38dc0 0000000000000007 ffff88032016d800 0000000000000000
 Call Trace:
  [<ffffffff8116a9c0>] lookup_dcache+0x80/0xe0
  [<ffffffff8116aa43>] __lookup_hash+0x23/0x90
  [<ffffffff8116b4a5>] lookup_one_len+0xc5/0x100
  [<ffffffffa03869a3>] nfs_sillyrename+0xe3/0x210 [nfs]
  [<ffffffff8116cadf>] vfs_unlink.part.25+0x7f/0xe0
  [<ffffffff8116f22c>] do_unlinkat+0x1ac/0x1d0
  [<ffffffff815717b9>] system_call_fastpath+0x16/0x1b
  [<00002b5348b5f527>] 0x2b5348b5f526
 Code: ec 38 b8 f6 ff ff ff 4c 89 64 24 18 4c 89 74 24 28 49 89 fc 48 89 5c 24 08 48 89 6c 24 10 49 89 f6 4c 89 6c 24 20 4c 89 7c 24 30 <f6> 46 38 40 0f 85 d1 00 00 00 e8 c4 c4 df e0 48 8b 58 30 49 89
 RIP  [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs]
  RSP <ffff8801b418bd38>
 CR2: 0000000000000038
 ---[ end trace 845113ed191985dd ]---

This Oops affects 3.5 kernels and older, and is due to lookup_one_len()
calling down to the dentry revalidation code with a NULL pointer
to struct nameidata.

It is fixed upstream by commit 0b728e1 (stop passing nameidata *
to ->d_revalidate())

Reported-by: Richard Ems <[email protected]>
Signed-off-by: Trond Myklebust <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm: restore open_count if drm_setup fails

commit 0f1cb1b upstream.

If drm_setup (called at first open) fails, the whole
open call has failed, so we should not keep the
open_count incremented.

Signed-off-by: Ilija Hadzic <[email protected]>
Reviewed-by: Thomas Hellstrom <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

hwmon: (w83627ehf) Force initial bank selection

commit 3300fb4 upstream.

Don't assume bank 0 is selected at device probe time. This may not be
the case. Force bank selection at first register access to guarantee
that we read the right registers upon driver loading.

Signed-off-by: Jean Delvare <[email protected]>
Reviewed-by: Guenter Roeck <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: PCM: Fix some races at disconnection

commit 9b0573c upstream.

Fix races at PCM disconnection:
- while a PCM device is being opened or closed
- while the PCM state is being changed without lock in prepare,
  hw_params, hw_free ops

Reported-by: Matthieu CASTET <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: Fix races at disconnection

commit 978520b upstream.

Close some races at disconnection of a USB audio device by adding the
chip->shutdown_mutex and chip->shutdown check at appropriate places.

The spots to put bandaids are:
- PCM prepare, hw_params and hw_free
- where the usb device is accessed for communication or get speed, in
 mixer.c and others; the device speed is now cached in subs->speed
 instead of accessing to chip->dev

The accesses in PCM open and close don't need the mutex protection
because these are already handled in the core PCM disconnection code.

The autosuspend/autoresume codes are still uncovered by this patch
because of possible mutex deadlocks.  They'll be covered by the
upcoming change to rwsem.

Also the mixer codes are untouched, too.  These will be fixed in
another patch, too.

Reported-by: Matthieu CASTET <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: Use rwsem for disconnect protection

commit 34f3c89 upstream.

Replace mutex with rwsem for codec->shutdown protection so that
concurrent accesses are allowed.

Also add the protection to snd_usb_autosuspend() and
snd_usb_autoresume(), too.

Reported-by: Matthieu CASTET <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: Fix races at disconnection in mixer_quirks.c

commit 888ea7d upstream.

Similar like the previous commit, cover with chip->shutdown_rwsem
and chip->shutdown checks.

Reported-by: Matthieu CASTET <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: Add a reference counter to card instance

commit a0830db upstream.

For more strict protection for wild disconnections, a refcount is
introduced to the card instance, and let it up/down when an object is
referred via snd_lookup_*() in the open ops.

The free-after-last-close check is also changed to check this refcount
instead of the empty list, too.

Reported-by: Matthieu CASTET <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: Avoid endless sleep after disconnect

commit 0914f79 upstream.

When disconnect callback is called, each component should wake up
sleepers and check card->shutdown flag for avoiding the endless sleep
blocking the proper resource release.

Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

sctp: fix call to SCTP_CMD_PROCESS_SACK in sctp_cmd_interpreter()

[ Upstream commit f6e80ab ]

Bug introduced by commit edfee03
(sctp: check src addr when processing SACK to update transport state)

Signed-off-by: Zijie Pan <[email protected]>
Signed-off-by: Nicolas Dichtel <[email protected]>
Acked-by: Vlad Yasevich <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

netlink: use kfree_rcu() in netlink_release()

[ Upstream commit 6d772ac ]

On some suspend/resume operations involving wimax device, we have
noticed some intermittent memory corruptions in netlink code.

Stéphane Marchesin tracked this corruption in netlink_update_listeners()
and suggested a patch.

It appears netlink_release() should use kfree_rcu() instead of kfree()
for the listeners structure as it may be used by other cpus using RCU
protection.

netlink_release() must set to NULL the listeners pointer when
it is about to be freed.

Also have to protect netlink_update_listeners() and
netlink_has_listeners() if listeners is NULL.

Add a nl_deref_protected() lockdep helper to properly document which
locks protects us.

Reported-by: Jonathan Kliegman <[email protected]>
Signed-off-by: Eric Dumazet <[email protected]>
Cc: Stéphane Marchesin <[email protected]>
Cc: Sam Leffler <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

tcp: fix FIONREAD/SIOCINQ

[ Upstream commit a3374c4 ]

tcp_ioctl() tries to take into account if tcp socket received a FIN
to report correct number bytes in receive queue.

But its flaky because if the application ate the last skb,
we return 1 instead of 0.

Correct way to detect that FIN was received is to test SOCK_DONE.

Reported-by: Elliot Hughes <[email protected]>
Signed-off-by: Eric Dumazet <[email protected]>
Cc: Neal Cardwell <[email protected]>
Cc: Tom Herbert <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ipv6: Set default hoplimit as zero.

[ Upstream commit 14edd87 ]

Commit a02e4b7(Demark default hoplimit as zero) only changes the
hoplimit checking condition and default value in ip6_dst_hoplimit, not
zeros all hoplimit default value.

Keep the zeroing ip6_template_metrics[RTAX_HOPLIMIT - 1] to force it as
const, cause as a37e6e3(net: force dst_default_metrics to const
section)

Signed-off-by: Li RongQing <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: usb: Fix memory leak on Tx data path

[ Upstream commit 39707c2 ]

Driver anchors the tx urbs and defers the urb submission if
a transmit request comes when the interface is suspended.
Anchoring urb increments the urb reference count. These
deferred urbs are later accessed by calling usb_get_from_anchor()
for submission during interface resume. usb_get_from_anchor()
unanchors the urb but urb reference count remains same.
This causes the urb reference count to remain non-zero
after usb_free_urb() gets called and urb never gets freed.
Hence call usb_put_urb() after anchoring the urb to properly
balance the reference count for these deferred urbs. Also,
unanchor these deferred urbs during disconnect, to free them
up.

Signed-off-by: Hemant Kumar <[email protected]>
Acked-by: Oliver Neukum <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

net: fix divide by zero in tcp algorithm illinois

[ Upstream commit 8f363b7 ]

Reading TCP stats when using TCP Illinois congestion control algorithm
can cause a divide by zero kernel oops.

The division by zero occur in tcp_illinois_info() at:
 do_div(t, ca->cnt_rtt);
where ca->cnt_rtt can become zero (when rtt_reset is called)

Steps to Reproduce:
 1. Register tcp_illinois:
     # sysctl -w net.ipv4.tcp_congestion_control=illinois
 2. Monitor internal TCP information via command "ss -i"
     # watch -d ss -i
 3. Establish new TCP conn to machine

Either it fails at the initial conn, or else it needs to wait
for a loss or a reset.

This is only related to reading stats.  The function avg_delay() also
performs the same divide, but is guarded with a (ca->cnt_rtt > 0) at its
calling point in update_params().  Thus, simply fix tcp_illinois_info().

Function tcp_illinois_info() / get_info() is called without
socket lock.  Thus, eliminate any race condition on ca->cnt_rtt
by using a local stack variable.  Simply reuse info.tcpv_rttcnt,
as its already set to ca->cnt_rtt.
Function avg_delay() is not affected by this race condition, as
its called with the socket lock.

Cc: Petr Matousek <[email protected]>
Signed-off-by: Jesper Dangaard Brouer <[email protected]>
Acked-by: Eric Dumazet <[email protected]>
Acked-by: Stephen Hemminger <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

l2tp: fix oops in l2tp_eth_create() error path

[ Upstream commit 7893363 ]

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

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

Signed-off-by: Tom Parkin <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ipv6: send unsolicited neighbour advertisements to all-nodes

[ Upstream commit 60713a0 ]

As documented in RFC4861 (Neighbor Discovery for IP version 6) 7.2.6.,
unsolicited neighbour advertisements should be sent to the all-nodes
multicast address.

Signed-off-by: Hannes Frederic Sowa <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

futex: Handle futex_pi OWNER_DIED take over correctly

commit 59fa624 upstream.

Siddhesh analyzed a failure in the take over of pi futexes in case the
owner died and provided a workaround.
See: http://sourceware.org/bugzilla/show_bug.cgi?id=14076

The detailed problem analysis shows:

Futex F is initialized with PTHREAD_PRIO_INHERIT and
PTHREAD_MUTEX_ROBUST_NP attributes.

T1 lock_futex_pi(F);

T2 lock_futex_pi(F);
   --> T2 blocks on the futex and creates pi_state which is associated
       to T1.

T1 exits
   --> exit_robust_list() runs
       --> Futex F userspace value TID field is set to 0 and
           FUTEX_OWNER_DIED bit is set.

T3 lock_futex_pi(F);
   --> Succeeds due to the check for F's userspace TID field == 0
   --> Claims ownership of the futex and sets its own TID into the
       userspace TID field of futex F
   --> returns to user space

T1 --> exit_pi_state_list()
       --> Transfers pi_state to waiter T2 and wakes T2 via
       	   rt_mutex_unlock(&pi_state->mutex)

T2 --> acquires pi_state->mutex and gains real ownership of the
       pi_state
   --> Claims ownership of the futex and sets its own TID into the
       userspace TID field of futex F
   --> returns to user space

T3 --> observes inconsistent state

This problem is independent of UP/SMP, preemptible/non preemptible
kernels, or process shared vs. private. The only difference is that
certain configurations are more likely to expose it.

So as Siddhesh correctly analyzed the following check in
futex_lock_pi_atomic() is the culprit:

	if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {

We check the userspace value for a TID value of 0 and take over the
futex unconditionally if that's true.

AFAICT this check is there as it is correct for a different corner
case of futexes: the WAITERS bit became stale.

Now the proposed change

-	if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {
+       if (unlikely(ownerdied ||
+                       !(curval & (FUTEX_TID_MASK | FUTEX_WAITERS)))) {

solves the problem, but it's not obvious why and it wreckages the
"stale WAITERS bit" case.

What happens is, that due to the WAITERS bit being set (T2 is blocked
on that futex) it enforces T3 to go through lookup_pi_state(), which
in the above case returns an existing pi_state and therefor forces T3
to legitimately fight with T2 over the ownership of the pi_state (via
pi_state->mutex). Probelm solved!

Though that does not work for the "WAITERS bit is stale" problem
because if lookup_pi_state() does not find existing pi_state it
returns -ERSCH (due to TID == 0) which causes futex_lock_pi() to
return -ESRCH to user space because the OWNER_DIED bit is not set.

Now there is a different solution to that problem. Do not look at the
user space value at all and enforce a lookup of possibly available
pi_state. If pi_state can be found, then the new incoming locker T3
blocks on that pi_state and legitimately races with T2 to acquire the
rt_mutex and the pi_state and therefor the proper ownership of the
user space futex.

lookup_pi_state() has the correct order of checks. It first tries to
find a pi_state associated with the user space futex and only if that
fails it checks for futex TID value = 0. If no pi_state is available
nothing can create new state at that point because this happens with
the hash bucket lock held.

So the above scenario changes to:

T1 lock_futex_pi(F);

T2 lock_futex_pi(F);
   --> T2 blocks on the futex and creates pi_state which is associated
       to T1.

T1 exits
   --> exit_robust_list() runs
       --> Futex F userspace value TID field is set to 0 and
           FUTEX_OWNER_DIED bit is set.

T3 lock_futex_pi(F);
   --> Finds pi_state and blocks on pi_state->rt_mutex

T1 --> exit_pi_state_list()
       --> Transfers pi_state to waiter T2 and wakes it via
       	   rt_mutex_unlock(&pi_state->mutex)

T2 --> acquires pi_state->mutex and gains ownership of the pi_state
   --> Claims ownership of the futex and sets its own TID into the
       userspace TID field of futex F
   --> returns to user space

This covers all gazillion points on which T3 might come in between
T1's exit_robust_list() clearing the TID field and T2 fixing it up. It
also solves the "WAITERS bit stale" problem by forcing the take over.

Another benefit of changing the code this way is that it makes it less
dependent on untrusted user space values and therefor minimizes the
possible wreckage which might be inflicted.

As usual after staring for too long at the futex code my brain hurts
so much that I really want to ditch that whole optimization of
avoiding the syscall for the non contended case for PI futexes and rip
out the maze of corner case handling code. Unfortunately we can't as
user space relies on that existing behaviour, but at least thinking
about it helps me to preserve my mental sanity. Maybe we should
nevertheless :)

Reported-and-tested-by: Siddhesh Poyarekar <[email protected]>
Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1210232138540.2756@ionos
Acked-by: Darren Hart <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/vmwgfx: Fix hibernation device reset

commit 95e8f6a upstream.

The device would not reset properly when resuming from hibernation.

Signed-off-by: Thomas Hellstrom <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Reviewed-by: Dmitry Torokhov <[email protected]>
Cc: [email protected]
Signed-off-by: Dave Airlie <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/i915: fixup infoframe support for sdvo

commit 81014b9 upstream.

At least the worst offenders:
- SDVO specifies that the encoder should compute the ecc. Testing also
  shows that we must not send the ecc field, so copy the dip_infoframe
  struct to a temporay place and avoid the ecc field. This way the avi
  infoframe is exactly 17 bytes long, which agrees with what the spec
  mandates as a minimal storage capacity (with the ecc field it would
  be 18 bytes).
- Only 17 when sending the avi infoframe. The SDVO spec explicitly
  says that sending more data than what the device announces results
  in undefined behaviour.
- Add __attribute__((packed)) to the avi and spd infoframes, for
  otherwise they're wrongly aligned. Noticed because the avi infoframe
  ended up being 18 bytes large instead of 17. We haven't noticed this
  yet because we don't use the uint16_t fields yet (which are the only
  ones that would be wrongly aligned).

This regression has been introduce by

3c17fe4 is the first bad commit
commit 3c17fe4
Author: David Härdeman <[email protected]>
Date:   Fri Sep 24 21:44:32 2010 +0200

    i915: enable AVI infoframe for intel_hdmi.c [v4]

Patch tested on my g33 with a sdvo hdmi adaptor.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=25732
Tested-by: Peter Ross <[email protected]> (G35 SDVO-HDMI)
Reviewed-by: Eugeni Dodonov <[email protected]>
Signed-Off-by: Daniel Vetter <[email protected]>
Cc: Ben Hutchings <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/i915: clear the entire sdvo infoframe buffer

commit b6e0e54 upstream.

Like in the case of native hdmi, which is fixed already in

commit adf00b2
Author: Paulo Zanoni <[email protected]>
Date:   Tue Sep 25 13:23:34 2012 -0300

    drm/i915: make sure we write all the DIP data bytes

we need to clear the entire sdvo buffer to avoid upsetting the
display.

Since infoframe buffer writing is now a bit more elaborate, extract it
into it's own function. This will be useful if we ever get around to
properly update the ELD for sdvo. Also #define proper names for the
two buffer indexes with fixed usage.

v2: Cite the right commit above, spotted by Paulo Zanoni.

v3: I'm too stupid to paste the right commit.

v4: Ben Hutchings noticed that I've failed to handle an underflow in
my loop logic, breaking it for i >= length + 8. Since I've just lost C
programmer license, use his solution. Also, make the frustrated 0-base
buffer size a notch more clear.

Reported-and-tested-by: Jürg Billeter <[email protected]>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=25732
Cc: Paulo Zanoni <[email protected]>
Cc: Ben Hutchings <[email protected]>
Reviewed-by: Rodrigo Vivi <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

USB: mos7840: remove unused variable

Fix warning about unused variable introduced by commit e681b66
("USB: mos7840: remove invalid disconnect handling") upstream.

A subsequent fix which removed the disconnect function got rid of the
warning but that one was only backported to v3.6.

Reported-by: Jiri Slaby <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

xfs: fix reading of wrapped log data

commit 6ce377a upstream.

Commit 4439647 ("xfs: reset buffer pointers before freeing them") in
3.0-rc1 introduced a regression when recovering log buffers that
wrapped around the end of log. The second part of the log buffer at
the start of the physical log was being read into the header buffer
rather than the data buffer, and hence recovery was seeing garbage
in the data buffer when it got to the region of the log buffer that
was incorrectly read.

Reported-by: Torsten Kaiser <[email protected]>
Signed-off-by: Dave Chinner <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Mark Tinguely <[email protected]>
Signed-off-by: Ben Myers <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

intel-iommu: Fix AB-BA lockdep report

commit 3e7abe2 upstream.

When unbinding a device so that I could pass it through to a KVM VM, I
got the lockdep report below.  It looks like a legitimate lock
ordering problem:

 - domain_context_mapping_one() takes iommu->lock and calls
   iommu_support_dev_iotlb(), which takes device_domain_lock (inside
   iommu->lock).

 - domain_remove_one_dev_info() starts by taking device_domain_lock
   then takes iommu->lock inside it (near the end of the function).

So this is the classic AB-BA deadlock.  It looks like a safe fix is to
simply release device_domain_lock a bit earlier, since as far as I can
tell, it doesn't protect any of the stuff accessed at the end of
domain_remove_one_dev_info() anyway.

BTW, the use of device_domain_lock looks a bit unsafe to me... it's
at least not obvious to me why we aren't vulnerable to the race below:

  iommu_support_dev_iotlb()
                                          domain_remove_dev_info()

  lock device_domain_lock
    find info
  unlock device_domain_lock

                                          lock device_domain_lock
                                            find same info
                                          unlock device_domain_lock

                                          free_devinfo_mem(info)

  do stuff with info after it's free

However I don't understand the locking here well enough to know if
this is a real problem, let alone what the best fix is.

Anyway here's the full lockdep output that prompted all of this:

     =======================================================
     [ INFO: possible circular locking dependency detected ]
     2.6.39.1+ #1
     -------------------------------------------------------
     bash/13954 is trying to acquire lock:
      (&(&iommu->lock)->rlock){......}, at: [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230

     but task is already holding lock:
      (device_domain_lock){-.-...}, at: [<ffffffff812f6508>] domain_remove_one_dev_info+0x208/0x230

     which lock already depends on the new lock.

     the existing dependency chain (in reverse order) is:

     -> #1 (device_domain_lock){-.-...}:
            [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
            [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
            [<ffffffff812f8350>] domain_context_mapping_one+0x600/0x750
            [<ffffffff812f84df>] domain_context_mapping+0x3f/0x120
            [<ffffffff812f9175>] iommu_prepare_identity_map+0x1c5/0x1e0
            [<ffffffff81ccf1ca>] intel_iommu_init+0x88e/0xb5e
            [<ffffffff81cab204>] pci_iommu_init+0x16/0x41
            [<ffffffff81002165>] do_one_initcall+0x45/0x190
            [<ffffffff81ca3d3f>] kernel_init+0xe3/0x168
            [<ffffffff8157ac24>] kernel_thread_helper+0x4/0x10

     -> #0 (&(&iommu->lock)->rlock){......}:
            [<ffffffff8109bf3e>] __lock_acquire+0x195e/0x1e10
            [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
            [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
            [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230
            [<ffffffff812f8b42>] device_notifier+0x72/0x90
            [<ffffffff8157555c>] notifier_call_chain+0x8c/0xc0
            [<ffffffff81089768>] __blocking_notifier_call_chain+0x78/0xb0
            [<ffffffff810897b6>] blocking_notifier_call_chain+0x16/0x20
            [<ffffffff81373a5c>] __device_release_driver+0xbc/0xe0
            [<ffffffff81373ccf>] device_release_driver+0x2f/0x50
            [<ffffffff81372ee3>] driver_unbind+0xa3/0xc0
            [<ffffffff813724ac>] drv_attr_store+0x2c/0x30
            [<ffffffff811e4506>] sysfs_write_file+0xe6/0x170
            [<ffffffff8117569e>] vfs_write+0xce/0x190
            [<ffffffff811759e4>] sys_write+0x54/0xa0
            [<ffffffff81579a82>] system_call_fastpath+0x16/0x1b

     other info that might help us debug this:

     6 locks held by bash/13954:
      #0:  (&buffer->mutex){+.+.+.}, at: [<ffffffff811e4464>] sysfs_write_file+0x44/0x170
      #1:  (s_active#3){++++.+}, at: [<ffffffff811e44ed>] sysfs_write_file+0xcd/0x170
      Andromadus#2:  (&__lockdep_no_validate__){+.+.+.}, at: [<ffffffff81372edb>] driver_unbind+0x9b/0xc0
      Andromadus#3:  (&__lockdep_no_validate__){+.+.+.}, at: [<ffffffff81373cc7>] device_release_driver+0x27/0x50
      Andromadus#4:  (&(&priv->bus_notifier)->rwsem){.+.+.+}, at: [<ffffffff8108974f>] __blocking_notifier_call_chain+0x5f/0xb0
      Andromadus#5:  (device_domain_lock){-.-...}, at: [<ffffffff812f6508>] domain_remove_one_dev_info+0x208/0x230

     stack backtrace:
     Pid: 13954, comm: bash Not tainted 2.6.39.1+ #1
     Call Trace:
      [<ffffffff810993a7>] print_circular_bug+0xf7/0x100
      [<ffffffff8109bf3e>] __lock_acquire+0x195e/0x1e10
      [<ffffffff810972bd>] ? trace_hardirqs_off+0xd/0x10
      [<ffffffff8109d57d>] ? trace_hardirqs_on_caller+0x13d/0x180
      [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
      [<ffffffff812f6421>] ? domain_remove_one_dev_info+0x121/0x230
      [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
      [<ffffffff812f6421>] ? domain_remove_one_dev_info+0x121/0x230
      [<ffffffff810972bd>] ? trace_hardirqs_off+0xd/0x10
      [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230
      [<ffffffff812f8b42>] device_notifier+0x72/0x90
      [<ffffffff8157555c>] notifier_call_chain+0x8c/0xc0
      [<ffffffff81089768>] __blocking_notifier_call_chain+0x78/0xb0
      [<ffffffff810897b6>] blocking_notifier_call_chain+0x16/0x20
      [<ffffffff81373a5c>] __device_release_driver+0xbc/0xe0
      [<ffffffff81373ccf>] device_release_driver+0x2f/0x50
      [<ffffffff81372ee3>] driver_unbind+0xa3/0xc0
      [<ffffffff813724ac>] drv_attr_store+0x2c/0x30
      [<ffffffff811e4506>] sysfs_write_file+0xe6/0x170
      [<ffffffff8117569e>] vfs_write+0xce/0x190
      [<ffffffff811759e4>] sys_write+0x54/0xa0
      [<ffffffff81579a82>] system_call_fastpath+0x16/0x1b

Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
Cc: Steven Rostedt <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: Fix card refcount unbalance

commit 8bb4d9c upstream.

There are uncovered cases whether the card refcount introduced by the
commit a0830db isn't properly increased or decreased:
- OSS PCM and mixer success paths
- When lookup function gets NULL

This patch fixes these places.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50251

Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ALSA: usb-audio: Fix mutex deadlock at disconnection

commit 10e4423 upstream.

The recent change for USB-audio disconnection race fixes introduced a
mutex deadlock again.  There is a circular dependency between
chip->shutdown_rwsem and pcm->open_mutex, depicted like below, when a
device is opened during the disconnection operation:

A. snd_usb_audio_disconnect() ->
     card.c::register_mutex ->
       chip->shutdown_rwsem (write) ->
         snd_card_disconnect() ->
           pcm.c::register_mutex ->
             pcm->open_mutex

B. snd_pcm_open() ->
     pcm->open_mutex ->
       snd_usb_pcm_open() ->
         chip->shutdown_rwsem (read)

Since the chip->shutdown_rwsem protection in the case A is required
only for turning on the chip->shutdown flag and it doesn't have to be
taken for the whole operation, we can reduce its window in
snd_usb_audio_disconnect().

Reported-by: Jiri Slaby <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Juansheng referenced this issue in Juansheng/kernel_htc_vision Jan 26, 2013
Dove: Attempt to fix PMU/RTC interrupts

commit 5d3df93 upstream.

Fix the acknowledgement of PMU interrupts on Dove: some Dove hardware
has not been sensibly designed so that interrupts can be handled in a
race free manner.  The PMU is one such instance.

The pending (aka 'cause') register is a bunch of RW bits, meaning that
these bits can be both cleared and set by software (confirmed on the
Armada-510 on the cubox.)

Hardware sets the appropriate bit when an interrupt is asserted, and
software is required to clear the bits which are to be processed.  If
we write ~(1 << bit), then we end up asserting every other interrupt
except the one we're processing.  So, we need to do a read-modify-write
cycle to clear the asserted bit.

However, any interrupts which occur in the middle of this cycle will
also be written back as zero, which will also clear the new interrupts.

The upshot of this is: there is _no_ way to safely clear down interrupts
in this register (and other similarly behaving interrupt pending
registers on this device.)  The patch below at least stops us creating
new interrupts.

Signed-off-by: Russell King <[email protected]>
Signed-off-by: Jason Cooper <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Dove: Fix irq_to_pmu()

commit d356cf5 upstream.

PMU interrupts start at IRQ_DOVE_PMU_START, not IRQ_DOVE_PMU_START + 1.
Fix the condition.  (It may have been less likely to occur had the code
been written "if (irq >= IRQ_DOVE_PMU_START" which imho is the easier
to understand notation, and matches the normal way of thinking about
these things.)

Signed-off-by: Russell King <[email protected]>
Signed-off-by: Jason Cooper <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

mm/vmemmap: fix wrong use of virt_to_page

commit ae64ffc upstream.

I enable CONFIG_DEBUG_VIRTUAL and CONFIG_SPARSEMEM_VMEMMAP, when doing
memory hotremove, there is a kernel BUG at arch/x86/mm/physaddr.c:20.

It is caused by free_section_usemap()->virt_to_page(), virt_to_page() is
only used for kernel direct mapping address, but sparse-vmemmap uses
vmemmap address, so it is going wrong here.

  ------------[ cut here ]------------
  kernel BUG at arch/x86/mm/physaddr.c:20!
  invalid opcode: 0000 [#1] SMP
  Modules linked in: acpihp_drv acpihp_slot edd cpufreq_conservative cpufreq_userspace cpufreq_powersave acpi_cpufreq mperf fuse vfat fat loop dm_mod coretemp kvm crc32c_intel ipv6 ixgbe igb iTCO_wdt i7core_edac edac_core pcspkr iTCO_vendor_support ioatdma microcode joydev sr_mod i2c_i801 dca lpc_ich mfd_core mdio tpm_tis i2c_core hid_generic tpm cdrom sg tpm_bios rtc_cmos button ext3 jbd mbcache usbhid hid uhci_hcd ehci_hcd usbcore usb_common sd_mod crc_t10dif processor thermal_sys hwmon scsi_dh_alua scsi_dh_hp_sw scsi_dh_rdac scsi_dh_emc scsi_dh ata_generic ata_piix libata megaraid_sas scsi_mod
  CPU 39
  Pid: 6454, comm: sh Not tainted 3.7.0-rc1-acpihp-final+ #45 QCI QSSC-S4R/QSSC-S4R
  RIP: 0010:[<ffffffff8103c908>]  [<ffffffff8103c908>] __phys_addr+0x88/0x90
  RSP: 0018:ffff8804440d7c08  EFLAGS: 00010006
  RAX: 0000000000000006 RBX: ffffea0012000000 RCX: 000000000000002c
  ...

Signed-off-by: Jianguo Wu <[email protected]>
Signed-off-by: Jiang Liu <[email protected]>
Reviewd-by: Wen Congyang <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Reviewed-by: Yasuaki Ishimatsu <[email protected]>
Reviewed-by: Michal Hocko <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

mm: soft offline: split thp at the beginning of soft_offline_page()

commit 783657a upstream.

When we try to soft-offline a thp tail page, put_page() is called on the
tail page unthinkingly and VM_BUG_ON is triggered in put_compound_page().

This patch splits thp before going into the main body of soft-offlining.

Signed-off-by: Naoya Horiguchi <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Wu Fengguang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

workqueue: exit rescuer_thread() as TASK_RUNNING

commit 412d32e upstream.

A rescue thread exiting TASK_INTERRUPTIBLE can lead to a task scheduling
off, never to be seen again.  In the case where this occurred, an exiting
thread hit reiserfs homebrew conditional resched while holding a mutex,
bringing the box to its knees.

PID: 18105  TASK: ffff8807fd412180  CPU: 5   COMMAND: "kdmflush"
 #0 [ffff8808157e7670] schedule at ffffffff8143f489
 #1 [ffff8808157e77b8] reiserfs_get_block at ffffffffa038ab2d [reiserfs]
 Andromadus#2 [ffff8808157e79a8] __block_write_begin at ffffffff8117fb14
 Andromadus#3 [ffff8808157e7a98] reiserfs_write_begin at ffffffffa0388695 [reiserfs]
 Andromadus#4 [ffff8808157e7ad8] generic_perform_write at ffffffff810ee9e2
 Andromadus#5 [ffff8808157e7b58] generic_file_buffered_write at ffffffff810eeb41
 #6 [ffff8808157e7ba8] __generic_file_aio_write at ffffffff810f1a3a
 #7 [ffff8808157e7c58] generic_file_aio_write at ffffffff810f1c88
 #8 [ffff8808157e7cc8] do_sync_write at ffffffff8114f850
 #9 [ffff8808157e7dd8] do_acct_process at ffffffff810a268f
    [exception RIP: kernel_thread_helper]
    RIP: ffffffff8144a5c0  RSP: ffff8808157e7f58  RFLAGS: 00000202
    RAX: 0000000000000000  RBX: 0000000000000000  RCX: 0000000000000000
    RDX: 0000000000000000  RSI: ffffffff8107af60  RDI: ffff8803ee491d18
    RBP: 0000000000000000   R8: 0000000000000000   R9: 0000000000000000
    R10: 0000000000000000  R11: 0000000000000000  R12: 0000000000000000
    R13: 0000000000000000  R14: 0000000000000000  R15: 0000000000000000
    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018

Signed-off-by: Mike Galbraith <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Revert "sched, autogroup: Stop going ahead if autogroup is disabled"

commit fd8ef11 upstream.

This reverts commit 800d4d3.

Between commits 8323f26 ("sched: Fix race in task_group()") and
800d4d3 ("sched, autogroup: Stop going ahead if autogroup is
disabled"), autogroup is a wreck.

With both applied, all you have to do to crash a box is disable
autogroup during boot up, then reboot..  boom, NULL pointer dereference
due to commit 800d4d3 not allowing autogroup to move things, and
commit 8323f26 making that the only way to switch runqueues:

  BUG: unable to handle kernel NULL pointer dereference at           (null)
  IP: [<ffffffff81063ac0>] effective_load.isra.43+0x50/0x90
  Pid: 7047, comm: systemd-user-se Not tainted 3.6.8-smp #7 MEDIONPC MS-7502/MS-7502
  RIP: effective_load.isra.43+0x50/0x90
  Process systemd-user-se (pid: 7047, threadinfo ffff880221dde000, task ffff88022618b3a0)
  Call Trace:
    select_task_rq_fair+0x255/0x780
    try_to_wake_up+0x156/0x2c0
    wake_up_state+0xb/0x10
    signal_wake_up+0x28/0x40
    complete_signal+0x1d6/0x250
    __send_signal+0x170/0x310
    send_signal+0x40/0x80
    do_send_sig_info+0x47/0x90
    group_send_sig_info+0x4a/0x70
    kill_pid_info+0x3a/0x60
    sys_kill+0x97/0x1a0
    ? vfs_read+0x120/0x160
    ? sys_read+0x45/0x90
    system_call_fastpath+0x16/0x1b
  Code: 49 0f af 41 50 31 d2 49 f7 f0 48 83 f8 01 48 0f 46 c6 48 2b 07 48 8b bf 40 01 00 00 48 85 ff 74 3a 45 31 c0 48 8b 8f 50 01 00 00 <48> 8b 11 4c 8b 89 80 00 00 00 49 89 d2 48 01 d0 45 8b 59 58 4c
  RIP  [<ffffffff81063ac0>] effective_load.isra.43+0x50/0x90
   RSP <ffff880221ddfbd8>
  CR2: 0000000000000000

Signed-off-by: Mike Galbraith <[email protected]>
Acked-by: Ingo Molnar <[email protected]>
Cc: Yong Zhang <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

route: release dst_entry.hh_cache when handling redirects

Stable-3.0 commit 42ab531 (ipv4: fix redirect handling) was
backport of mainline commit 9cc20b2 from 3.2-rc3 where hh
member of struct dst_entry was already gone.

However, in 3.0 we still have it and we have to clean it as
well, otherwise it keeps pointing to the cleaned up (and
unusable) hh_cache entry and packets cannot be sent out.

Signed-off-by: Michal Kubecek <[email protected]>
Cc: Eric Dumazet <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ACPI: missing break

commit 879dca0 upstream.

We handle NOTIFY_THROTTLING so don't then fall through to unsupported event.

Signed-off-by: Alan Cox <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
Signed-off-by: Peter Huewe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

i915: Quirk no_lvds on Gigabyte GA-D525TUD ITX motherboard

commit a51d4ed upstream.

This board is incorrectly detected as having an LVDS connector,
resulting in the VGA output (the only available output on the board)
showing the console only in the top-left 1024x768 pixels, and an extra
LVDS connector appearing in X.

It's a desktop Mini-ITX board using an Atom D525 CPU with an NM10
chipset.

I've had this board for about a year, but this is the first time I
noticed the issue because I've been running it headless for most of its
life.

Signed-off-by: Calvin Walton <[email protected]>
Signed-off-by: Peter Huewe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/i915: Add no-lvds quirk for Supermicro X7SPA-H

commit c31407a upstream.

Reported-and-tested-by: Francois Tigeot <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55375
Signed-off-by: Chris Wilson <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Signed-off-by: Peter Huewe <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

scsi: Silence unnecessary warnings about ioctl to partition

commit 6d93592 upstream.

Sometimes, warnings about ioctls to partition happen often enough that they
form majority of the warnings in the kernel log and users complain. In some
cases warnings are about ioctls such as SG_IO so it's not good to get rid of
the warnings completely as they can ease debugging of userspace problems
when ioctl is refused.

Since I have seen warnings from lots of commands, including some proprietary
userspace applications, I don't think disallowing the ioctls for processes
with CAP_SYS_RAWIO will happen in the near future if ever. So lets just
stop warning for processes with CAP_SYS_RAWIO for which ioctl is allowed.

Acked-by: Paolo Bonzini <[email protected]>
CC: James Bottomley <[email protected]>
CC: [email protected]
Signed-off-by: Jan Kara <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
Cc: Satoru Takeuchi <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Mustaavalkosta referenced this issue in Mustaavalkosta/htc7x30-3.0 Mar 1, 2013
This moves ARM over to the asm-generic/unaligned.h header. This has the
benefit of better code generated especially for ARMv7 on gcc 4.7+
compilers.

As Arnd Bergmann, points out: The asm-generic version uses the "struct"
version for native-endian unaligned access and the "byteshift" version
for the opposite endianess. The current ARM version however uses the
"byteshift" implementation for both.

Thanks to Nicolas Pitre for the excellent analysis:

Test case:

int foo (int *x) { return get_unaligned(x); }
long long bar (long long *x) { return get_unaligned(x); }

With the current ARM version:

foo:
	ldrb	r3, [r0, #2]	@ zero_extendqisi2	@ MEM[(const u8 *)x_1(D) + 2B], MEM[(const u8 *)x_1(D) + 2B]
	ldrb	r1, [r0, #1]	@ zero_extendqisi2	@ MEM[(const u8 *)x_1(D) + 1B], MEM[(const u8 *)x_1(D) + 1B]
	ldrb	r2, [r0, #0]	@ zero_extendqisi2	@ MEM[(const u8 *)x_1(D)], MEM[(const u8 *)x_1(D)]
	mov	r3, r3, asl #16	@ tmp154, MEM[(const u8 *)x_1(D) + 2B],
	ldrb	r0, [r0, #3]	@ zero_extendqisi2	@ MEM[(const u8 *)x_1(D) + 3B], MEM[(const u8 *)x_1(D) + 3B]
	orr	r3, r3, r1, asl #8	@, tmp155, tmp154, MEM[(const u8 *)x_1(D) + 1B],
	orr	r3, r3, r2	@ tmp157, tmp155, MEM[(const u8 *)x_1(D)]
	orr	r0, r3, r0, asl #24	@,, tmp157, MEM[(const u8 *)x_1(D) + 3B],
	bx	lr	@

bar:
	stmfd	sp!, {r4, r5, r6, r7}	@,
	mov	r2, #0	@ tmp184,
	ldrb	r5, [r0, #6]	@ zero_extendqisi2	@ MEM[(const u8 *)x_1(D) + 6B], MEM[(const u8 *)x_1(D) + 6B]
	ldrb	r4, [r0, #5]	@ zero_extendqisi2	@ MEM[(const u8 *)x_1(D) + 5B], MEM[(const u8 *)x_1(D) + 5B]
	ldrb	ip, [r0, #2]	@ zero_extendqisi2	@ MEM[(const u8 *)x_1(D) + 2B], MEM[(const u8 *)x_1(D) + 2B]
	ldrb	r1, [r0, #4]	@ zero_extendqisi2	@ MEM[(const u8 *)x_1(D) + 4B], MEM[(const u8 *)x_1(D) + 4B]
	mov	r5, r5, asl #16	@ tmp175, MEM[(const u8 *)x_1(D) + 6B],
	ldrb	r7, [r0, #1]	@ zero_extendqisi2	@ MEM[(const u8 *)x_1(D) + 1B], MEM[(const u8 *)x_1(D) + 1B]
	orr	r5, r5, r4, asl #8	@, tmp176, tmp175, MEM[(const u8 *)x_1(D) + 5B],
	ldrb	r6, [r0, #7]	@ zero_extendqisi2	@ MEM[(const u8 *)x_1(D) + 7B], MEM[(const u8 *)x_1(D) + 7B]
	orr	r5, r5, r1	@ tmp178, tmp176, MEM[(const u8 *)x_1(D) + 4B]
	ldrb	r4, [r0, #0]	@ zero_extendqisi2	@ MEM[(const u8 *)x_1(D)], MEM[(const u8 *)x_1(D)]
	mov	ip, ip, asl #16	@ tmp188, MEM[(const u8 *)x_1(D) + 2B],
	ldrb	r1, [r0, #3]	@ zero_extendqisi2	@ MEM[(const u8 *)x_1(D) + 3B], MEM[(const u8 *)x_1(D) + 3B]
	orr	ip, ip, r7, asl #8	@, tmp189, tmp188, MEM[(const u8 *)x_1(D) + 1B],
	orr	r3, r5, r6, asl #24	@,, tmp178, MEM[(const u8 *)x_1(D) + 7B],
	orr	ip, ip, r4	@ tmp191, tmp189, MEM[(const u8 *)x_1(D)]
	orr	ip, ip, r1, asl #24	@, tmp194, tmp191, MEM[(const u8 *)x_1(D) + 3B],
	mov	r1, r3	@,
	orr	r0, r2, ip	@ tmp171, tmp184, tmp194
	ldmfd	sp!, {r4, r5, r6, r7}
	bx	lr

In both cases the code is slightly suboptimal.  One may wonder why
wasting r2 with the constant 0 in the second case for example.  And all
the mov's could be folded in subsequent orr's, etc.

Now with the asm-generic version:

foo:
	ldr	r0, [r0, #0]	@ unaligned	@,* x
	bx	lr	@

bar:
	mov	r3, r0	@ x, x
	ldr	r0, [r0, #0]	@ unaligned	@,* x
	ldr	r1, [r3, #4]	@ unaligned	@,
	bx	lr	@

This is way better of course, but only because this was compiled for
ARMv7. In this case the compiler knows that the hardware can do
unaligned word access.  This isn't that obvious for foo(), but if we
remove the get_unaligned() from bar as follows:

long long bar (long long *x) {return *x; }

then the resulting code is:

bar:
	ldmia	r0, {r0, r1}	@ x,,
	bx	lr	@

So this proves that the presumed aligned vs unaligned cases does have
influence on the instructions the compiler may use and that the above
unaligned code results are not just an accident.

Still... this isn't fully conclusive without at least looking at the
resulting assembly fron a pre ARMv6 compilation.  Let's see with an
ARMv5 target:

foo:
	ldrb	r3, [r0, #0]	@ zero_extendqisi2	@ tmp139,* x
	ldrb	r1, [r0, #1]	@ zero_extendqisi2	@ tmp140,
	ldrb	r2, [r0, #2]	@ zero_extendqisi2	@ tmp143,
	ldrb	r0, [r0, #3]	@ zero_extendqisi2	@ tmp146,
	orr	r3, r3, r1, asl #8	@, tmp142, tmp139, tmp140,
	orr	r3, r3, r2, asl #16	@, tmp145, tmp142, tmp143,
	orr	r0, r3, r0, asl #24	@,, tmp145, tmp146,
	bx	lr	@

bar:
	stmfd	sp!, {r4, r5, r6, r7}	@,
	ldrb	r2, [r0, #0]	@ zero_extendqisi2	@ tmp139,* x
	ldrb	r7, [r0, #1]	@ zero_extendqisi2	@ tmp140,
	ldrb	r3, [r0, #4]	@ zero_extendqisi2	@ tmp149,
	ldrb	r6, [r0, #5]	@ zero_extendqisi2	@ tmp150,
	ldrb	r5, [r0, #2]	@ zero_extendqisi2	@ tmp143,
	ldrb	r4, [r0, #6]	@ zero_extendqisi2	@ tmp153,
	ldrb	r1, [r0, #7]	@ zero_extendqisi2	@ tmp156,
	ldrb	ip, [r0, #3]	@ zero_extendqisi2	@ tmp146,
	orr	r2, r2, r7, asl #8	@, tmp142, tmp139, tmp140,
	orr	r3, r3, r6, asl #8	@, tmp152, tmp149, tmp150,
	orr	r2, r2, r5, asl #16	@, tmp145, tmp142, tmp143,
	orr	r3, r3, r4, asl #16	@, tmp155, tmp152, tmp153,
	orr	r0, r2, ip, asl #24	@,, tmp145, tmp146,
	orr	r1, r3, r1, asl #24	@,, tmp155, tmp156,
	ldmfd	sp!, {r4, r5, r6, r7}
	bx	lr

Compared to the initial results, this is really nicely optimized and I
couldn't do much better if I were to hand code it myself.

Signed-off-by: Rob Herring <[email protected]>
Reviewed-by: Nicolas Pitre <[email protected]>
Tested-by: Thomas Petazzoni <[email protected]>
Reviewed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Russell King <[email protected]>
modified for Mako from kernel.org reference

Signed-off-by: faux123 <[email protected]>

Conflicts:
	arch/arm/include/asm/Kbuild
Mustaavalkosta referenced this issue in Mustaavalkosta/htc7x30-3.0 Mar 6, 2013
commit 1d05f993784973189395051cc711fdd6dd5eb389
Author: Greg Kroah-Hartman <[email protected]>
Date:   Mon Feb 13 11:15:52 2012 -0800

    Linux 3.0.21

commit 8a533666d1591cf4ea596c6bd710e2fe682cb56a
Author: Eric Dumazet <[email protected]>
Date:   Thu Feb 9 16:13:19 2012 -0500

    net: fix NULL dereferences in check_peer_redir()

    [ Upstream commit d3aaeb38c40e5a6c08dd31a1b64da65c4352be36, along
      with dependent backports of commits:
         69cce1d1404968f78b177a0314f5822d5afdbbfb
         9de79c127cccecb11ae6a21ab1499e87aa222880
         218fa90f072e4aeff9003d57e390857f4f35513e
         580da35a31f91a594f3090b7a2c39b85cb051a12
         f7e57044eeb1841847c24aa06766c8290c202583
         e049f28883126c689cf95859480d9ee4ab23b7fa ]

    Gergely Kalman reported crashes in check_peer_redir().

    It appears commit f39925dbde778 (ipv4: Cache learned redirect
    information in inetpeer.) added a race, leading to possible NULL ptr
    dereference.

    Since we can now change dst neighbour, we should make sure a reader can
    safely use a neighbour.

    Add RCU protection to dst neighbour, and make sure check_peer_redir()
    can be called safely by different cpus in parallel.

    As neighbours are already freed after one RCU grace period, this patch
    should not add typical RCU penalty (cache cold effects)

    Many thanks to Gergely for providing a pretty report pointing to the
    bug.

    Reported-by: Gergely Kalman <[email protected]>
    Signed-off-by: Eric Dumazet <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 323a479328cbc2fb5cf647790f7414ca570a577b
Author: Andreas Herrmann <[email protected]>
Date:   Fri Jan 6 15:57:55 2012 +0100

    powernow-k8: Fix indexing issue

    commit a8eb28480e9b637cc78b9aa5e08612ba97e1317a upstream.

    The driver uses the pstate number from the status register as index in
    its table of ACPI pstates (powernow_table). This is wrong as this is
    not a 1-to-1 mapping.

    For example we can have _PSS information to just utilize Pstate 0 and
    Pstate 4, ie.

      powernow-k8: Core Performance Boosting: on.
      powernow-k8:    0 : pstate 0 (2200 MHz)
      powernow-k8:    1 : pstate 4 (1400 MHz)

    In this example the driver's powernow_table has just 2 entries. Using
    the pstate number (4) as index into this table is just plain wrong.

    Signed-off-by: Andreas Herrmann <[email protected]>
    Signed-off-by: Dave Jones <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 2d8a3a209b35f8301c86e7962f636a372a0d7cad
Author: Andreas Herrmann <[email protected]>
Date:   Fri Jan 6 15:56:31 2012 +0100

    powernow-k8: Avoid Pstate MSR accesses on systems supporting CPB

    commit 201bf0f129e1715a33568d1563d9a75b840ab4d3 upstream.

    Due to CPB we can't directly map SW Pstates to Pstate MSRs. Get rid of
    the paranoia check. (assuming that the ACPI Pstate information is
    correct.)

    Signed-off-by: Andreas Herrmann <[email protected]>
    Signed-off-by: Dave Jones <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit ebc5010892742064d7436a1c1ff91b3189c4b8c7
Author: Axel Lin <[email protected]>
Date:   Wed Feb 1 12:31:47 2012 +0800

    mmc: cb710 core: Add missing spin_lock_init for irq_lock of struct cb710_chip

    commit b5266ea675c5a041e2852c7ccec4cf2d4f5e0cf4 upstream.

    Signed-off-by: Axel Lin <[email protected]>
    Acked-by: Michał Mirosław <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 27939dafb1bd1053fda96d69d4b693f29f2389b6
Author: Rui li <[email protected]>
Date:   Tue Jan 31 15:27:33 2012 +0800

    USB: add new zte 3g-dongle's pid to option.c

    commit 1608ea5f4b5d6262cd6e808839491cfb2a67405a upstream.

    As ZTE have and will use more pid for new products this year,
    so we need to add some new zte 3g-dongle's pid on option.c ,
    and delete one pid 0x0154 because it use for mass-storage port.

    Signed-off-by: Rui li <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 71f1a6a81350c7bf75141e183c1d5e310f264622
Author: Milan Kocian <[email protected]>
Date:   Fri Feb 3 14:28:00 2012 +0100

    USB: usbserial: add new PID number (0xa951) to the ftdi driver

    commit 90451e6973a5da155c6f315a409ca0a8d3ce6b76 upstream.

    Signed-off-by: Milan Kocian <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 20ef4883ff2c65f96da1617446ebc58c0a707970
Author: Jayachandran C <[email protected]>
Date:   Fri Jan 27 20:27:32 2012 +0530

    usb: Skip PCI USB quirk handling for Netlogic XLP

    commit e4436a7c17ac2b5e138f93f83a541cba9b311685 upstream.

    The Netlogic XLP SoC's on-chip USB controller appears as a PCI
    USB device, but does not need the EHCI/OHCI handoff done in
    usb/host/pci-quirks.c.

    The pci-quirks.c is enabled for all vendors and devices, and is
    enabled if USB and PCI are configured.

    If we do not skip the qurik handling on XLP, the readb() call in
    ehci_bios_handoff() will cause a crash since byte access is not
    supported for EHCI registers in XLP.

    Signed-off-by: Jayachandran C <[email protected]>
    Acked-by: Alan Stern <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d6adb709398ee159ab2ef26d51760041ca5e8262
Author: Timo Juhani Lindfors <[email protected]>
Date:   Sun Jan 29 16:12:13 2012 +0200

    usb: gadget: zero: fix bug in loopback autoresume handling

    commit 683da59d7b8ae04891636d4b59893cd4e9b0b7e5 upstream.

    ab943a2e125b (USB: gadget: gadget zero uses new suspend/resume hooks)
    introduced a copy-paste error where f_loopback.c writes to a variable
    declared in f_sourcesink.c. This prevents one from creating gadgets
    that only have a loopback function.

    Signed-off-by: Timo Juhani Lindfors <[email protected]>
    Signed-off-by: Felipe Balbi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit fc2286972bd426b03fe64d79d39d9ff9ac1c4cc3
Author: Larry Finger <[email protected]>
Date:   Sat Jan 7 10:07:03 2012 -0600

    staging: r8712u: Add new Sitecom UsB ID

    commit 1793bf1deddc8ce25dc41925d5dbe64536c841b6 upstream.

    Add USB ID for SITECOM WLA-1000 V1 001 WLAN

    Reported-and-tested-by: Roland Gruber <[email protected]>
    Reported-and-tested-by: Dario Lucia <[email protected]>
    Signed-off-by: Larry Finger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 946972e6ab9c59142f5cb51f31ea36a090f2ce16
Author: Pekka Paalanen <[email protected]>
Date:   Sun Jan 22 16:33:47 2012 +0200

    Staging: asus_oled: fix NULL-ptr crash on unloading

    commit 3589e74595a4332ebf77b5ed006f3c6686071ecd upstream.

    Asus_oled triggers the following bug on module unloading:

     usbcore: deregistering interface driver asus-oled
     BUG: unable to handle kernel NULL pointer dereference at 0000000000000038
     IP: [<ffffffff8111292b>] sysfs_delete_link+0x30/0x66

     Call Trace:
      [<ffffffff81225373>] device_remove_class_symlinks+0x6b/0x70
      [<ffffffff812256a8>] device_del+0x9f/0x1ab
      [<ffffffff812257c5>] device_unregister+0x11/0x1e
      [<ffffffffa000cb82>] asus_oled_disconnect+0x4f/0x9e [asus_oled]
      [<ffffffff81277430>] usb_unbind_interface+0x54/0x103
      [<ffffffff812276c4>] __device_release_driver+0xa2/0xeb
      [<ffffffff81227794>] driver_detach+0x87/0xad
      [<ffffffff812269e9>] bus_remove_driver+0x91/0xc1
      [<ffffffff81227fb4>] driver_unregister+0x66/0x6e
      [<ffffffff812771ed>] usb_deregister+0xbb/0xc4
      [<ffffffffa000ce87>] asus_oled_exit+0x2f/0x31 [asus_oled]
      [<ffffffff81068365>] sys_delete_module+0x1b8/0x21b
      [<ffffffff810ae3de>] ? do_munmap+0x2ef/0x313
      [<ffffffff813699bb>] system_call_fastpath+0x16/0x1b

    This is due to an incorrect destruction sequence in asus_oled_exit().

    Fix the order, fixes the bug. Tested on an Asus G50V laptop only.

    Cc: Jakub Schmidtke <[email protected]>
    Signed-off-by: Pekka Paalanen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 3f64466ca0f04dc2b138a3c1e348a7e15b91ebba
Author: Pekka Paalanen <[email protected]>
Date:   Sun Jan 22 16:33:46 2012 +0200

    Staging: asus_oled: fix image processing

    commit 635032cb397b396241372fa0ff36ae758e658b23 upstream.

    Programming an image was broken, because odev->buf_offs was not advanced
    for val == 0 in append_values(). This regression was introduced in:

     commit 1ff12a4aa354bed093a0240d5e6347b1e27601bc
     Author: Kevin A. Granade <[email protected]>
     Date:   Sat Sep 5 01:03:39 2009 -0500

         Staging: asus_oled: Cleaned up checkpatch issues.

    Fix the image processing by special-casing val == 0.

    I have tested this change on an Asus G50V laptop only.

    Cc: Jakub Schmidtke <[email protected]>
    Cc: Kevin A. Granade <[email protected]>
    Signed-off-by: Pekka Paalanen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 967a6f42d195569b596f9af39cd878803a0d1f8b
Author: Roland Dreier <[email protected]>
Date:   Mon Jan 9 17:54:00 2012 -0800

    target: Correct sense key for INVALID FIELD IN {PARAMETER LIST,CDB}

    commit 9fbc8909876a2160044e71d376848973b9bfdc3f upstream.

    According to SPC-4, the sense key for commands that are failed with
    INVALID FIELD IN PARAMETER LIST and INVALID FIELD IN CDB should be
    ILLEGAL REQUEST (5h) rather than ABORTED COMMAND (Bh).  Without this
    patch, a tcm_loop LUN incorrectly gives:

        # sg_raw -r 1 -v /dev/sda 3 1 0 0 ff 0
        Sense Information:
         Fixed format, current;  Sense key: Aborted Command
         Additional sense: Invalid field in cdb
         Raw sense data (in hex):
                70 00 0b 00 00 00 00 0a  00 00 00 00 24 00 00 00
                00 00

    While a real SCSI disk gives:

        Sense Information:
         Fixed format, current;  Sense key: Illegal Request
         Additional sense: Invalid field in cdb
         Raw sense data (in hex):
                70 00 05 00 00 00 00 18  00 00 00 00 24 00 00 00
                00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00

    with the main point being that the real disk gives a sense key of
    ILLEGAL REQUEST (5h).

    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Nicholas Bellinger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b8a8c4aa9e22c2de7af17ea48b7cc868f5bc79ad
Author: Marco Sanvido <[email protected]>
Date:   Tue Jan 3 17:12:58 2012 -0800

    target: Allow PERSISTENT RESERVE IN for non-reservation holder

    commit 6816966a8418b980481b4dced7eddd1796b145e8 upstream.

    Initiators that aren't the active reservation holder should be able to
    do a PERSISTENT RESERVE IN command in all cases, so add it to the list
    of allowed CDBs in core_scsi3_pr_seq_non_holder().

    Signed-off-by: Marco Sanvido <[email protected]>
    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Nicholas Bellinger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b96473a25fa375b08c9bf0c1c0dbf47ca826eaec
Author: Marco Sanvido <[email protected]>
Date:   Tue Jan 3 17:12:57 2012 -0800

    target: Use correct preempted registration sense code

    commit 9e08e34e3735ae057eb3834da3570995811b7eb9 upstream.

    The comments quote the right parts of the spec:

       * d) Establish a unit attention condition for the
       *    initiator port associated with every I_T nexus
       *    that lost its registration other than the I_T
       *    nexus on which the PERSISTENT RESERVE OUT command
       *    was received, with the additional sense code set
       *    to REGISTRATIONS PREEMPTED.

    and

       * e) Establish a unit attention condition for the initiator
       *    port associated with every I_T nexus that lost its
       *    persistent reservation and/or registration, with the
       *    additional sense code set to REGISTRATIONS PREEMPTED;

    but the actual code accidentally uses ASCQ_2AH_RESERVATIONS_PREEMPTED
    instead of ASCQ_2AH_REGISTRATIONS_PREEMPTED.  Fix this.

    Signed-off-by: Marco Sanvido <[email protected]>
    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Nicholas Bellinger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 91b08ca08c8f5fbad289950086d6fb7ab0642d63
Author: Hugh Dickins <[email protected]>
Date:   Wed Feb 8 17:13:40 2012 -0800

    mm: fix UP THP spin_is_locked BUGs

    commit b9980cdcf2524c5fe15d8cbae9c97b3ed6385563 upstream.

    Fix CONFIG_TRANSPARENT_HUGEPAGE=y CONFIG_SMP=n CONFIG_DEBUG_VM=y
    CONFIG_DEBUG_SPINLOCK=n kernel: spin_is_locked() is then always false,
    and so triggers some BUGs in Transparent HugePage codepaths.

    asm-generic/bug.h mentions this problem, and provides a WARN_ON_SMP(x);
    but being too lazy to add VM_BUG_ON_SMP, BUG_ON_SMP, WARN_ON_SMP_ONCE,
    VM_WARN_ON_SMP_ONCE, just test NR_CPUS != 1 in the existing VM_BUG_ONs.

    Signed-off-by: Hugh Dickins <[email protected]>
    Cc: Andrea Arcangeli <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b9134812300fd0e3c242c50af5c563065d2f1b1e
Author: Mel Gorman <[email protected]>
Date:   Wed Feb 8 17:13:38 2012 -0800

    mm: compaction: check for overlapping nodes during isolation for migration

    commit dc9086004b3d5db75997a645b3fe08d9138b7ad0 upstream.

    When isolating pages for migration, migration starts at the start of a
    zone while the free scanner starts at the end of the zone.  Migration
    avoids entering a new zone by never going beyond the free scanned.

    Unfortunately, in very rare cases nodes can overlap.  When this happens,
    migration isolates pages without the LRU lock held, corrupting lists
    which will trigger errors in reclaim or during page free such as in the
    following oops

      BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
      IP: [<ffffffff810f795c>] free_pcppages_bulk+0xcc/0x450
      PGD 1dda554067 PUD 1e1cb58067 PMD 0
      Oops: 0000 [#1] SMP
      CPU 37
      Pid: 17088, comm: memcg_process_s Tainted: G            X
      RIP: free_pcppages_bulk+0xcc/0x450
      Process memcg_process_s (pid: 17088, threadinfo ffff881c2926e000, task ffff881c2926c0c0)
      Call Trace:
        free_hot_cold_page+0x17e/0x1f0
        __pagevec_free+0x90/0xb0
        release_pages+0x22a/0x260
        pagevec_lru_move_fn+0xf3/0x110
        putback_lru_page+0x66/0xe0
        unmap_and_move+0x156/0x180
        migrate_pages+0x9e/0x1b0
        compact_zone+0x1f3/0x2f0
        compact_zone_order+0xa2/0xe0
        try_to_compact_pages+0xdf/0x110
        __alloc_pages_direct_compact+0xee/0x1c0
        __alloc_pages_slowpath+0x370/0x830
        __alloc_pages_nodemask+0x1b1/0x1c0
        alloc_pages_vma+0x9b/0x160
        do_huge_pmd_anonymous_page+0x160/0x270
        do_page_fault+0x207/0x4c0
        page_fault+0x25/0x30

    The "X" in the taint flag means that external modules were loaded but but
    is unrelated to the bug triggering.  The real problem was because the PFN
    layout looks like this

      Zone PFN ranges:
        DMA      0x00000010 -> 0x00001000
        DMA32    0x00001000 -> 0x00100000
        Normal   0x00100000 -> 0x01e80000
      Movable zone start PFN for each node
      early_node_map[14] active PFN ranges
          0: 0x00000010 -> 0x0000009b
          0: 0x00000100 -> 0x0007a1ec
          0: 0x0007a354 -> 0x0007a379
          0: 0x0007f7ff -> 0x0007f800
          0: 0x00100000 -> 0x00680000
          1: 0x00680000 -> 0x00e80000
          0: 0x00e80000 -> 0x01080000
          1: 0x01080000 -> 0x01280000
          0: 0x01280000 -> 0x01480000
          1: 0x01480000 -> 0x01680000
          0: 0x01680000 -> 0x01880000
          1: 0x01880000 -> 0x01a80000
          0: 0x01a80000 -> 0x01c80000
          1: 0x01c80000 -> 0x01e80000

    The fix is straight-forward.  isolate_migratepages() has to make a
    similar check to isolate_freepage to ensure that it never isolates pages
    from a zone it does not hold the LRU lock for.

    This was discovered in a 3.0-based kernel but it affects 3.1.x, 3.2.x
    and current mainline.

    Signed-off-by: Mel Gorman <[email protected]>
    Acked-by: Michal Nazarewicz <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a5e2ba3e021e7a3135a7dbb8e188d21971a59f49
Author: Russell King <[email protected]>
Date:   Wed Feb 8 17:13:41 2012 -0800

    pcmcia: fix socket refcount decrementing on each resume

    commit 025e4ab3db07fcbf62c01e4f30d1012234beb980 upstream.

    This fixes a memory-corrupting bug: not only does it cause the warning,
    but as a result of dropping the refcount to zero, it causes the
    pcmcia_socket0 device structure to be freed while it still has
    references, causing slab caches corruption.  A fatal oops quickly
    follows this warning - often even just a 'dmesg' following the warning
    causes the kernel to oops.

    While testing suspend/resume on an ARM device with PCMCIA support, and a
    CF card inserted, I found that after five suspend and resumes, the
    kernel would complain, and shortly die after with slab corruption.

      WARNING: at include/linux/kref.h:41 kobject_get+0x28/0x50()

    As the message doesn't give a clue about which kobject, and the built-in
    debugging in drivers/base/power/main.c happens too late, this was added
    right before each get_device():

      printk("%s: %p [%s] %u\n", __func__, dev, kobject_name(&dev->kobj), atomic_read(&dev->kobj.kref.refcount));

    and on the 3rd s2ram cycle, the following behaviour observed:

    On the 3rd suspend/resume cycle:

      dpm_prepare: c1a0d998 [pcmcia_socket0] 3
      dpm_suspend: c1a0d998 [pcmcia_socket0] 3
      dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 3
      dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 3
      dpm_resume: c1a0d998 [pcmcia_socket0] 3
      dpm_complete: c1a0d998 [pcmcia_socket0] 2

    4th:

      dpm_prepare: c1a0d998 [pcmcia_socket0] 2
      dpm_suspend: c1a0d998 [pcmcia_socket0] 2
      dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 2
      dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 2
      dpm_resume: c1a0d998 [pcmcia_socket0] 2
      dpm_complete: c1a0d998 [pcmcia_socket0] 1

    5th:

      dpm_prepare: c1a0d998 [pcmcia_socket0] 1
      dpm_suspend: c1a0d998 [pcmcia_socket0] 1
      dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 1
      dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 1
      dpm_resume: c1a0d998 [pcmcia_socket0] 1
      dpm_complete: c1a0d998 [pcmcia_socket0] 0
      ------------[ cut here ]------------
      WARNING: at include/linux/kref.h:41 kobject_get+0x28/0x50()
      Modules linked in: ucb1x00_core
      Backtrace:
      [<c0212090>] (dump_backtrace+0x0/0x110) from [<c04799dc>] (dump_stack+0x18/0x1c)
      [<c04799c4>] (dump_stack+0x0/0x1c) from [<c021cba0>] (warn_slowpath_common+0x50/0x68)
      [<c021cb50>] (warn_slowpath_common+0x0/0x68) from [<c021cbdc>] (warn_slowpath_null+0x24/0x28)
      [<c021cbb8>] (warn_slowpath_null+0x0/0x28) from [<c0335374>] (kobject_get+0x28/0x50)
      [<c033534c>] (kobject_get+0x0/0x50) from [<c03804f4>] (get_device+0x1c/0x24)
      [<c0388c90>] (dpm_complete+0x0/0x1a0) from [<c0389cc0>] (dpm_resume_end+0x1c/0x20)
      ...

    Looking at commit 7b24e7988263 ("pcmcia: split up central event handler"),
    the following change was made to cs.c:

                    return 0;
            }
     #endif
    -
    -       send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW);
    +       if (!(skt->state & SOCKET_CARDBUS) && (skt->callback))
    +               skt->callback->early_resume(skt);
            return 0;
     }

    And the corresponding change in ds.c is from:

    -static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
    -{
    -       struct pcmcia_socket *s = pcmcia_get_socket(skt);
    ...
    -       switch (event) {
    ...
    -       case CS_EVENT_PM_RESUME:
    -               if (verify_cis_cache(skt) != 0) {
    -                       dev_dbg(&skt->dev, "cis mismatch - different card\n");
    -                       /* first, remove the card */
    -                       ds_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH);
    -                       mutex_lock(&s->ops_mutex);
    -                       destroy_cis_cache(skt);
    -                       kfree(skt->fake_cis);
    -                       skt->fake_cis = NULL;
    -                       s->functions = 0;
    -                       mutex_unlock(&s->ops_mutex);
    -                       /* now, add the new card */
    -                       ds_event(skt, CS_EVENT_CARD_INSERTION,
    -                                CS_EVENT_PRI_LOW);
    -               }
    -               break;
    ...
    -    }

    -    pcmcia_put_socket(s);

    -    return 0;
    -} /* ds_event */

    to:

    +static int pcmcia_bus_early_resume(struct pcmcia_socket *skt)
    +{
    +       if (!verify_cis_cache(skt)) {
    +               pcmcia_put_socket(skt);
    +               return 0;
    +       }

    +       dev_dbg(&skt->dev, "cis mismatch - different card\n");

    +       /* first, remove the card */
    +       pcmcia_bus_remove(skt);
    +       mutex_lock(&skt->ops_mutex);
    +       destroy_cis_cache(skt);
    +       kfree(skt->fake_cis);
    +       skt->fake_cis = NULL;
    +       skt->functions = 0;
    +       mutex_unlock(&skt->ops_mutex);

    +       /* now, add the new card */
    +       pcmcia_bus_add(skt);
    +       return 0;
    +}

    As can be seen, the original function called pcmcia_get_socket() and
    pcmcia_put_socket() around the guts, whereas the replacement code
    calls pcmcia_put_socket() only in one path.  This creates an imbalance
    in the refcounting.

    Testing with pcmcia_put_socket() put removed shows that the bug is gone:

      dpm_suspend: c1a10998 [pcmcia_socket0] 5
      dpm_suspend_noirq: c1a10998 [pcmcia_socket0] 5
      dpm_resume_noirq: c1a10998 [pcmcia_socket0] 5
      dpm_resume: c1a10998 [pcmcia_socket0] 5
      dpm_complete: c1a10998 [pcmcia_socket0] 5

    Tested-by: Russell King <[email protected]>
    Signed-off-by: Russell King <[email protected]>
    Cc: Dominik Brodowski <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 2b42237845c6c1f94479320b012664bbf07bb989
Author: Susan Gao <[email protected]>
Date:   Mon Jan 30 13:57:04 2012 -0800

    ASoC: wm8962: Fix word length configuration

    commit 2b6712b19531e22455e7fa18371c5ba9eec76699 upstream.

    Signed-off-by: Susan Gao <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b855f76b5f217bd6d03c7dfa38a64b51143338ac
Author: Mark Brown <[email protected]>
Date:   Wed Feb 1 23:46:58 2012 +0000

    ASoC: wm_hubs: Correct line input to line output 2 paths

    commit 43b6cec27e1e50a1de3eff47e66e502f3fe7e66e upstream.

    The second line output mixer has the controls for the line input bypasses
    in the opposite order.

    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 30b4b3a54fc6ca34c6f8a18b56c83680ad0a7fa9
Author: Mark Brown <[email protected]>
Date:   Tue Jan 31 11:55:32 2012 +0000

    ASoC: wm_hubs: Fix routing of input PGAs to line output mixer

    commit ee76744c51ec342df9822b4a85dbbfc3887b6d60 upstream.

    IN1L/R is routed to both line output mixers, we don't route IN1 to LINEOUT1
    and IN2 to LINEOUT2.

    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit eb521fbb338f21b2de12fe8f7e4fa5b7e4f9fb2a
Author: Guenter Roeck <[email protected]>
Date:   Fri Jan 27 05:43:59 2012 -0800

    hwmon: (w83627ehf) Fix number of fans for NCT6776F

    commit 585c0fd8216e0c9f98e2434092af7ec0f999522d upstream.

    NCT6776F can select fan input pins for fans 3 to 5 with a secondary set of
    chip register bits. Check that second set of bits in addition to the first set
    to detect if fans 3..5 are monitored.

    Signed-off-by: Guenter Roeck <[email protected]>
    Acked-by: Jean Delvare <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d378b2d044139f88384d278bd5830669c44c789b
Author: Peter Zijlstra <[email protected]>
Date:   Mon Nov 14 13:13:49 2011 +0100

    lockdep, bug: Exclude TAINT_FIRMWARE_WORKAROUND from disabling lockdep

    commit df754e6af2f237a6c020c0daff55a1a609338e31 upstream.

    It's unlikely that TAINT_FIRMWARE_WORKAROUND causes false
    lockdep messages, so do not disable lockdep in that case.
    We still want to keep lockdep disabled in the
    TAINT_OOT_MODULE case:

      - bin-only modules can cause various instabilities in
        their and in unrelated kernel code

      - they are impossible to debug for kernel developers

      - they also typically do not have the copyright license
        permission to link to the GPL-ed lockdep code.

    Suggested-by: Ben Hutchings <[email protected]>
    Signed-off-by: Peter Zijlstra <[email protected]>
    Link: http://lkml.kernel.org/n/[email protected]
    Signed-off-by: Ingo Molnar <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e02c339f506e10fadf8a5f00f1c932035596ed8e
Author: Hubert Feurstein <[email protected]>
Date:   Mon Jan 9 17:23:57 2012 +0100

    atmel_lcdfb: fix usage of CONTRAST_CTR in suspend/resume

    commit 9f1065032ceb7e86c7c9f16bb86518857e88a172 upstream.

    An error was existing in the saving of CONTRAST_CTR register
    across suspend/resume.

    Signed-off-by: Hubert Feurstein <[email protected]>
    Signed-off-by: Nicolas Ferre <[email protected]>
    Acked-by: Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
    Signed-off-by: Florian Tobias Schandinat <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7a415a8da853b0724413680a769d89affc8b5be5
Author: Shirish Pargaonkar <[email protected]>
Date:   Thu Feb 2 15:28:28 2012 -0600

    cifs: Fix oops in session setup code for null user mounts

    commit de47a4176c532ef5961b8a46a2d541a3517412d3 upstream.

    For null user mounts, do not invoke string length function
    during session setup.

    Reported-and-Tested-by: Chris Clayton <[email protected]>
    Acked-by: Jeff Layton <[email protected]>
    Signed-off-by: Shirish Pargaonkar <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 1a11d5d7fb7988a92e798dfbed7cdd350c0701cc
Author: Li Wang <[email protected]>
Date:   Thu Jan 19 09:44:36 2012 +0800

    eCryptfs: Infinite loop due to overflow in ecryptfs_write()

    commit 684a3ff7e69acc7c678d1a1394fe9e757993fd34 upstream.

    ecryptfs_write() can enter an infinite loop when truncating a file to a
    size larger than 4G. This only happens on architectures where size_t is
    represented by 32 bits.

    This was caused by a size_t overflow due to it incorrectly being used to
    store the result of a calculation which uses potentially large values of
    type loff_t.

    [[email protected]: rewrite subject and commit message]
    Signed-off-by: Li Wang <[email protected]>
    Signed-off-by: Yunchuan Wen <[email protected]>
    Reviewed-by: Cong Wang <[email protected]>
    Signed-off-by: Tyler Hicks <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit dade9ad146b19c22141032d84190d2220623d2ca
Author: Eugeni Dodonov <[email protected]>
Date:   Sat Jan 7 23:40:35 2012 -0200

    drm/i915: handle 3rd pipe

    commit 07c1e8c1462fa7324de4c36ae9e55da2abd79cee upstream.

    We don't need to check 3rd pipe specifically, as it shares PLL with some
    other one.

    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41977
    Signed-off-by: Eugeni Dodonov <[email protected]>
    Reviewed-by: Jesse Barnes <[email protected]>
    Signed-off-by: Keith Packard <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit bd26f229584ab3c0470410550d3c69bf3c9d29ee
Author: Rodrigo Vivi <[email protected]>
Date:   Wed Dec 14 21:10:06 2011 -0200

    drm/i915: Fix TV Out refresh rate.

    commit 23bd15ec662344dc10e9918fdd0dbc58bc71526d upstream.

    TV Out refresh rate was half of the specification for almost all modes.
    Due to this reason pixel clock was so low for some modes causing flickering screen.

    Signed-off-by: Rodrigo Vivi <[email protected]>
    Reviewed-by: Jesse Barnes <[email protected]>
    Signed-off-by: Keith Packard <[email protected]>
    Signed-off-by: Eugeni Dodonov <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 5b19005c6230e6a65d3fe3de8f514feac7d2eebb
Author: Daniel Vetter <[email protected]>
Date:   Sun Nov 27 18:58:17 2011 +0100

    drm/i915: check ACTHD of all rings

    commit 097354eb14fa94d31a09c64d640643f58e4a5a9a upstream.

    Otherwise hangcheck spuriously fires when running blitter/bsd-only
    workloads.

    Contrary to a similar patch by Ben Widawsky this does not check
    INSTDONE of the other rings. Chris Wilson implied that in a failure to
    detect a hang, most likely because INSTDONE was fluctuating. Thus only
    check ACTHD, which as far as I know is rather reliable. Also, blitter
    and bsd rings can't launch complex tasks from a single instruction
    (like 3D_PRIM on the render with complex or even infinite shaders).

    This fixes spurious gpu hang detection when running
    tests/gem_hangcheck_forcewake on snb/ivb.

    Signed-Off-by: Daniel Vetter <[email protected]>
    Reviewed-by: Chris Wilson <[email protected]>
    Signed-off-by: Keith Packard <[email protected]>
    Signed-off-by: Eugeni Dodonov <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 1f8991ccf771442ae2423971798a6ca9d6db6343
Author: Wu Fengguang <[email protected]>
Date:   Fri Dec 9 20:42:21 2011 +0800

    drm/i915: DisplayPort hot remove notification to audio driver

    commit 832afda6a7d7235ef0e09f4ec46736861540da6d upstream.

    On DP monitor hot remove, clear DP_AUDIO_OUTPUT_ENABLE accordingly,
    so that the audio driver will receive hot plug events and take action
    to refresh its device state and ELD contents.

    Note that the DP_AUDIO_OUTPUT_ENABLE bit may be enabled or disabled
    only when the link training is complete and set to "Normal".

    Tested OK for both hot plug/remove and DPMS on/off.

    Signed-off-by: Wu Fengguang <[email protected]>
    Signed-off-by: Keith Packard <[email protected]>
    Signed-off-by: Eugeni Dodonov <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 032aa01c0b53e12b3ac46db8e7202a3230a83a89
Author: Wu Fengguang <[email protected]>
Date:   Fri Dec 9 20:42:20 2011 +0800

    drm/i915: HDMI hot remove notification to audio driver

    commit 2deed761188d7480eb5f7efbfe7aa77f09322ed8 upstream.

    On HDMI monitor hot remove, clear SDVO_AUDIO_ENABLE accordingly, so that
    the audio driver will receive hot plug events and take action to refresh
    its device state and ELD contents.

    The cleared SDVO_AUDIO_ENABLE bit needs to be restored to prevent losing
    HDMI audio after DPMS on.

    CC: Wang Zhenyu <[email protected]>
    Signed-off-by: Wu Fengguang <[email protected]>
    Signed-off-by: Keith Packard <[email protected]>
    Signed-off-by: Eugeni Dodonov <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 1357ed0b4b9db30846377febb40a847d6103c991
Author: Jan Kara <[email protected]>
Date:   Fri Dec 23 11:53:07 2011 +0100

    udf: Mark LVID buffer as uptodate before marking it dirty

    commit 853a0c25baf96b028de1654bea1e0c8857eadf3d upstream.

    When we hit EIO while writing LVID, the buffer uptodate bit is cleared.
    This then results in an anoying warning from mark_buffer_dirty() when we
    write the buffer again. So just set uptodate flag unconditionally.

    Reviewed-by: Namjae Jeon <[email protected]>
    Signed-off-by: Jan Kara <[email protected]>
    Cc: Dave Jones <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 10f672f1a199240bc2a77d6f81e1d37f33ba743e
Author: Mark Brown <[email protected]>
Date:   Tue Sep 20 11:41:54 2011 +0100

    ASoC: Ensure we generate a driver name

    commit f0e8ed858edb327802ee65fd695cc1538286226f upstream.

    Commit 873bd4c (ASoC: Don't set invalid name string to snd_card->driver
    field) broke generation of a driver name for all ASoC cards relying on the
    automatic generation of one. Fix this by using the old default with spaces
    replaced by underscores.

    Signed-off-by: Mark Brown <[email protected]>
    Acked-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c27711dc7f2cff89cee6a47026d936672cb29350
Author: Chanho Min <[email protected]>
Date:   Thu Jan 5 20:00:19 2012 +0900

    sched/rt: Fix task stack corruption under __ARCH_WANT_INTERRUPTS_ON_CTXSW

    commit cb297a3e433dbdcf7ad81e0564e7b804c941ff0d upstream.

    This issue happens under the following conditions:

     1. preemption is off
     2. __ARCH_WANT_INTERRUPTS_ON_CTXSW is defined
     3. RT scheduling class
     4. SMP system

    Sequence is as follows:

     1.suppose current task is A. start schedule()
     2.task A is enqueued pushable task at the entry of schedule()
       __schedule
        prev = rq->curr;
        ...
        put_prev_task
         put_prev_task_rt
          enqueue_pushable_task
     4.pick the task B as next task.
       next = pick_next_task(rq);
     3.rq->curr set to task B and context_switch is started.
       rq->curr = next;
     4.At the entry of context_swtich, release this cpu's rq->lock.
       context_switch
        prepare_task_switch
         prepare_lock_switch
          raw_spin_unlock_irq(&rq->lock);
     5.Shortly after rq->lock is released, interrupt is occurred and start IRQ context
     6.try_to_wake_up() which called by ISR acquires rq->lock
        try_to_wake_up
         ttwu_remote
          rq = __task_rq_lock(p)
          ttwu_do_wakeup(rq, p, wake_flags);
            task_woken_rt
     7.push_rt_task picks the task A which is enqueued before.
       task_woken_rt
        push_rt_tasks(rq)
         next_task = pick_next_pushable_task(rq)
     8.At find_lock_lowest_rq(), If double_lock_balance() returns 0,
       lowest_rq can be the remote rq.
      (But,If preemption is on, double_lock_balance always return 1 and it
       does't happen.)
       push_rt_task
        find_lock_lowest_rq
         if (double_lock_balance(rq, lowest_rq))..
     9.find_lock_lowest_rq return the available rq. task A is migrated to
       the remote cpu/rq.
       push_rt_task
        ...
        deactivate_task(rq, next_task, 0);
        set_task_cpu(next_task, lowest_rq->cpu);
        activate_task(lowest_rq, next_task, 0);
     10. But, task A is on irq context at this cpu.
         So, task A is scheduled by two cpus at the same time until restore from IRQ.
         Task A's stack is corrupted.

    To fix it, don't migrate an RT task if it's still running.

    Signed-off-by: Chanho Min <[email protected]>
    Signed-off-by: Peter Zijlstra <[email protected]>
    Acked-by: Steven Rostedt <[email protected]>
    Link: http://lkml.kernel.org/r/CAOAMb1BHA=5fm7KTewYyke6u-8DP0iUuJMpgQw54vNeXFsGpoQ@mail.gmail.com
    Signed-off-by: Ingo Molnar <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 32c4490a6ffbe3de604581f5fdce361eb049acff
Author: Seth Forshee <[email protected]>
Date:   Tue Jan 31 19:06:25 2012 -0600

    drm/radeon/kms: disable output polling when suspended

    commit 86698c20f71d488b32c49ed4687fb3cf8a88a5ca upstream.

    Polling the outputs when the device is suspended can result in erroneous
    status updates. Disable output polling during suspend to prevent this
    from happening.

    Signed-off-by: Seth Forshee <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Signed-off-by: Dave Airlie <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e1cf4ad959d7b2644f2be70ff38030d6cd3cbede
Author: Ben Skeggs <[email protected]>
Date:   Tue Jan 10 10:18:28 2012 +1000

    drm/nouveau/gem: fix fence_sync race / oops

    commit 525895ba388c949aa906f26e3ec5cb1ab041f56b upstream.

    Due to a race it was possible for a fence to be destroyed while another
    thread was trying to synchronise with it.  If this happened in the fallback
    non-semaphore path, it lead to the following oops due to fence->channel
    being NULL.

    BUG: unable to handle kernel NULL pointer dereference at   (null)
    IP: [<fa9632ce>] nouveau_fence_update+0xe/0xe0 [nouveau]
    *pde = a649c067
    SMP
    Modules linked in: fuse nouveau(O) ttm(O) drm_kms_helper(O) drm(O) mxm_wmi video wmi netconsole configfs lockd bnep bluetooth rfkill ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack ip6table_filter ip6_tables snd_hda_codec_realtek snd_hda_intel snd_hda_cobinfmt_misc uinput ata_generic pata_acpi pata_aet2c_algo_bit i2c_core [last unloaded: wmi]

    Pid: 2255, comm: gnome-shell Tainted: G           O 3.2.0-0.rc5.git0.1.fc17.i686 #1 System manufacturer System Product Name/M2A-VM
    EIP: 0060:[<fa9632ce>] EFLAGS: 00010296 CPU: 1
    EIP is at nouveau_fence_update+0xe/0xe0 [nouveau]
    EAX: 00000000 EBX: ddfc6dd0 ECX: dd111580 EDX: 00000000
    ESI: 00003e80 EDI: dd111580 EBP: dd121d00 ESP: dd121ce8
     DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
    Process gnome-shell (pid: 2255, ti=dd120000 task=dd111580 task.ti=dd120000)
    Stack:
     7dc86c76 00000000 00003e80 ddfc6dd0 00003e80 dd111580 dd121d0c fa96371f
     00000000 dd121d3c fa963773 dd111580 01000246 000ec53d 00000000 ddfc6dd0
     00001f40 00000000 ddfc6dd0 00000010 dc7df840 dd121d6c fa9639a0 00000000
    Call Trace:
     [<fa96371f>] __nouveau_fence_signalled+0x1f/0x30 [nouveau]
     [<fa963773>] __nouveau_fence_wait+0x43/0xd0 [nouveau]
     [<fa9639a0>] nouveau_fence_sync+0x1a0/0x1c0 [nouveau]
     [<fa964046>] validate_list+0x176/0x300 [nouveau]
     [<f7d9c9c0>] ? ttm_bo_mem_put+0x30/0x30 [ttm]
     [<fa964b8a>] nouveau_gem_ioctl_pushbuf+0x48a/0xfd0 [nouveau]
     [<c0406481>] ? die+0x31/0x80
     [<f7c93d98>] drm_ioctl+0x388/0x490 [drm]
     [<c0406481>] ? die+0x31/0x80
     [<fa964700>] ? nouveau_gem_ioctl_new+0x150/0x150 [nouveau]
     [<c0635c7b>] ? file_has_perm+0xcb/0xe0
     [<f7c93a10>] ? drm_copy_field+0x80/0x80 [drm]
     [<c0564f56>] do_vfs_ioctl+0x86/0x5b0
     [<c0406481>] ? die+0x31/0x80
     [<c0635f22>] ? selinux_file_ioctl+0x62/0x130
     [<c0554f30>] ? fget_light+0x30/0x340
     [<c05654ef>] sys_ioctl+0x6f/0x80
     [<c099e3a4>] syscall_call+0x7/0xb
     [<c0406481>] ? die+0x31/0x80
     [<c0406481>] ? die+0x31/0x80

    Signed-off-by: Ben Skeggs <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit f5e9a83833c2effd51bb138b598636f4ed661498
Author: Michel Dänzer <[email protected]>
Date:   Wed Feb 1 12:09:55 2012 +0100

    drm/radeon: Set DESKTOP_HEIGHT register to the framebuffer (not mode) height.

    commit 1b61925061660009f5b8047f93c5297e04541273 upstream.

    The value of this register is transferred to the V_COUNTER register at the
    beginning of vertical blank. V_COUNTER is the reference for VLINE waits and
    goes from VIEWPORT_Y_START to VIEWPORT_Y_START+VIEWPORT_HEIGHT during scanout,
    so if VIEWPORT_Y_START is not 0, V_COUNTER actually went backwards at the
    beginning of vertical blank, and VLINE waits excluding the whole scanout area
    could never finish (possibly only if VIEWPORT_Y_START is larger than the length
    of vertical blank in scanlines). Setting DESKTOP_HEIGHT to the framebuffer
    height should prevent this for any kind of VLINE wait.

    Fixes https://bugs.freedesktop.org/show_bug.cgi?id=45329 .

    Signed-off-by: Michel Dänzer <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Signed-off-by: Dave Airlie <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 77650df5a701fb3a7acadfb347ebfb0e95cffe09
Author: Mel Gorman <[email protected]>
Date:   Fri Feb 3 15:37:18 2012 -0800

    mm: compaction: check pfn_valid when entering a new MAX_ORDER_NR_PAGES block during isolation for migration

    commit 0bf380bc70ecba68cb4d74dc656cc2fa8c4d801a upstream.

    When isolating for migration, migration starts at the start of a zone
    which is not necessarily pageblock aligned.  Further, it stops isolating
    when COMPACT_CLUSTER_MAX pages are isolated so migrate_pfn is generally
    not aligned.  This allows isolate_migratepages() to call pfn_to_page() on
    an invalid PFN which can result in a crash.  This was originally reported
    against a 3.0-based kernel with the following trace in a crash dump.

    PID: 9902   TASK: d47aecd0  CPU: 0   COMMAND: "memcg_process_s"
     #0 [d72d3ad0] crash_kexec at c028cfdb
     #1 [d72d3b24] oops_end at c05c5322
     #2 [d72d3b38] __bad_area_nosemaphore at c0227e60
     #3 [d72d3bec] bad_area at c0227fb6
     #4 [d72d3c00] do_page_fault at c05c72ec
     #5 [d72d3c80] error_code (via page_fault) at c05c47a4
        EAX: 00000000  EBX: 000c0000  ECX: 00000001  EDX: 00000807  EBP: 000c0000
        DS:  007b      ESI: 00000001  ES:  007b      EDI: f3000a80  GS:  6f50
        CS:  0060      EIP: c030b15a  ERR: ffffffff  EFLAGS: 00010002
     #6 [d72d3cb4] isolate_migratepages at c030b15a
     #7 [d72d3d14] zone_watermark_ok at c02d26cb
     #8 [d72d3d2c] compact_zone at c030b8de
     #9 [d72d3d68] compact_zone_order at c030bba1
    #10 [d72d3db4] try_to_compact_pages at c030bc84
    #11 [d72d3ddc] __alloc_pages_direct_compact at c02d61e7
    #12 [d72d3e08] __alloc_pages_slowpath at c02d66c7
    #13 [d72d3e78] __alloc_pages_nodemask at c02d6a97
    #14 [d72d3eb8] alloc_pages_vma at c030a845
    #15 [d72d3ed4] do_huge_pmd_anonymous_page at c03178eb
    #16 [d72d3f00] handle_mm_fault at c02f36c6
    #17 [d72d3f30] do_page_fault at c05c70ed
    #18 [d72d3fb0] error_code (via page_fault) at c05c47a4
        EAX: b71ff000  EBX: 00000001  ECX: 00001600  EDX: 00000431
        DS:  007b      ESI: 08048950  ES:  007b      EDI: bfaa3788
        SS:  007b      ESP: bfaa36e0  EBP: bfaa3828  GS:  6f50
        CS:  0073      EIP: 080487c8  ERR: ffffffff  EFLAGS: 00010202

    It was also reported by Herbert van den Bergh against 3.1-based kernel
    with the following snippet from the console log.

    BUG: unable to handle kernel paging request at 01c00008
    IP: [<c0522399>] isolate_migratepages+0x119/0x390
    *pdpt = 000000002f7ce001 *pde = 0000000000000000

    It is expected that it also affects 3.2.x and current mainline.

    The problem is that pfn_valid is only called on the first PFN being
    checked and that PFN is not necessarily aligned.  Lets say we have a case
    like this

    H = MAX_ORDER_NR_PAGES boundary
    | = pageblock boundary
    m = cc->migrate_pfn
    f = cc->free_pfn
    o = memory hole

    H------|------H------|----m-Hoooooo|ooooooH-f----|------H

    The migrate_pfn is just below a memory hole and the free scanner is beyond
    the hole.  When isolate_migratepages started, it scans from migrate_pfn to
    migrate_pfn+pageblock_nr_pages which is now in a memory hole.  It checks
    pfn_valid() on the first PFN but then scans into the hole where there are
    not necessarily valid struct pages.

    This patch ensures that isolate_migratepages calls pfn_valid when
    necessary.

    Reported-by: Herbert van den Bergh <[email protected]>
    Tested-by: Herbert van den Bergh <[email protected]>
    Signed-off-by: Mel Gorman <[email protected]>
    Acked-by: Michal Nazarewicz <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c713decb179258db83fd048c09ec55d521d864d4
Author: Carsten Otte <[email protected]>
Date:   Fri Feb 3 15:37:14 2012 -0800

    mm/filemap_xip.c: fix race condition in xip_file_fault()

    commit 99f02ef1f18631eb0a4e0ea0a3d56878dbcb4b90 upstream.

    Fix a race condition that shows in conjunction with xip_file_fault() when
    two threads of the same user process fault on the same memory page.

    In this case, the race winner will install the page table entry and the
    unlucky loser will cause an oops: xip_file_fault calls vm_insert_pfn (via
    vm_insert_mixed) which drops out at this check:

    	retval = -EBUSY;
    	if (!pte_none(*pte))
    		goto out_unlock;

    The resulting -EBUSY return value will trigger a BUG_ON() in
    xip_file_fault.

    This fix simply considers the fault as fixed in this case, because the
    race winner has successfully installed the pte.

    [[email protected]: use conventional (and consistent) comment layout]
    Reported-by: David Sadler <[email protected]>
    Signed-off-by: Carsten Otte <[email protected]>
    Reported-by: Louis Alex Eisner <[email protected]>
    Cc: Hugh Dickins <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 73632d80356dcadfcacc8e20a319850b112abb9b
Author: Nikolaus Voss <[email protected]>
Date:   Tue Jan 17 10:28:33 2012 +0100

    at_hdmac: bugfix for enabling channel irq

    commit bda3a47c886664e86ee14eb79e9072b9e341f575 upstream.

    commit 463894705e4089d0ff69e7d877312d496ac70e5b deleted redundant
    chan_id and chancnt initialization in dma drivers as this is done
    in dma_async_device_register().

    However, atc_enable_irq() relied on chan_id set before registering
    the device, what left only channel 0 functional for this driver.

    This patch introduces atc_enable/disable_chan_irq() as a variant
    of atc_enable/disable_irq() with the channel as explicit argument.

    Signed-off-by: Nikolaus Voss <[email protected]>
    Signed-off-by: Nicolas Ferre <[email protected]>
    Signed-off-by: Vinod Koul <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 603b63484725a6e88e4ae5da58716efd88154b1e
Author: Jiang Liu <[email protected]>
Date:   Fri Feb 3 15:37:16 2012 -0800

    kprobes: fix a memory leak in function pre_handler_kretprobe()

    commit 55ca6140e9bb307efc97a9301a4f501de02a6fd6 upstream.

    In function pre_handler_kretprobe(), the allocated kretprobe_instance
    object will get leaked if the entry_handler callback returns non-zero.
    This may cause all the preallocated kretprobe_instance objects exhausted.

    This issue can be reproduced by changing
    samples/kprobes/kretprobe_example.c to probe "mutex_unlock".  And the fix
    is straightforward: just put the allocated kretprobe_instance object back
    onto the free_instances list.

    [[email protected]: use raw_spin_lock/unlock]
    Signed-off-by: Jiang Liu <[email protected]>
    Acked-by: Jim Keniston <[email protected]>
    Acked-by: Ananth N Mavinakayanahalli <[email protected]>
    Cc: Masami Hiramatsu <[email protected]>
    Cc: Anil S Keshavamurthy <[email protected]>
    Cc: "David S. Miller" <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 55d9f089521b1355cdd6914d1186ae02ddc0f74f
Author: Jack Morgenstein <[email protected]>
Date:   Thu Jan 26 16:41:33 2012 +0200

    IB/mlx4: pass SMP vendor-specific attribute MADs to firmware

    commit a6f7feae6d19e84253918d88b04153af09d3a243 upstream.

    In the current code, vendor-specific MADs (e.g with the FDR-10
    attribute) are silently dropped by the driver, resulting in timeouts
    at the sending side and inability to query/configure the relevant
    feature.  However, the ConnectX firmware is able to handle such MADs.
    For unsupported attributes, the firmware returns a GET_RESPONSE MAD
    containing an error status.

    For example, for a FDR-10 node with LID 11:

        # ibstat mlx4_0 1

        CA: 'mlx4_0'
        Port 1:
        State: Active
        Physical state: LinkUp
        Rate: 40 (FDR10)
        Base lid: 11
        LMC: 0
        SM lid: 24
        Capability mask: 0x02514868
        Port GUID: 0x0002c903002e65d1
        Link layer: InfiniBand

    Extended Port Query (EPI) vendor mad timeouts before the patch:

        # smpquery MEPI 11 -d

        ibwarn: [4196] smp_query_via: attr 0xff90 mod 0x0 route Lid 11
        ibwarn: [4196] _do_madrpc: retry 1 (timeout 1000 ms)
        ibwarn: [4196] _do_madrpc: retry 2 (timeout 1000 ms)
        ibwarn: [4196] _do_madrpc: timeout after 3 retries, 3000 ms
        ibwarn: [4196] mad_rpc: _do_madrpc failed; dport (Lid 11)
        smpquery: iberror: [pid 4196] main: failed: operation EPI: ext port info query failed

    EPI query works OK with the patch:

        # smpquery MEPI 11 -d

        ibwarn: [6548] smp_query_via: attr 0xff90 mod 0x0 route Lid 11
        ibwarn: [6548] mad_rpc: data offs 64 sz 64
        mad data
        0000 0000 0000 0001 0000 0001 0000 0001
        0000 0000 0000 0000 0000 0000 0000 0000
        0000 0000 0000 0000 0000 0000 0000 0000
        0000 0000 0000 0000 0000 0000 0000 0000
        # Ext Port info: Lid 11 port 0
        StateChangeEnable:...............0x00
        LinkSpeedSupported:..............0x01
        LinkSpeedEnabled:................0x01
        LinkSpeedActive:.................0x01

    Signed-off-by: Jack Morgenstein <[email protected]>
    Signed-off-by: Or Gerlitz <[email protected]>
    Acked-by: Ira Weiny <[email protected]>
    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c2f8080ae4ebf8d860addf050536b1ec71c53e19
Author: Stefan Richter <[email protected]>
Date:   Sun Jan 29 12:41:15 2012 +0100

    firewire: ohci: disable MSI on Ricoh controllers

    commit 320cfa6ce0b3dc794fedfa4bae54c0f65077234d upstream.

    The PCIe device

        FireWire (IEEE 1394) [0c00]: Ricoh Co Ltd FireWire Host Controller
        [1180:e832] (prog-if 10 [OHCI])

    is unable to access attached FireWire devices when MSI is enabled but
    works if MSI is disabled.
    http://www.mail-archive.com/[email protected]/msg28251.html

    Hence add the "disable MSI" quirks flag for this device, or in fact for
    safety and simplicity for all current (R5U230, R5U231, R5U240) and
    future Ricoh PCIe 1394 controllers.

    Reported-by: Stefan Thomas <[email protected]>
    Signed-off-by: Stefan Richter <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 914dcd6a7120a034c515605ca509cb7e6767f52c
Author: Clemens Ladisch <[email protected]>
Date:   Thu Jan 26 22:05:58 2012 +0100

    firewire: ohci: add reset packet quirk for SB Audigy

    commit d1bb399ad03c11e792f6dea198d3b1e23061f094 upstream.

    The Audigy's SB1394 controller is actually from Texas Instruments
    and has the same bus reset packet generation bug, so it needs the
    same quirk entry.

    Signed-off-by: Clemens Ladisch <[email protected]>
    Signed-off-by: Stefan Richter <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 0053779e04bbfabe31287245d89ad10bb66e758a
Author: Oleg Nesterov <[email protected]>
Date:   Tue Jan 31 17:15:11 2012 +0100

    proc: make sure mem_open() doesn't pin the target's memory

    commit 6d08f2c7139790c268820a2e590795cb8333181a upstream.

    Once /proc/pid/mem is opened, the memory can't be released until
    mem_release() even if its owner exits.

    Change mem_open() to do atomic_inc(mm_count) + mmput(), this only
    pins mm_struct. Change mem_rw() to do atomic_inc_not_zero(mm_count)
    before access_remote_vm(), this verifies that this mm is still alive.

    I am not sure what should mem_rw() return if atomic_inc_not_zero()
    fails. With this patch it returns zero to match the "mm == NULL" case,
    may be it should return -EINVAL like it did before e268337d.

    Perhaps it makes sense to add the additional fatal_signal_pending()
    check into the main loop, to ensure we do not hold this memory if
    the target task was oom-killed.

    Signed-off-by: Oleg Nesterov <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b49767a65a6454f7d546068a785e25dbb0eabbcd
Author: Oleg Nesterov <[email protected]>
Date:   Tue Jan 31 17:14:54 2012 +0100

    proc: unify mem_read() and mem_write()

    commit 572d34b946bae070debd42db1143034d9687e13f upstream.

    No functional changes, cleanup and preparation.

    mem_read() and mem_write() are very similar. Move this code into the
    new common helper, mem_rw(), which takes the additional "int write"
    argument.

    Signed-off-by: Oleg Nesterov <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 401f63716ca0bca1728e55ccf2132fb3785cf5da
Author: Oleg Nesterov <[email protected]>
Date:   Tue Jan 31 17:14:38 2012 +0100

    proc: mem_release() should check mm != NULL

    commit 71879d3cb3dd8f2dfdefb252775c1b3ea04a3dd4 upstream.

    mem_release() can hit mm == NULL, add the necessary check.

    Signed-off-by: Oleg Nesterov <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 344d390bcb4c796b4b7797395cfc07e2c43d935d
Author: Samuel Thibault <[email protected]>
Date:   Fri Feb 3 15:37:15 2012 -0800

    drivers/tty/vt/vt_ioctl.c: fix KDFONTOP 32bit compatibility layer

    commit cbcb8346054073d000ecac324763372d6abd44ac upstream.

    KDFONTOP(GET) currently fails with EIO when being run in a 32bit userland
    with a 64bit kernel if the font width is not 8.

    This is because of the setting of the KD_FONT_FLAG_OLD flag, which makes
    con_font_get return EIO in such case.

    This flag should *not* be set for KDFONTOP, since it's actually the whole
    point of this flag (see comment in con_font_set for instance).

    Signed-off-by: Samuel Thibault <[email protected]>
    Reviewed-by: Arnd Bergmann <[email protected]>
    Cc: Arthur Taylor <[email protected]>
    Cc: Jiri Slaby <[email protected]>
    Cc: Jiri Olsa <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 17f272d8e4349543de855ea63e4eea4a67a7abc5
Author: Yegor Yefremov <[email protected]>
Date:   Mon Jan 23 08:32:23 2012 +0100

    ARM: OMAP2+: GPMC: fix device size setup

    commit 8ef5d844cc3a644ea6f7665932a4307e9fad01fa upstream.

    following statement can only change device size from 8-bit(0) to 16-bit(1),
    but not vice versa:

    regval |= GPMC_CONFIG1_DEVICESIZE(wval);

    so as this field has 1 reserved bit, that could be used in future,
    just clear both bits and then OR with the desired value

    Signed-off-by: Yegor Yefremov <[email protected]>
    Signed-off-by: Tony Lindgren <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e358073331debaab9e14b3139bc469184288aa48
Author: Will Deacon <[email protected]>
Date:   Mon Jan 30 20:23:29 2012 +0100

    ARM: 7308/1: vfp: flush thread hwstate before copying ptrace registers

    commit 8130b9d7b9d858aa04ce67805e8951e3cb6e9b2f upstream.

    If we are context switched whilst copying into a thread's
    vfp_hard_struct then the partial copy may be corrupted by the VFP
    context switching code (see "ARM: vfp: flush thread hwstate before
    restoring context from sigframe").

    This patch updates the ptrace VFP set code so that the thread state is
    flushed before the copy, therefore disabling VFP and preventing
    corruption from occurring.

    Signed-off-by: Will Deacon <[email protected]>
    Signed-off-by: Russell King <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit ae3939e12cc597be0ba28d5f3b3d8f158f2d6d70
Author: Dave Martin <[email protected]>
Date:   Mon Jan 30 20:22:28 2012 +0100

    ARM: 7307/1: vfp: fix ptrace regset modification race

    commit 247f4993a5974e6759606c4d380748eecfd273ff upstream.

    In a preemptible kernel, vfp_set() can be preempted, causing the
    hardware VFP context to be switched while the thread vfp state is
    being read and modified.  This leads to a race condition which can
    cause the thread vfp state to become corrupted if lazy VFP context
    save occurs due to preemption in between the time thread->vfpstate
    is read and the time the modified state is written back.

    This may occur if preemption occurs during the execution of a
    ptrace() call which modifies the VFP register state of a thread.
    Such instances should be very rare in most realistic scenarios --
    none has been reported, so far as I am aware.  Only uniprocessor
    systems should be affected, since VFP context save is not currently
    lazy in SMP kernels.

    The problem was introduced by my earlier patch migrating to use
    regsets to implement ptrace.

    This patch does a vfp_sync_hwstate() before reading
    thread->vfpstate, to make sure that the thread's VFP state is not
    live in the hardware registers while the registers are modified.

    Thanks to Will Deacon for spotting this.

    Signed-off-by: Dave Martin <[email protected]>
    Signed-off-by: Will Deacon <[email protected]>
    Signed-off-by: Russell King <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 886d462b0c92357a2f0ca0fc19f5877efbb1f638
Author: Will Deacon <[email protected]>
Date:   Mon Jan 30 20:21:42 2012 +0100

    ARM: 7306/1: vfp: flush thread hwstate before restoring context from sigframe

    commit 2af276dfb1722e97b190bd2e646b079a2aa674db upstream.

    Following execution of a signal handler, we currently restore the VFP
    context from the ucontext in the signal frame. This involves copying
    from the user stack into the current thread's vfp_hard_struct and then
    flushing the new data out to the hardware registers.

    This is problematic when using a preemptible kernel because we could be
    context switched whilst updating the vfp_hard_struct. If the current
    thread has made use of VFP since the last context switch, the VFP
    notifier will copy from the hardware registers into the vfp_hard_struct,
    overwriting any data that had been partially copied by the signal code.

    Disabling preemption across copy_from_user calls is a terrible idea, so
    instead we move the VFP thread flush *before* we update the
    vfp_hard_struct. Since the flushing is performed lazily, this has the
    effect of disabling VFP and clearing the CPU's VFP state pointer,
    therefore preventing the thread from being updated with stale data on
    the next context switch.

    Tested-by: Peter Maydell <[email protected]>
    Signed-off-by: Will Deacon <[email protected]>
    Signed-off-by: Russell King <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a2eeb4b984210336662a9ebdbecb96efd8823ff2
Author: UK KIM <[email protected]>
Date:   Sat Jan 28 01:52:22 2012 +0900

    ASoC: wm_hubs: fix wrong bits for LINEOUT2 N/P mixer

    commit 114395c61ad2eb5a7a5cd163fcadb2414e48245a upstream.

    Signed-off-by: UK KIM <[email protected]>
    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 2cf7d6f29728c367ac742e7e17d89d8d9b6caeba
Author: Mark Brown <[email protected]>
Date:   Fri Jan 20 12:19:43 2012 +0000

    ASoC: wm_hubs: Enable line out VMID buffer for single ended line outputs

    commit 77231abe55433aa17eca712718745275853fa66d upstream.

    For optimal performance the single ended line outputs require that the
    line output VMID buffer be enabled.

    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 3fe10cf8e23ed6e32c09c05303df7e66abdb7e39
Author: David Henningsson <[email protected]>
Date:   Wed Feb 1 12:05:41 2012 +0100

    ALSA: HDA: Fix duplicated output to more than one codec

    commit 54c2a89f60fd71b924d0f848ac892442951401a6 upstream.

    This typo caused the wrong codec's nid to be checked for wcaps type.
    As a result, sometimes speakers would duplicate the output sent to
    HDMI output.

    BugLink: https://bugs.launchpad.net/bugs/924320
    Signed-off-by: David Henningsson <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 99067d691614385f824b42f9a02da9708e66dbb6
Author: Shaohua Li <[email protected]>
Date:   Fri Feb 3 15:37:17 2012 -0800

    readahead: fix pipeline break caused by block plug

    commit 3deaa7190a8da38453c4fabd9dec7f66d17fff67 upstream.

    Herbert Poetzl reported a performance regression since 2.6.39.  The test
    is a simple dd read, but with big block size.  The reason is:

    T1: ra (A, A+128k), (A+128k, A+256k)
    T2: lock_page for page A, submit the 256k
    T3: hit page A+128K, ra (A+256k, A+384). the range isn't submitted
    because of plug and there isn't any lock_page till we hit page A+256k
    because all pages from A to A+256k is in memory
    T4: hit page A+256k, ra (A+384, A+ 512). Because of plug, the range isn't
    submitted again.
    T5: lock_page A+256k, so (A+256k, A+512k) will be submitted. The task is
    waitting for (A+256k, A+512k) finish.

    There is no request to disk in T3 and T4, so readahead pipeline breaks.

    We really don't need block plug for generic_file_aio_read() for buffered
    I/O.  The readahead already has plug and has fine grained control when I/O
    should be submitted.  Deleting plug for buffered I/O fixes the regression.

    One side effect is plug makes the request size 256k, the size is 128k
    without it.  This is because default ra size is 128k and not a reason we
    need plug here.

    Vivek said:

    : We submit some readahead IO to device request queue but because of nested
    : plug, queue never gets unplugged.  When read logic reaches a page which is
    : not in page cache, it waits for page to be read from the disk
    : (lock_page_killable()) and that time we flush the plug list.
    :
    : So effectively read ahead logic is kind of broken in parts because of
    : nested plugging.  Removing top level plug (generic_file_aio_read()) for
    : buffered reads, will allow unplugging queue earlier for readahead.

    Signed-off-by: Shaohua Li <[email protected]>
    Signed-off-by: Wu Fengguang <[email protected]>
    Reported-by: Herbert Poetzl <[email protected]>
    Tested-by: Eric Dumazet <[email protected]>
    Cc: Christoph Hellwig <[email protected]>
    Cc: Jens Axboe <[email protected]>
    Cc: Vivek Goyal <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-o…
Mustaavalkosta referenced this issue in Mustaavalkosta/htc7x30-3.0 Mar 6, 2013
commit 26a7895e70104811258cf023d06a21f92ab590c6
Author: Greg Kroah-Hartman <[email protected]>
Date:   Sun Jun 10 00:33:45 2012 +0900

    Linux 3.0.34

commit 749c8151fdf307fb7527aded025850027d44aadc
Author: Tao Ma <[email protected]>
Date:   Thu Jun 7 19:04:19 2012 -0400

    ext4: don't set i_flags in EXT4_IOC_SETFLAGS

    commit b22b1f178f6799278d3178d894f37facb2085765 upstream.

    Commit 7990696 uses the ext4_{set,clear}_inode_flags() functions to
    change the i_flags automatically but fails to remove the error setting
    of i_flags.  So we still have the problem of trashing state flags.
    Fix this by removing the assignment.

    Signed-off-by: Tao Ma <[email protected]>
    Signed-off-by: "Theodore Ts'o" <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 65926f3ad3b38644b74496f2a32161f6f02f1079
Author: Grazvydas Ignotas <[email protected]>
Date:   Fri May 18 03:04:08 2012 +0300

    wl1251: fix oops on early interrupt

    commit f380f2c4a12e913356bd49f8790ec1063c4fe9f8 upstream.

    This driver disables interrupt just after requesting it and enables it
    later, after interface is up. However currently there is a time window
    between request_irq() and disable_irq() where if interrupt arrives, the
    driver oopses because it's not yet ready to process it. This can be
    reproduced by inserting the module, associating and removing the module
    multiple times.

    Eliminate this race by setting IRQF_NOAUTOEN flag before request_irq().

    Signed-off-by: Grazvydas Ignotas <[email protected]>
    Signed-off-by: John W. Linville <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b8d3d5a553b423ab3676554aeddf30dc6ededbcb
Author: Andy Whitcroft <[email protected]>
Date:   Thu May 3 14:48:26 2012 +0100

    ACPI battery: only refresh the sysfs files when pertinent information changes

    commit c5971456964290da7e98222892797b71ef793e62 upstream.

    We only need to regenerate the sysfs files when the capacity units
    change, avoid the update otherwise.

    The origin of this issue is dates way back to 2.6.38:
    da8aeb92d4853f37e281f11fddf61f9c7d84c3cd
    (ACPI / Battery: Update information on info notification and resume)

    Signed-off-by: Andy Whitcroft <[email protected]>
    Tested-by: Ralf Jung <[email protected]>
    Signed-off-by: Len Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 284cbb43179add9bf88083535bc39f43d16e6668
Author: Alex Deucher <[email protected]>
Date:   Tue Jun 5 09:50:30 2012 -0400

    drm/radeon/kms: add new BTC PCI ids

    commit a2bef8ce826dd1e787fd8ad9b6e0566ba59dab43 upstream.

    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Dave Airlie <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 32e090b1f4bdfe9756e1b8f0b5280acb036d1c61
Author: Salman Qazi <[email protected]>
Date:   Thu May 31 23:52:14 2012 -0400

    ext4: remove mb_groups before tearing down the buddy_cache

    commit 95599968d19db175829fb580baa6b68939b320fb upstream.

    We can't have references held on pages in the s_buddy_cache while we are
    trying to truncate its pages and put the inode.  All the pages must be
    gone before we reach clear_inode.  This can only be gauranteed if we
    can prevent new users from grabbing references to s_buddy_cache's pages.

    The original bug can be reproduced and the bug fix can be verified by:

    while true; do mount -t ext4 /dev/ram0 /export/hda3/ram0; \
    	umount /export/hda3/ram0; done &

    while true; do cat /proc/fs/ext4/ram0/mb_groups; done

    Signed-off-by: Salman Qazi <[email protected]>
    Signed-off-by: "Theodore Ts'o" <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 97434cf53353728708c133af183a11a158c8c26a
Author: Salman Qazi <[email protected]>
Date:   Thu May 31 23:51:27 2012 -0400

    ext4: add ext4_mb_unload_buddy in the error path

    commit 02b7831019ea4e7994968c84b5826fa8b248ffc8 upstream.

    ext4_free_blocks fails to pair an ext4_mb_load_buddy with a matching
    ext4_mb_unload_buddy when it fails a memory allocation.

    Signed-off-by: Salman Qazi <[email protected]>
    Signed-off-by: "Theodore Ts'o" <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit eeb7cb57cf619ae9ab8210b21b49820ed40a472f
Author: Theodore Ts'o <[email protected]>
Date:   Thu May 31 23:46:01 2012 -0400

    ext4: don't trash state flags in EXT4_IOC_SETFLAGS

    commit 79906964a187c405db72a3abc60eb9b50d804fbc upstream.

    In commit 353eb83c we removed i_state_flags with 64-bit longs, But
    when handling the EXT4_IOC_SETFLAGS ioctl, we replace i_flags
    directly, which trashes the state flags which are stored in the high
    32-bits of i_flags on 64-bit platforms.  So use the the
    ext4_{set,clear}_inode_flags() functions which use atomic bit
    manipulation functions instead.

    Reported-by: Tao Ma <[email protected]>
    Signed-off-by: "Theodore Ts'o" <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 801bdd926b6229da233f6db25770c9e817f98d4e
Author: Theodore Ts'o <[email protected]>
Date:   Wed May 30 23:00:16 2012 -0400

    ext4: add missing save_error_info() to ext4_error()

    commit f3fc0210c0fc91900766c995f089c39170e68305 upstream.

    The ext4_error() function is missing a call to save_error_info().
    Since this is the function which marks the file system as containing
    an error, this oversight (which was introduced in 2.6.36) is quite
    significant, and should be backported to older stable kernels with
    high urgency.

    Reported-by: Ken Sumrall <[email protected]>
    Signed-off-by: "Theodore Ts'o" <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e36db7f818de59e3b0fdeaabda97e696a177b9a9
Author: Eric Sandeen <[email protected]>
Date:   Mon May 28 14:17:25 2012 -0400

    ext4: force ro mount if ext4_setup_super() fails

    commit 7e84b6216467b84cd332c8e567bf5aa113fd2f38 upstream.

    If ext4_setup_super() fails i.e. due to a too-high revision,
    the error is logged in dmesg but the fs is not mounted RO as
    indicated.

    Tested by:

    # mkfs.ext4 -r 4 /dev/sdb6
    # mount /dev/sdb6 /mnt/test
    # dmesg | grep "too high"
    [164919.759248] EXT4-fs (sdb6): revision level too high, forcing read-only mode
    # grep sdb6 /proc/mounts
    /dev/sdb6 /mnt/test2 ext4 rw,seclabel,relatime,data=ordered 0 0

    Reviewed-by: Andreas Dilger <[email protected]>
    Signed-off-by: Eric Sandeen <[email protected]>
    Signed-off-by: "Theodore Ts'o" <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 570986003b9cd61b7ccf03beacb56f5f5f6f3409
Author: Benjamin Poirier <[email protected]>
Date:   Thu May 24 11:32:38 2012 +0000

    xfrm: take net hdr len into account for esp payload size calculation

    [ Upstream commit 91657eafb64b4cb53ec3a2fbc4afc3497f735788 ]

    Corrects the function that determines the esp payload size. The calculations
    done in esp{4,6}_get_mtu() lead to overlength frames in transport mode for
    certain mtu values and suboptimal frames for others.

    According to what is done, mainly in esp{,6}_output() and tcp_mtu_to_mss(),
    net_header_len must be taken into account before doing the alignment
    calculation.

    Signed-off-by: Benjamin Poirier <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 09c073a87938a5031b396ad63c8acdfae86fc153
Author: Felix Fietkau <[email protected]>
Date:   Tue May 29 03:35:08 2012 +0000

    skb: avoid unnecessary reallocations in __skb_cow

    [ Upstream commit 617c8c11236716dcbda877e764b7bf37c6fd8063 ]

    At the beginning of __skb_cow, headroom gets set to a minimum of
    NET_SKB_PAD. This causes unnecessary reallocations if the buffer was not
    cloned and the headroom is just below NET_SKB_PAD, but still more than the
    amount requested by the caller.
    This was showing up frequently in my tests on VLAN tx, where
    vlan_insert_tag calls skb_cow_head(skb, VLAN_HLEN).

    Locally generated packets should have enough headroom, and for forward
    paths, we already have NET_SKB_PAD bytes of headroom, so we don't need to
    add any extra space here.

    Signed-off-by: Felix Fietkau <[email protected]>
    Signed-off-by: Eric Dumazet <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 337c934a55a7956bcd349b6f56c6add58d2550f3
Author: Nicolas Dichtel <[email protected]>
Date:   Fri May 4 05:24:54 2012 +0000

    sctp: check cached dst before using it

    [ Upstream commit e0268868ba064980488fc8c194db3d8e9fb2959c ]

    dst_check() will take care of SA (and obsolete field), hence
    IPsec rekeying scenario is taken into account.

    Signed-off-by: Nicolas Dichtel <[email protected]>
    Acked-by: Vlad Yaseivch <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 83bba7979059b83df4edc16f747784c6990fc3bb
Author: David S. Miller <[email protected]>
Date:   Thu May 10 23:03:34 2012 -0400

    Revert "net: maintain namespace isolation between vlan and real device"

    [ Upstream commit 59b9997baba5242997ddc7bd96b1391f5275a5a4 ]

    This reverts commit 8a83a00b0735190384a348156837918271034144.

    It causes regressions for S390 devices, because it does an
    unconditional DST drop on SKBs for vlans and the QETH device
    needs the neighbour entry hung off the DST for certain things
    on transmit.

    Arnd can't remember exactly why he even needed this change.

    Conflicts:

    	drivers/net/macvlan.c
    	net/8021q/vlan_dev.c
    	net/core/dev.c

    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a2abc1310ff689486730215fcea629b74b01abe4
Author: Eric Dumazet <[email protected]>
Date:   Thu May 17 23:52:26 2012 +0000

    pktgen: fix module unload for good

    [ Upstream commit d4b1133558e0d417342d5d2c49e4c35b428ff20d ]

    commit c57b5468406 (pktgen: fix crash at module unload) did a very poor
    job with list primitives.

    1) list_splice() arguments were in the wrong order

    2) list_splice(list, head) has undefined behavior if head is not
    initialized.

    3) We should use the list_splice_init() variant to clear pktgen_threads
    list.

    Signed-off-by: Eric Dumazet <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 45d21c136849cda838e77928d544fc7cd9d6239c
Author: Eric Dumazet <[email protected]>
Date:   Wed May 9 13:29:51 2012 +0000

    pktgen: fix crash at module unload

    [ Upstream commit c57b54684060c8aced64a5b78ff69ff289af97b9 ]

    commit 7d3d43dab4e9 (net: In unregister_netdevice_notifier unregister
    the netdevices.) makes pktgen crashing at module unload.

    [  296.820578] BUG: spinlock bad magic on CPU#6, rmmod/3267
    [  296.820719]  lock: ffff880310c38000, .magic: ffff8803, .owner: <none>/-1, .owner_cpu: -1
    [  296.820943] Pid: 3267, comm: rmmod Not tainted 3.4.0-rc5+ #254
    [  296.821079] Call Trace:
    [  296.821211]  [<ffffffff8168a715>] spin_dump+0x8a/0x8f
    [  296.821345]  [<ffffffff8168a73b>] spin_bug+0x21/0x26
    [  296.821507]  [<ffffffff812b4741>] do_raw_spin_lock+0x131/0x140
    [  296.821648]  [<ffffffff8169188e>] _raw_spin_lock+0x1e/0x20
    [  296.821786]  [<ffffffffa00cc0fd>] __pktgen_NN_threads+0x4d/0x140 [pktgen]
    [  296.821928]  [<ffffffffa00ccf8d>] pktgen_device_event+0x10d/0x1e0 [pktgen]
    [  296.822073]  [<ffffffff8154ed4f>] unregister_netdevice_notifier+0x7f/0x100
    [  296.822216]  [<ffffffffa00d2a0b>] pg_cleanup+0x48/0x73 [pktgen]
    [  296.822357]  [<ffffffff8109528e>] sys_delete_module+0x17e/0x2a0
    [  296.822502]  [<ffffffff81699652>] system_call_fastpath+0x16/0x1b

    Hold the pktgen_thread_lock while splicing pktgen_threads, and test
    pktgen_exiting in pktgen_device_event() to make unload faster.

    Signed-off-by: Eric Dumazet <[email protected]>
    Cc: Eric W. Biederman <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 3dc6bc132f2afce8da98e0f047c4cc8ae569d6cb
Author: James Chapman <[email protected]>
Date:   Tue May 29 23:13:23 2012 +0000

    l2tp: fix oops in L2TP IP sockets for connect() AF_UNSPEC case

    [ Upstream commit c51ce49735c183ef2592db70f918ee698716276b ]

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

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

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

    Reported-by: Sasha Levin <[email protected]>
    Signed-off-by: James Chapman <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 5111df358197ca9c5001bf2bb542fc8c346bb5b5
Author: Gao feng <[email protected]>
Date:   Sat May 26 01:30:53 2012 +0000

    ipv6: fix incorrect ipsec fragment

    [ Upstream commit 0c1833797a5a6ec23ea9261d979aa18078720b74 ]

    Since commit ad0081e43a
    "ipv6: Fragment locally generated tunnel-mode IPSec6 packets as needed"
    the fragment of packets is incorrect.
    because tunnel mode needs IPsec headers and trailer for all fragments,
    while on transport mode it is sufficient to add the headers to the
    first fragment and the trailer to the last.

    so modify mtu and maxfraglen base on ipsec mode and if fragment is first
    or last.

    with my test,it work well(every fragment's size is the mtu)
    and does not trigger slow fragment path.

    Changes from v1:
    	though optimization, mtu_prev and maxfraglen_prev can be delete.
    	replace xfrm mode codes with dst_entry's new frag DST_XFRM_TUNNEL.
    	add fuction ip6_append_data_mtu to make codes clearer.

    Signed-off-by: Gao feng <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 49d7872377ba34fc2b2e1e460073a387e7adcfae
Author: Yanmin Zhang <[email protected]>
Date:   Wed May 23 15:39:45 2012 +0000

    ipv4: fix the rcu race between free_fib_info and ip_route_output_slow

    [ Upstream commit e49cc0da7283088c5e03d475ffe2fdcb24a6d5b1 ]

    We hit a kernel OOPS.

    <3>[23898.789643] BUG: sleeping function called from invalid context at
    /data/buildbot/workdir/ics/hardware/intel/linux-2.6/arch/x86/mm/fault.c:1103
    <3>[23898.862215] in_atomic(): 0, irqs_disabled(): 0, pid: 10526, name:
    Thread-6683
    <4>[23898.967805] HSU serial 0000:00:05.1: 0000:00:05.2:HSU serial prevented me
    to suspend...
    <4>[23899.258526] Pid: 10526, comm: Thread-6683 Tainted: G        W
    3.0.8-137685-ge7742f9 #1
    <4>[23899.357404] HSU serial 0000:00:05.1: 0000:00:05.2:HSU serial prevented me
    to suspend...
    <4>[23899.904225] Call Trace:
    <4>[23899.989209]  [<c1227f50>] ? pgtable_bad+0x130/0x130
    <4>[23900.000416]  [<c1238c2a>] __might_sleep+0x10a/0x110
    <4>[23900.007357]  [<c1228021>] do_page_fault+0xd1/0x3c0
    <4>[23900.013764]  [<c18e9ba9>] ? restore_all+0xf/0xf
    <4>[23900.024024]  [<c17c007b>] ? napi_complete+0x8b/0x690
    <4>[23900.029297]  [<c1227f50>] ? pgtable_bad+0x130/0x130
    <4>[23900.123739]  [<c1227f50>] ? pgtable_bad+0x130/0x130
    <4>[23900.128955]  [<c18ea0c3>] error_code+0x5f/0x64
    <4>[23900.133466]  [<c1227f50>] ? pgtable_bad+0x130/0x130
    <4>[23900.138450]  [<c17f6298>] ? __ip_route_output_key+0x698/0x7c0
    <4>[23900.144312]  [<c17f5f8d>] ? __ip_route_output_key+0x38d/0x7c0
    <4>[23900.150730]  [<c17f63df>] ip_route_output_flow+0x1f/0x60
    <4>[23900.156261]  [<c181de58>] ip4_datagram_connect+0x188/0x2b0
    <4>[23900.161960]  [<c18e981f>] ? _raw_spin_unlock_bh+0x1f/0x30
    <4>[23900.167834]  [<c18298d6>] inet_dgram_connect+0x36/0x80
    <4>[23900.173224]  [<c14f9e88>] ? _copy_from_user+0x48/0x140
    <4>[23900.178817]  [<c17ab9da>] sys_connect+0x9a/0xd0
    <4>[23900.183538]  [<c132e93c>] ? alloc_file+0xdc/0x240
    <4>[23900.189111]  [<c123925d>] ? sub_preempt_count+0x3d/0x50

    Function free_fib_info resets nexthop_nh->nh_dev to NULL before releasing
    fi. Other cpu might be accessing fi. Fixing it by delaying the releasing.

    With the patch, we ran MTBF testing on Android mobile for 12 hours
    and didn't trigger the issue.

    Thank Eric for very detailed review/checking the issue.

    Signed-off-by: Yanmin Zhang <[email protected]>
    Signed-off-by: Kun Jiang <[email protected]>
    Acked-by: Eric Dumazet <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit f77baf324713ef5d6ae9ae63a77aed2bfbe4333d
Author: David S. Miller <[email protected]>
Date:   Thu May 10 22:16:32 2012 -0400

    ipv4: Do not use dead fib_info entries.

    [ Upstream commit dccd9ecc374462e5d6a5b8f8110415a86c2213d8 ]

    Due to RCU lookups and RCU based release, fib_info objects can
    be found during lookup which have fi->fib_dead set.

    We must ignore these entries, otherwise we risk dereferencing
    the parts of the entry which are being torn down.

    Reported-by: Yevgen Pronenko <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 166ab4d1f2a1fae8f2cbe43da0e35befadc1e90b
Author: Thomas Hellstrom <[email protected]>
Date:   Fri Jun 1 15:39:11 2012 +0200

    drm/ttm: Fix spinlock imbalance

    commit a8ff3ee211fccf708e1911bbc096625453ebf759 upstream.

    This imbalance may cause hangs when TTM is trying to swap out a buffer
    that is already on the delayed delete list.

    Signed-off-by: Thomas Hellstrom <[email protected]>
    Reviewed-by: Jakob Bornecrantz <[email protected]>
    Signed-off-by: Dave Airlie <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit df1dadab46b1a1deec017dc4bb20c6325f6fbd23
Author: Jerome Glisse <[email protected]>
Date:   Thu May 31 19:00:24 2012 -0400

    drm/radeon: fix HD6790, HD6570 backend programming

    commit 95c4b23ec4e2fa5604df229ddf134e31d7b3b378 upstream.

    Without this bit sets we get broken rendering and
    lockups.

    fglrx sets this bit.

    Bugs that should be fixed by this patch :
    https://bugs.freedesktop.org/show_bug.cgi?id=49792
    https://bugzilla.kernel.org/show_bug.cgi?id=43207
    https://bugs.freedesktop.org/show_bug.cgi?id=39282

    Signed-off-by: Jerome Glisse <[email protected]>
    Acked-by: Alex Deucher <[email protected]>
    Signed-off-by: Dave Airlie <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit eb7165df9c92e2b6d4b33a7a7176dbedac70404b
Author: Alex Deucher <[email protected]>
Date:   Thu May 31 18:54:43 2012 -0400

    drm/radeon: properly program gart on rv740, juniper, cypress, barts, hemlock

    commit 0b8c30bc4943137a4a36b9cb059b1cc684f5d702 upstream.

    Need to program an additional VM register.  This doesn't not currently
    cause any problems, but allows us to program the proper backend
    map in a subsequent patch which should improve performance on these
    asics.

    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Dave Airlie <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 82a7795bc1860e5cfd4410f060b4dc5cbae41d1d
Author: Dmitry Maluka <[email protected]>
Date:   Fri May 11 20:51:51 2012 +0300

    mtd: nand: fix scan_read_raw_oob

    commit 34a5704d91d6f8376a4c0a0143a1dd3eb3ccb37e upstream.

    It seems there is a bug in scan_read_raw_oob() in nand_bbt.c which
    should cause wrong functioning of NAND_BBT_SCANALLPAGES option.

    Artem: the patch did not apply and I had to amend it a bit.

    Signed-off-by: Artem Bityutskiy <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 6baeff72b712f09aec676153d5b752dffaf90c17
Author: Al Viro <[email protected]>
Date:   Tue May 29 22:03:48 2012 -0400

    vfs: umount_tree() might be called on subtree that had never made it

    commit 63d37a84ab6004c235314ffd7a76c5eb28c2fae0 upstream.

    __mnt_make_shortterm() in there undoes the effect of __mnt_make_longterm()
    we'd done back when we set ->mnt_ns non-NULL; it should not be done to
    vfsmounts that had never gone through commit_tree() and friends.  Kudos to
    lczerner for catching that one...

    Signed-off-by: Al Viro <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a6923156ec0556f79a8ec5deb40d1aa929184b21
Author: Clemens Ladisch <[email protected]>
Date:   Fri May 18 18:00:43 2012 +0200

    ALSA: usb-audio: fix rate_list memory leak

    commit 5cd5d7c44990658df6ab49f6253c39617c53b03d upstream.

    The array of sample rates is reallocated every time when opening
    the PCM device, but was freed only once when unplugging the device.

    Reported-by: "Alexander E. Patrakov" <[email protected]>
    Signed-off-by: Clemens Ladisch <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 08bbb19de6601c4205419ad3c30b730693919b07
Author: Michael Gruetzner <[email protected]>
Date:   Wed May 2 22:33:40 2012 +0200

    Bluetooth: Add support for Foxconn/Hon Hai AR5BBU22 0489:E03C

    commit 85d59726c5c66016a507f1f4a60db8e374dd284d upstream.

    Add Foxconn/Hon Hai AR5BBU22 Bluetooth Module( 0x489:0xE03C) to
    the blacklist of btusb module and add it to the ath3k module to properly
    load the firmware in Kernel 3.3.4
    The device is integrated in  e.g. some  Acer Aspire 7750G.

    Output from /sys/kernel/debug/usb/devices:

    T:  Bus=01 Lev=02 Prnt=02 Port=05 Cnt=02 Dev#=  6 Spd=12   MxCh= 0
    D:  Ver= 2.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=0489 ProdID=e03c Rev= 0.02
    S:  Manufacturer=Atheros Communications
    S:  Product=Bluetooth USB Host Controller
    S:  SerialNumber=Alaska Day 2006
    C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
    I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
    I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
    I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms

    Signed-off-by: Michael Gruetzner <[email protected]>
    Signed-off-by: Gustavo Padovan <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 2ae5f906f8f1548aa33375433ff9f03dc7a7763a
Author: Steven Harms <[email protected]>
Date:   Fri Apr 13 14:45:55 2012 -0400

    Add Foxconn / Hon Hai IDs for btusb module

    commit 985140369be1e886754d8ac0375dd64e4f727311 upstream.

    This change adds 0x0489:0xe033 to the btusb module.

    This bluetooth usb device is integrated in the Acer TimelineX AS4830TG-6808 notebook.

    Output from /sys/kernel/debug/usb/devices:

    T:  Bus=01 Lev=02 Prnt=02 Port=05 Cnt=02 Dev#=  4 Spd=12   MxCh= 0
    D:  Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=0489 ProdID=e033 Rev= 2.29
    S:  Manufacturer=Broadcom Corp
    S:  Product=Acer Module
    S:  SerialNumber=60D819F74101
    C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=  0mA
    I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
    E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
    E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
    E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
    I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
    I:  If#= 1 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
    I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
    I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  32 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  32 Ivl=1ms
    I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  64 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  64 Ivl=1ms
    I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
    E:  Ad=83(I) Atr=01(Isoc) MxPS=  64 Ivl=1ms
    E:  Ad=03(O) Atr=01(Isoc) MxPS=  64 Ivl=1ms
    I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
    E:  Ad=84(I) Atr=02(Bulk) MxPS=  32 Ivl=0ms
    E:  Ad=04(O) Atr=02(Bulk) MxPS=  32 Ivl=0ms
    I:* If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)

    Signed-off-by: Steven Harms <[email protected]>
    Signed-off-by: Gustavo Padovan <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b278d462c5d7dcf0479e90f2bc3da5b3d3419aad
Author: Don Zickus <[email protected]>
Date:   Wed Mar 28 16:41:11 2012 -0400

    Bluetooth: btusb: typo in Broadcom SoftSailing id

    commit 2e8b506310f6433d5558387fd568d4bfb1d6a799 upstream.

    I was trying to backport the following commit to RHEL-6

        From 0cea73465cd22373c5cd43a3edd25fbd4bb532ef Mon Sep 17 00:00:00 2001
        From: Oliver Neukum <[email protected]>
        Date: Wed, 21 Sep 2011 11:37:15 +0200
        Subject: [PATCH] btusb: add device entry for Broadcom SoftSailing

    and noticed it wasn't working on an HP Elitebook.  Looking into the patch I
    noticed a very subtle typo in the ids.  The patch has '0x05ac' instead of
    '0x0a5c'.  A snippet of the lsusb -v output also shows this:

    Bus 002 Device 003: ID 0a5c:21e1 Broadcom Corp.
    Device Descriptor:
      bLength                18
      bDescriptorType         1
      bcdUSB               2.00
      bDeviceClass          255 Vendor Specific Class
      bDeviceSubClass         1
      bDeviceProtocol         1
      bMaxPacketSize0        64
      idVendor           0x0a5c Broadcom Corp.
      idProduct          0x21e1
      bcdDevice            1.12
      iManufacturer           1 Broadcom Corp
      iProduct                2 BCM20702A0
      iSerial                 3 60D819F0338C
      bNumConfigurations      1

    Looking at other Broadcom ids, the fix matches them whereas the original patch
    matches Apple's ids.

    Tested on an HP Elitebook 8760w.  The btusb binds and the userspace stuff loads
    correctly.

    Cc: Oliver Neukum <[email protected]>
    Signed-off-by: Don Zickus <[email protected]>
    Acked-by: Marcel Holtmann <[email protected]>
    Signed-off-by: Johan Hedberg <[email protected]>
    Cc: Jonathan Nieder <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 604e4dfc28704f407829b10529d81d5f5ebc05ab
Author: Manoj Iyer <[email protected]>
Date:   Mon Apr 9 09:22:28 2012 -0500

    Bluetooth: btusb: Add vendor specific ID (0489 e042) for BCM20702A0

    commit 79cd76022044f8177bb00e3fd590ec8d6b5f8c35 upstream.

    T: Bus=02 Lev=02 Prnt=02 Port=04 Cnt=01 Dev#= 3 Spd=12 MxCh= 0
    D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
    P: Vendor=0489 ProdID=e042 Rev=01.12
    S: Manufacturer=Broadcom Corp
    S: Product=BCM20702A0
    S: SerialNumber=E4D53DCA61B5
    C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
    I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
    I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
    I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
    I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)

    Reported-by: Dennis Chua <[email protected]>
    Signed-off-by: Manoj Iyer <[email protected]>
    Signed-off-by: Johan Hedberg <[email protected]>
    Cc: Jonathan Nieder <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 5cfd6dcaa23cd0c08e54a82c70cddadbce943732
Author: João Paulo Rechi Vita <[email protected]>
Date:   Wed Mar 14 21:45:16 2012 +0200

    Bluetooth: btusb: Add USB device ID "0a5c 21e8"

    commit 6dfc326f0605fd87e4c10ccde10de0ce4280d72d upstream.

    One more vendor-specific ID for BCM20702A0.

    T:  Bus=01 Lev=03 Prnt=05 Port=02 Cnt=01 Dev#=  9 Spd=12  MxCh= 0
    D:  Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=0a5c ProdID=21e8 Rev=01.12
    S:  Manufacturer=Broadcom Corp
    S:  Product=BCM20702A0
    S:  SerialNumber=00027221F4E2
    C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
    I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
    I:  If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
    I:  If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)

    Signed-off-by: João Paulo Rechi Vita <[email protected]>
    Acked-by: Gustavo F. Padovan <[email protected]>
    Signed-off-by: Johan Hedberg <[email protected]>
    Cc: Jonathan Nieder <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 6241414b303a01ecd3488f3a60a597c4f7352c50
Author: James M. Leddy <[email protected]>
Date:   Tue Mar 6 02:41:33 2012 +0200

    Bluetooth: btusb: add support for BCM20702A0 [0a5c:21e6]

    commit 0a4eaeeb993658a4d6cff054a863241f32d3d2fb upstream.

    Add another vendor specific ID for BCM20702A0.  This has been tested and
    works on hardware with this device.

    output of usb-devices:
    T: Bus=01 Lev=02 Prnt=02 Port=03 Cnt=04 Dev#= 6 Spd=12 MxCh= 0
    D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
    P: Vendor=0a5c ProdID=21e6 Rev=01.12
    S: Manufacturer=Broadcom Corp
    S: Product=BCM20702A0
    S: SerialNumber=D0DF9AFB227B
    C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
    I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
    I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
    I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
    I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)

    Signed-off-by: James M. Leddy <[email protected]>
    Acked-by: Marcel Holtmann <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Johan Hedberg <[email protected]>
    Cc: Jonathan Nieder <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 3a4f179e1eb9414d199655d460e8bb6d7a90f60d
Author: Manoj Iyer <[email protected]>
Date:   Thu Feb 2 09:32:36 2012 -0600

    Bluetooth: btusb: Add vendor specific ID (0a5c 21f3) for BCM20702A0

    commit 37305cf649689a4d2341dd6fd89b091c6007f9ba upstream.

    T: Bus=01 Lev=02 Prnt=02 Port=03 Cnt=03 Dev#= 5 Spd=12 MxCh= 0
    D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
    P: Vendor=0a5c ProdID=21f3 Rev=01.12
    S: Manufacturer=Broadcom Corp
    S: Product=BCM20702A0
    S: SerialNumber=74DE2B344A7B
    C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
    I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
    I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
    I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
    I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)

    Signed-off-by: Manoj Iyer <[email protected]>
    Tested-by: Dennis Chua <[email protected]>
    Acked-by: Marcel Holtmann <[email protected]>
    Signed-off-by: Johan Hedberg <[email protected]>
    Cc: Jonathan Nieder <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 4a520924f5fc7e0465538511c3fd6332c92dbd5e
Author: Jesse Sung <[email protected]>
Date:   Thu Dec 22 10:48:47 2011 +0800

    Bluetooth: Add support for BCM20702A0 [0a5c:21e3]

    commit c0190925dacd976a67044f4382d4effbed568dce upstream.

    Add another vendor specific ID for BCM20702A0.

    output of usb-devices:
    T: Bus=06 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 4 Spd=12 MxCh= 0
    D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
    P: Vendor=0a5c ProdID=21e3 Rev=01.12
    S: Manufacturer=Broadcom Corp
    S: Product=BCM20702A0
    S: SerialNumber=9439E5CBF66C
    C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
    I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
    I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
    I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
    I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)

    Signed-off-by: Wen-chien Jesse Sung <[email protected]>
    Acked-by: Marcel Holtmann <[email protected]>
    Signed-off-by: Gustavo F. Padovan <[email protected]>
    Cc: Jonathan Nieder <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit f109bcfe0d07f8068ef8642f4dc2f8849e6f3a37
Author: Wen-chien Jesse Sung <[email protected]>
Date:   Tue Nov 8 14:30:22 2011 +0800

    Bluetooth: Add support for Broadcom BCM20702A0

    commit d13431ca3eb2a2c14314f04813cdc11cd869f150 upstream.

    Since this device declares itself as vendor specific, must add
    a new entry to device ID table to support it.

    usb-device output of this device:

    T:  Bus=01 Lev=02 Prnt=02 Port=03 Cnt=01 Dev#=  3 Spd=12  MxCh= 0
    D:  Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=413c ProdID=8197 Rev=01.12
    S:  Manufacturer=Broadcom Corp
    S:  Product=BCM20702A0
    S:  SerialNumber=D0DF9AA9C9F1
    C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
    I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
    I:  If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
    I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
    I:  If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)

    Signed-off-by: Wen-chien Jesse Sung <[email protected]>
    Signed-off-by: Gustavo F. Padovan <[email protected]>
    Cc: Jonathan Nieder <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 2d8666ac2e380052996fe9775e311fc8312a8d1c
Author: Daniel Vetter <[email protected]>
Date:   Tue May 22 21:41:25 2012 +0200

    drm/i915: wait for a vblank to pass after tv detect

    commit bf2125e2f7e931b50a6c76ba0435ba001409ccbf upstream.

    Otherwise the hw will get confused and result in a black screen.

    This regression has been most likely introduce in

    commit 974b93315b2213b74a42a87e8a9d4fc8c0dbe90c
    Author: Chris Wilson <[email protected]>
    Date:   Sun Sep 5 00:44:20 2010 +0100

        drm/i915/tv: Poll for DAC state change

    That commit replace the first msleep(20) with a busy-loop, but failed
    to keep the 2nd msleep around. Later on we've replaced all these
    msleep(20) by proper vblanks.

    For reference also see the commit in xf86-video-intel:

    commit 1142be53eb8d2ee8a9b60ace5d49f0ba27332275
    Author: Jesse Barnes <[email protected]>
    Date:   Mon Jun 9 08:52:59 2008 -0700

        Fix TV programming:  add vblank wait after TV_CTL writes

        Fxies FDO bug #14000; we need to wait for vblank after
        writing TV_CTL or following "DPMS on" calls may not actually enable the output.

    v2: As suggested by Chris Wilson, add a small comment to ensure that
    no one accidentally removes this vblank wait again - there really
    seems to be no sane explanation for why we need it, but it is
    required.

    Launchpad: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/763688
    Reported-and-Tested-by: Robert Lowery <[email protected]>
    Cc: Rodrigo Vivi <[email protected]>
    Acked-by: Chris Wilson <[email protected]>
    Signed-Off-by: Daniel Vetter <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit da94f65433119e4961748c8dc6f7603a3c53232b
Author: Daniel Vetter <[email protected]>
Date:   Sat May 12 22:22:58 2012 +0200

    drm/i915: properly handle interlaced bit for sdvo dtd conversion

    commit 59d92bfa5f0cdf57f82f5181b0ad6af75c3fdf41 upstream.

    We've simply ignored this, which isn't too great. With this, interlaced
    1080i works on my HDMI screen connected through sdvo. For no apparent
    reason anything else still doesn't work as it should.

    While at it, give these magic numbers in the dtd proper names and
    add a comment that they match with EDID detailed timings.

    v2: Actually use the right bit for interlaced.

    Tested-by: Peter Ross <[email protected]>
    Reviewed-by: Paulo Zanoni <[email protected]>
    Signed-Off-by: Daniel Vetter <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 0fe9c3d32bc0e7a46d78dca13a6ed3f91ec92f47
Author: Alex Deucher <[email protected]>
Date:   Wed May 23 11:48:59 2012 -0400

    drm/radeon: fix XFX quirk

    commit 1ebf169ad4dc68f18cc0dab35163b0f324fc6c41 upstream.

    Only override the ddc bus if the connector doesn't have
    a valid one.  The existing code overrode the ddc bus for
    all connectors even if it had ddc bus.

    Fixes ddc on another XFX card with the same pci ids that
    was broken by the quirk overwriting the correct ddc bus.

    Reported-by: Mehdi Aqadjani Memar <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Dave Airlie <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 6ab5902511d32b50b4b973320979ba99693aa5be
Author: Trond Myklebust <[email protected]>
Date:   Mon May 28 11:36:28 2012 -0400

    NFSv4: Map NFS4ERR_SHARE_DENIED into an EACCES error instead of EIO

    commit fb13bfa7e1bcfdcfdece47c24b62f1a1cad957e9 upstream.

    If a file OPEN is denied due to a share lock, the resulting
    NFS4ERR_SHARE_DENIED is currently mapped to the default EIO.
    This patch adds a more appropriate mapping, and brings Linux
    into line with what Solaris 10 does.

    See https://bugzilla.kernel.org/show_bug.cgi?id=43286

    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 6ec1d66c8d22bc76ebf37860a87ca399790beb5d
Author: Eyal Shapira <[email protected]>
Date:   Tue May 29 02:00:22 2012 -0700

    mac80211: fix ADDBA declined after suspend with wowlan

    commit 7b21aea04d084916ac4e0e8852dcc9cd60ec0d1d upstream.

    WLAN_STA_BLOCK_BA is set while suspending but doesn't get cleared
    when resuming in case of wowlan. This causes further ADDBA requests
    received to be rejected. Fix it by clearing it in the wowlan path
    as well.

    Signed-off-by: Eyal Shapira <[email protected]>
    Reviewed-by: Johannes Berg <[email protected]>
    Signed-off-by: John W. Linville <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 65ec0e1ca3d1ff89f36db4cd19441bf001fb7d8a
Author: David Woodhouse <[email protected]>
Date:   Thu May 24 04:58:27 2012 +0000

    solos-pci: Fix DMA support

    commit b4bd8ad9bb311e8536f726f7a633620ccd358cde upstream.

    DMA support has finally made its way to the top of the TODO list, having
    realised that a Geode using MMIO can't keep up with two ADSL2+ lines
    each running at 21Mb/s.

    This patch fixes a couple of bugs in the DMA support in the driver, so
    once the corresponding FPGA update is complete and tested everything
    should work properly.

    We weren't storing the currently-transmitting skb, so we were never
    unmapping it and never freeing/popping it when the TX was done.
    And the addition of pci_set_master() is fairly self-explanatory.

    Signed-off-by: David Woodhouse <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b5035120fc0b3df71a8b58f086ec32ba5a5c1c55
Author: James Bottomley <[email protected]>
Date:   Mon May 21 07:49:01 2012 +0100

    PARISC: fix TLB fault path on PA2.0 narrow systems

    commit 2f649c1f6f0fef445ce79a19b79e5ce8fe9d7f19 upstream.

    commit 5e185581d7c46ddd33cd9c01106d1fc86efb9376
    Author: James Bottomley <[email protected]>

        [PARISC] fix PA1.1 oops on boot

    Didn't quite fix the crash on boot.  It moved it from PA1.1 processors to
    PA2.0 narrow kernels.  The final fix is to make sure the [id]tlb_miss_20 paths
    also work.  Even on narrow systems, these paths require using the wide
    instructions becuase the tlb insertion format is wide.  Fix this by
    conditioning the dep[wd],z on whether we're being called from _11 or _20[w]
    paths.

    Tested-by: Helge Deller <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 488f1224df8e32d9592afbcaf6d2c393d6ad6d8f
Author: John David Anglin <[email protected]>
Date:   Thu May 17 10:34:34 2012 -0400

    PARISC: fix boot failure on 32-bit systems caused by branch stubs placed before .text

    commit ed5fb2471b7060767957fb964eb1aaec71533ab1 upstream.

    In certain configurations, the resulting kernel becomes too large to boot
    because the linker places the long branch stubs for the merged .text section
    at the very start of the image.  As a result, the initial transfer of control
    jumps to an unexpected location.  Fix this by placing the head text in a
    separate section so the stubs for .text are not at the start of the image.

    Signed-off-by: John David Anglin <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 93b71523531161bfdd2ac30dd1ea4bb70d1708bd
Author: Shirish Pargaonkar <[email protected]>
Date:   Mon May 21 09:20:12 2012 -0500

    cifs: fix oops while traversing open file list (try #4)

    commit 2c0c2a08bed7a3b791f88d09d16ace56acb3dd98 upstream.

    While traversing the linked list of open file handles, if the identfied
    file handle is invalid, a reopen is attempted and if it fails, we
    resume traversing where we stopped and cifs can oops while accessing
    invalid next element, for list might have changed.

    So mark the invalid file handle and attempt reopen if no
    valid file handle is found in rest of the list.
    If reopen fails, move the invalid file handle to the end of the list
    and start traversing the list again from the begining.
    Repeat this four times before giving up and returning an error if
    file reopen keeps failing.

    Signed-off-by: Shirish Pargaonkar <[email protected]>
    Reviewed-by: Jeff Layton <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e48fdd4d095a5340bb88374bbbfa6b72625ab0c1
Author: Meenakshi Venkataraman <[email protected]>
Date:   Wed May 16 22:35:57 2012 +0200

    iwlwifi: update BT traffic load states correctly

    commit 882dde8eb0d49ce0f853f8f4084dde56a21fe55f upstream.

    When BT traffic load changes from its
    previous state, a new LQ command needs to be
    sent down to the firmware. This needs to
    be done only once per change. The state
    variable that keeps track of this change is
    last_bt_traffic_load. However, it was not
    being updated when the change had been
    handled. Not updating this variable was
    causing a flood of advanced BT config
    commands to be sent to the firmware. Fix
    this.

    Signed-off-by: Meenakshi Venkataraman <[email protected]>
    Signed-off-by: Wey-Yi Guy <[email protected]>
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: John W. Linville <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 2d363e959e1980c1bd3cc4397da635e570bd8a09
Author: Andrea Arcangeli <[email protected]>
Date:   Tue May 29 15:06:49 2012 -0700

    mm: pmd_read_atomic: fix 32bit PAE pmd walk vs pmd_populate SMP race condition

    commit 26c191788f18129af0eb32a358cdaea0c7479626 upstream.

    When holding the mmap_sem for reading, pmd_offset_map_lock should only
    run on a pmd_t that has been read atomically from the pmdp pointer,
    otherwise we may read only half of it leading to this crash.

    PID: 11679  TASK: f06e8000  CPU: 3   COMMAND: "do_race_2_panic"
     #0 [f06a9dd8] crash_kexec at c049b5ec
     #1 [f06a9e2c] oops_end at c083d1c2
     #2 [f06a9e40] no_context at c0433ded
     #3 [f06a9e64] bad_area_nosemaphore at c043401a
     #4 [f06a9e6c] __do_page_fault at c0434493
     #5 [f06a9eec] do_page_fault at c083eb45
     #6 [f06a9f04] error_code (via page_fault) at c083c5d5
        EAX: 01fb470c EBX: fff35000 ECX: 00000003 EDX: 00000100 EBP:
        00000000
        DS:  007b     ESI: 9e201000 ES:  007b     EDI: 01fb4700 GS:  00e0
        CS:  0060     EIP: c083bc14 ERR: ffffffff EFLAGS: 00010246
     #7 [f06a9f38] _spin_lock at c083bc14
     #8 [f06a9f44] sys_mincore at c0507b7d
     #9 [f06a9fb0] system_call at c083becd
                             start           len
        EAX: ffffffda  EBX: 9e200000  ECX: 00001000  EDX: 6228537f
        DS:  007b      ESI: 00000000  ES:  007b      EDI: 003d0f00
        SS:  007b      ESP: 62285354  EBP: 62285388  GS:  0033
        CS:  0073      EIP: 00291416  ERR: 000000da  EFLAGS: 00000286

    This should be a longstanding bug affecting x86 32bit PAE without THP.
    Only archs with 64bit large pmd_t and 32bit unsigned long should be
    affected.

    With THP enabled the barrier() in pmd_none_or_trans_huge_or_clear_bad()
    would partly hide the bug when the pmd transition from none to stable,
    by forcing a re-read of the *pmd in pmd_offset_map_lock, but when THP is
    enabled a new set of problem arises by the fact could then transition
    freely in any of the none, pmd_trans_huge or pmd_trans_stable states.
    So making the barrier in pmd_none_or_trans_huge_or_clear_bad()
    unconditional isn't good idea and it would be a flakey solution.

    This should be fully fixed by introducing a pmd_read_atomic that reads
    the pmd in order with THP disabled, or by reading the pmd atomically
    with cmpxchg8b with THP enabled.

    Luckily this new race condition only triggers in the places that must
    already be covered by pmd_none_or_trans_huge_or_clear_bad() so the fix
    is localized there but this bug is not related to THP.

    NOTE: this can trigger on x86 32bit systems with PAE enabled with more
    than 4G of ram, otherwise the high part of the pmd will never risk to be
    truncated because it would be zero at all times, in turn so hiding the
    SMP race.

    This bug was discovered and fully debugged by Ulrich, quote:

    ----
    [..]
    pmd_none_or_trans_huge_or_clear_bad() loads the content of edx and
    eax.

        496 static inline int pmd_none_or_trans_huge_or_clear_bad(pmd_t
        *pmd)
        497 {
        498         /* depend on compiler for an atomic pmd read */
        499         pmd_t pmdval = *pmd;

                                    // edi = pmd pointer
    0xc0507a74 <sys_mincore+548>:   mov    0x8(%esp),%edi
    ...
                                    // edx = PTE page table high address
    0xc0507a84 <sys_mincore+564>:   mov    0x4(%edi),%edx
    ...
                                    // eax = PTE page table low address
    0xc0507a8e <sys_mincore+574>:   mov    (%edi),%eax

    [..]

    Please note that the PMD is not read atomically. These are two "mov"
    instructions where the high order bits of the PMD entry are fetched
    first. Hence, the above machine code is prone to the following race.

    -  The PMD entry {high|low} is 0x0000000000000000.
       The "mov" at 0xc0507a84 loads 0x00000000 into edx.

    -  A page fault (on another CPU) sneaks in between the two "mov"
       instructions and instantiates the PMD.

    -  The PMD entry {high|low} is now 0x00000003fda38067.
       The "mov" at 0xc0507a8e loads 0xfda38067 into eax.
    ----

    Reported-by: Ulrich Obergfell <[email protected]>
    Signed-off-by: Andrea Arcangeli <[email protected]>
    Cc: Mel Gorman <[email protected]>
    Cc: Hugh Dickins <[email protected]>
    Cc: Larry Woodman <[email protected]>
    Cc: Petr Matousek <[email protected]>
    Cc: Rik van Riel <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit dce59c2faeb130855bd05d025d854ae79d8dbedd
Author: Michal Hocko <[email protected]>
Date:   Tue May 29 15:06:45 2012 -0700

    mm: consider all swapped back pages in used-once logic

    commit e48982734ea0500d1eba4f9d96195acc5406cad6 upstream.

    Commit 645747462435 ("vmscan: detect mapped file pages used only once")
    made mapped pages have another round in inactive list because they might
    be just short lived and so we could consider them again next time.  This
    heuristic helps to reduce pressure on the active list with a streaming
    IO worklods.

    This patch fixes a regression introduced by this commit for heavy shmem
    based workloads because unlike Anon pages, which are excluded from this
    heuristic because they are usually long lived, shmem pages are handled
    as a regular page cache.

    This doesn't work quite well, unfortunately, if the workload is mostly
    backed by shmem (in memory database sitting on 80% of memory) with a
    streaming IO in the background (backup - up to 20% of memory).  Anon
    inactive list is full of (dirty) shmem pages when watermarks are hit.
    Shmem pages are kept in the inactive list (they are referenced) in the
    first round and it is hard to reclaim anything else so we reach lower
    scanning priorities very quickly which leads to an excessive swap out.

    Let's fix this by excluding all swap backed pages (they tend to be long
    lived wrt.  the regular page cache anyway) from used-once heuristic and
    rather activate them if they are referenced.

    The customer's workload is shmem backed database (80% of RAM) and they
    are measuring transactions/s with an IO in the background (20%).
    Transactions touch more or less random rows in the table.  The
    transaction rate fell by a factor of 3 (in the worst case) because of
    commit 64574746.  This patch restores the previous numbers.

    Signed-off-by: Michal Hocko <[email protected]>
    Acked-by: Johannes Weiner <[email protected]>
    Cc: Mel Gorman <[email protected]>
    Cc: Minchan Kim <[email protected]>
    Cc: KAMEZAWA Hiroyuki <[email protected]>
    Reviewed-by: Rik van Riel <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit f4090d8272224cc1a4a83f70e2ecbd92d5c460e6
Author: Jun'ichi Nomura <[email protected]>
Date:   Tue May 22 18:57:17 2012 +0900

    SCSI: Fix dm-multipath starvation when scsi host is busy

    commit b7e94a1686c5daef4f649f7f4f839cc294f07710 upstream.

    block congestion control doesn't have any concept of fairness across
    multiple queues.  This means that if SCSI reports the host as busy in
    the queue congestion control it can result in an unfair starvation
    situation in dm-mp if there are multiple multipath devices on the same
    host.  For example:
    http://www.redhat.com/archives/dm-devel/2012-May/msg00123.html

    The fix for this is to report only the sdev busy state (and ignore the
    host busy state) in the block congestion control call back.
    The host is still congested, but the SCSI subsystem will sort out the
    congestion in a fair way because it knows the relation between the
    queues and the host.

    [jejb: fixed up trailing whitespace]
    Reported-by: Bernd Schubert <[email protected]>
    Tested-by: Bernd Schubert <[email protected]>
    Signed-off-by: Jun'ichi Nomura <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit af9c3bad265e370e3148d50f78a38cfbd14021f3
Author: James Bottomley <[email protected]>
Date:   Wed May 30 09:45:39 2012 +0000

    SCSI: fix scsi_wait_scan

    commit 1ff2f40305772b159a91c19590ee159d3a504afc upstream.

    Commit  c751085943362143f84346d274e0011419c84202
    Author: Rafael J. Wysocki <[email protected]>
    Date:   Sun Apr 12 20:06:56 2009 +0200

        PM/Hibernate: Wait for SCSI devices scan to complete during resume

    Broke the scsi_wait_scan module in 2.6.30.  Apparently debian still uses it so
    fix it and backport to stable before removing it in 3.6.

    The breakage is caused because the function template in
    include/scsi/scsi_scan.h is defined to be a nop unless SCSI is built in.
    That means that in the modular case (which is every distro), the
    scsi_wait_scan module does a simple async_synchronize_full() instead of
    waiting for scans.

    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
Mustaavalkosta referenced this issue in Mustaavalkosta/htc7x30-3.0 Mar 6, 2013
commit b09b34258046c4555e535a279e29032303a932f8
Author: Greg Kroah-Hartman <[email protected]>
Date:   Thu Aug 9 08:28:18 2012 -0700

    Linux 3.0.40

commit b7a06be61b78c66860897ee2a0f9e23845f1f438
Author: Darren Hart <[email protected]>
Date:   Fri Jul 20 11:53:31 2012 -0700

    futex: Forbid uaddr == uaddr2 in futex_wait_requeue_pi()

    commit 6f7b0a2a5c0fb03be7c25bd1745baa50582348ef upstream.

    If uaddr == uaddr2, then we have broken the rule of only requeueing
    from a non-pi futex to a pi futex with this call. If we attempt this,
    as the trinity test suite manages to do, we miss early wakeups as
    q.key is equal to key2 (because they are the same uaddr). We will then
    attempt to dereference the pi_mutex (which would exist had the futex_q
    been properly requeued to a pi futex) and trigger a NULL pointer
    dereference.

    Signed-off-by: Darren Hart <[email protected]>
    Cc: Dave Jones <[email protected]>
    Link: http://lkml.kernel.org/r/ad82bfe7f7d130247fbe2b5b4275654807774227.1342809673.git.dvhart@linux.intel.com
    Signed-off-by: Thomas Gleixner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7367fdb4987147438ca8cd69d6ae021ffc646c57
Author: Darren Hart <[email protected]>
Date:   Fri Jul 20 11:53:30 2012 -0700

    futex: Fix bug in WARN_ON for NULL q.pi_state

    commit f27071cb7fe3e1d37a9dbe6c0dfc5395cd40fa43 upstream.

    The WARN_ON in futex_wait_requeue_pi() for a NULL q.pi_state was testing
    the address (&q.pi_state) of the pointer instead of the value
    (q.pi_state) of the pointer. Correct it accordingly.

    Signed-off-by: Darren Hart <[email protected]>
    Cc: Dave Jones <[email protected]>
    Link: http://lkml.kernel.org/r/1c85d97f6e5f79ec389a4ead3e367363c74bd09a.1342809673.git.dvhart@linux.intel.com
    Signed-off-by: Thomas Gleixner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit bc16cc3950aed91b84c9a7071af2c72abee91660
Author: Darren Hart <[email protected]>
Date:   Fri Jul 20 11:53:29 2012 -0700

    futex: Test for pi_mutex on fault in futex_wait_requeue_pi()

    commit b6070a8d9853eda010a549fa9a09eb8d7269b929 upstream.

    If fixup_pi_state_owner() faults, pi_mutex may be NULL. Test
    for pi_mutex != NULL before testing the owner against current
    and possibly unlocking it.

    Signed-off-by: Darren Hart <[email protected]>
    Cc: Dave Jones <[email protected]>
    Cc: Dan Carpenter <[email protected]>
    Link: http://lkml.kernel.org/r/dc59890338fc413606f04e5c5b131530734dae3d.1342809673.git.dvhart@linux.intel.com
    Signed-off-by: Thomas Gleixner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e3d8d77f515ca7aa4896f1ed9b8e24a487225109
Author: Mikael Pettersson <[email protected]>
Date:   Thu Apr 19 00:53:36 2012 +0200

    m68k: Correct the Atari ALLOWINT definition

    commit c663600584a596b5e66258cc10716fb781a5c2c9 upstream.

    Booting a 3.2, 3.3, or 3.4-rc4 kernel on an Atari using the
    `nfeth' ethernet device triggers a WARN_ONCE() in generic irq
    handling code on the first irq for that device:

    WARNING: at kernel/irq/handle.c:146 handle_irq_event_percpu+0x134/0x142()
    irq 3 handler nfeth_interrupt+0x0/0x194 enabled interrupts
    Modules linked in:
    Call Trace: [<000299b2>] warn_slowpath_common+0x48/0x6a
     [<000299c0>] warn_slowpath_common+0x56/0x6a
     [<00029a4c>] warn_slowpath_fmt+0x2a/0x32
     [<0005b34c>] handle_irq_event_percpu+0x134/0x142
     [<0005b34c>] handle_irq_event_percpu+0x134/0x142
     [<0000a584>] nfeth_interrupt+0x0/0x194
     [<001ba0a8>] schedule_preempt_disabled+0x0/0xc
     [<0005b37a>] handle_irq_event+0x20/0x2c
     [<0005add4>] generic_handle_irq+0x2c/0x3a
     [<00002ab6>] do_IRQ+0x20/0x32
     [<0000289e>] auto_irqhandler_fixup+0x4/0x6
     [<00003144>] cpu_idle+0x22/0x2e
     [<001b8a78>] printk+0x0/0x18
     [<0024d112>] start_kernel+0x37a/0x386
     [<0003021d>] __do_proc_dointvec+0xb1/0x366
     [<0003021d>] __do_proc_dointvec+0xb1/0x366
     [<0024c31e>] _sinittext+0x31e/0x9c0

    After invoking the irq's handler the kernel sees !irqs_disabled()
    and concludes that the handler erroneously enabled interrupts.

    However, debugging shows that !irqs_disabled() is true even before
    the handler is invoked, which indicates a problem in the platform
    code rather than the specific driver.

    The warning does not occur in 3.1 or older kernels.

    It turns out that the ALLOWINT definition for Atari is incorrect.

    The Atari definition of ALLOWINT is ~0x400, the stated purpose of
    that is to avoid taking HSYNC interrupts.  irqs_disabled() returns
    true if the 3-bit ipl & 4 is non-zero.  The nfeth interrupt runs at
    ipl 3 (it's autovector 3), but 3 & 4 is zero so irqs_disabled() is
    false, and the warning above is generated.

    When interrupts are explicitly disabled, ipl is set to 7.  When they
    are enabled, ipl is masked with ALLOWINT.  On Atari this will result
    in ipl = 3, which blocks interrupts at ipl 3 and below.  So how come
    nfeth interrupts at ipl 3 are received at all?  That's because ipl
    is reset to 2 by Atari-specific code in default_idle(), again with
    the stated purpose of blocking HSYNC interrupts.  This discrepancy
    means that ipl 3 can remain blocked for longer than intended.

    Both default_idle() and falcon_hblhandler() identify HSYNC with
    ipl 2, and the "Atari ST/.../F030 Hardware Register Listing" agrees,
    but ALLOWINT is defined as if HSYNC was ipl 3.

    [As an experiment I modified default_idle() to reset ipl to 3, and
    as expected that resulted in all nfeth interrupts being blocked.]

    The fix is simple: define ALLOWINT as ~0x500 instead.  This makes
    arch_local_irq_enable() consistent with default_idle(), and prevents
    the !irqs_disabled() problems for ipl 3 interrupts.

    Tested on Atari running in an Aranym VM.

    Signed-off-by: Mikael Pettersson <[email protected]>
    Tested-by: Michael Schmitz <[email protected]>
    Signed-off-by: Geert Uytterhoeven <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d3be3eeedbc5b39f93b27c6ece2879c1d417eed5
Author: Andreas Schwab <[email protected]>
Date:   Sat Jul 28 00:20:34 2012 +0200

    m68k: Make sys_atomic_cmpxchg_32 work on classic m68k

    commit 9e2760d18b3cf179534bbc27692c84879c61b97c upstream.

    User space access must always go through uaccess accessors, since on
    classic m68k user space and kernel space are completely separate.

    Signed-off-by: Andreas Schwab <[email protected]>
    Tested-by: Thorsten Glaser <[email protected]>
    Signed-off-by: Geert Uytterhoeven <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 3b6ae1807d29f8cacd63fddf513110f9308b4c8e
Author: Mark Brown <[email protected]>
Date:   Fri Jun 22 17:21:17 2012 +0100

    ASoC: wm8994: Ensure there are enough BCLKs for four channels

    commit b8edf3e5522735c8ce78b81845f7a1a2d4a08626 upstream.

    Otherwise if someone tries to use all four channels on AIF1 with the
    device in master mode we won't be able to clock out all the data.

    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 4ae4c20ceb593c1a8f392bb1100cc60a1f04ee4c
Author: Mark Brown <[email protected]>
Date:   Mon Jul 30 18:24:19 2012 +0100

    ASoC: wm8962: Allow VMID time to fully ramp

    commit 9d40e5582c9c4cfb6977ba2a0ca9c2ed82c56f21 upstream.

    Required for reliable power up from cold.

    Signed-off-by: Mark Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit de4bc9fc942526dbcb0246dbb2ca87ad9b3b02b0
Author: Takashi Iwai <[email protected]>
Date:   Mon Jul 23 11:35:55 2012 +0200

    ALSA: mpu401: Fix missing initialization of irq field

    commit bc733d495267a23ef8660220d696c6e549ce30b3 upstream.

    The irq field of struct snd_mpu401 is supposed to be initialized to -1.
    Since it's set to zero as of now, a probing error before the irq
    installation results in a kernel warning "Trying to free already-free
    IRQ 0".

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=44821
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit f45cd6dfe00503a2ff49920bf8365a55ea69edbb
Author: Daniel Mack <[email protected]>
Date:   Wed Aug 1 10:16:53 2012 +0200

    ALSA: snd-usb: fix clock source validity index

    commit aff252a848ce21b431ba822de3dab9c4c94571cb upstream.

    uac_clock_source_is_valid() uses the control selector value to access
    the bmControls bitmap of the clock source unit. This is wrong, as
    control selector values start from 1, while the bitmap uses all
    available bits.

    In other words, "Clock Validity Control" is stored in D3..2, not D5..4
    of the clock selector unit's bmControls.

    Signed-off-by: Daniel Mack <[email protected]>
    Reported-by: Andreas Koch <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit aeaab8a0fee896fb31f2e5044f86d2a270d65cb6
Author: Colin Ian King <[email protected]>
Date:   Mon Jul 30 16:06:42 2012 +0100

    USB: echi-dbgp: increase the controller wait time to come out of halt.

    commit f96a4216e85050c0a9d41a41ecb0ae9d8e39b509 upstream.

    The default 10 microsecond delay for the controller to come out of
    halt in dbgp_ehci_startup is too short, so increase it to 1 millisecond.

    This is based on emperical testing on various USB debug ports on
    modern machines such as a Lenovo X220i and an Ivybridge development
    platform that needed to wait ~450-950 microseconds.

    Signed-off-by: Colin Ian King <[email protected]>
    Signed-off-by: Jason Wessel <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 4e98953723643ac9db9191381f52973a8f113902
Author: Mathias Krause <[email protected]>
Date:   Sun Jul 29 19:45:14 2012 +0000

    net/tun: fix ioctl() based info leaks

    [ Upstream commits a117dacde0288f3ec60b6e5bcedae8fa37ee0dfc
      and 8bbb181308bc348e02bfdbebdedd4e4ec9d452ce ]

    The tun module leaks up to 36 bytes of memory by not fully initializing
    a structure located on the stack that gets copied to user memory by the
    TUNGETIFF and SIOCGIFHWADDR ioctl()s.

    Signed-off-by: Mathias Krause <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 41f079a0e1089bf0ed2b795cc427bf40b72efe0e
Author: Jiri Kosina <[email protected]>
Date:   Fri Jul 27 10:38:50 2012 +0000

    tcp: perform DMA to userspace only if there is a task waiting for it

    [ Upstream commit 59ea33a68a9083ac98515e4861c00e71efdc49a1 ]

    Back in 2006, commit 1a2449a87b ("[I/OAT]: TCP recv offload to I/OAT")
    added support for receive offloading to IOAT dma engine if available.

    The code in tcp_rcv_established() tries to perform early DMA copy if
    applicable. It however does so without checking whether the userspace
    task is actually expecting the data in the buffer.

    This is not a problem under normal circumstances, but there is a corner
    case where this doesn't work -- and that's when MSG_TRUNC flag to
    recvmsg() is used.

    If the IOAT dma engine is not used, the code properly checks whether
    there is a valid ucopy.task and the socket is owned by userspace, but
    misses the check in the dmaengine case.

    This problem can be observed in real trivially -- for example 'tbench' is a
    good reproducer, as it makes a heavy use of MSG_TRUNC. On systems utilizing
    IOAT, you will soon find tbench waiting indefinitely in sk_wait_data(), as they
    have been already early-copied in tcp_rcv_established() using dma engine.

    This patch introduces the same check we are performing in the simple
    iovec copy case to the IOAT case as well. It fixes the indefinite
    recvmsg(MSG_TRUNC) hangs.

    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c94eb3f964dd7c08486d7c1227c7b5b69d09aabe
Author: Jiri Benc <[email protected]>
Date:   Fri Jul 27 02:58:22 2012 +0000

    net: fix rtnetlink IFF_PROMISC and IFF_ALLMULTI handling

    [ Upstream commit b1beb681cba5358f62e6187340660ade226a5fcc ]

    When device flags are set using rtnetlink, IFF_PROMISC and IFF_ALLMULTI
    flags are handled specially. Function dev_change_flags sets IFF_PROMISC and
    IFF_ALLMULTI bits in dev->gflags according to the passed value but
    do_setlink passes a result of rtnl_dev_combine_flags which takes those bits
    from dev->flags.

    This can be easily trigerred by doing:

    tcpdump -i eth0 &
    ip l s up eth0

    ip sets IFF_UP flag in ifi_flags and ifi_change, which is combined with
    IFF_PROMISC by rtnl_dev_combine_flags, causing __dev_change_flags to set
    IFF_PROMISC in gflags.

    Reported-by: Max Matveev <[email protected]>
    Signed-off-by: Jiri Benc <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 242e0e14c3995231230b2836bcd1f5dc6c08ff90
Author: Dan Carpenter <[email protected]>
Date:   Fri Jul 27 01:46:51 2012 +0000

    USB: kaweth.c: use GFP_ATOMIC under spin_lock

    [ Upstream commit e4c7f259c5be99dcfc3d98f913590663b0305bf8 ]

    The problem is that we call this with a spin lock held.  The call tree
    is:
    	kaweth_start_xmit() holds kaweth->device_lock.
    	-> kaweth_async_set_rx_mode()
    	   -> kaweth_control()
    	      -> kaweth_internal_control_msg()

    The kaweth_internal_control_msg() function is only called from
    kaweth_control() which used GFP_ATOMIC for its allocations.

    Signed-off-by: Dan Carpenter <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 8d7c99de6821880884e6f9ade1c6f269d40ebbae
Author: Hangbin Liu <[email protected]>
Date:   Thu Jul 26 22:52:21 2012 +0000

    tcp: Add TCP_USER_TIMEOUT negative value check

    [ Upstream commit 42493570100b91ef663c4c6f0c0fdab238f9d3c2 ]

    TCP_USER_TIMEOUT is a TCP level socket option that takes an unsigned int. But
    patch "tcp: Add TCP_USER_TIMEOUT socket option"(dca43c75) didn't check the negative
    values. If a user assign -1 to it, the socket will set successfully and wait
    for 4294967295 miliseconds. This patch add a negative value check to avoid
    this issue.

    Signed-off-by: Hangbin Liu <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 8a22bda491f4fb197c31c2d50c18a816be494a75
Author: Alan Cox <[email protected]>
Date:   Tue Jul 24 08:16:25 2012 +0000

    wanmain: comparing array with NULL

    [ Upstream commit 8b72ff6484fe303e01498b58621810a114f3cf09 ]

    gcc really should warn about these !

    Signed-off-by: Alan Cox <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 4b53a23467b73b472f276d5530a103a736fe8ae1
Author: Alan Cox <[email protected]>
Date:   Tue Jul 24 02:42:14 2012 +0000

    caif: fix NULL pointer check

    [ Upstream commit c66b9b7d365444b433307ebb18734757cb668a02 ]

    Reported-by: <[email protected]>
    Resolves-bug: http://bugzilla.kernel.org/show_bug?44441
    Signed-off-by: Alan Cox <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit bca8ae51a3761a9fc4795641541a3478001975c1
Author: Paul Moore <[email protected]>
Date:   Tue Jul 17 11:07:47 2012 +0000

    cipso: don't follow a NULL pointer when setsockopt() is called

    [ Upstream commit 89d7ae34cdda4195809a5a987f697a517a2a3177 ]

    As reported by Alan Cox, and verified by Lin Ming, when a user
    attempts to add a CIPSO option to a socket using the CIPSO_V4_TAG_LOCAL
    tag the kernel dies a terrible death when it attempts to follow a NULL
    pointer (the skb argument to cipso_v4_validate() is NULL when called via
    the setsockopt() syscall).

    This patch fixes this by first checking to ensure that the skb is
    non-NULL before using it to find the incoming network interface.  In
    the unlikely case where the skb is NULL and the user attempts to add
    a CIPSO option with the _TAG_LOCAL tag we return an error as this is
    not something we want to allow.

    A simple reproducer, kindly supplied by Lin Ming, although you must
    have the CIPSO DOI #3 configure on the system first or you will be
    caught early in cipso_v4_validate():

    	#include <sys/types.h>
    	#include <sys/socket.h>
    	#include <linux/ip.h>
    	#include <linux/in.h>
    	#include <string.h>

    	struct local_tag {
    		char type;
    		char length;
    		char info[4];
    	};

    	struct cipso {
    		char type;
    		char length;
    		char doi[4];
    		struct local_tag local;
    	};

    	int main(int argc, char **argv)
    	{
    		int sockfd;
    		struct cipso cipso = {
    			.type = IPOPT_CIPSO,
    			.length = sizeof(struct cipso),
    			.local = {
    				.type = 128,
    				.length = sizeof(struct local_tag),
    			},
    		};

    		memset(cipso.doi, 0, 4);
    		cipso.doi[3] = 3;

    		sockfd = socket(AF_INET, SOCK_DGRAM, 0);
    		#define SOL_IP 0
    		setsockopt(sockfd, SOL_IP, IP_OPTIONS,
    			&cipso, sizeof(struct cipso));

    		return 0;
    	}

    CC: Lin Ming <[email protected]>
    Reported-by: Alan Cox <[email protected]>
    Signed-off-by: Paul Moore <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 22cb83b5a318697b09fe1d6e237703d8371ab1fe
Author: Sjur Brændeland <[email protected]>
Date:   Sun Jul 15 10:10:14 2012 +0000

    caif: Fix access to freed pernet memory

    [ Upstream commit 96f80d123eff05c3cd4701463786b87952a6c3ac ]

    unregister_netdevice_notifier() must be called before
    unregister_pernet_subsys() to avoid accessing already freed
    pernet memory. This fixes the following oops when doing rmmod:

    Call Trace:
     [<ffffffffa0f802bd>] caif_device_notify+0x4d/0x5a0 [caif]
     [<ffffffff81552ba9>] unregister_netdevice_notifier+0xb9/0x100
     [<ffffffffa0f86dcc>] caif_device_exit+0x1c/0x250 [caif]
     [<ffffffff810e7734>] sys_delete_module+0x1a4/0x300
     [<ffffffff810da82d>] ? trace_hardirqs_on_caller+0x15d/0x1e0
     [<ffffffff813517de>] ? trace_hardirqs_on_thunk+0x3a/0x3
     [<ffffffff81696bad>] system_call_fastpath+0x1a/0x1f

    RIP
     [<ffffffffa0f7f561>] caif_get+0x51/0xb0 [caif]

    Signed-off-by: Sjur Brændeland <[email protected]>
    Acked-by: "Eric W. Biederman" <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 2f890d2777247beb207be1c99835a0c5e09d340c
Author: Neil Horman <[email protected]>
Date:   Mon Jul 16 09:13:51 2012 +0000

    sctp: Fix list corruption resulting from freeing an association on a list

    [ Upstream commit 2eebc1e188e9e45886ee00662519849339884d6d ]

    A few days ago Dave Jones reported this oops:

    [22766.294255] general protection fault: 0000 [#1] PREEMPT SMP
    [22766.295376] CPU 0
    [22766.295384] Modules linked in:
    [22766.387137]  ffffffffa169f292 6b6b6b6b6b6b6b6b ffff880147c03a90
    ffff880147c03a74
    [22766.387135] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 00000000000
    [22766.387136] Process trinity-watchdo (pid: 10896, threadinfo ffff88013e7d2000,
    [22766.387137] Stack:
    [22766.387140]  ffff880147c03a10
    [22766.387140]  ffffffffa169f2b6
    [22766.387140]  ffff88013ed95728
    [22766.387143]  0000000000000002
    [22766.387143]  0000000000000000
    [22766.387143]  ffff880003fad062
    [22766.387144]  ffff88013c120000
    [22766.387144]
    [22766.387145] Call Trace:
    [22766.387145]  <IRQ>
    [22766.387150]  [<ffffffffa169f292>] ? __sctp_lookup_association+0x62/0xd0
    [sctp]
    [22766.387154]  [<ffffffffa169f2b6>] __sctp_lookup_association+0x86/0xd0 [sctp]
    [22766.387157]  [<ffffffffa169f597>] sctp_rcv+0x207/0xbb0 [sctp]
    [22766.387161]  [<ffffffff810d4da8>] ? trace_hardirqs_off_caller+0x28/0xd0
    [22766.387163]  [<ffffffff815827e3>] ? nf_hook_slow+0x133/0x210
    [22766.387166]  [<ffffffff815902fc>] ? ip_local_deliver_finish+0x4c/0x4c0
    [22766.387168]  [<ffffffff8159043d>] ip_local_deliver_finish+0x18d/0x4c0
    [22766.387169]  [<ffffffff815902fc>] ? ip_local_deliver_finish+0x4c/0x4c0
    [22766.387171]  [<ffffffff81590a07>] ip_local_deliver+0x47/0x80
    [22766.387172]  [<ffffffff8158fd80>] ip_rcv_finish+0x150/0x680
    [22766.387174]  [<ffffffff81590c54>] ip_rcv+0x214/0x320
    [22766.387176]  [<ffffffff81558c07>] __netif_receive_skb+0x7b7/0x910
    [22766.387178]  [<ffffffff8155856c>] ? __netif_receive_skb+0x11c/0x910
    [22766.387180]  [<ffffffff810d423e>] ? put_lock_stats.isra.25+0xe/0x40
    [22766.387182]  [<ffffffff81558f83>] netif_receive_skb+0x23/0x1f0
    [22766.387183]  [<ffffffff815596a9>] ? dev_gro_receive+0x139/0x440
    [22766.387185]  [<ffffffff81559280>] napi_skb_finish+0x70/0xa0
    [22766.387187]  [<ffffffff81559cb5>] napi_gro_receive+0xf5/0x130
    [22766.387218]  [<ffffffffa01c4679>] e1000_receive_skb+0x59/0x70 [e1000e]
    [22766.387242]  [<ffffffffa01c5aab>] e1000_clean_rx_irq+0x28b/0x460 [e1000e]
    [22766.387266]  [<ffffffffa01c9c18>] e1000e_poll+0x78/0x430 [e1000e]
    [22766.387268]  [<ffffffff81559fea>] net_rx_action+0x1aa/0x3d0
    [22766.387270]  [<ffffffff810a495f>] ? account_system_vtime+0x10f/0x130
    [22766.387273]  [<ffffffff810734d0>] __do_softirq+0xe0/0x420
    [22766.387275]  [<ffffffff8169826c>] call_softirq+0x1c/0x30
    [22766.387278]  [<ffffffff8101db15>] do_softirq+0xd5/0x110
    [22766.387279]  [<ffffffff81073bc5>] irq_exit+0xd5/0xe0
    [22766.387281]  [<ffffffff81698b03>] do_IRQ+0x63/0xd0
    [22766.387283]  [<ffffffff8168ee2f>] common_interrupt+0x6f/0x6f
    [22766.387283]  <EOI>
    [22766.387284]
    [22766.387285]  [<ffffffff8168eed9>] ? retint_swapgs+0x13/0x1b
    [22766.387285] Code: c0 90 5d c3 66 0f 1f 44 00 00 4c 89 c8 5d c3 0f 1f 00 55 48
    89 e5 48 83
    ec 20 48 89 5d e8 4c 89 65 f0 4c 89 6d f8 66 66 66 66 90 <0f> b7 87 98 00 00 00
    48 89 fb
    49 89 f5 66 c1 c0 08 66 39 46 02
    [22766.387307]
    [22766.387307] RIP
    [22766.387311]  [<ffffffffa168a2c9>] sctp_assoc_is_match+0x19/0x90 [sctp]
    [22766.387311]  RSP <ffff880147c039b0>
    [22766.387142]  ffffffffa16ab120
    [22766.599537] ---[ end trace 3f6dae82e37b17f5 ]---
    [22766.601221] Kernel panic - not syncing: Fatal exception in interrupt

    It appears from his analysis and some staring at the code that this is likely
    occuring because an association is getting freed while still on the
    sctp_assoc_hashtable.  As a result, we get a gpf when traversing the hashtable
    while a freed node corrupts part of the list.

    Nominally I would think that an mibalanced refcount was responsible for this,
    but I can't seem to find any obvious imbalance.  What I did note however was
    that the two places where we create an association using
    sctp_primitive_ASSOCIATE (__sctp_connect and sctp_sendmsg), have failure paths
    which free a newly created association after calling sctp_primitive_ASSOCIATE.
    sctp_primitive_ASSOCIATE brings us into the sctp_sf_do_prm_asoc path, which
    issues a SCTP_CMD_NEW_ASOC side effect, which in turn adds a new association to
    the aforementioned hash table.  the sctp command interpreter that process side
    effects has not way to unwind previously processed commands, so freeing the
    association from the __sctp_connect or sctp_sendmsg error path would lead to a
    freed association remaining on this hash table.

    I've fixed this but modifying sctp_[un]hash_established to use hlist_del_init,
    which allows us to proerly use hlist_unhashed to check if the node is on a
    hashlist safely during a delete.  That in turn alows us to safely call
    sctp_unhash_established in the __sctp_connect and sctp_sendmsg error paths
    before freeing them, regardles of what the associations state is on the hash
    list.

    I noted, while I was doing this, that the __sctp_unhash_endpoint was using
    hlist_unhsashed in a simmilar fashion, but never nullified any removed nodes
    pointers to make that function work properly, so I fixed that up in a simmilar
    fashion.

    I attempted to test this using a virtual guest running the SCTP_RR test from
    netperf in a loop while running the trinity fuzzer, both in a loop.  I wasn't
    able to recreate the problem prior to this fix, nor was I able to trigger the
    failure after (neither of which I suppose is suprising).  Given the trace above
    however, I think its likely that this is what we hit.

    Signed-off-by: Neil Horman <[email protected]>
    Reported-by: [email protected]
    CC: [email protected]
    CC: "David S. Miller" <[email protected]>
    CC: Vlad Yasevich <[email protected]>
    CC: Sridhar Samudrala <[email protected]>
    CC: [email protected]
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 9b9f676623b92483d890d1a3a52611c09fc190f3
Author: Alan Cox <[email protected]>
Date:   Thu Jul 12 03:39:11 2012 +0000

    sch_sfb: Fix missing NULL check

    [ Upstream commit 7ac2908e4b2edaec60e9090ddb4d9ceb76c05e7d ]

    Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=44461

    Signed-off-by: Alan Cox <[email protected]>
    Acked-by: Eric Dumazet <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 6577472957c45c35cedaa0e53748cb1c6c954e44
Author: Michael Chan <[email protected]>
Date:   Tue Jul 10 10:04:40 2012 +0000

    bnx2: Fix bug in bnx2_free_tx_skbs().

    [ Upstream commit c1f5163de417dab01fa9daaf09a74bbb19303f3c ]

    In rare cases, bnx2x_free_tx_skbs() can unmap the wrong DMA address
    when it gets to the last entry of the tx ring.  We were not using
    the proper macro to skip the last entry when advancing the tx index.

    Reported-by: Zongyun Lai <[email protected]>
    Reviewed-by: Jeffrey Huang <[email protected]>
    Signed-off-by: Michael Chan <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b4cbf953e071121a4082e35c9820c3c3c10aeb55
Author: Brian Foster <[email protected]>
Date:   Sun Jul 22 23:59:40 2012 -0400

    ext4: don't let i_reserved_meta_blocks go negative

    commit 97795d2a5b8d3c8dc4365d4bd3404191840453ba upstream.

    If we hit a condition where we have allocated metadata blocks that
    were not appropriately reserved, we risk underflow of
    ei->i_reserved_meta_blocks.  In turn, this can throw
    sbi->s_dirtyclusters_counter significantly out of whack and undermine
    the nondelalloc fallback logic in ext4_nonda_switch().  Warn if this
    occurs and set i_allocated_meta_blocks to avoid this problem.

    This condition is reproduced by xfstests 270 against ext2 with
    delalloc enabled:

    Mar 28 08:58:02 localhost kernel: [  171.526344] EXT4-fs (loop1): delayed block allocation failed for inode 14 at logical offset 64486 with max blocks 64 with error -28
    Mar 28 08:58:02 localhost kernel: [  171.526346] EXT4-fs (loop1): This should not happen!! Data will be lost

    270 ultimately fails with an inconsistent filesystem and requires an
    fsck to repair.  The cause of the error is an underflow in
    ext4_da_update_reserve_space() due to an unreserved meta block
    allocation.

    Signed-off-by: Brian Foster <[email protected]>
    Signed-off-by: "Theodore Ts'o" <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 6ff2c41b81bd0778aa44ffcfce0ea623fa660887
Author: Theodore Ts'o <[email protected]>
Date:   Sat Jun 30 19:14:57 2012 -0400

    ext4: pass a char * to ext4_count_free() instead of a buffer_head ptr

    commit f6fb99cadcd44660c68e13f6eab28333653621e6 upstream.

    Make it possible for ext4_count_free to operate on buffers and not
    just data in buffer_heads.

    Signed-off-by: "Theodore Ts'o" <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit eb65b85e1bce06b665b3568c19a249cd886fa6ff
Author: Jeff Layton <[email protected]>
Date:   Mon Jul 23 13:58:51 2012 -0400

    nfs: skip commit in releasepage if we're freeing memory for fs-related reasons

    commit 5cf02d09b50b1ee1c2d536c9cf64af5a7d433f56 upstream.

    We've had some reports of a deadlock where rpciod ends up with a stack
    trace like this:

        PID: 2507   TASK: ffff88103691ab40  CPU: 14  COMMAND: "rpciod/14"
         #0 [ffff8810343bf2f0] schedule at ffffffff814dabd9
         #1 [ffff8810343bf3b8] nfs_wait_bit_killable at ffffffffa038fc04 [nfs]
         #2 [ffff8810343bf3c8] __wait_on_bit at ffffffff814dbc2f
         #3 [ffff8810343bf418] out_of_line_wait_on_bit at ffffffff814dbcd8
         #4 [ffff8810343bf488] nfs_commit_inode at ffffffffa039e0c1 [nfs]
         #5 [ffff8810343bf4f8] nfs_release_page at ffffffffa038bef6 [nfs]
         #6 [ffff8810343bf528] try_to_release_page at ffffffff8110c670
         #7 [ffff8810343bf538] shrink_page_list.clone.0 at ffffffff81126271
         #8 [ffff8810343bf668] shrink_inactive_list at ffffffff81126638
         #9 [ffff8810343bf818] shrink_zone at ffffffff8112788f
        #10 [ffff8810343bf8c8] do_try_to_free_pages at ffffffff81127b1e
        #11 [ffff8810343bf958] try_to_free_pages at ffffffff8112812f
        #12 [ffff8810343bfa08] __alloc_pages_nodemask at ffffffff8111fdad
        #13 [ffff8810343bfb28] kmem_getpages at ffffffff81159942
        #14 [ffff8810343bfb58] fallback_alloc at ffffffff8115a55a
        #15 [ffff8810343bfbd8] ____cache_alloc_node at ffffffff8115a2d9
        #16 [ffff8810343bfc38] kmem_cache_alloc at ffffffff8115b09b
        #17 [ffff8810343bfc78] sk_prot_alloc at ffffffff81411808
        #18 [ffff8810343bfcb8] sk_alloc at ffffffff8141197c
        #19 [ffff8810343bfce8] inet_create at ffffffff81483ba6
        #20 [ffff8810343bfd38] __sock_create at ffffffff8140b4a7
        #21 [ffff8810343bfd98] xs_create_sock at ffffffffa01f649b [sunrpc]
        #22 [ffff8810343bfdd8] xs_tcp_setup_socket at ffffffffa01f6965 [sunrpc]
        #23 [ffff8810343bfe38] worker_thread at ffffffff810887d0
        #24 [ffff8810343bfee8] kthread at ffffffff8108dd96
        #25 [ffff8810343bff48] kernel_thread at ffffffff8100c1ca

    rpciod is trying to allocate memory for a new socket to talk to the
    server. The VM ends up calling ->releasepage to get more memory, and it
    tries to do a blocking commit. That commit can't succeed however without
    a connected socket, so we deadlock.

    Fix this by setting PF_FSTRANS on the workqueue task prior to doing the
    socket allocation, and having nfs_release_page check for that flag when
    deciding whether to do a commit call. Also, set PF_FSTRANS
    unconditionally in rpc_async_schedule since that function can also do
    allocations sometimes.

    Signed-off-by: Jeff Layton <[email protected]>
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 9d0ed6ec043bb8cbb895d13ce780878e2e50df80
Author: J. Bruce Fields <[email protected]>
Date:   Tue Jun 5 16:52:06 2012 -0400

    nfsd4: our filesystems are normally case sensitive

    commit 2930d381d22b9c56f40dd4c63a8fa59719ca2c3c upstream.

    Actually, xfs and jfs can optionally be case insensitive; we'll handle
    that case in later patches.

    Signed-off-by: J. Bruce Fields <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 073271315cd11ae149fde728a8c0d96fb2ad03eb
Author: Jerome Glisse <[email protected]>
Date:   Thu Jul 19 17:25:55 2012 -0400

    drm/radeon: on hotplug force link training to happen (v2)

    commit ca2ccde5e2f24a792caa4cca919fc5c6f65d1887 upstream.

    To have DP behave like VGA/DVI we need to retrain the link
    on hotplug. For this to happen we need to force link
    training to happen by setting connector dpms to off
    before asking it turning it on again.

    v2: agd5f
    - drop the dp_get_link_status() change in atombios_dp.c
      for now.  We still need the dpms OFF change.

    Signed-off-by: Jerome Glisse <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Dave Airlie <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a0283f9072a2c289926a8bafb99a231a55eb7517
Author: Jerome Glisse <[email protected]>
Date:   Thu Jul 19 17:15:56 2012 -0400

    drm/radeon: fix hotplug of DP to DVI|HDMI passive adapters (v2)

    commit 266dcba541a1ef7e5d82d9e67c67fde2910636e8 upstream.

    No need to retrain the link for passive adapters.

    v2: agd5f
    - no passive DP to VGA adapters, update comments
    - assign radeon_connector_atom_dig after we are sure
      we have a digital connector as analog connectors
      have different private data.
    - get new sink type before checking for retrain.  No
      need to check if it's no longer a DP connection.

    Signed-off-by: Jerome Glisse <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Dave Airlie <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit ea07d57bea33b7004d1773db115bf62bb7788c99
Author: Jerome Glisse <[email protected]>
Date:   Tue Jul 17 17:17:16 2012 -0400

    drm/radeon: fix non revealent error message

    commit 8d1c702aa0b2c4b22b0742b72a1149d91690674b upstream.

    We want to print link status query failed only if it's
    an unexepected fail. If we query to see if we need
    link training it might be because there is nothing
    connected and thus link status query have the right
    to fail in that case.

    To avoid printing failure when it's expected, move the
    failure message to proper place.

    Signed-off-by: Jerome Glisse <[email protected]>
    Signed-off-by: Dave Airlie <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 4826f249d0b09bb6d8969277b43df9ffc3bccfe5
Author: Michel Dänzer <[email protected]>
Date:   Tue Jul 17 19:02:09 2012 +0200

    drm/radeon: Try harder to avoid HW cursor ending on a multiple of 128 columns.

    commit f60ec4c7df043df81e62891ac45383d012afe0da upstream.

    This could previously fail if either of the enabled displays was using a
    horizontal resolution that is a multiple of 128, and only the leftmost column
    of the cursor was (supposed to be) visible at the right edge of that display.

    The solution is to move the cursor one pixel to the left in that case.

    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33183

    Signed-off-by: Michel Dänzer <[email protected]>
    Reviewed-by: Alex Deucher <[email protected]>
    Signed-off-by: Dave Airlie <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 4ffd3692dd84a5979310c5e86bcf942e4b46c9ce
Author: Chris Mason <[email protected]>
Date:   Wed Jul 25 15:57:13 2012 -0400

    Btrfs: call the ordered free operation without any locks held

    commit e9fbcb42201c862fd6ab45c48ead4f47bb2dea9d upstream.

    Each ordered operation has a free callback, and this was called with the
    worker spinlock held.  Josef made the free callback also call iput,
    which we can't do with the spinlock.

    This drops the spinlock for the free operation and grabs it again before
    moving through the rest of the list.  We'll circle back around to this
    and find a cleaner way that doesn't bounce the lock around so much.

    Signed-off-by: Chris Mason <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 53895e01fe540ddd0c9f2615468a04cb48d9ed2f
Author: Lan Tianyu <[email protected]>
Date:   Fri Jul 20 13:29:16 2012 +0800

    ACPI/AC: prevent OOPS on some boxes due to missing check power_supply_register() return value check

    commit f197ac13f6eeb351b31250b9ab7d0da17434ea36 upstream.

    In the ac.c, power_supply_register()'s return value is not checked.

    As a result, the driver's add() ops may return success
    even though the device failed to initialize.

    For example, some BIOS may describe two ACADs in the same DSDT.
    The second ACAD device will fail to register,
    but ACPI driver's add() ops returns sucessfully.
    The ACPI device will receive ACPI notification and cause OOPS.

    https://bugzilla.redhat.com/show_bug.cgi?id=772730

    Signed-off-by: Lan Tianyu <[email protected]>
    Signed-off-by: Len Brown <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b1c7ba1bab7363fee6dc5d4ee5be4e916adcf691
Author: Tejun Heo <[email protected]>
Date:   Tue Jul 17 12:39:26 2012 -0700

    workqueue: perform cpu down operations from low priority cpu_notifier()

    commit 6575820221f7a4dd6eadecf7bf83cdd154335eda upstream.

    Currently, all workqueue cpu hotplug operations run off
    CPU_PRI_WORKQUEUE which is higher than normal notifiers.  This is to
    ensure that workqueue is up and running while bringing up a CPU before
    other notifiers try to use workqueue on the CPU.

    Per-cpu workqueues are supposed to remain working and bound to the CPU
    for normal CPU_DOWN_PREPARE notifiers.  This holds mostly true even
    with workqueue offlining running with higher priority because
    workqueue CPU_DOWN_PREPARE only creates a bound trustee thread which
    runs the per-cpu workqueue without concurrency management without
    explicitly detaching the existing workers.

    However, if the trustee needs to create new workers, it creates
    unbound workers which may wander off to other CPUs while
    CPU_DOWN_PREPARE notifiers are in progress.  Furthermore, if the CPU
    down is cancelled, the per-CPU workqueue may end up with workers which
    aren't bound to the CPU.

    While reliably reproducible with a convoluted artificial test-case
    involving scheduling and flushing CPU burning work items from CPU down
    notifiers, this isn't very likely to happen in the wild, and, even
    when it happens, the effects are likely to be hidden by the following
    successful CPU down.

    Fix it by using different priorities for up and down notifiers - high
    priority for up operations and low priority for down operations.

    Workqueue cpu hotplug operations will soon go through further cleanup.

    Signed-off-by: Tejun Heo <[email protected]>
    Acked-by: "Rafael J. Wysocki" <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 8d50f086b22f886265031643748e4089257c768b
Author: Paul Gortmaker <[email protected]>
Date:   Tue Jun 5 11:15:50 2012 -0400

    stable: update references to older 2.6 versions for 3.x

    commit 2584f5212d97b664be250ad5700a2d0fee31a10d upstream.

    Also add information on where the respective trees are.

    Signed-off-by: Paul Gortmaker <[email protected]>
    Acked-by: Rob Landley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 31b1c0850709c77ece1690a8fbc043829717d14c
Author: Srivatsa S. Bhat <[email protected]>
Date:   Sat Jun 16 15:30:45 2012 +0200

    ftrace: Disable function tracing during suspend/resume and hibernation, again

    commit 443772d408a25af62498793f6f805ce3c559309a upstream.

    If function tracing is enabled for some of the low-level suspend/resume
    functions, it leads to triple fault during resume from suspend, ultimately
    ending up in a reboot instead of a resume (or a total refusal to come out
    of suspended state, on some machines).

    This issue was explained in more detail in commit f42ac38c59e0a03d (ftrace:
    disable tracing for suspend to ram). However, the changes made by that commit
    got reverted by commit cbe2f5a6e84eebb (tracing: allow tracing of
    suspend/resume & hibernation code again). So, unfortunately since things are
    not yet robust enough to allow tracing of low-level suspend/resume functions,
    suspend/resume is still broken when ftrace is enabled.

    So fix this by disabling function tracing during suspend/resume & hibernation.

    Signed-off-by: Srivatsa S. Bhat <[email protected]>
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit dc525df9895f810ba777feec1540c7b822512c04
Author: J. Bruce Fields <[email protected]>
Date:   Mon Jul 23 15:17:17 2012 -0400

    locks: fix checking of fcntl_setlease argument

    commit 0ec4f431eb56d633da3a55da67d5c4b88886ccc7 upstream.

    The only checks of the long argument passed to fcntl(fd,F_SETLEASE,.)
    are done after converting the long to an int.  Thus some illegal values
    may be let through and cause problems in later code.

    [ They actually *don't* cause problems in mainline, as of Dave Jones's
      commit 8d657eb3b438 "Remove easily user-triggerable BUG from
      generic_setlease", but we should fix this anyway.  And this patch will
      be necessary to fix real bugs on earlier kernels. ]

    Signed-off-by: J. Bruce Fields <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit f58f16f2039cca9dc58a406593e5f46c6a35e0df
Author: Kevin Cernekee <[email protected]>
Date:   Sun Jun 24 21:11:22 2012 -0700

    usb: gadget: Fix g_ether interface link status

    commit 31bde1ceaa873bcaecd49e829bfabceacc4c512d upstream.

    A "usb0" interface that has never been connected to a host has an unknown
    operstate, and therefore the IFF_RUNNING flag is (incorrectly) asserted
    when queried by ifconfig, ifplugd, etc.  This is a result of calling
    netif_carrier_off() too early in the probe function; it should be called
    after register_netdev().

    Similar problems have been fixed in many other drivers, e.g.:

        e826eafa6 (bonding: Call netif_carrier_off after register_netdevice)
        0d672e9f8 (drivers/net: Call netif_carrier_off at the end of the probe)
        6a3c869a6 (cxgb4: fix reported state of interfaces without link)

    Fix is to move netif_carrier_off() to the end of the function.

    Signed-off-by: Kevin Cernekee <[email protected]>
    Signed-off-by: Felipe Balbi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a0f7a5ac6e752612427077b2c04db1e0ae720a66
Author: Hans de Goede <[email protected]>
Date:   Wed Jul 4 09:18:01 2012 +0200

    usbdevfs: Correct amount of data copied to user in processcompl_compat

    commit 2102e06a5f2e414694921f23591f072a5ba7db9f upstream.

    iso data buffers may have holes in them if some packets were short, so for
    iso urbs we should always copy the entire buffer, just like the regular
    processcompl does.

    Signed-off-by: Hans de Goede <[email protected]>
    Acked-by: Alan Stern <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c6c3f3ff6c89fdd50ac44ed7787141d8a50b79de
Author: David Henningsson <[email protected]>
Date:   Wed Jul 18 07:38:46 2012 +0200

    ALSA: hda - Add support for Realtek ALC282

    commit 4e01ec636e64707d202a1ca21a47bbc6d53085b7 upstream.

    This codec has a separate dmic path (separate dmic only ADC),
    and thus it looks mostly like ALC275.

    BugLink: https://bugs.launchpad.net/bugs/1025377
    Tested-by: Ray Chen <[email protected]>
    Signed-off-by: David Henningsson <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c3d6a03a5702fb0971109d235dd3c74a5bd08248
Author: Nishanth Menon <[email protected]>
Date:   Fri May 18 12:26:19 2012 -0500

    ARM: OMAP2+: OPP: Fix to ensure check of right oppdef after bad one

    commit b110547e586eb5825bc1d04aa9147bff83b57672 upstream.

    Commit 9fa2df6b90786301b175e264f5fa9846aba81a65
    (ARM: OMAP2+: OPP: allow OPP enumeration to continue if device is not present)
    makes the logic:
    for (i = 0; i < opp_def_size; i++) {
    	<snip>
    	if (!oh || !oh->od) {
    		<snip>
    		continue;
    	}
    <snip>
    opp_def++;
    }

    In short, the moment we hit a "Bad OPP", we end up looping the list
    comparing against the bad opp definition pointer for the rest of the
    iteration count. Instead, increment opp_def in the for loop itself
    and allow continue to be used in code without much thought so that
    we check the next set of OPP definition pointers :)

    Cc: Steve Sakoman <[email protected]>
    Cc: Tony Lindgren <[email protected]>
    Signed-off-by: Nishanth Menon <[email protected]>
    Signed-off-by: Kevin Hilman <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 8add44b313360a3940e6734b96c636c8c8edc5f8
Author: Bart Van Assche <[email protected]>
Date:   Fri Jun 29 15:34:26 2012 +0000

    SCSI: Avoid dangling pointer in scsi_requeue_command()

    commit 940f5d47e2f2e1fa00443921a0abf4822335b54d upstream.

    When we call scsi_unprep_request() the command associated with the request
    gets destroyed and therefore drops its reference on the device.  If this was
    the only reference, the device may get released and we end up with a NULL
    pointer deref when we call blk_requeue_request.

    Reported-by: Mike Christie <[email protected]>
    Signed-off-by: Bart Van Assche <[email protected]>
    Reviewed-by: Mike Christie <[email protected]>
    Reviewed-by: Tejun Heo <[email protected]>
    [jejb: enhance commend and add commit log for stable]
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 8fff2f802f32cbb0ed253117cc01586762c22ae9
Author: Dan Williams <[email protected]>
Date:   Thu Jun 21 23:47:28 2012 -0700

    SCSI: fix hot unplug vs async scan race

    commit 3b661a92e869ebe2358de8f4b3230ad84f7fce51 upstream.

    The following crash results from cases where the end_device has been
    removed before scsi_sysfs_add_sdev has had a chance to run.

     BUG: unable to handle kernel NULL pointer dereference at 0000000000000098
     IP: [<ffffffff8115e100>] sysfs_create_dir+0x32/0xb6
     ...
     Call Trace:
      [<ffffffff8125e4a8>] kobject_add_internal+0x120/0x1e3
      [<ffffffff81075149>] ? trace_hardirqs_on+0xd/0xf
      [<ffffffff8125e641>] kobject_add_varg+0x41/0x50
      [<ffffffff8125e70b>] kobject_add+0x64/0x66
      [<ffffffff8131122b>] device_add+0x12d/0x63a
      [<ffffffff814b65ea>] ? _raw_spin_unlock_irqrestore+0x47/0x56
      [<ffffffff8107de15>] ? module_refcount+0x89/0xa0
      [<ffffffff8132f348>] scsi_sysfs_add_sdev+0x4e/0x28a
      [<ffffffff8132dcbb>] do_scan_async+0x9c/0x145

    ...teach scsi_sysfs_add_devices() to check for deleted devices() before
    trying to add them, and teach scsi_remove_target() how to remove targets
    that have not been added via device_add().

    Reported-by: Dariusz Majchrzak <[email protected]>
    Signed-off-by: Dan Williams <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit bd9afacc545006fac0136c42783bdad0688e9165
Author: Dan Williams <[email protected]>
Date:   Thu Jun 21 23:25:32 2012 -0700

    SCSI: fix eh wakeup (scsi_schedule_eh vs scsi_restart_operations)

    commit 57fc2e335fd3c2f898ee73570dc81426c28dc7b4 upstream.

    Rapid ata hotplug on a libsas controller results in cases where libsas
    is waiting indefinitely on eh to perform an ata probe.

    A race exists between scsi_schedule_eh() and scsi_restart_operations()
    in the case when scsi_restart_operations() issues i/o to other devices
    in the sas domain.  When this happens the host state transitions from
    SHOST_RECOVERY (set by scsi_schedule_eh) back to SHOST_RUNNING and
    ->host_busy is non-zero so we put the eh thread to sleep even though
    ->host_eh_scheduled is active.

    Before putting the error handler to sleep we need to check if the
    host_state needs to return to SHOST_RECOVERY for another trip through
    eh.  Since i/o that is released by scsi_restart_operations has been
    blocked for at least one eh cycle, this implementation allows those
    i/o's to run before another eh cycle starts to discourage hung task
    timeouts.

    Reported-by: Tom Jackson <[email protected]>
    Tested-by: Tom Jackson <[email protected]>
    Signed-off-by: Dan Williams <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 3f67ec4b517d985ac6961a1a03f91339e62657c0
Author: Dan Williams <[email protected]>
Date:   Thu Jun 21 23:36:20 2012 -0700

    SCSI: libsas: fix sas_discover_devices return code handling

    commit b17caa174a7e1fd2e17b26e210d4ee91c4c28b37 upstream.

    commit 198439e4 [SCSI] libsas: do not set res = 0 in sas_ex_discover_dev()
    commit 19252de6 [SCSI] libsas: fix wide port hotplug issues

    The above commits seem to have confused the return value of
    sas_ex_discover_dev which is non-zero on failure and
    sas_ex_join_wide_port which just indicates short circuiting discovery on
    already established ports.  The result is random discovery failures
    depending on configuration.

    Calls to sas_ex_join_wide_port are the source of the trouble as its
    return value is errantly assigned to 'res'.  Convert it to bool and stop
    returning its result up the stack.

    Tested-by: Dan Melnic <[email protected]>
    Reported-by: Dan Melnic <[email protected]>
    Signed-off-by: Dan Williams <[email protected]>
    Reviewed-by: Jack Wang <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 2da74cd8a6bad64d02207396c76d0939f3c57aaa
Author: Dan Williams <[email protected]>
Date:   Thu Jun 21 23:36:15 2012 -0700

    SCSI: libsas: continue revalidation

    commit 26f2f199ff150d8876b2641c41e60d1c92d2fb81 upstream.

    Continue running revalidation until no more broadcast devices are
    discovered.  Fixes cases where re-discovery completes too early in a
    domain with multiple expanders with pending re-discovery events.
    Servicing BCNs can get backed up behind error recovery.

    Signed-off-by: Dan Williams <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c43386c06d5d73a9b3a8604226b1e32d85a4c384
Author: Andreas Schwab <[email protected]>
Date:   Fri Dec 9 11:35:08 2011 +0000

    powerpc: Fix wrong divisor in usecs_to_cputime

    commit 9f5072d4f63f28d30d343573830ac6c85fc0deff upstream.

    Commit d57af9b (taskstats: use real microsecond granularity for CPU times)
    renamed msecs_to_cputime to usecs_to_cputime, but failed to update all
    numbers on the way.  This causes nonsensical cpu idle/iowait values to be
    displayed in /proc/stat (the only user of usecs_to_cputime so far).

    This also renames __cputime_msec_factor to __cputime_usec_factor, adapting
    its value and using it directly in cputime_to_usecs instead of doing two
    multiplications.

    Signed-off-by: Andreas Schwab <[email protected]>
    Acked-by: Anton Blanchard <[email protected]>
    Signed-off-by: Benjamin Herrenschmidt <[email protected]>
    Cc: Michal Hocko <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 93487ce8d6edc7c550b1449770df5e44715f520f
Author: Tiejun Chen <[email protected]>
Date:   Wed Jul 11 14:22:46 2012 +1000

    powerpc: Add "memory" attribute for mfmsr()

    commit b416c9a10baae6a177b4f9ee858b8d309542fbef upstream.

    Add "memory" attribute in inline assembly language as a compiler
    barrier to make sure 4.6.x GCC don't reorder mfmsr().

    Signed-off-by: Tiejun Chen <[email protected]>
    Signed-off-by: Benjamin Herrenschmidt <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a8ed5765b5a8bf44a86284d80afd24f37a23e369
Author: roger blofeld <[email protected]>
Date:   Thu Jun 21 05:27:14 2012 +0000

    powerpc/ftrace: Fix assembly trampoline register usage

    commit fd5a42980e1cf327b7240adf5e7b51ea41c23437 upstream.

    Just like the module loader, ftrace needs to be updated to use r12
    instead of r11 with newer gcc's.

    Signed-off-by: Roger Blofeld <[email protected]>
    Signed-off-by: Benjamin Herrenschmidt <[email protected]>
    Signed-off-by: Paul Gortmaker <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 4067ad7b53cd5ba2699286620a2c645bb56542fa
Author: Daniel Drake <[email protected]>
Date:   Tue Jul 3 23:13:39 2012 +0100

    mmc: sdhci-pci: CaFe has broken card detection

    commit 55fc05b7414274f17795cd0e8a3b1546f3649d5e upstream.

    At http://dev.laptop.org/ticket/11980 we have determined that the
    Marvell CaFe SDHCI controller reports bad card presence during
    resume. It reports that no card is present even when it is.
    This is a regression -- resume worked back around 2.6.37.

    Around 400ms after resuming, a "card inserted" interrupt is
    generated, at which point it starts reporting presence.

    Work around this hardware oddity by setting the
    SDHCI_QUIRK_BROKEN_CARD_DETECTION flag.
    Thanks to Chris Ball for helping with diagnosis.

    Signed-off-by: Daniel Drake <[email protected]>
    Signed-off-by: Chris Ball <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
Mustaavalkosta referenced this issue in Mustaavalkosta/htc7x30-3.0 Mar 6, 2013
commit 24e842a
Author: Greg Kroah-Hartman <[email protected]>
Date:   Sun Oct 7 08:28:29 2012 -0700

    Linux 3.0.45

commit d71df54
Author: Bart Van Assche <[email protected]>
Date:   Fri Aug 24 09:08:41 2012 +0000

    SCSI: scsi_dh_alua: Enable STPG for unavailable ports

    commit e47f897 upstream.

    A quote from SPC-4: "While in the unavailable primary target port
    asymmetric access state, the device server shall support those of
    the following commands that it supports while in the active/optimized
    state: [ ... ] d) SET TARGET PORT GROUPS; [ ... ]". Hence enable
    sending STPG to a target port group that is in the unavailable state.

    Signed-off-by: Bart Van Assche <[email protected]>
    Reviewed-by: Mike Christie <[email protected]>
    Acked-by: Hannes Reinecke <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 8fda079
Author: Dan Williams <[email protected]>
Date:   Tue Aug 28 22:12:10 2012 -0700

    SCSI: scsi_remove_target: fix softlockup regression on hot remove

    commit bc3f02a upstream.

    John reports:
     BUG: soft lockup - CPU#2 stuck for 23s! [kworker/u:8:2202]
     [..]
     Call Trace:
      [<ffffffff8141782a>] scsi_remove_target+0xda/0x1f0
      [<ffffffff81421de5>] sas_rphy_remove+0x55/0x60
      [<ffffffff81421e01>] sas_rphy_delete+0x11/0x20
      [<ffffffff81421e35>] sas_port_delete+0x25/0x160
      [<ffffffff814549a3>] mptsas_del_end_device+0x183/0x270

    ...introduced by commit 3b661a9 "[SCSI] fix hot unplug vs async scan race".

    Don't restart lookup of more stargets in the multi-target case, just
    arrange to traverse the list once, on the assumption that new targets
    are always added at the end.  There is no guarantee that the target will
    change state in scsi_target_reap() so we can end up spinning if we
    restart.

    Acked-by: Jack Wang <[email protected]>
    LKML-Reference: <CAEhu1-6wq1YsNiscGMwP4ud0Q+MrViRzv=kcWCQSBNc8c68N5Q@mail.gmail.com>
    Reported-by: John Drescher <[email protected]>
    Tested-by: John Drescher <[email protected]>
    Signed-off-by: Dan Williams <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit fc3ef18
Author: Yinghai Lu <[email protected]>
Date:   Mon Jul 25 13:08:38 2011 -0700

    PCI: honor child buses add_size in hot plug configuration

    commit be76891 upstream.

    git commit c8adf9a
        "PCI: pre-allocate additional resources to devices only after
    	successful allocation of essential resources."

    fails to take into consideration the optional-resources needed by children
    devices while calculating the optional-resource needed by the bridge.

    This can be a problem on some setup. For example, if a hotplug bridge has 8
    children hotplug bridges, the bridge should have enough resources to accomodate
    the hotplug requirements for each of its children hotplug bridges.  Currently
    this is not the case.

    This patch fixes the problem.

    Signed-off-by: Yinghai Lu <[email protected]>
    Reviewed-by: Ram Pai <[email protected]>
    Signed-off-by: Jesse Barnes <[email protected]>
    Cc: Andrew Worsley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 368d531
Author: Avi Kivity <[email protected]>
Date:   Wed Aug 22 13:03:48 2012 +0300

    x86/alternatives: Fix p6 nops on non-modular kernels

    commit cb09cad upstream.

    Probably a leftover from the early days of self-patching, p6nops
    are marked __initconst_or_module, which causes them to be
    discarded in a non-modular kernel.  If something later triggers
    patching, it will overwrite kernel code with garbage.

    Reported-by: Tomas Racek <[email protected]>
    Signed-off-by: Avi Kivity <[email protected]>
    Cc: Michael Tokarev <[email protected]>
    Cc: Borislav Petkov <[email protected]>
    Cc: Marcelo Tosatti <[email protected]>
    Cc: [email protected]
    Cc: Anthony Liguori <[email protected]>
    Cc: H. Peter Anvin <[email protected]>
    Cc: Alan Cox <[email protected]>
    Cc: Alan Cox <[email protected]>
    Link: http://lkml.kernel.org/r/[email protected]
    Signed-off-by: Ingo Molnar <[email protected]>
    Cc: Ben Jencks <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 42cc576
Author: Dan Williams <[email protected]>
Date:   Fri Jun 22 11:31:14 2012 -0700

    isci: fix isci_pci_probe() generates warning on efi failure path

    commit 6d70a74 upstream.

    The oem parameter image embedded in the efi variable is at an offset
    from the start of the variable.  However, in the failure path we try to
    free the 'orom' pointer which is only valid when the paramaters are
    being read from the legacy option-rom space.

    Since failure to load the oem parameters is unlikely and we keep the
    memory around in the success case just defer all de-allocation to devm.

    Reported-by: Don Morris <[email protected]>
    Signed-off-by: Dan Williams <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7385895
Author: Bart Van Assche <[email protected]>
Date:   Fri Aug 24 10:29:11 2012 +0000

    IB/srp: Avoid having aborted requests hang

    commit d853667 upstream.

    We need to call scsi_done() for commands after we abort them.

    Signed-off-by: Bart Van Assche <[email protected]>
    Acked-by: David Dillow <[email protected]>
    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7846edb
Author: Bart Van Assche <[email protected]>
Date:   Fri Aug 24 10:27:54 2012 +0000

    IB/srp: Fix use-after-free in srp_reset_req()

    commit 9b796d0 upstream.

    srp_free_req() uses the scsi_cmnd structure contents to unmap
    buffers, so we must invoke srp_free_req() before we release
    ownership of that structure.

    Signed-off-by: Bart Van Assche <[email protected]>
    Acked-by: David Dillow <[email protected]>
    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 0a44207
Author: Patrick McHardy <[email protected]>
Date:   Thu Aug 30 07:01:30 2012 +0000

    IPoIB: Fix use-after-free of multicast object

    commit bea1e22 upstream.

    Fix a crash in ipoib_mcast_join_task().  (with help from Or Gerlitz)

    Commit c8c2afe ("IPoIB: Use rtnl lock/unlock when changing device
    flags") added a call to rtnl_lock() in ipoib_mcast_join_task(), which
    is run from the ipoib_workqueue, and hence the workqueue can't be
    flushed from the context of ipoib_stop().

    In the current code, ipoib_stop() (which doesn't flush the workqueue)
    calls ipoib_mcast_dev_flush(), which goes and deletes all the
    multicast entries.  This takes place without any synchronization with
    a possible running instance of ipoib_mcast_join_task() for the same
    ipoib device, leading to a crash due to NULL pointer dereference.

    Fix this by making sure that the workqueue is flushed before
    ipoib_mcast_dev_flush() is called.  To make that possible, we move the
    RTNL-lock wrapped code to ipoib_mcast_join_finish().

    Signed-off-by: Patrick McHardy <[email protected]>
    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d125a7e
Author: Wei Yongjun <[email protected]>
Date:   Fri Sep 21 15:09:47 2012 +0800

    can: mscan-mpc5xxx: fix return value check in mpc512x_can_get_clock()

    commit f61bd05 upstream.

    In case of error, the function clk_get() returns ERR_PTR()
    and never returns NULL pointer. The NULL test in the error
    handling should be replaced with IS_ERR().

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

    Signed-off-by: Wei Yongjun <[email protected]>
    Acked-by: Wolfgang Grandegger <[email protected]>
    Signed-off-by: Marc Kleine-Budde <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c07ad5e
Author: Stephen M. Cameron <[email protected]>
Date:   Thu Jul 26 11:34:10 2012 -0500

    SCSI: hpsa: Use LUN reset instead of target reset

    commit 21e89af upstream.

    It turns out Smart Array logical drives do not support target
    reset and when the target reset fails, the logical drive will
    be taken off line.  Symptoms look like this:

    hpsa 0000:03:00.0: Abort request on C1:B0:T0:L0
    hpsa 0000:03:00.0: resetting device 1:0:0:0
    hpsa 0000:03:00.0: cp ffff880037c56000 is reported invalid (probably means target device no longer present)
    hpsa 0000:03:00.0: resetting device failed.
    sd 1:0:0:0: Device offlined - not ready after error recovery
    sd 1:0:0:0: rejecting I/O to offline device
    EXT3-fs error (device sdb1): read_block_bitmap:

    LUN reset is supported though, and is what we should be using.
    Target reset is also disruptive in shared SAS situations,
    for example, an external MSA1210m which does support target
    reset attached to Smart Arrays in multiple hosts -- a target
    reset from one host is disruptive to other hosts as all LUNs
    on the target will be reset and will abort all outstanding i/os
    back to all the attached hosts.  So we should use LUN reset,
    not target reset.

    Tested this with Smart Array logical drives and with tape drives.
    Not sure how this bug survived since 2009, except it must be very
    rare for a Smart Array to require more than 30s to complete a request.

    Signed-off-by: Stephen M. Cameron <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a3b1f83
Author: Benjamin Herrenschmidt <[email protected]>
Date:   Mon Jul 30 11:33:05 2012 +1000

    SCSI: ibmvscsi: Fix host config length field overflow

    commit 225c569 upstream.

    The length field in the host config packet is only 16-bit long, so
    passing it 0x10000 (64K which is our standard PAGE_SIZE) doesn't
    work and result in an empty config from the server.

    Signed-off-by: Benjamin Herrenschmidt <[email protected]>
    Acked-by: Robert Jennings <[email protected]>
    Signed-off-by: James Bottomley <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 079c1ed
Author: Artem Bityutskiy <[email protected]>
Date:   Sat Aug 18 14:11:42 2012 +0200

    UBI: fix autoresize handling in R/O mode

    commit abb3e01 upstream.

    Currently UBI fails in autoresize when it is in R/O mode (e.g., because the
    underlying MTD device is R/O). This patch fixes the issue - we just skip
    autoresize and print a warning.

    Reported-by: Pali Rohár <[email protected]>
    Signed-off-by: Artem Bityutskiy <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e54195a
Author: Russ Gorby <[email protected]>
Date:   Mon Aug 13 13:45:30 2012 +0100

    n_gsm: memory leak in uplink error path

    commit 88ed2a6 upstream.

    Uplink (TX) network data will go through gsm_dlci_data_output_framed
    there is a bug where if memory allocation fails, the skb which
    has already been pulled off the list will be lost.

    In addition TX skbs were being processed in LIFO order

    Fixed the memory leak, and changed to FIFO order processing

    Signed-off-by: Russ Gorby <[email protected]>
    Tested-by: Kappel, LaurentX <[email protected]>
    Signed-off-by: Alan Cox <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a4e92d2
Author: Michael Spang <[email protected]>
Date:   Fri Sep 14 13:05:49 2012 -0400

    Increase XHCI suspend timeout to 16ms

    commit a6e097d upstream.

    The Intel XHCI specification says that after clearing the run/stop bit
    the controller may take up to 16ms to halt. We've seen a device take
    14ms, which with the current timeout of 10ms causes the kernel to
    abort the suspend. Increasing the timeout to the recommended value
    fixes the problem.

    This patch should be backported to kernels as old as 2.6.37, that
    contain the commit 5535b1d "USB: xHCI:
    PCI power management implementation".

    Signed-off-by: Michael Spang <[email protected]>
    Signed-off-by: Sarah Sharp <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7c36d46
Author: Denys Vlasenko <[email protected]>
Date:   Wed Sep 26 11:34:50 2012 +1000

    coredump: prevent double-free on an error path in core dumper

    commit f34f9d1 upstream.

    In !CORE_DUMP_USE_REGSET case, if elf_note_info_init fails to allocate
    memory for info->fields, it frees already allocated stuff and returns
    error to its caller, fill_note_info.  Which in turn returns error to its
    caller, elf_core_dump.  Which jumps to cleanup label and calls
    free_note_info, which will happily try to free all info->fields again.
    BOOM.

    This is the fix.

    Signed-off-by: Oleg Nesterov <[email protected]>
    Signed-off-by: Denys Vlasenko <[email protected]>
    Cc: Venu Byravarasu <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 9ce5f86
Author: Russ Gorby <[email protected]>
Date:   Mon Aug 13 13:44:40 2012 +0100

    n_gsm: added interlocking for gsm_data_lock for certain code paths

    commit 5e44708 upstream.

    There were some locking holes in the management of the MUX's
    message queue for 2 code paths:
    1) gsmld_write_wakeup
    2) receipt of CMD_FCON flow-control message
    In both cases gsm_data_kick is called w/o locking so it can collide
    with other other instances of gsm_data_kick (pulling messages tx_tail)
    or potentially other instances of __gsm_data_queu (adding messages to tx_head)

    Changed to take the tx_lock in these 2 cases

    Signed-off-by: Russ Gorby <[email protected]>
    Tested-by: Yin, Fengwei <[email protected]>
    Signed-off-by: Alan Cox <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 9c1ce83
Author: Sarah Sharp <[email protected]>
Date:   Wed Sep 19 16:27:26 2012 -0700

    xhci: Intel Panther Point BEI quirk.

    commit 80fab3b upstream.

    When a device with an isochronous endpoint is behind a hub plugged into
    the Intel Panther Point xHCI host controller, and the driver submits
    multiple frames per URB, the xHCI driver will set the Block Event
    Interrupt (BEI) flag on all but the last TD for the URB.  This causes
    the host controller to place an event on the event ring, but not send an
    interrupt.  When the last TD for the URB completes, BEI is cleared, and
    we get an interrupt for the whole URB.

    However, under a Panther Point xHCI host controller, if the parent hub
    is unplugged when one or more events from transfers with BEI set are on
    the event ring, a port status change event is placed on the event ring,
    but no interrupt is generated.  This means URBs stop completing, and the
    USB device disconnect is not noticed.  Something like a USB headset will
    cause mplayer to hang when the device is disconnected.

    If another transfer is sent (such as running `sudo lsusb -v`), the next
    transfer event seems to "unstick" the event ring, the xHCI driver gets
    an interrupt, and the disconnect is reported to the USB core.

    The fix is not to use the BEI flag under the Panther Point xHCI host.
    This will impact power consumption and system responsiveness, because
    the xHCI driver will receive an interrupt for every frame in all
    isochronous URBs instead of once per URB.

    Intel chipset developers confirm that this bug will be hit if the BEI
    flag is used on any endpoint, not just ones that are behind a hub.

    This patch should be backported to kernels as old as 3.0, that contain
    the commit 69e848c "Intel xhci: Support
    EHCI/xHCI port switching."

    Signed-off-by: Sarah Sharp <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c19d52a
Author: Khalid Aziz <[email protected]>
Date:   Mon Sep 10 12:52:42 2012 -0600

    firmware: Add missing attributes to EFI variable attribute print out from sysfs

    commit 7083909 upstream.

    Some of the EFI variable attributes are missing from print out from
    /sys/firmware/efi/vars/*/attributes. This patch adds those in. It also
    updates code to use pre-defined constants for masking current value
    of attributes.

    Signed-off-by: Khalid Aziz <[email protected]>
    Reviewed-by: Kees Cook <[email protected]>
    Acked-by: Matthew Garrett <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit f39a3e8
Author: Larry Finger <[email protected]>
Date:   Wed Sep 26 12:32:02 2012 -0500

    b43legacy: Fix crash on unload when firmware not available

    commit 2d838bb upstream.

    When b43legacy is loaded without the firmware being available, a following
    unload generates a kernel NULL pointer dereference BUG as follows:

    [  214.330789] BUG: unable to handle kernel NULL pointer dereference at 0000004c
    [  214.330997] IP: [<c104c395>] drain_workqueue+0x15/0x170
    [  214.331179] *pde = 00000000
    [  214.331311] Oops: 0000 [#1] SMP
    [  214.331471] Modules linked in: b43legacy(-) ssb pcmcia mac80211 cfg80211 af_packet mperf arc4 ppdev sr_mod cdrom sg shpchp yenta_socket pcmcia_rsrc pci_hotplug pcmcia_core battery parport_pc parport floppy container ac button edd autofs4 ohci_hcd ehci_hcd usbcore usb_common thermal processor scsi_dh_rdac scsi_dh_hp_sw scsi_dh_emc scsi_dh_alua scsi_dh fan thermal_sys hwmon ata_generic pata_ali libata [last unloaded: cfg80211]
    [  214.333421] Pid: 3639, comm: modprobe Not tainted 3.6.0-rc6-wl+ #163 Source Technology VIC 9921/ALI Based Notebook
    [  214.333580] EIP: 0060:[<c104c395>] EFLAGS: 00010246 CPU: 0
    [  214.333687] EIP is at drain_workqueue+0x15/0x170
    [  214.333788] EAX: c162ac40 EBX: cdfb8360 ECX: 0000002a EDX: 00002a2a
    [  214.333890] ESI: 00000000 EDI: 00000000 EBP: cd767e7c ESP: cd767e5c
    [  214.333957]  DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
    [  214.333957] CR0: 8005003b CR2: 0000004c CR3: 0c96a000 CR4: 00000090
    [  214.333957] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
    [  214.333957] DR6: ffff0ff0 DR7: 00000400
    [  214.333957] Process modprobe (pid: 3639, ti=cd766000 task=cf802e90 task.ti=cd766000)
    [  214.333957] Stack:
    [  214.333957]  00000292 cd767e74 c12c5e09 00000296 00000296 cdfb8360 cdfb9220 00000000
    [  214.333957]  cd767e90 c104c4fd cdfb8360 cdfb9220 cd682800 cd767ea4 d0c10184 cd682800
    [  214.333957]  cd767ea4 cba31064 cd767eb8 d0867908 cba31064 d087e09c cd96f034 cd767ec4
    [  214.333957] Call Trace:
    [  214.333957]  [<c12c5e09>] ? skb_dequeue+0x49/0x60
    [  214.333957]  [<c104c4fd>] destroy_workqueue+0xd/0x150
    [  214.333957]  [<d0c10184>] ieee80211_unregister_hw+0xc4/0x100 [mac80211]
    [  214.333957]  [<d0867908>] b43legacy_remove+0x78/0x80 [b43legacy]
    [  214.333957]  [<d083654d>] ssb_device_remove+0x1d/0x30 [ssb]
    [  214.333957]  [<c126f15a>] __device_release_driver+0x5a/0xb0
    [  214.333957]  [<c126fb07>] driver_detach+0x87/0x90
    [  214.333957]  [<c126ef4c>] bus_remove_driver+0x6c/0xe0
    [  214.333957]  [<c1270120>] driver_unregister+0x40/0x70
    [  214.333957]  [<d083686b>] ssb_driver_unregister+0xb/0x10 [ssb]
    [  214.333957]  [<d087c488>] b43legacy_exit+0xd/0xf [b43legacy]
    [  214.333957]  [<c1089dde>] sys_delete_module+0x14e/0x2b0
    [  214.333957]  [<c110a4a7>] ? vfs_write+0xf7/0x150
    [  214.333957]  [<c1240050>] ? tty_write_lock+0x50/0x50
    [  214.333957]  [<c110a6f8>] ? sys_write+0x38/0x70
    [  214.333957]  [<c1397c55>] syscall_call+0x7/0xb
    [  214.333957] Code: bc 27 00 00 00 00 a1 74 61 56 c1 55 89 e5 e8 a3 fc ff ff 5d c3 90 55 89 e5 57 56 89 c6 53 b8 40 ac 62 c1 83 ec 14 e8 bb b7 34 00 <8b> 46 4c 8d 50 01 85 c0 89 56 4c 75 03 83 0e 40 80 05 40 ac 62
    [  214.333957] EIP: [<c104c395>] drain_workqueue+0x15/0x170 SS:ESP 0068:cd767e5c
    [  214.333957] CR2: 000000000000004c
    [  214.341110] ---[ end trace c7e90ec026d875a6 ]---Index: wireless-testing/drivers/net/wireless/b43legacy/main.c

    The problem is fixed by making certain that the ucode pointer is not NULL
    before deregistering the driver in mac80211.

    Signed-off-by: Larry Finger <[email protected]>
    Signed-off-by: John W. Linville <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d482e8f
Author: Flavio Leitner <[email protected]>
Date:   Fri Sep 21 21:04:34 2012 -0300

    serial: set correct baud_base for EXSYS EX-41092 Dual 16950

    commit 26e8220 upstream.

    Apparently the same card model has two IDs, so this patch
    complements the commit 39aced6
    adding the missing one.

    Signed-off-by: Flavio Leitner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit f580d51
Author: Linus Walleij <[email protected]>
Date:   Wed Sep 26 17:21:36 2012 +0200

    serial: pl011: handle corruption at high clock speeds

    commit c5dd553 upstream.

    This works around a few glitches in the ST version of the PL011
    serial driver when using very high baud rates, as we do in the
    Ux500: 3, 3.25, 4 and 4.05 Mbps.

    Problem Observed/rootcause:

    When using high baud-rates, and the baudrate*8 is getting close to
    the provided clock frequency (so a division factor close to 1), when
    using bursts of characters (so they are abutted), then it seems as if
    there is not enough time to detect the beginning of the start-bit which
    is a timing reference for the entire character, and thus the sampling
    moment of character bits is moving towards the end of each bit, instead
    of the middle.

    Fix:
    Increase slightly the RX baud rate of the UART above the theoretical
    baudrate by 5%. This will definitely give more margin time to the
    UART_RX to correctly sample the data at the middle of the bit period.

    Also fix the ages old copy-paste error in the very stressed comment,
    it's referencing the registers used in the PL010 driver rather than
    the PL011 ones.

    Signed-off-by: Guillaume Jaunet <[email protected]>
    Signed-off-by: Christophe Arnal <[email protected]>
    Signed-off-by: Matthias Locher <[email protected]>
    Signed-off-by: Rajanikanth HV <[email protected]>
    Cc: Bibek Basu <[email protected]>
    Cc: Par-Gunnar Hjalmdahl <[email protected]>
    Signed-off-by: Linus Walleij <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 63959b0
Author: Jiri Slaby <[email protected]>
Date:   Tue Aug 7 21:47:39 2012 +0200

    TTY: ttyprintk, don't touch behind tty->write_buf

    commit ee8b593 upstream.

    If a user provides a buffer larger than a tty->write_buf chunk and
    passes '\r' at the end of the buffer, we touch an out-of-bound memory.

    Add a check there to prevent this.

    Signed-off-by: Jiri Slaby <[email protected]>
    Cc: Samo Pogacnik <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 0950902
Author: Stanislav Kozina <[email protected]>
Date:   Thu Aug 16 12:01:47 2012 +0100

    Remove BUG_ON from n_tty_read()

    commit e9490e9 upstream.

    Change the BUG_ON to WARN_ON and return in case of tty->read_buf==NULL. We want to track a
    couple of long standing reports of this but at the same time we can avoid killing the box.

    Signed-off-by: Stanislav Kozina <[email protected]>
    Signed-off-by: Alan Cox <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 8455d77
Author: Ian Abbott <[email protected]>
Date:   Wed Sep 19 19:37:39 2012 +0100

    staging: comedi: fix memory leak for saved channel list

    commit c8cad4c upstream.

    When `do_cmd_ioctl()` allocates memory for the kernel copy of a channel
    list, it frees any previously allocated channel list in
    `async->cmd.chanlist` and replaces it with the new one.  However, if the
    device is ever removed (or "detached") the cleanup code in
    `cleanup_device()` in "drivers.c" does not free this memory so it is
    lost.

    A sensible place to free the kernel copy of the channel list is in
    `do_become_nonbusy()` as at that point the comedi asynchronous command
    associated with the channel list is no longer valid.  Free the channel
    list in `do_become_nonbusy()` instead of `do_cmd_ioctl()` and clear the
    pointer to prevent it being freed more than once.

    Note that `cleanup_device()` could be called at an inappropriate time
    while the comedi device is open, but that's a separate bug not related
    to this this patch.

    Signed-off-by: Ian Abbott <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 03acba6
Author: Ian Abbott <[email protected]>
Date:   Tue Sep 18 19:46:58 2012 +0100

    staging: comedi: don't dereference user memory for INSN_INTTRIG

    commit 5d06e3d upstream.

    `parse_insn()` is dereferencing the user-space pointer `insn->data`
    directly when handling the `INSN_INTTRIG` comedi instruction.  It
    shouldn't be using `insn->data` at all; it should be using the separate
    `data` pointer passed to the function.  Fix it.

    Signed-off-by: Ian Abbott <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e451b6d
Author: Ian Abbott <[email protected]>
Date:   Thu Sep 27 17:45:27 2012 +0100

    staging: comedi: jr3_pci: fix iomem dereference

    commit e187895 upstream.

    Correct a direct dereference of I/O memory to use an appropriate I/O
    memory access function.  Note that the pointer being dereferenced is not
    currently tagged with `__iomem` but I plan to correct that for 3.7.

    Signed-off-by: Ian Abbott <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 99f7fee
Author: Ian Abbott <[email protected]>
Date:   Mon Sep 24 17:20:52 2012 +0100

    staging: comedi: s626: don't dereference insn->data

    commit b655c2c upstream.

    `s626_enc_insn_config()` is incorrectly dereferencing `insn->data` which
    is a pointer to user memory.  It should be dereferencing the separate
    `data` parameter that points to a copy of the data in kernel memory.

    Signed-off-by: Ian Abbott <[email protected]>
    Reviewed-by: H Hartley Sweeten <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit bf26fa2
Author: Ben Hutchings <[email protected]>
Date:   Sun Sep 16 04:18:50 2012 +0100

    staging: speakup_soft: Fix reading of init string

    commit 40fe4f8 upstream.

    softsynth_read() reads a character at a time from the init string;
    when it finds the null terminator it sets the initialized flag but
    then repeats the last character.

    Additionally, if the read() buffer is not big enough for the init
    string, the next read() will start reading from the beginning again.
    So the caller may never progress to reading anything else.

    Replace the simple initialized flag with the current position in
    the init string, carried over between calls.  Switch to reading
    real data once this reaches the null terminator.

    (This assumes that the length of the init string can't change, which
    seems to be the case.  Really, the string and position belong together
    in a per-file private struct.)

    Tested-by: Samuel Thibault <[email protected]>
    Signed-off-by: Ben Hutchings <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit bd6a0fa
Author: Bjørn Mork <[email protected]>
Date:   Wed Sep 19 22:02:03 2012 +0200

    USB: qcaux: add Pantech vendor class match

    commit c638eb2 upstream.

    The three Pantech devices UML190 (106c:3716), UML290 (106c:3718) and
    P4200 (106c:3721) all use the same subclasses to identify vendor
    specific functions.  Replace the existing device specific entries
    with generic vendor matching, adding support for the P4200.

    Signed-off-by: Bjørn Mork <[email protected]>
    Cc: Thomas Schäfer <[email protected]>
    Acked-by: Dan Williams <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 3f72cbc
Author: Antonio Ospite <[email protected]>
Date:   Sun Sep 23 09:57:25 2012 +0200

    USB: ftdi_sio: add TIAO USB Multi-Protocol Adapter (TUMPA) support

    commit 54575b0 upstream.

    TIAO/DIYGADGET USB Multi-Protocol Adapter (TUMPA) is an FTDI FT2232H
    based device which provides an easily accessible JTAG, SPI, I2C, serial
    breakout.

    http://www.diygadget.com/tiao-usb-multi-protocol-adapter-jtag-spi-i2c-serial.html
    http://www.tiaowiki.com/w/TIAO_USB_Multi_Protocol_Adapter_User%27s_Manual

    FTDI FT2232H provides two serial channels (A and B), but on the TUMPA
    channel A is dedicated to JTAG/SPI while channel B can be used for
    UART/RS-232: use the ftdi_jtag_quirk to expose only channel B as
    a usb-serial interface to userspace.

    Signed-off-by: Antonio Ospite <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 952c5d8
Author: Bjørn Mork <[email protected]>
Date:   Wed Sep 19 22:02:12 2012 +0200

    USB: option: blacklist QMI interface on ZTE MF683

    commit 160c942 upstream.

    Interface #5 on ZTE MF683 is a QMI/wwan interface.

    Signed-off-by: Bjørn Mork <[email protected]>
    Cc: Shawn J. Goff <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7da444a
Author: Mike Snitzer <[email protected]>
Date:   Wed Sep 26 23:45:42 2012 +0100

    dm: handle requests beyond end of device instead of using BUG_ON

    commit ba1cbad upstream.

    The access beyond the end of device BUG_ON that was introduced to
    dm_request_fn via commit 29e4013 ("dm: implement
    REQ_FLUSH/FUA support for request-based dm") was an overly
    drastic (but simple) response to this situation.

    I have received a report that this BUG_ON was hit and now think
    it would be better to use dm_kill_unmapped_request() to fail the clone
    and original request with -EIO.

    map_request() will assign the valid target returned by
    dm_table_find_target to tio->ti.  But when the target
    isn't valid tio->ti is never assigned (because map_request isn't
    called); so add a check for tio->ti != NULL to dm_done().

    Reported-by: Mike Christie <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Jun'ichi Nomura <[email protected]>
    Signed-off-by: Alasdair G Kergon <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d2212d2
Author: Miklos Szeredi <[email protected]>
Date:   Mon Sep 17 22:23:30 2012 +0200

    vfs: dcache: fix deadlock in tree traversal

    commit 8110e16 upstream.

    IBM reported a deadlock in select_parent().  This was found to be caused
    by taking rename_lock when already locked when restarting the tree
    traversal.

    There are two cases when the traversal needs to be restarted:

     1) concurrent d_move(); this can only happen when not already locked,
        since taking rename_lock protects against concurrent d_move().

     2) racing with final d_put() on child just at the moment of ascending
        to parent; rename_lock doesn't protect against this rare race, so it
        can happen when already locked.

    Because of case 2, we need to be able to handle restarting the traversal
    when rename_lock is already held.  This patch fixes all three callers of
    try_to_ascend().

    IBM reported that the deadlock is gone with this patch.

    [ I rewrote the patch to be smaller and just do the "goto again" if the
      lock was already held, but credit goes to Miklos for the real work.
       - Linus ]

    Signed-off-by: Miklos Szeredi <[email protected]>
    Cc: Al Viro <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
Mustaavalkosta referenced this issue in Mustaavalkosta/htc7x30-3.0 Mar 7, 2013
commit 89d2d13
Author: Greg Kroah-Hartman <[email protected]>
Date:   Sat Nov 17 13:14:48 2012 -0800

    Linux 3.0.52

commit 0933714
Author: Takashi Iwai <[email protected]>
Date:   Tue Nov 13 11:22:48 2012 +0100

    ALSA: usb-audio: Fix mutex deadlock at disconnection

    commit 10e4423 upstream.

    The recent change for USB-audio disconnection race fixes introduced a
    mutex deadlock again.  There is a circular dependency between
    chip->shutdown_rwsem and pcm->open_mutex, depicted like below, when a
    device is opened during the disconnection operation:

    A. snd_usb_audio_disconnect() ->
         card.c::register_mutex ->
           chip->shutdown_rwsem (write) ->
             snd_card_disconnect() ->
               pcm.c::register_mutex ->
                 pcm->open_mutex

    B. snd_pcm_open() ->
         pcm->open_mutex ->
           snd_usb_pcm_open() ->
             chip->shutdown_rwsem (read)

    Since the chip->shutdown_rwsem protection in the case A is required
    only for turning on the chip->shutdown flag and it doesn't have to be
    taken for the whole operation, we can reduce its window in
    snd_usb_audio_disconnect().

    Reported-by: Jiri Slaby <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit aaf238b
Author: Takashi Iwai <[email protected]>
Date:   Thu Nov 8 14:36:18 2012 +0100

    ALSA: Fix card refcount unbalance

    commit 8bb4d9c upstream.

    There are uncovered cases whether the card refcount introduced by the
    commit a0830db isn't properly increased or decreased:
    - OSS PCM and mixer success paths
    - When lookup function gets NULL

    This patch fixes these places.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=50251

    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 919609d
Author: Roland Dreier <[email protected]>
Date:   Wed Jul 20 06:22:21 2011 -0700

    intel-iommu: Fix AB-BA lockdep report

    commit 3e7abe2 upstream.

    When unbinding a device so that I could pass it through to a KVM VM, I
    got the lockdep report below.  It looks like a legitimate lock
    ordering problem:

     - domain_context_mapping_one() takes iommu->lock and calls
       iommu_support_dev_iotlb(), which takes device_domain_lock (inside
       iommu->lock).

     - domain_remove_one_dev_info() starts by taking device_domain_lock
       then takes iommu->lock inside it (near the end of the function).

    So this is the classic AB-BA deadlock.  It looks like a safe fix is to
    simply release device_domain_lock a bit earlier, since as far as I can
    tell, it doesn't protect any of the stuff accessed at the end of
    domain_remove_one_dev_info() anyway.

    BTW, the use of device_domain_lock looks a bit unsafe to me... it's
    at least not obvious to me why we aren't vulnerable to the race below:

      iommu_support_dev_iotlb()
                                              domain_remove_dev_info()

      lock device_domain_lock
        find info
      unlock device_domain_lock

                                              lock device_domain_lock
                                                find same info
                                              unlock device_domain_lock

                                              free_devinfo_mem(info)

      do stuff with info after it's free

    However I don't understand the locking here well enough to know if
    this is a real problem, let alone what the best fix is.

    Anyway here's the full lockdep output that prompted all of this:

         =======================================================
         [ INFO: possible circular locking dependency detected ]
         2.6.39.1+ #1
         -------------------------------------------------------
         bash/13954 is trying to acquire lock:
          (&(&iommu->lock)->rlock){......}, at: [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230

         but task is already holding lock:
          (device_domain_lock){-.-...}, at: [<ffffffff812f6508>] domain_remove_one_dev_info+0x208/0x230

         which lock already depends on the new lock.

         the existing dependency chain (in reverse order) is:

         -> #1 (device_domain_lock){-.-...}:
                [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
                [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
                [<ffffffff812f8350>] domain_context_mapping_one+0x600/0x750
                [<ffffffff812f84df>] domain_context_mapping+0x3f/0x120
                [<ffffffff812f9175>] iommu_prepare_identity_map+0x1c5/0x1e0
                [<ffffffff81ccf1ca>] intel_iommu_init+0x88e/0xb5e
                [<ffffffff81cab204>] pci_iommu_init+0x16/0x41
                [<ffffffff81002165>] do_one_initcall+0x45/0x190
                [<ffffffff81ca3d3f>] kernel_init+0xe3/0x168
                [<ffffffff8157ac24>] kernel_thread_helper+0x4/0x10

         -> #0 (&(&iommu->lock)->rlock){......}:
                [<ffffffff8109bf3e>] __lock_acquire+0x195e/0x1e10
                [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
                [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
                [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230
                [<ffffffff812f8b42>] device_notifier+0x72/0x90
                [<ffffffff8157555c>] notifier_call_chain+0x8c/0xc0
                [<ffffffff81089768>] __blocking_notifier_call_chain+0x78/0xb0
                [<ffffffff810897b6>] blocking_notifier_call_chain+0x16/0x20
                [<ffffffff81373a5c>] __device_release_driver+0xbc/0xe0
                [<ffffffff81373ccf>] device_release_driver+0x2f/0x50
                [<ffffffff81372ee3>] driver_unbind+0xa3/0xc0
                [<ffffffff813724ac>] drv_attr_store+0x2c/0x30
                [<ffffffff811e4506>] sysfs_write_file+0xe6/0x170
                [<ffffffff8117569e>] vfs_write+0xce/0x190
                [<ffffffff811759e4>] sys_write+0x54/0xa0
                [<ffffffff81579a82>] system_call_fastpath+0x16/0x1b

         other info that might help us debug this:

         6 locks held by bash/13954:
          #0:  (&buffer->mutex){+.+.+.}, at: [<ffffffff811e4464>] sysfs_write_file+0x44/0x170
          #1:  (s_active#3){++++.+}, at: [<ffffffff811e44ed>] sysfs_write_file+0xcd/0x170
          #2:  (&__lockdep_no_validate__){+.+.+.}, at: [<ffffffff81372edb>] driver_unbind+0x9b/0xc0
          #3:  (&__lockdep_no_validate__){+.+.+.}, at: [<ffffffff81373cc7>] device_release_driver+0x27/0x50
          #4:  (&(&priv->bus_notifier)->rwsem){.+.+.+}, at: [<ffffffff8108974f>] __blocking_notifier_call_chain+0x5f/0xb0
          #5:  (device_domain_lock){-.-...}, at: [<ffffffff812f6508>] domain_remove_one_dev_info+0x208/0x230

         stack backtrace:
         Pid: 13954, comm: bash Not tainted 2.6.39.1+ #1
         Call Trace:
          [<ffffffff810993a7>] print_circular_bug+0xf7/0x100
          [<ffffffff8109bf3e>] __lock_acquire+0x195e/0x1e10
          [<ffffffff810972bd>] ? trace_hardirqs_off+0xd/0x10
          [<ffffffff8109d57d>] ? trace_hardirqs_on_caller+0x13d/0x180
          [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
          [<ffffffff812f6421>] ? domain_remove_one_dev_info+0x121/0x230
          [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
          [<ffffffff812f6421>] ? domain_remove_one_dev_info+0x121/0x230
          [<ffffffff810972bd>] ? trace_hardirqs_off+0xd/0x10
          [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230
          [<ffffffff812f8b42>] device_notifier+0x72/0x90
          [<ffffffff8157555c>] notifier_call_chain+0x8c/0xc0
          [<ffffffff81089768>] __blocking_notifier_call_chain+0x78/0xb0
          [<ffffffff810897b6>] blocking_notifier_call_chain+0x16/0x20
          [<ffffffff81373a5c>] __device_release_driver+0xbc/0xe0
          [<ffffffff81373ccf>] device_release_driver+0x2f/0x50
          [<ffffffff81372ee3>] driver_unbind+0xa3/0xc0
          [<ffffffff813724ac>] drv_attr_store+0x2c/0x30
          [<ffffffff811e4506>] sysfs_write_file+0xe6/0x170
          [<ffffffff8117569e>] vfs_write+0xce/0x190
          [<ffffffff811759e4>] sys_write+0x54/0xa0
          [<ffffffff81579a82>] system_call_fastpath+0x16/0x1b

    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: David Woodhouse <[email protected]>
    Cc: Steven Rostedt <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 11b34bb
Author: Dave Chinner <[email protected]>
Date:   Fri Nov 2 11:38:44 2012 +1100

    xfs: fix reading of wrapped log data

    commit 6ce377a upstream.

    Commit 4439647 ("xfs: reset buffer pointers before freeing them") in
    3.0-rc1 introduced a regression when recovering log buffers that
    wrapped around the end of log. The second part of the log buffer at
    the start of the physical log was being read into the header buffer
    rather than the data buffer, and hence recovery was seeing garbage
    in the data buffer when it got to the region of the log buffer that
    was incorrectly read.

    Reported-by: Torsten Kaiser <[email protected]>
    Signed-off-by: Dave Chinner <[email protected]>
    Reviewed-by: Christoph Hellwig <[email protected]>
    Reviewed-by: Mark Tinguely <[email protected]>
    Signed-off-by: Ben Myers <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 87725c3
Author: Johan Hovold <[email protected]>
Date:   Thu Nov 8 18:28:59 2012 +0100

    USB: mos7840: remove unused variable

    Fix warning about unused variable introduced by commit e681b66
    ("USB: mos7840: remove invalid disconnect handling") upstream.

    A subsequent fix which removed the disconnect function got rid of the
    warning but that one was only backported to v3.6.

    Reported-by: Jiri Slaby <[email protected]>
    Signed-off-by: Johan Hovold <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b7832d4
Author: Daniel Vetter <[email protected]>
Date:   Sun Oct 21 12:52:39 2012 +0200

    drm/i915: clear the entire sdvo infoframe buffer

    commit b6e0e54 upstream.

    Like in the case of native hdmi, which is fixed already in

    commit adf00b2
    Author: Paulo Zanoni <[email protected]>
    Date:   Tue Sep 25 13:23:34 2012 -0300

        drm/i915: make sure we write all the DIP data bytes

    we need to clear the entire sdvo buffer to avoid upsetting the
    display.

    Since infoframe buffer writing is now a bit more elaborate, extract it
    into it's own function. This will be useful if we ever get around to
    properly update the ELD for sdvo. Also #define proper names for the
    two buffer indexes with fixed usage.

    v2: Cite the right commit above, spotted by Paulo Zanoni.

    v3: I'm too stupid to paste the right commit.

    v4: Ben Hutchings noticed that I've failed to handle an underflow in
    my loop logic, breaking it for i >= length + 8. Since I've just lost C
    programmer license, use his solution. Also, make the frustrated 0-base
    buffer size a notch more clear.

    Reported-and-tested-by: Jürg Billeter <[email protected]>
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=25732
    Cc: Paulo Zanoni <[email protected]>
    Cc: Ben Hutchings <[email protected]>
    Reviewed-by: Rodrigo Vivi <[email protected]>
    Signed-off-by: Daniel Vetter <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 9615dee
Author: Daniel Vetter <[email protected]>
Date:   Sat May 12 20:22:00 2012 +0200

    drm/i915: fixup infoframe support for sdvo

    commit 81014b9 upstream.

    At least the worst offenders:
    - SDVO specifies that the encoder should compute the ecc. Testing also
      shows that we must not send the ecc field, so copy the dip_infoframe
      struct to a temporay place and avoid the ecc field. This way the avi
      infoframe is exactly 17 bytes long, which agrees with what the spec
      mandates as a minimal storage capacity (with the ecc field it would
      be 18 bytes).
    - Only 17 when sending the avi infoframe. The SDVO spec explicitly
      says that sending more data than what the device announces results
      in undefined behaviour.
    - Add __attribute__((packed)) to the avi and spd infoframes, for
      otherwise they're wrongly aligned. Noticed because the avi infoframe
      ended up being 18 bytes large instead of 17. We haven't noticed this
      yet because we don't use the uint16_t fields yet (which are the only
      ones that would be wrongly aligned).

    This regression has been introduce by

    3c17fe4 is the first bad commit
    commit 3c17fe4
    Author: David Härdeman <[email protected]>
    Date:   Fri Sep 24 21:44:32 2010 +0200

        i915: enable AVI infoframe for intel_hdmi.c [v4]

    Patch tested on my g33 with a sdvo hdmi adaptor.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=25732
    Tested-by: Peter Ross <[email protected]> (G35 SDVO-HDMI)
    Reviewed-by: Eugeni Dodonov <[email protected]>
    Signed-Off-by: Daniel Vetter <[email protected]>
    Cc: Ben Hutchings <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d18edec
Author: Thomas Hellstrom <[email protected]>
Date:   Fri Nov 9 10:05:57 2012 +0100

    drm/vmwgfx: Fix hibernation device reset

    commit 95e8f6a upstream.

    The device would not reset properly when resuming from hibernation.

    Signed-off-by: Thomas Hellstrom <[email protected]>
    Reviewed-by: Brian Paul <[email protected]>
    Reviewed-by: Dmitry Torokhov <[email protected]>
    Cc: [email protected]
    Signed-off-by: Dave Airlie <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 2f56580
Author: Thomas Gleixner <[email protected]>
Date:   Tue Oct 23 22:29:38 2012 +0200

    futex: Handle futex_pi OWNER_DIED take over correctly

    commit 59fa624 upstream.

    Siddhesh analyzed a failure in the take over of pi futexes in case the
    owner died and provided a workaround.
    See: http://sourceware.org/bugzilla/show_bug.cgi?id=14076

    The detailed problem analysis shows:

    Futex F is initialized with PTHREAD_PRIO_INHERIT and
    PTHREAD_MUTEX_ROBUST_NP attributes.

    T1 lock_futex_pi(F);

    T2 lock_futex_pi(F);
       --> T2 blocks on the futex and creates pi_state which is associated
           to T1.

    T1 exits
       --> exit_robust_list() runs
           --> Futex F userspace value TID field is set to 0 and
               FUTEX_OWNER_DIED bit is set.

    T3 lock_futex_pi(F);
       --> Succeeds due to the check for F's userspace TID field == 0
       --> Claims ownership of the futex and sets its own TID into the
           userspace TID field of futex F
       --> returns to user space

    T1 --> exit_pi_state_list()
           --> Transfers pi_state to waiter T2 and wakes T2 via
           	   rt_mutex_unlock(&pi_state->mutex)

    T2 --> acquires pi_state->mutex and gains real ownership of the
           pi_state
       --> Claims ownership of the futex and sets its own TID into the
           userspace TID field of futex F
       --> returns to user space

    T3 --> observes inconsistent state

    This problem is independent of UP/SMP, preemptible/non preemptible
    kernels, or process shared vs. private. The only difference is that
    certain configurations are more likely to expose it.

    So as Siddhesh correctly analyzed the following check in
    futex_lock_pi_atomic() is the culprit:

    	if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {

    We check the userspace value for a TID value of 0 and take over the
    futex unconditionally if that's true.

    AFAICT this check is there as it is correct for a different corner
    case of futexes: the WAITERS bit became stale.

    Now the proposed change

    -	if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {
    +       if (unlikely(ownerdied ||
    +                       !(curval & (FUTEX_TID_MASK | FUTEX_WAITERS)))) {

    solves the problem, but it's not obvious why and it wreckages the
    "stale WAITERS bit" case.

    What happens is, that due to the WAITERS bit being set (T2 is blocked
    on that futex) it enforces T3 to go through lookup_pi_state(), which
    in the above case returns an existing pi_state and therefor forces T3
    to legitimately fight with T2 over the ownership of the pi_state (via
    pi_state->mutex). Probelm solved!

    Though that does not work for the "WAITERS bit is stale" problem
    because if lookup_pi_state() does not find existing pi_state it
    returns -ERSCH (due to TID == 0) which causes futex_lock_pi() to
    return -ESRCH to user space because the OWNER_DIED bit is not set.

    Now there is a different solution to that problem. Do not look at the
    user space value at all and enforce a lookup of possibly available
    pi_state. If pi_state can be found, then the new incoming locker T3
    blocks on that pi_state and legitimately races with T2 to acquire the
    rt_mutex and the pi_state and therefor the proper ownership of the
    user space futex.

    lookup_pi_state() has the correct order of checks. It first tries to
    find a pi_state associated with the user space futex and only if that
    fails it checks for futex TID value = 0. If no pi_state is available
    nothing can create new state at that point because this happens with
    the hash bucket lock held.

    So the above scenario changes to:

    T1 lock_futex_pi(F);

    T2 lock_futex_pi(F);
       --> T2 blocks on the futex and creates pi_state which is associated
           to T1.

    T1 exits
       --> exit_robust_list() runs
           --> Futex F userspace value TID field is set to 0 and
               FUTEX_OWNER_DIED bit is set.

    T3 lock_futex_pi(F);
       --> Finds pi_state and blocks on pi_state->rt_mutex

    T1 --> exit_pi_state_list()
           --> Transfers pi_state to waiter T2 and wakes it via
           	   rt_mutex_unlock(&pi_state->mutex)

    T2 --> acquires pi_state->mutex and gains ownership of the pi_state
       --> Claims ownership of the futex and sets its own TID into the
           userspace TID field of futex F
       --> returns to user space

    This covers all gazillion points on which T3 might come in between
    T1's exit_robust_list() clearing the TID field and T2 fixing it up. It
    also solves the "WAITERS bit stale" problem by forcing the take over.

    Another benefit of changing the code this way is that it makes it less
    dependent on untrusted user space values and therefor minimizes the
    possible wreckage which might be inflicted.

    As usual after staring for too long at the futex code my brain hurts
    so much that I really want to ditch that whole optimization of
    avoiding the syscall for the non contended case for PI futexes and rip
    out the maze of corner case handling code. Unfortunately we can't as
    user space relies on that existing behaviour, but at least thinking
    about it helps me to preserve my mental sanity. Maybe we should
    nevertheless :)

    Reported-and-tested-by: Siddhesh Poyarekar <[email protected]>
    Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1210232138540.2756@ionos
    Acked-by: Darren Hart <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 2e570a4
Author: Hannes Frederic Sowa <[email protected]>
Date:   Tue Nov 6 16:18:41 2012 +0000

    ipv6: send unsolicited neighbour advertisements to all-nodes

    [ Upstream commit 60713a0 ]

    As documented in RFC4861 (Neighbor Discovery for IP version 6) 7.2.6.,
    unsolicited neighbour advertisements should be sent to the all-nodes
    multicast address.

    Signed-off-by: Hannes Frederic Sowa <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 5a3e425
Author: Tom Parkin <[email protected]>
Date:   Mon Oct 29 23:41:48 2012 +0000

    l2tp: fix oops in l2tp_eth_create() error path

    [ Upstream commit 7893363 ]

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

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

    Signed-off-by: Tom Parkin <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 798c7db
Author: Jesper Dangaard Brouer <[email protected]>
Date:   Wed Oct 31 02:45:32 2012 +0000

    net: fix divide by zero in tcp algorithm illinois

    [ Upstream commit 8f363b7 ]

    Reading TCP stats when using TCP Illinois congestion control algorithm
    can cause a divide by zero kernel oops.

    The division by zero occur in tcp_illinois_info() at:
     do_div(t, ca->cnt_rtt);
    where ca->cnt_rtt can become zero (when rtt_reset is called)

    Steps to Reproduce:
     1. Register tcp_illinois:
         # sysctl -w net.ipv4.tcp_congestion_control=illinois
     2. Monitor internal TCP information via command "ss -i"
         # watch -d ss -i
     3. Establish new TCP conn to machine

    Either it fails at the initial conn, or else it needs to wait
    for a loss or a reset.

    This is only related to reading stats.  The function avg_delay() also
    performs the same divide, but is guarded with a (ca->cnt_rtt > 0) at its
    calling point in update_params().  Thus, simply fix tcp_illinois_info().

    Function tcp_illinois_info() / get_info() is called without
    socket lock.  Thus, eliminate any race condition on ca->cnt_rtt
    by using a local stack variable.  Simply reuse info.tcpv_rttcnt,
    as its already set to ca->cnt_rtt.
    Function avg_delay() is not affected by this race condition, as
    its called with the socket lock.

    Cc: Petr Matousek <[email protected]>
    Signed-off-by: Jesper Dangaard Brouer <[email protected]>
    Acked-by: Eric Dumazet <[email protected]>
    Acked-by: Stephen Hemminger <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 690bfe5
Author: Hemant Kumar <[email protected]>
Date:   Thu Oct 25 18:17:54 2012 +0000

    net: usb: Fix memory leak on Tx data path

    [ Upstream commit 39707c2 ]

    Driver anchors the tx urbs and defers the urb submission if
    a transmit request comes when the interface is suspended.
    Anchoring urb increments the urb reference count. These
    deferred urbs are later accessed by calling usb_get_from_anchor()
    for submission during interface resume. usb_get_from_anchor()
    unanchors the urb but urb reference count remains same.
    This causes the urb reference count to remain non-zero
    after usb_free_urb() gets called and urb never gets freed.
    Hence call usb_put_urb() after anchoring the urb to properly
    balance the reference count for these deferred urbs. Also,
    unanchor these deferred urbs during disconnect, to free them
    up.

    Signed-off-by: Hemant Kumar <[email protected]>
    Acked-by: Oliver Neukum <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit db138ef
Author: Li RongQing <[email protected]>
Date:   Wed Oct 24 14:01:18 2012 +0800

    ipv6: Set default hoplimit as zero.

    [ Upstream commit 14edd87 ]

    Commit a02e4b7(Demark default hoplimit as zero) only changes the
    hoplimit checking condition and default value in ip6_dst_hoplimit, not
    zeros all hoplimit default value.

    Keep the zeroing ip6_template_metrics[RTAX_HOPLIMIT - 1] to force it as
    const, cause as a37e6e3(net: force dst_default_metrics to const
    section)

    Signed-off-by: Li RongQing <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 3297d60
Author: Eric Dumazet <[email protected]>
Date:   Thu Oct 18 09:14:12 2012 +0000

    tcp: fix FIONREAD/SIOCINQ

    [ Upstream commit a3374c4 ]

    tcp_ioctl() tries to take into account if tcp socket received a FIN
    to report correct number bytes in receive queue.

    But its flaky because if the application ate the last skb,
    we return 1 instead of 0.

    Correct way to detect that FIN was received is to test SOCK_DONE.

    Reported-by: Elliot Hughes <[email protected]>
    Signed-off-by: Eric Dumazet <[email protected]>
    Cc: Neal Cardwell <[email protected]>
    Cc: Tom Herbert <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit fdc00ab
Author: Eric Dumazet <[email protected]>
Date:   Thu Oct 18 03:21:55 2012 +0000

    netlink: use kfree_rcu() in netlink_release()

    [ Upstream commit 6d772ac ]

    On some suspend/resume operations involving wimax device, we have
    noticed some intermittent memory corruptions in netlink code.

    Stéphane Marchesin tracked this corruption in netlink_update_listeners()
    and suggested a patch.

    It appears netlink_release() should use kfree_rcu() instead of kfree()
    for the listeners structure as it may be used by other cpus using RCU
    protection.

    netlink_release() must set to NULL the listeners pointer when
    it is about to be freed.

    Also have to protect netlink_update_listeners() and
    netlink_has_listeners() if listeners is NULL.

    Add a nl_deref_protected() lockdep helper to properly document which
    locks protects us.

    Reported-by: Jonathan Kliegman <[email protected]>
    Signed-off-by: Eric Dumazet <[email protected]>
    Cc: Stéphane Marchesin <[email protected]>
    Cc: Sam Leffler <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b232704
Author: Zijie Pan <[email protected]>
Date:   Mon Oct 15 03:56:39 2012 +0000

    sctp: fix call to SCTP_CMD_PROCESS_SACK in sctp_cmd_interpreter()

    [ Upstream commit f6e80ab ]

    Bug introduced by commit edfee03
    (sctp: check src addr when processing SACK to update transport state)

    Signed-off-by: Zijie Pan <[email protected]>
    Signed-off-by: Nicolas Dichtel <[email protected]>
    Acked-by: Vlad Yasevich <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 8a7173c
Author: Takashi Iwai <[email protected]>
Date:   Wed Nov 7 12:44:13 2012 +0100

    ALSA: Avoid endless sleep after disconnect

    commit 0914f79 upstream.

    When disconnect callback is called, each component should wake up
    sleepers and check card->shutdown flag for avoiding the endless sleep
    blocking the proper resource release.

    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 40edba6
Author: Takashi Iwai <[email protected]>
Date:   Wed Nov 7 12:44:12 2012 +0100

    ALSA: Add a reference counter to card instance

    commit a0830db upstream.

    For more strict protection for wild disconnections, a refcount is
    introduced to the card instance, and let it up/down when an object is
    referred via snd_lookup_*() in the open ops.

    The free-after-last-close check is also changed to check this refcount
    instead of the empty list, too.

    Reported-by: Matthieu CASTET <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit fb434cc
Author: Takashi Iwai <[email protected]>
Date:   Wed Nov 7 12:44:11 2012 +0100

    ALSA: usb-audio: Fix races at disconnection in mixer_quirks.c

    commit 888ea7d upstream.

    Similar like the previous commit, cover with chip->shutdown_rwsem
    and chip->shutdown checks.

    Reported-by: Matthieu CASTET <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 1456577
Author: Takashi Iwai <[email protected]>
Date:   Wed Nov 7 12:44:10 2012 +0100

    ALSA: usb-audio: Use rwsem for disconnect protection

    commit 34f3c89 upstream.

    Replace mutex with rwsem for codec->shutdown protection so that
    concurrent accesses are allowed.

    Also add the protection to snd_usb_autosuspend() and
    snd_usb_autoresume(), too.

    Reported-by: Matthieu CASTET <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit ea7b69a
Author: Takashi Iwai <[email protected]>
Date:   Wed Nov 7 12:44:09 2012 +0100

    ALSA: usb-audio: Fix races at disconnection

    commit 978520b upstream.

    Close some races at disconnection of a USB audio device by adding the
    chip->shutdown_mutex and chip->shutdown check at appropriate places.

    The spots to put bandaids are:
    - PCM prepare, hw_params and hw_free
    - where the usb device is accessed for communication or get speed, in
     mixer.c and others; the device speed is now cached in subs->speed
     instead of accessing to chip->dev

    The accesses in PCM open and close don't need the mutex protection
    because these are already handled in the core PCM disconnection code.

    The autosuspend/autoresume codes are still uncovered by this patch
    because of possible mutex deadlocks.  They'll be covered by the
    upcoming change to rwsem.

    Also the mixer codes are untouched, too.  These will be fixed in
    another patch, too.

    Reported-by: Matthieu CASTET <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 61bc285
Author: Takashi Iwai <[email protected]>
Date:   Wed Nov 7 12:39:51 2012 +0100

    ALSA: PCM: Fix some races at disconnection

    commit 9b0573c upstream.

    Fix races at PCM disconnection:
    - while a PCM device is being opened or closed
    - while the PCM state is being changed without lock in prepare,
      hw_params, hw_free ops

    Reported-by: Matthieu CASTET <[email protected]>
    Signed-off-by: Takashi Iwai <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit ec1f5bf
Author: Jean Delvare <[email protected]>
Date:   Mon Nov 5 21:54:39 2012 +0100

    hwmon: (w83627ehf) Force initial bank selection

    commit 3300fb4 upstream.

    Don't assume bank 0 is selected at device probe time. This may not be
    the case. Force bank selection at first register access to guarantee
    that we read the right registers upon driver loading.

    Signed-off-by: Jean Delvare <[email protected]>
    Reviewed-by: Guenter Roeck <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 356c93d
Author: Ilija Hadzic <[email protected]>
Date:   Mon Oct 29 17:35:00 2012 +0000

    drm: restore open_count if drm_setup fails

    commit 0f1cb1b upstream.

    If drm_setup (called at first open) fails, the whole
    open call has failed, so we should not keep the
    open_count incremented.

    Signed-off-by: Ilija Hadzic <[email protected]>
    Reviewed-by: Thomas Hellstrom <[email protected]>
    Signed-off-by: Dave Airlie <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 4d02840
Author: Trond Myklebust <[email protected]>
Date:   Wed Aug 22 16:08:17 2012 -0400

    NFS: Fix Oopses in nfs_lookup_revalidate and nfs4_lookup_revalidate

    [Fixed upstream as part of 0b728e1, but that's a much larger patch,
    this is only the nfs portion backported as needed.]

    Fix the following Oops in 3.5.1:

     BUG: unable to handle kernel NULL pointer dereference at 0000000000000038
     IP: [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs]
     PGD 337c63067 PUD 0
     Oops: 0000 [#1] SMP
     CPU 5
     Modules linked in: nfs fscache nfsd lockd nfs_acl auth_rpcgss sunrpc af_packet binfmt_misc cpufreq_conservative cpufreq_userspace cpufreq_powersave dm_mod acpi_cpufreq mperf coretemp gpio_ich kvm_intel joydev kvm ioatdma hid_generic igb lpc_ich i7core_edac edac_core ptp serio_raw dca pcspkr i2c_i801 mfd_core sg pps_core usbhid crc32c_intel microcode button autofs4 uhci_hcd ttm drm_kms_helper drm i2c_algo_bit sysimgblt sysfillrect syscopyarea ehci_hcd usbcore usb_common scsi_dh_rdac scsi_dh_emc scsi_dh_hp_sw scsi_dh_alua scsi_dh edd fan ata_piix thermal processor thermal_sys

     Pid: 30431, comm: java Not tainted 3.5.1-2-default #1 Supermicro X8DTT/X8DTT
     RIP: 0010:[<ffffffffa03789cd>]  [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs]
     RSP: 0018:ffff8801b418bd38  EFLAGS: 00010292
     RAX: 00000000fffffff6 RBX: ffff88032016d800 RCX: 0000000000000020
     RDX: ffffffff00000000 RSI: 0000000000000000 RDI: ffff8801824a7b00
     RBP: ffff8801b418bdf8 R08: 7fffff0034323030 R09: fffffffff04c03ed
     R10: ffff8801824a7b00 R11: 0000000000000002 R12: ffff8801824a7b00
     R13: ffff8801824a7b00 R14: 0000000000000000 R15: ffff8803201725d0
     FS:  00002b53a46cb700(0000) GS:ffff88033fc20000(0000) knlGS:0000000000000000
     CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
     CR2: 0000000000000038 CR3: 000000020a426000 CR4: 00000000000007e0
     DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
     DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
     Process java (pid: 30431, threadinfo ffff8801b418a000, task ffff8801b5d20600)
     Stack:
      ffff8801b418be44 ffff88032016d800 ffff8801b418bdf8 0000000000000000
      ffff8801824a7b00 ffff8801b418bdd7 ffff8803201725d0 ffffffff8116a9c0
      ffff8801b5c38dc0 0000000000000007 ffff88032016d800 0000000000000000
     Call Trace:
      [<ffffffff8116a9c0>] lookup_dcache+0x80/0xe0
      [<ffffffff8116aa43>] __lookup_hash+0x23/0x90
      [<ffffffff8116b4a5>] lookup_one_len+0xc5/0x100
      [<ffffffffa03869a3>] nfs_sillyrename+0xe3/0x210 [nfs]
      [<ffffffff8116cadf>] vfs_unlink.part.25+0x7f/0xe0
      [<ffffffff8116f22c>] do_unlinkat+0x1ac/0x1d0
      [<ffffffff815717b9>] system_call_fastpath+0x16/0x1b
      [<00002b5348b5f527>] 0x2b5348b5f526
     Code: ec 38 b8 f6 ff ff ff 4c 89 64 24 18 4c 89 74 24 28 49 89 fc 48 89 5c 24 08 48 89 6c 24 10 49 89 f6 4c 89 6c 24 20 4c 89 7c 24 30 <f6> 46 38 40 0f 85 d1 00 00 00 e8 c4 c4 df e0 48 8b 58 30 49 89
     RIP  [<ffffffffa03789cd>] nfs_lookup_revalidate+0x2d/0x480 [nfs]
      RSP <ffff8801b418bd38>
     CR2: 0000000000000038
     ---[ end trace 845113ed191985dd ]---

    This Oops affects 3.5 kernels and older, and is due to lookup_one_len()
    calling down to the dentry revalidation code with a NULL pointer
    to struct nameidata.

    It is fixed upstream by commit 0b728e1 (stop passing nameidata *
    to ->d_revalidate())

    Reported-by: Richard Ems <[email protected]>
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 095a518
Author: NeilBrown <[email protected]>
Date:   Wed Oct 31 12:16:01 2012 +1100

    NFS: fix bug in legacy DNS resolver.

    commit 8d96b10 upstream.

    The DNS resolver's use of the sunrpc cache involves a 'ttl' number
    (relative) rather that a timeout (absolute).  This confused me when
    I wrote
      commit c5b29f8
         "sunrpc: use seconds since boot in expiry cache"

    and I managed to break it.  The effect is that any TTL is interpreted
    as 0, and nothing useful gets into the cache.

    This patch removes the use of get_expiry() - which really expects an
    expiry time - and uses get_uint() instead, treating the int correctly
    as a ttl.

    This fixes a regression that has been present since 2.6.37, causing
    certain NFS accesses in certain environments to incorrectly fail.

    Reported-by: Chuck Lever <[email protected]>
    Tested-by: Chuck Lever <[email protected]>
    Signed-off-by: NeilBrown <[email protected]>
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 110d3a2
Author: J. Bruce Fields <[email protected]>
Date:   Tue Jun 12 16:54:16 2012 -0400

    nfsd: add get_uint for u32's

    commit a007c4c upstream.

    I don't think there's a practical difference for the range of values
    these interfaces should see, but it would be safer to be unambiguous.

    Signed-off-by: J. Bruce Fields <[email protected]>
    Cc: Sasha Levin <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit f354d0c
Author: Trond Myklebust <[email protected]>
Date:   Mon Oct 29 18:53:23 2012 -0400

    NFSv4: nfs4_locku_done must release the sequence id

    commit 2b1bc30 upstream.

    If the state recovery machinery is triggered by the call to
    nfs4_async_handle_error() then we can deadlock.

    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 6fbd3cd
Author: Ben Hutchings <[email protected]>
Date:   Sun Oct 21 19:23:52 2012 +0100

    nfs: Show original device name verbatim in /proc/*/mount{s,info}

    commit 97a5486 upstream.

    Since commit c7f404b ('vfs: new superblock methods to override
    /proc/*/mount{s,info}'), nfs_path() is used to generate the mounted
    device name reported back to userland.

    nfs_path() always generates a trailing slash when the given dentry is
    the root of an NFS mount, but userland may expect the original device
    name to be returned verbatim (as it used to be).  Make this
    canonicalisation optional and change the callers accordingly.

    [[email protected]: use flag instead of bool argument]
    Reported-and-tested-by: Chris Hiestand <[email protected]>
    Reference: http://bugs.debian.org/669314
    Signed-off-by: Ben Hutchings <[email protected]>
    Signed-off-by: Jonathan Nieder <[email protected]>
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e4648b1
Author: Scott Mayhew <[email protected]>
Date:   Tue Oct 16 13:22:19 2012 -0400

    nfsv3: Make v3 mounts fail with ETIMEDOUTs instead EIO on mountd timeouts

    commit acce94e upstream.

    In very busy v3 environment, rpc.mountd can respond to the NULL
    procedure but not the MNT procedure in a timely manner causing
    the MNT procedure to time out. The problem is the mount system
    call returns EIO which causes the mount to fail, instead of
    ETIMEDOUT, which would cause the mount to be retried.

    This patch sets the RPC_TASK_SOFT|RPC_TASK_TIMEOUT flags to
    the rpc_call_sync() call in nfs_mount() which causes
    ETIMEDOUT to be returned on timed out connections.

    Signed-off-by: Steve Dickson <[email protected]>
    Signed-off-by: Trond Myklebust <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 9c750c9
Author: Antonio Quartulli <[email protected]>
Date:   Fri Oct 26 18:54:25 2012 +0200

    mac80211: fix SSID copy on IBSS JOIN

    commit badecb0 upstream.

    The 'ssid' field of the cfg80211_ibss_params is a u8 pointer and
    its length is likely to be less than IEEE80211_MAX_SSID_LEN most
    of the time.

    This patch fixes the ssid copy in ieee80211_ibss_join() by using
    the SSID length to prevent it from reading beyond the string.

    Signed-off-by: Antonio Quartulli <[email protected]>
    [rewrapped commit message, small rewording]
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 03938ad
Author: Johannes Berg <[email protected]>
Date:   Fri Oct 26 00:33:36 2012 +0200

    mac80211: check management frame header length

    commit 4a4f1a5 upstream.

    Due to pskb_may_pull() checking the skb length, all
    non-management frames are checked on input whether
    their 802.11 header is fully present. Also add that
    check for management frames and remove a check that
    is now duplicate. This prevents accessing skb data
    beyond the frame end.

    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 2dda2bb
Author: Egbert Eich <[email protected]>
Date:   Wed Oct 24 18:29:49 2012 +0200

    DRM/Radeon: Fix Load Detection on legacy primary DAC.

    commit 83325d0 upstream.

    An uninitialized variable led to broken load detection.

    Signed-off-by: Egbert Eich <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 6f8acfd
Author: Javier Cardona <[email protected]>
Date:   Thu Oct 25 11:10:18 2012 -0700

    mac80211: don't inspect Sequence Control field on control frames

    commit f7fbf70 upstream.

    Per IEEE Std. 802.11-2012, Sec 8.2.4.4.1, the sequence Control field is
    not present in control frames.  We noticed this problem when processing
    Block Ack Requests.

    Signed-off-by: Javier Cardona <[email protected]>
    Signed-off-by: Javier Lopez <[email protected]>
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 4bdd5ed
Author: Johannes Berg <[email protected]>
Date:   Thu Oct 25 21:51:59 2012 +0200

    wireless: drop invalid mesh address extension frames

    commit 7dd111e upstream.

    The mesh header can have address extension by a 4th
    or a 5th and 6th address, but never both. Drop such
    frames in 802.11 -> 802.3 conversion along with any
    frames that have the wrong extension.

    Reviewed-by: Javier Cardona <[email protected]>
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 58bca02
Author: Felix Fietkau <[email protected]>
Date:   Wed Oct 17 13:56:19 2012 +0200

    cfg80211: fix antenna gain handling

    commit c4a9faf upstream.

    No driver initializes chan->max_antenna_gain to something sensible, and
    the only place where it is being used right now is inside ath9k. This
    leads to ath9k potentially using less tx power than it can use, which can
    decrease performance/range in some rare cases.

    Rather than going through every single driver, this patch initializes
    chan->orig_mag in wiphy_register(), ignoring whatever value the driver
    left in there. If a driver for some reason wishes to limit it independent
    from regulatory rulesets, it can do so internally.

    Signed-off-by: Felix Fietkau <[email protected]>
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit f100fdf
Author: Roland Dreier <[email protected]>
Date:   Wed Oct 31 09:16:44 2012 -0700

    target: Don't return success from module_init() if setup fails

    commit 0d0f9df upstream.

    If the call to core_dev_release_virtual_lun0() fails, then nothing
    sets ret to anything other than 0, so even though everything is
    torn down and freed, target_core_init_configfs() will seem to succeed
    and the module will be loaded.  Fix this by passing the return value
    on up the chain.

    Signed-off-by: Roland Dreier <[email protected]>
    Signed-off-by: Nicholas Bellinger <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 4a7dfa5
Author: Stanislaw Gruszka <[email protected]>
Date:   Thu Oct 25 09:51:39 2012 +0200

    rt2800: validate step value for temperature compensation

    commit bf7e1ab upstream.

    Some hardware has correct (!= 0xff) value of tssi_bounds[4] in the
    EEPROM, but step is equal to 0xff. This results on ridiculous delta
    calculations and completely broke TX power settings.

    Reported-and-tested-by: Pavel Lucik <[email protected]>
    Signed-off-by: Stanislaw Gruszka <[email protected]>
    Acked-by: Ivo van Doorn <[email protected]>
    Signed-off-by: John W. Linville <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a699cd3
Author: Felix Fietkau <[email protected]>
Date:   Fri Oct 26 00:31:11 2012 +0200

    ath9k: fix stale pointers potentially causing access to free'd skbs

    commit 8c6e309 upstream.

    bf->bf_next is only while buffers are chained as part of an A-MPDU
    in the tx queue. When a tid queue is flushed (e.g. on tearing down
    an aggregation session), frames can be enqueued again as normal
    transmission, without bf_next being cleared. This can lead to the
    old pointer being dereferenced again later.

    This patch might fix crashes and "Failed to stop TX DMA!" messages.

    Signed-off-by: Felix Fietkau <[email protected]>
    Signed-off-by: John W. Linville <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
Mustaavalkosta referenced this issue in Mustaavalkosta/htc7x30-3.0 Mar 7, 2013
commit 4eb15b7
Author: Greg Kroah-Hartman <[email protected]>
Date:   Mon Dec 10 10:45:23 2012 -0800

    Linux 3.0.56

commit 9012327
Author: Jan Kara <[email protected]>
Date:   Fri Jun 15 12:52:46 2012 +0200

    scsi: Silence unnecessary warnings about ioctl to partition

    commit 6d93592 upstream.

    Sometimes, warnings about ioctls to partition happen often enough that they
    form majority of the warnings in the kernel log and users complain. In some
    cases warnings are about ioctls such as SG_IO so it's not good to get rid of
    the warnings completely as they can ease debugging of userspace problems
    when ioctl is refused.

    Since I have seen warnings from lots of commands, including some proprietary
    userspace applications, I don't think disallowing the ioctls for processes
    with CAP_SYS_RAWIO will happen in the near future if ever. So lets just
    stop warning for processes with CAP_SYS_RAWIO for which ioctl is allowed.

    Acked-by: Paolo Bonzini <[email protected]>
    CC: James Bottomley <[email protected]>
    CC: [email protected]
    Signed-off-by: Jan Kara <[email protected]>
    Signed-off-by: Jens Axboe <[email protected]>
    Cc: Satoru Takeuchi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 95b471a
Author: Chris Wilson <[email protected]>
Date:   Thu Oct 18 21:07:01 2012 +0100

    drm/i915: Add no-lvds quirk for Supermicro X7SPA-H

    commit c31407a upstream.

    Reported-and-tested-by: Francois Tigeot <[email protected]>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55375
    Signed-off-by: Chris Wilson <[email protected]>
    Signed-off-by: Daniel Vetter <[email protected]>
    Signed-off-by: Peter Huewe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 4d574d2
Author: Calvin Walton <[email protected]>
Date:   Fri Aug 24 07:56:31 2012 -0400

    i915: Quirk no_lvds on Gigabyte GA-D525TUD ITX motherboard

    commit a51d4ed upstream.

    This board is incorrectly detected as having an LVDS connector,
    resulting in the VGA output (the only available output on the board)
    showing the console only in the top-left 1024x768 pixels, and an extra
    LVDS connector appearing in X.

    It's a desktop Mini-ITX board using an Atom D525 CPU with an NM10
    chipset.

    I've had this board for about a year, but this is the first time I
    noticed the issue because I've been running it headless for most of its
    life.

    Signed-off-by: Calvin Walton <[email protected]>
    Signed-off-by: Peter Huewe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b0ce22d
Author: Alan Cox <[email protected]>
Date:   Fri Oct 26 01:05:56 2012 +0200

    ACPI: missing break

    commit 879dca0 upstream.

    We handle NOTIFY_THROTTLING so don't then fall through to unsupported event.

    Signed-off-by: Alan Cox <[email protected]>
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Peter Huewe <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit bc436dd
Author: Michal Kubecek <[email protected]>
Date:   Tue Dec 4 11:09:13 2012 +0100

    route: release dst_entry.hh_cache when handling redirects

    Stable-3.0 commit 42ab531 (ipv4: fix redirect handling) was
    backport of mainline commit 9cc20b2 from 3.2-rc3 where hh
    member of struct dst_entry was already gone.

    However, in 3.0 we still have it and we have to clean it as
    well, otherwise it keeps pointing to the cleaned up (and
    unusable) hh_cache entry and packets cannot be sent out.

    Signed-off-by: Michal Kubecek <[email protected]>
    Cc: Eric Dumazet <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e86b690
Author: Mike Galbraith <[email protected]>
Date:   Mon Dec 3 06:25:25 2012 +0100

    Revert "sched, autogroup: Stop going ahead if autogroup is disabled"

    commit fd8ef11 upstream.

    This reverts commit 800d4d3.

    Between commits 8323f26 ("sched: Fix race in task_group()") and
    800d4d3 ("sched, autogroup: Stop going ahead if autogroup is
    disabled"), autogroup is a wreck.

    With both applied, all you have to do to crash a box is disable
    autogroup during boot up, then reboot..  boom, NULL pointer dereference
    due to commit 800d4d3 not allowing autogroup to move things, and
    commit 8323f26 making that the only way to switch runqueues:

      BUG: unable to handle kernel NULL pointer dereference at           (null)
      IP: [<ffffffff81063ac0>] effective_load.isra.43+0x50/0x90
      Pid: 7047, comm: systemd-user-se Not tainted 3.6.8-smp #7 MEDIONPC MS-7502/MS-7502
      RIP: effective_load.isra.43+0x50/0x90
      Process systemd-user-se (pid: 7047, threadinfo ffff880221dde000, task ffff88022618b3a0)
      Call Trace:
        select_task_rq_fair+0x255/0x780
        try_to_wake_up+0x156/0x2c0
        wake_up_state+0xb/0x10
        signal_wake_up+0x28/0x40
        complete_signal+0x1d6/0x250
        __send_signal+0x170/0x310
        send_signal+0x40/0x80
        do_send_sig_info+0x47/0x90
        group_send_sig_info+0x4a/0x70
        kill_pid_info+0x3a/0x60
        sys_kill+0x97/0x1a0
        ? vfs_read+0x120/0x160
        ? sys_read+0x45/0x90
        system_call_fastpath+0x16/0x1b
      Code: 49 0f af 41 50 31 d2 49 f7 f0 48 83 f8 01 48 0f 46 c6 48 2b 07 48 8b bf 40 01 00 00 48 85 ff 74 3a 45 31 c0 48 8b 8f 50 01 00 00 <48> 8b 11 4c 8b 89 80 00 00 00 49 89 d2 48 01 d0 45 8b 59 58 4c
      RIP  [<ffffffff81063ac0>] effective_load.isra.43+0x50/0x90
       RSP <ffff880221ddfbd8>
      CR2: 0000000000000000

    Signed-off-by: Mike Galbraith <[email protected]>
    Acked-by: Ingo Molnar <[email protected]>
    Cc: Yong Zhang <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit cc3c85d
Author: Mike Galbraith <[email protected]>
Date:   Wed Nov 28 07:17:18 2012 +0100

    workqueue: exit rescuer_thread() as TASK_RUNNING

    commit 412d32e upstream.

    A rescue thread exiting TASK_INTERRUPTIBLE can lead to a task scheduling
    off, never to be seen again.  In the case where this occurred, an exiting
    thread hit reiserfs homebrew conditional resched while holding a mutex,
    bringing the box to its knees.

    PID: 18105  TASK: ffff8807fd412180  CPU: 5   COMMAND: "kdmflush"
     #0 [ffff8808157e7670] schedule at ffffffff8143f489
     #1 [ffff8808157e77b8] reiserfs_get_block at ffffffffa038ab2d [reiserfs]
     #2 [ffff8808157e79a8] __block_write_begin at ffffffff8117fb14
     #3 [ffff8808157e7a98] reiserfs_write_begin at ffffffffa0388695 [reiserfs]
     #4 [ffff8808157e7ad8] generic_perform_write at ffffffff810ee9e2
     #5 [ffff8808157e7b58] generic_file_buffered_write at ffffffff810eeb41
     #6 [ffff8808157e7ba8] __generic_file_aio_write at ffffffff810f1a3a
     #7 [ffff8808157e7c58] generic_file_aio_write at ffffffff810f1c88
     #8 [ffff8808157e7cc8] do_sync_write at ffffffff8114f850
     #9 [ffff8808157e7dd8] do_acct_process at ffffffff810a268f
        [exception RIP: kernel_thread_helper]
        RIP: ffffffff8144a5c0  RSP: ffff8808157e7f58  RFLAGS: 00000202
        RAX: 0000000000000000  RBX: 0000000000000000  RCX: 0000000000000000
        RDX: 0000000000000000  RSI: ffffffff8107af60  RDI: ffff8803ee491d18
        RBP: 0000000000000000   R8: 0000000000000000   R9: 0000000000000000
        R10: 0000000000000000  R11: 0000000000000000  R12: 0000000000000000
        R13: 0000000000000000  R14: 0000000000000000  R15: 0000000000000000
        ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018

    Signed-off-by: Mike Galbraith <[email protected]>
    Signed-off-by: Tejun Heo <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 11bcecc
Author: Naoya Horiguchi <[email protected]>
Date:   Thu Nov 29 13:54:34 2012 -0800

    mm: soft offline: split thp at the beginning of soft_offline_page()

    commit 783657a upstream.

    When we try to soft-offline a thp tail page, put_page() is called on the
    tail page unthinkingly and VM_BUG_ON is triggered in put_compound_page().

    This patch splits thp before going into the main body of soft-offlining.

    Signed-off-by: Naoya Horiguchi <[email protected]>
    Cc: Andi Kleen <[email protected]>
    Cc: Tony Luck <[email protected]>
    Cc: Andi Kleen <[email protected]>
    Cc: Wu Fengguang <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 8bec650
Author: Jianguo Wu <[email protected]>
Date:   Thu Nov 29 13:54:21 2012 -0800

    mm/vmemmap: fix wrong use of virt_to_page

    commit ae64ffc upstream.

    I enable CONFIG_DEBUG_VIRTUAL and CONFIG_SPARSEMEM_VMEMMAP, when doing
    memory hotremove, there is a kernel BUG at arch/x86/mm/physaddr.c:20.

    It is caused by free_section_usemap()->virt_to_page(), virt_to_page() is
    only used for kernel direct mapping address, but sparse-vmemmap uses
    vmemmap address, so it is going wrong here.

      ------------[ cut here ]------------
      kernel BUG at arch/x86/mm/physaddr.c:20!
      invalid opcode: 0000 [#1] SMP
      Modules linked in: acpihp_drv acpihp_slot edd cpufreq_conservative cpufreq_userspace cpufreq_powersave acpi_cpufreq mperf fuse vfat fat loop dm_mod coretemp kvm crc32c_intel ipv6 ixgbe igb iTCO_wdt i7core_edac edac_core pcspkr iTCO_vendor_support ioatdma microcode joydev sr_mod i2c_i801 dca lpc_ich mfd_core mdio tpm_tis i2c_core hid_generic tpm cdrom sg tpm_bios rtc_cmos button ext3 jbd mbcache usbhid hid uhci_hcd ehci_hcd usbcore usb_common sd_mod crc_t10dif processor thermal_sys hwmon scsi_dh_alua scsi_dh_hp_sw scsi_dh_rdac scsi_dh_emc scsi_dh ata_generic ata_piix libata megaraid_sas scsi_mod
      CPU 39
      Pid: 6454, comm: sh Not tainted 3.7.0-rc1-acpihp-final+ #45 QCI QSSC-S4R/QSSC-S4R
      RIP: 0010:[<ffffffff8103c908>]  [<ffffffff8103c908>] __phys_addr+0x88/0x90
      RSP: 0018:ffff8804440d7c08  EFLAGS: 00010006
      RAX: 0000000000000006 RBX: ffffea0012000000 RCX: 000000000000002c
      ...

    Signed-off-by: Jianguo Wu <[email protected]>
    Signed-off-by: Jiang Liu <[email protected]>
    Reviewd-by: Wen Congyang <[email protected]>
    Acked-by: Johannes Weiner <[email protected]>
    Reviewed-by: Yasuaki Ishimatsu <[email protected]>
    Reviewed-by: Michal Hocko <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 6d62cb3
Author: Russell King - ARM Linux <[email protected]>
Date:   Sun Nov 18 16:39:32 2012 +0000

    Dove: Fix irq_to_pmu()

    commit d356cf5 upstream.

    PMU interrupts start at IRQ_DOVE_PMU_START, not IRQ_DOVE_PMU_START + 1.
    Fix the condition.  (It may have been less likely to occur had the code
    been written "if (irq >= IRQ_DOVE_PMU_START" which imho is the easier
    to understand notation, and matches the normal way of thinking about
    these things.)

    Signed-off-by: Russell King <[email protected]>
    Signed-off-by: Jason Cooper <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 31a2aa1
Author: Russell King - ARM Linux <[email protected]>
Date:   Sun Nov 18 16:29:44 2012 +0000

    Dove: Attempt to fix PMU/RTC interrupts

    commit 5d3df93 upstream.

    Fix the acknowledgement of PMU interrupts on Dove: some Dove hardware
    has not been sensibly designed so that interrupts can be handled in a
    race free manner.  The PMU is one such instance.

    The pending (aka 'cause') register is a bunch of RW bits, meaning that
    these bits can be both cleared and set by software (confirmed on the
    Armada-510 on the cubox.)

    Hardware sets the appropriate bit when an interrupt is asserted, and
    software is required to clear the bits which are to be processed.  If
    we write ~(1 << bit), then we end up asserting every other interrupt
    except the one we're processing.  So, we need to do a read-modify-write
    cycle to clear the asserted bit.

    However, any interrupts which occur in the middle of this cycle will
    also be written back as zero, which will also clear the new interrupts.

    The upshot of this is: there is _no_ way to safely clear down interrupts
    in this register (and other similarly behaving interrupt pending
    registers on this device.)  The patch below at least stops us creating
    new interrupts.

    Signed-off-by: Russell King <[email protected]>
    Signed-off-by: Jason Cooper <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
Mustaavalkosta referenced this issue in Mustaavalkosta/htc7x30-3.0 Apr 4, 2013
I get this lockdep warning from swapping load on linux-next, due to
"vmscan: kswapd carefully call compaction".

=================================
[ INFO: inconsistent lock state ]
3.3.0-rc2-next-20120201 #5 Not tainted
---------------------------------
inconsistent {RECLAIM_FS-ON-W} -> {IN-RECLAIM_FS-W} usage.
kswapd0/28 [HC0[0]:SC0[0]:HE1:SE1] takes:
 (pcpu_alloc_mutex){+.+.?.}, at: [<ffffffff810d6684>] pcpu_alloc+0x67/0x325
{RECLAIM_FS-ON-W} state was registered at:
  [<ffffffff81099b75>] mark_held_locks+0xd7/0x103
  [<ffffffff8109a13c>] lockdep_trace_alloc+0x85/0x9e
  [<ffffffff810f6bdc>] __kmalloc+0x6c/0x14b
  [<ffffffff810d57fd>] pcpu_mem_zalloc+0x59/0x62
  [<ffffffff810d5d16>] pcpu_extend_area_map+0x26/0xb1
  [<ffffffff810d679f>] pcpu_alloc+0x182/0x325
  [<ffffffff810d694d>] __alloc_percpu+0xb/0xd
  [<ffffffff8142ebfd>] snmp_mib_init+0x1e/0x2e
  [<ffffffff8185cd8d>] ipv4_mib_init_net+0x7a/0x184
  [<ffffffff813dc963>] ops_init.clone.0+0x6b/0x73
  [<ffffffff813dc9cc>] register_pernet_operations+0x61/0xa0
  [<ffffffff813dca8e>] register_pernet_subsys+0x29/0x42
  [<ffffffff8185d044>] inet_init+0x1ad/0x252
  [<ffffffff810002e3>] do_one_initcall+0x7a/0x12f
  [<ffffffff81832bc5>] kernel_init+0x9d/0x11e
  [<ffffffff814e51e4>] kernel_thread_helper+0x4/0x10
irq event stamp: 656613
hardirqs last  enabled at (656613): [<ffffffff814e0ddc>] __mutex_unlock_slowpath+0x104/0x128
hardirqs last disabled at (656612): [<ffffffff814e0d34>] __mutex_unlock_slowpath+0x5c/0x128
softirqs last  enabled at (655568): [<ffffffff8105b4a5>] __do_softirq+0x120/0x136
softirqs last disabled at (654757): [<ffffffff814e52dc>] call_softirq+0x1c/0x30

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(pcpu_alloc_mutex);
  <Interrupt>
    lock(pcpu_alloc_mutex);

 *** DEADLOCK ***

no locks held by kswapd0/28.

stack backtrace:
Pid: 28, comm: kswapd0 Not tainted 3.3.0-rc2-next-20120201 #5
Call Trace:
 [<ffffffff810981f4>] print_usage_bug+0x1bf/0x1d0
 [<ffffffff81096c3e>] ? print_irq_inversion_bug+0x1d9/0x1d9
 [<ffffffff810982c0>] mark_lock_irq+0xbb/0x22e
 [<ffffffff810c5399>] ? free_hot_cold_page+0x13d/0x14f
 [<ffffffff81098684>] mark_lock+0x251/0x331
 [<ffffffff81098893>] mark_irqflags+0x12f/0x141
 [<ffffffff81098e32>] __lock_acquire+0x58d/0x753
 [<ffffffff810d6684>] ? pcpu_alloc+0x67/0x325
 [<ffffffff81099433>] lock_acquire+0x54/0x6a
 [<ffffffff810d6684>] ? pcpu_alloc+0x67/0x325
 [<ffffffff8107a5b8>] ? add_preempt_count+0xa9/0xae
 [<ffffffff814e0a21>] mutex_lock_nested+0x5e/0x315
 [<ffffffff810d6684>] ? pcpu_alloc+0x67/0x325
 [<ffffffff81098f81>] ? __lock_acquire+0x6dc/0x753
 [<ffffffff810c9fb0>] ? __pagevec_release+0x2c/0x2c
 [<ffffffff810d6684>] pcpu_alloc+0x67/0x325
 [<ffffffff810c9fb0>] ? __pagevec_release+0x2c/0x2c
 [<ffffffff810d694d>] __alloc_percpu+0xb/0xd
 [<ffffffff8106c35e>] schedule_on_each_cpu+0x23/0x110
 [<ffffffff810c9fcb>] lru_add_drain_all+0x10/0x12
 [<ffffffff810f126f>] __compact_pgdat+0x20/0x182
 [<ffffffff810f15c2>] compact_pgdat+0x27/0x29
 [<ffffffff810c306b>] ? zone_watermark_ok+0x1a/0x1c
 [<ffffffff810cdf6f>] balance_pgdat+0x732/0x751
 [<ffffffff810ce0ed>] kswapd+0x15f/0x178
 [<ffffffff810cdf8e>] ? balance_pgdat+0x751/0x751
 [<ffffffff8106fd11>] kthread+0x84/0x8c
 [<ffffffff814e51e4>] kernel_thread_helper+0x4/0x10
 [<ffffffff810787ed>] ? finish_task_switch+0x85/0xea
 [<ffffffff814e3861>] ? retint_restore_args+0xe/0xe
 [<ffffffff8106fc8d>] ? __init_kthread_worker+0x56/0x56
 [<ffffffff814e51e0>] ? gs_change+0xb/0xb

The RECLAIM_FS notations indicate that it's doing the GFP_FS checking that
Nick hacked into lockdep a while back: I think we're intended to read that
"<Interrupt>" in the DEADLOCK scenario as "<Direct reclaim>".

I'm hazy, I have not reached any conclusion as to whether it's right to
complain or not; but I believe it's uneasy about kswapd now doing the
mutex_lock(&pcpu_alloc_mutex) which lru_add_drain_all() entails.  Nor have
I reached any conclusion as to whether it's important for kswapd to do
that draining or not.

But so as not to get blocked on this, with lockdep disabled from giving
further reports, here's a patch which removes the lru_add_drain_all() from
kswapd's callpath (and calls it only once from compact_nodes(), instead of
once per node).

Signed-off-by: Hugh Dickins <[email protected]>
Cc: Rik van Riel <[email protected]>
Acked-by: Mel Gorman <[email protected]>
Cc: Tejun Heo <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Mustaavalkosta referenced this issue in Mustaavalkosta/htc7x30-3.0 May 12, 2013
commit ea88a24
Author: Greg Kroah-Hartman <[email protected]>
Date:   Sat May 11 13:38:25 2013 -0700

    Linux 3.0.78

commit 1183e65
Author: Andre Przywara <[email protected]>
Date:   Wed Oct 31 17:20:50 2012 +0100

    Revert "x86, amd: Disable way access filter on Piledriver CPUs" it is duplicated

    Revert 5e3fe67 which is
    commit 2bbf0a1 upstream.

    Willy pointed out that I messed up and applied this one twice to the
    3.0-stable tree, so revert the second instance of it.

    Reported by: Willy Tarreau <[email protected]>
    Cc: Andre Przywara <[email protected]>
    Cc: H. Peter Anvin <[email protected]>
    Cc: CAI Qian <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

    reverted:

commit dadd72b
Author: Jerry Hoemann <[email protected]>
Date:   Tue Apr 30 15:15:55 2013 -0600

    x86/mm: account for PGDIR_SIZE alignment

    Patch for -stable.  Function find_early_table_space removed upstream.

    Fixes panic in alloc_low_page due to pgt_buf overflow during
    init_memory_mapping.

    find_early_table_space sizes pgt_buf based upon the size of the
    memory being mapped, but it does not take into account the alignment
    of the memory.  When the region being mapped spans a 512GB (PGDIR_SIZE)
    alignment, a panic from alloc_low_pages occurs.

    kernel_physical_mapping_init takes into account PGDIR_SIZE alignment.
    This causes an extra call to alloc_low_page to be made.  This extra call
    isn't accounted for by find_early_table_space and causes a kernel panic.

    Change is to take into account PGDIR_SIZE alignment in find_early_table_space.

    Signed-off-by: Jerry Hoemann <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d47f90f
Author: Chen Gang <[email protected]>
Date:   Mon Apr 29 15:05:19 2013 -0700

    kernel/audit_tree.c: tree will leak memory when failure occurs in audit_trim_trees()

    commit 12b2f11 upstream.

    audit_trim_trees() calls get_tree().  If a failure occurs we must call
    put_tree().

    [[email protected]: run put_tree() before mutex_lock() for small scalability improvement]
    Signed-off-by: Chen Gang <[email protected]>
    Cc: Al Viro <[email protected]>
    Cc: Eric Paris <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Jonghwan Choi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 07bdcd2
Author: Steven Rostedt (Red Hat) <[email protected]>
Date:   Fri Mar 15 13:10:35 2013 -0400

    tracing: Fix ftrace_dump()

    commit 7fe70b5 upstream.

    ftrace_dump() had a lot of issues. What ftrace_dump() does, is when
    ftrace_dump_on_oops is set (via a kernel parameter or sysctl), it
    will dump out the ftrace buffers to the console when either a oops,
    panic, or a sysrq-z occurs.

    This was written a long time ago when ftrace was fragile to recursion.
    But it wasn't written well even for that.

    There's a possible deadlock that can occur if a ftrace_dump() is happening
    and an NMI triggers another dump. This is because it grabs a lock
    before checking if the dump ran.

    It also totally disables ftrace, and tracing for no good reasons.

    As the ring_buffer now checks if it is read via a oops or NMI, where
    there's a chance that the buffer gets corrupted, it will disable
    itself. No need to have ftrace_dump() do the same.

    ftrace_dump() is now cleaned up where it uses an atomic counter to
    make sure only one dump happens at a time. A simple atomic_inc_return()
    is enough that is needed for both other CPUs and NMIs. No need for
    a spinlock, as if one CPU is running the dump, no other CPU needs
    to do it too.

    The tracing_on variable is turned off and not turned on. The original
    code did this, but it wasn't pretty. By just disabling this variable
    we get the result of not seeing traces that happen between crashes.

    For sysrq-z, it doesn't get turned on, but the user can always write
    a '1' to the tracing_on file. If they are using sysrq-z, then they should
    know about tracing_on.

    The new code is much easier to read and less error prone. No more
    deadlock possibility when an NMI triggers here.

    Reported-by: zhangwei(Jovi) <[email protected]>
    Cc: Thomas Gleixner <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Frederic Weisbecker <[email protected]>
    Signed-off-by: Steven Rostedt <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 82bab2b
Author: Alex Deucher <[email protected]>
Date:   Thu Apr 25 09:29:17 2013 -0400

    drm/radeon: fix possible segfault when parsing pm tables

    commit f8e6bfc upstream.

    If we have a empty power table, bail early and allocate
    the default power state.

    Should fix:
    https://bugs.freedesktop.org/show_bug.cgi?id=63865

    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b085d86
Author: Alex Deucher <[email protected]>
Date:   Wed Apr 24 14:39:31 2013 -0400

    drm/radeon: fix endian bugs in atom_allocate_fb_scratch()

    commit beb71fc upstream.

    Reviwed-by: Michel Dänzer <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 370112b
Author: Alex Deucher <[email protected]>
Date:   Thu Apr 11 12:45:34 2013 -0400

    drm/radeon/evergreen+: don't enable HPD interrupts on eDP/LVDS

    commit 2e97be7 upstream.

    Avoids potential interrupt storms when the display is disabled.

    May fix:
    https://bugzilla.kernel.org/show_bug.cgi?id=56041

    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b1459cd
Author: Alex Deucher <[email protected]>
Date:   Mon Mar 18 17:12:50 2013 -0400

    drm/radeon: don't use get_engine_clock() on APUs

    commit bf05d99 upstream.

    It doesn't work reliably.  Just report back the currently
    selected engine clock.

    Partially fixes:
    https://bugs.freedesktop.org/show_bug.cgi?id=62493

    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c2fde23
Author: David Müller <[email protected]>
Date:   Fri Apr 19 10:41:50 2013 +0200

    drm/i915: Fall back to bit banging mode for DVO transmitter detection

    commit e4bfff5 upstream.

    As discussed in this thread
    http://lists.freedesktop.org/archives/dri-devel/2013-April/037411.html
    GMBUS based DVO transmitter detection seems to be unreliable which could
    result in an unusable DVO port.

    The attached patch fixes this by falling back to bit banging mode for
    the time DVO transmitter detection is in progress.

    Signed-off-by: David Müller <[email protected]>
    Tested-by: David Müller <[email protected]>
    Signed-off-by: Daniel Vetter <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit df859dd
Author: Christian Lamparter <[email protected]>
Date:   Wed Apr 3 14:34:11 2013 +0200

    drm/i915: Add no-lvds quirk for Fujitsu Esprimo Q900

    commit 9e9dd0e upstream.

    The "Mobile Sandy Bridge CPUs" in the Fujitsu Esprimo Q900
    mini desktop PCs are probably misleading the LVDS detection
    code in intel_lvds_supported. Nothing is connected to the
    LVDS ports in these systems.

    Signed-off-by: Christian Lamparter <[email protected]>
    Signed-off-by: Daniel Vetter <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 332400f
Author: Hans Schillstrom <[email protected]>
Date:   Sat Apr 27 20:06:14 2013 +0200

    ipvs: ip_vs_sip_fill_param() BUG: bad check of return value

    commit f7a1dd6 upstream.

    The reason for this patch is crash in kmemdup
    caused by returning from get_callid with uniialized
    matchoff and matchlen.

    Removing Zero check of matchlen since it's done by ct_sip_get_header()

    BUG: unable to handle kernel paging request at ffff880457b5763f
    IP: [<ffffffff810df7fc>] kmemdup+0x2e/0x35
    PGD 27f6067 PUD 0
    Oops: 0000 [#1] PREEMPT SMP
    Modules linked in: xt_state xt_helper nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_mangle xt_connmark xt_conntrack ip6_tables nf_conntrack_ftp ip_vs_ftp nf_nat xt_tcpudp iptable_mangle xt_mark ip_tables x_tables ip_vs_rr ip_vs_lblcr ip_vs_pe_sip ip_vs nf_conntrack_sip nf_conntrack bonding igb i2c_algo_bit i2c_core
    CPU 5
    Pid: 0, comm: swapper/5 Not tainted 3.9.0-rc5+ #5                  /S1200KP
    RIP: 0010:[<ffffffff810df7fc>]  [<ffffffff810df7fc>] kmemdup+0x2e/0x35
    RSP: 0018:ffff8803fea03648  EFLAGS: 00010282
    RAX: ffff8803d61063e0 RBX: 0000000000000003 RCX: 0000000000000003
    RDX: 0000000000000003 RSI: ffff880457b5763f RDI: ffff8803d61063e0
    RBP: ffff8803fea03658 R08: 0000000000000008 R09: 0000000000000011
    R10: 0000000000000011 R11: 00ffffffff81a8a3 R12: ffff880457b5763f
    R13: ffff8803d67f786a R14: ffff8803fea03730 R15: ffffffffa0098e90
    FS:  0000000000000000(0000) GS:ffff8803fea00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: ffff880457b5763f CR3: 0000000001a0c000 CR4: 00000000001407e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Process swapper/5 (pid: 0, threadinfo ffff8803ee18c000, task ffff8803ee18a480)
    Stack:
     ffff8803d822a080 000000000000001c ffff8803fea036c8 ffffffffa000937a
     ffffffff81f0d8a0 000000038135fdd5 ffff880300000014 ffff880300110000
     ffffffff150118ac ffff8803d7e8a000 ffff88031e0118ac 0000000000000000
    Call Trace:
     <IRQ>

     [<ffffffffa000937a>] ip_vs_sip_fill_param+0x13a/0x187 [ip_vs_pe_sip]
     [<ffffffffa007b209>] ip_vs_sched_persist+0x2c6/0x9c3 [ip_vs]
     [<ffffffff8107dc53>] ? __lock_acquire+0x677/0x1697
     [<ffffffff8100972e>] ? native_sched_clock+0x3c/0x7d
     [<ffffffff8100972e>] ? native_sched_clock+0x3c/0x7d
     [<ffffffff810649bc>] ? sched_clock_cpu+0x43/0xcf
     [<ffffffffa007bb1e>] ip_vs_schedule+0x181/0x4ba [ip_vs]
    ...

    Signed-off-by: Hans Schillstrom <[email protected]>
    Acked-by: Julian Anastasov <[email protected]>
    Signed-off-by: Simon Horman <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Cc: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit eda948e
Author: David Jeffery <[email protected]>
Date:   Mon May 6 13:49:30 2013 +0800

    autofs - remove autofs dentry mount check

    commit ce8a5db upstream.

    When checking if an autofs mount point is busy it isn't sufficient to
    only check if it's a mount point.

    For example, if the mount of an offset mountpoint in a tree is denied
    for this host by its export and the dentry becomes a process working
    directory the check incorrectly returns the mount as not in use at
    expire.

    This can happen since the default when mounting within a tree is
    nostrict, which means ingnore mount fails on mounts within the tree and
    continue.  The nostrict option is meant to allow mounting in this case.

    Signed-off-by: David Jeffery <[email protected]>
    Signed-off-by: Ian Kent <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 5013bcf
Author: Vaidyanathan Srinivasan <[email protected]>
Date:   Fri Mar 22 05:49:35 2013 +0000

    powerpc: fix numa distance for form0 device tree

    commit 7122bee upstream.

    The following commit breaks numa distance setup for old powerpc
    systems that use form0 encoding in device tree.

    commit 41eab6f
    powerpc/numa: Use form 1 affinity to setup node distance

    Device tree node /rtas/ibm,associativity-reference-points would
    index into /cpus/PowerPCxxxx/ibm,associativity based on form0 or
    form1 encoding detected by ibm,architecture-vec-5 property.

    All modern systems use form1 and current kernel code is correct.
    However, on older systems with form0 encoding, the numa distance
    will get hard coded as LOCAL_DISTANCE for all nodes.  This causes
    task scheduling anomaly since scheduler will skip building numa
    level domain (topmost domain with all cpus) if all numa distances
    are same.  (value of 'level' in sched_init_numa() will remain 0)

    Prior to the above commit:
    ((from) == (to) ? LOCAL_DISTANCE : REMOTE_DISTANCE)

    Restoring compatible behavior with this patch for old powerpc systems
    with device tree where numa distance are encoded as form0.

    Signed-off-by: Vaidyanathan Srinivasan <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
Flinny referenced this issue in Andromadus/htc7x30-3.0 May 15, 2013
powerpc: fix numa distance for form0 device tree

commit 7122bee upstream.

The following commit breaks numa distance setup for old powerpc
systems that use form0 encoding in device tree.

commit 41eab6f
powerpc/numa: Use form 1 affinity to setup node distance

Device tree node /rtas/ibm,associativity-reference-points would
index into /cpus/PowerPCxxxx/ibm,associativity based on form0 or
form1 encoding detected by ibm,architecture-vec-5 property.

All modern systems use form1 and current kernel code is correct.
However, on older systems with form0 encoding, the numa distance
will get hard coded as LOCAL_DISTANCE for all nodes.  This causes
task scheduling anomaly since scheduler will skip building numa
level domain (topmost domain with all cpus) if all numa distances
are same.  (value of 'level' in sched_init_numa() will remain 0)

Prior to the above commit:
((from) == (to) ? LOCAL_DISTANCE : REMOTE_DISTANCE)

Restoring compatible behavior with this patch for old powerpc systems
with device tree where numa distance are encoded as form0.

Signed-off-by: Vaidyanathan Srinivasan <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

autofs - remove autofs dentry mount check

commit ce8a5db upstream.

When checking if an autofs mount point is busy it isn't sufficient to
only check if it's a mount point.

For example, if the mount of an offset mountpoint in a tree is denied
for this host by its export and the dentry becomes a process working
directory the check incorrectly returns the mount as not in use at
expire.

This can happen since the default when mounting within a tree is
nostrict, which means ingnore mount fails on mounts within the tree and
continue.  The nostrict option is meant to allow mounting in this case.

Signed-off-by: David Jeffery <[email protected]>
Signed-off-by: Ian Kent <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ipvs: ip_vs_sip_fill_param() BUG: bad check of return value

commit f7a1dd6 upstream.

The reason for this patch is crash in kmemdup
caused by returning from get_callid with uniialized
matchoff and matchlen.

Removing Zero check of matchlen since it's done by ct_sip_get_header()

BUG: unable to handle kernel paging request at ffff880457b5763f
IP: [<ffffffff810df7fc>] kmemdup+0x2e/0x35
PGD 27f6067 PUD 0
Oops: 0000 [#1] PREEMPT SMP
Modules linked in: xt_state xt_helper nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_mangle xt_connmark xt_conntrack ip6_tables nf_conntrack_ftp ip_vs_ftp nf_nat xt_tcpudp iptable_mangle xt_mark ip_tables x_tables ip_vs_rr ip_vs_lblcr ip_vs_pe_sip ip_vs nf_conntrack_sip nf_conntrack bonding igb i2c_algo_bit i2c_core
CPU 5
Pid: 0, comm: swapper/5 Not tainted 3.9.0-rc5+ #5                  /S1200KP
RIP: 0010:[<ffffffff810df7fc>]  [<ffffffff810df7fc>] kmemdup+0x2e/0x35
RSP: 0018:ffff8803fea03648  EFLAGS: 00010282
RAX: ffff8803d61063e0 RBX: 0000000000000003 RCX: 0000000000000003
RDX: 0000000000000003 RSI: ffff880457b5763f RDI: ffff8803d61063e0
RBP: ffff8803fea03658 R08: 0000000000000008 R09: 0000000000000011
R10: 0000000000000011 R11: 00ffffffff81a8a3 R12: ffff880457b5763f
R13: ffff8803d67f786a R14: ffff8803fea03730 R15: ffffffffa0098e90
FS:  0000000000000000(0000) GS:ffff8803fea00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffff880457b5763f CR3: 0000000001a0c000 CR4: 00000000001407e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process swapper/5 (pid: 0, threadinfo ffff8803ee18c000, task ffff8803ee18a480)
Stack:
 ffff8803d822a080 000000000000001c ffff8803fea036c8 ffffffffa000937a
 ffffffff81f0d8a0 000000038135fdd5 ffff880300000014 ffff880300110000
 ffffffff150118ac ffff8803d7e8a000 ffff88031e0118ac 0000000000000000
Call Trace:
 <IRQ>

 [<ffffffffa000937a>] ip_vs_sip_fill_param+0x13a/0x187 [ip_vs_pe_sip]
 [<ffffffffa007b209>] ip_vs_sched_persist+0x2c6/0x9c3 [ip_vs]
 [<ffffffff8107dc53>] ? __lock_acquire+0x677/0x1697
 [<ffffffff8100972e>] ? native_sched_clock+0x3c/0x7d
 [<ffffffff8100972e>] ? native_sched_clock+0x3c/0x7d
 [<ffffffff810649bc>] ? sched_clock_cpu+0x43/0xcf
 [<ffffffffa007bb1e>] ip_vs_schedule+0x181/0x4ba [ip_vs]
...

Signed-off-by: Hans Schillstrom <[email protected]>
Acked-by: Julian Anastasov <[email protected]>
Signed-off-by: Simon Horman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Cc: Pablo Neira Ayuso <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/i915: Add no-lvds quirk for Fujitsu Esprimo Q900

commit 9e9dd0e upstream.

The "Mobile Sandy Bridge CPUs" in the Fujitsu Esprimo Q900
mini desktop PCs are probably misleading the LVDS detection
code in intel_lvds_supported. Nothing is connected to the
LVDS ports in these systems.

Signed-off-by: Christian Lamparter <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/i915: Fall back to bit banging mode for DVO transmitter detection

commit e4bfff5 upstream.

As discussed in this thread
http://lists.freedesktop.org/archives/dri-devel/2013-April/037411.html
GMBUS based DVO transmitter detection seems to be unreliable which could
result in an unusable DVO port.

The attached patch fixes this by falling back to bit banging mode for
the time DVO transmitter detection is in progress.

Signed-off-by: David Müller <[email protected]>
Tested-by: David Müller <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/radeon: don't use get_engine_clock() on APUs

commit bf05d99 upstream.

It doesn't work reliably.  Just report back the currently
selected engine clock.

Partially fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=62493

Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/radeon/evergreen+: don't enable HPD interrupts on eDP/LVDS

commit 2e97be7 upstream.

Avoids potential interrupt storms when the display is disabled.

May fix:
https://bugzilla.kernel.org/show_bug.cgi?id=56041

Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/radeon: fix endian bugs in atom_allocate_fb_scratch()

commit beb71fc upstream.

Reviwed-by: Michel Dänzer <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/radeon: fix possible segfault when parsing pm tables

commit f8e6bfc upstream.

If we have a empty power table, bail early and allocate
the default power state.

Should fix:
https://bugs.freedesktop.org/show_bug.cgi?id=63865

Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

tracing: Fix ftrace_dump()

commit 7fe70b5 upstream.

ftrace_dump() had a lot of issues. What ftrace_dump() does, is when
ftrace_dump_on_oops is set (via a kernel parameter or sysctl), it
will dump out the ftrace buffers to the console when either a oops,
panic, or a sysrq-z occurs.

This was written a long time ago when ftrace was fragile to recursion.
But it wasn't written well even for that.

There's a possible deadlock that can occur if a ftrace_dump() is happening
and an NMI triggers another dump. This is because it grabs a lock
before checking if the dump ran.

It also totally disables ftrace, and tracing for no good reasons.

As the ring_buffer now checks if it is read via a oops or NMI, where
there's a chance that the buffer gets corrupted, it will disable
itself. No need to have ftrace_dump() do the same.

ftrace_dump() is now cleaned up where it uses an atomic counter to
make sure only one dump happens at a time. A simple atomic_inc_return()
is enough that is needed for both other CPUs and NMIs. No need for
a spinlock, as if one CPU is running the dump, no other CPU needs
to do it too.

The tracing_on variable is turned off and not turned on. The original
code did this, but it wasn't pretty. By just disabling this variable
we get the result of not seeing traces that happen between crashes.

For sysrq-z, it doesn't get turned on, but the user can always write
a '1' to the tracing_on file. If they are using sysrq-z, then they should
know about tracing_on.

The new code is much easier to read and less error prone. No more
deadlock possibility when an NMI triggers here.

Reported-by: zhangwei(Jovi) <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

kernel/audit_tree.c: tree will leak memory when failure occurs in audit_trim_trees()

commit 12b2f11 upstream.

audit_trim_trees() calls get_tree().  If a failure occurs we must call
put_tree().

[[email protected]: run put_tree() before mutex_lock() for small scalability improvement]
Signed-off-by: Chen Gang <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Eric Paris <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Jonghwan Choi <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

x86/mm: account for PGDIR_SIZE alignment

Patch for -stable.  Function find_early_table_space removed upstream.

Fixes panic in alloc_low_page due to pgt_buf overflow during
init_memory_mapping.

find_early_table_space sizes pgt_buf based upon the size of the
memory being mapped, but it does not take into account the alignment
of the memory.  When the region being mapped spans a 512GB (PGDIR_SIZE)
alignment, a panic from alloc_low_pages occurs.

kernel_physical_mapping_init takes into account PGDIR_SIZE alignment.
This causes an extra call to alloc_low_page to be made.  This extra call
isn't accounted for by find_early_table_space and causes a kernel panic.

Change is to take into account PGDIR_SIZE alignment in find_early_table_space.

Signed-off-by: Jerry Hoemann <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Revert "x86, amd: Disable way access filter on Piledriver CPUs" it is duplicated

Revert 5e3fe67 which is
commit 2bbf0a1 upstream.

Willy pointed out that I messed up and applied this one twice to the
3.0-stable tree, so revert the second instance of it.

Reported by: Willy Tarreau <[email protected]>
Cc: Andre Przywara <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: CAI Qian <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

reverted:
Juansheng referenced this issue in Juansheng/kernel_htc_vision May 20, 2013
powerpc: fix numa distance for form0 device tree

commit 7122bee upstream.

The following commit breaks numa distance setup for old powerpc
systems that use form0 encoding in device tree.

commit 41eab6f
powerpc/numa: Use form 1 affinity to setup node distance

Device tree node /rtas/ibm,associativity-reference-points would
index into /cpus/PowerPCxxxx/ibm,associativity based on form0 or
form1 encoding detected by ibm,architecture-vec-5 property.

All modern systems use form1 and current kernel code is correct.
However, on older systems with form0 encoding, the numa distance
will get hard coded as LOCAL_DISTANCE for all nodes.  This causes
task scheduling anomaly since scheduler will skip building numa
level domain (topmost domain with all cpus) if all numa distances
are same.  (value of 'level' in sched_init_numa() will remain 0)

Prior to the above commit:
((from) == (to) ? LOCAL_DISTANCE : REMOTE_DISTANCE)

Restoring compatible behavior with this patch for old powerpc systems
with device tree where numa distance are encoded as form0.

Signed-off-by: Vaidyanathan Srinivasan <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

autofs - remove autofs dentry mount check

commit ce8a5db upstream.

When checking if an autofs mount point is busy it isn't sufficient to
only check if it's a mount point.

For example, if the mount of an offset mountpoint in a tree is denied
for this host by its export and the dentry becomes a process working
directory the check incorrectly returns the mount as not in use at
expire.

This can happen since the default when mounting within a tree is
nostrict, which means ingnore mount fails on mounts within the tree and
continue.  The nostrict option is meant to allow mounting in this case.

Signed-off-by: David Jeffery <[email protected]>
Signed-off-by: Ian Kent <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

ipvs: ip_vs_sip_fill_param() BUG: bad check of return value

commit f7a1dd6 upstream.

The reason for this patch is crash in kmemdup
caused by returning from get_callid with uniialized
matchoff and matchlen.

Removing Zero check of matchlen since it's done by ct_sip_get_header()

BUG: unable to handle kernel paging request at ffff880457b5763f
IP: [<ffffffff810df7fc>] kmemdup+0x2e/0x35
PGD 27f6067 PUD 0
Oops: 0000 [#1] PREEMPT SMP
Modules linked in: xt_state xt_helper nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_mangle xt_connmark xt_conntrack ip6_tables nf_conntrack_ftp ip_vs_ftp nf_nat xt_tcpudp iptable_mangle xt_mark ip_tables x_tables ip_vs_rr ip_vs_lblcr ip_vs_pe_sip ip_vs nf_conntrack_sip nf_conntrack bonding igb i2c_algo_bit i2c_core
CPU 5
Pid: 0, comm: swapper/5 Not tainted 3.9.0-rc5+ Andromadus#5                  /S1200KP
RIP: 0010:[<ffffffff810df7fc>]  [<ffffffff810df7fc>] kmemdup+0x2e/0x35
RSP: 0018:ffff8803fea03648  EFLAGS: 00010282
RAX: ffff8803d61063e0 RBX: 0000000000000003 RCX: 0000000000000003
RDX: 0000000000000003 RSI: ffff880457b5763f RDI: ffff8803d61063e0
RBP: ffff8803fea03658 R08: 0000000000000008 R09: 0000000000000011
R10: 0000000000000011 R11: 00ffffffff81a8a3 R12: ffff880457b5763f
R13: ffff8803d67f786a R14: ffff8803fea03730 R15: ffffffffa0098e90
FS:  0000000000000000(0000) GS:ffff8803fea00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffff880457b5763f CR3: 0000000001a0c000 CR4: 00000000001407e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process swapper/5 (pid: 0, threadinfo ffff8803ee18c000, task ffff8803ee18a480)
Stack:
 ffff8803d822a080 000000000000001c ffff8803fea036c8 ffffffffa000937a
 ffffffff81f0d8a0 000000038135fdd5 ffff880300000014 ffff880300110000
 ffffffff150118ac ffff8803d7e8a000 ffff88031e0118ac 0000000000000000
Call Trace:
 <IRQ>

 [<ffffffffa000937a>] ip_vs_sip_fill_param+0x13a/0x187 [ip_vs_pe_sip]
 [<ffffffffa007b209>] ip_vs_sched_persist+0x2c6/0x9c3 [ip_vs]
 [<ffffffff8107dc53>] ? __lock_acquire+0x677/0x1697
 [<ffffffff8100972e>] ? native_sched_clock+0x3c/0x7d
 [<ffffffff8100972e>] ? native_sched_clock+0x3c/0x7d
 [<ffffffff810649bc>] ? sched_clock_cpu+0x43/0xcf
 [<ffffffffa007bb1e>] ip_vs_schedule+0x181/0x4ba [ip_vs]
...

Signed-off-by: Hans Schillstrom <[email protected]>
Acked-by: Julian Anastasov <[email protected]>
Signed-off-by: Simon Horman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Cc: Pablo Neira Ayuso <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/i915: Add no-lvds quirk for Fujitsu Esprimo Q900

commit 9e9dd0e upstream.

The "Mobile Sandy Bridge CPUs" in the Fujitsu Esprimo Q900
mini desktop PCs are probably misleading the LVDS detection
code in intel_lvds_supported. Nothing is connected to the
LVDS ports in these systems.

Signed-off-by: Christian Lamparter <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/i915: Fall back to bit banging mode for DVO transmitter detection

commit e4bfff5 upstream.

As discussed in this thread
http://lists.freedesktop.org/archives/dri-devel/2013-April/037411.html
GMBUS based DVO transmitter detection seems to be unreliable which could
result in an unusable DVO port.

The attached patch fixes this by falling back to bit banging mode for
the time DVO transmitter detection is in progress.

Signed-off-by: David Müller <[email protected]>
Tested-by: David Müller <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/radeon: don't use get_engine_clock() on APUs

commit bf05d99 upstream.

It doesn't work reliably.  Just report back the currently
selected engine clock.

Partially fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=62493

Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/radeon/evergreen+: don't enable HPD interrupts on eDP/LVDS

commit 2e97be7 upstream.

Avoids potential interrupt storms when the display is disabled.

May fix:
https://bugzilla.kernel.org/show_bug.cgi?id=56041

Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/radeon: fix endian bugs in atom_allocate_fb_scratch()

commit beb71fc upstream.

Reviwed-by: Michel Dänzer <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

drm/radeon: fix possible segfault when parsing pm tables

commit f8e6bfc upstream.

If we have a empty power table, bail early and allocate
the default power state.

Should fix:
https://bugs.freedesktop.org/show_bug.cgi?id=63865

Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

tracing: Fix ftrace_dump()

commit 7fe70b5 upstream.

ftrace_dump() had a lot of issues. What ftrace_dump() does, is when
ftrace_dump_on_oops is set (via a kernel parameter or sysctl), it
will dump out the ftrace buffers to the console when either a oops,
panic, or a sysrq-z occurs.

This was written a long time ago when ftrace was fragile to recursion.
But it wasn't written well even for that.

There's a possible deadlock that can occur if a ftrace_dump() is happening
and an NMI triggers another dump. This is because it grabs a lock
before checking if the dump ran.

It also totally disables ftrace, and tracing for no good reasons.

As the ring_buffer now checks if it is read via a oops or NMI, where
there's a chance that the buffer gets corrupted, it will disable
itself. No need to have ftrace_dump() do the same.

ftrace_dump() is now cleaned up where it uses an atomic counter to
make sure only one dump happens at a time. A simple atomic_inc_return()
is enough that is needed for both other CPUs and NMIs. No need for
a spinlock, as if one CPU is running the dump, no other CPU needs
to do it too.

The tracing_on variable is turned off and not turned on. The original
code did this, but it wasn't pretty. By just disabling this variable
we get the result of not seeing traces that happen between crashes.

For sysrq-z, it doesn't get turned on, but the user can always write
a '1' to the tracing_on file. If they are using sysrq-z, then they should
know about tracing_on.

The new code is much easier to read and less error prone. No more
deadlock possibility when an NMI triggers here.

Reported-by: zhangwei(Jovi) <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

kernel/audit_tree.c: tree will leak memory when failure occurs in audit_trim_trees()

commit 12b2f11 upstream.

audit_trim_trees() calls get_tree().  If a failure occurs we must call
put_tree().

[[email protected]: run put_tree() before mutex_lock() for small scalability improvement]
Signed-off-by: Chen Gang <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Eric Paris <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Jonghwan Choi <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

x86/mm: account for PGDIR_SIZE alignment

Patch for -stable.  Function find_early_table_space removed upstream.

Fixes panic in alloc_low_page due to pgt_buf overflow during
init_memory_mapping.

find_early_table_space sizes pgt_buf based upon the size of the
memory being mapped, but it does not take into account the alignment
of the memory.  When the region being mapped spans a 512GB (PGDIR_SIZE)
alignment, a panic from alloc_low_pages occurs.

kernel_physical_mapping_init takes into account PGDIR_SIZE alignment.
This causes an extra call to alloc_low_page to be made.  This extra call
isn't accounted for by find_early_table_space and causes a kernel panic.

Change is to take into account PGDIR_SIZE alignment in find_early_table_space.

Signed-off-by: Jerry Hoemann <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

Revert "x86, amd: Disable way access filter on Piledriver CPUs" it is duplicated

Revert 5e3fe67 which is
commit 2bbf0a1 upstream.

Willy pointed out that I messed up and applied this one twice to the
3.0-stable tree, so revert the second instance of it.

Reported by: Willy Tarreau <[email protected]>
Cc: Andre Przywara <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: CAI Qian <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

reverted:

Linux 3.0.78
yanniks referenced this issue in yanniks/RowShow-7x30 Jun 20, 2013
commit 3e7abe2 upstream.

When unbinding a device so that I could pass it through to a KVM VM, I
got the lockdep report below.  It looks like a legitimate lock
ordering problem:

 - domain_context_mapping_one() takes iommu->lock and calls
   iommu_support_dev_iotlb(), which takes device_domain_lock (inside
   iommu->lock).

 - domain_remove_one_dev_info() starts by taking device_domain_lock
   then takes iommu->lock inside it (near the end of the function).

So this is the classic AB-BA deadlock.  It looks like a safe fix is to
simply release device_domain_lock a bit earlier, since as far as I can
tell, it doesn't protect any of the stuff accessed at the end of
domain_remove_one_dev_info() anyway.

BTW, the use of device_domain_lock looks a bit unsafe to me... it's
at least not obvious to me why we aren't vulnerable to the race below:

  iommu_support_dev_iotlb()
                                          domain_remove_dev_info()

  lock device_domain_lock
    find info
  unlock device_domain_lock

                                          lock device_domain_lock
                                            find same info
                                          unlock device_domain_lock

                                          free_devinfo_mem(info)

  do stuff with info after it's free

However I don't understand the locking here well enough to know if
this is a real problem, let alone what the best fix is.

Anyway here's the full lockdep output that prompted all of this:

     =======================================================
     [ INFO: possible circular locking dependency detected ]
     2.6.39.1+ KangBangKreations#1
     -------------------------------------------------------
     bash/13954 is trying to acquire lock:
      (&(&iommu->lock)->rlock){......}, at: [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230

     but task is already holding lock:
      (device_domain_lock){-.-...}, at: [<ffffffff812f6508>] domain_remove_one_dev_info+0x208/0x230

     which lock already depends on the new lock.

     the existing dependency chain (in reverse order) is:

     -> KangBangKreations#1 (device_domain_lock){-.-...}:
            [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
            [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
            [<ffffffff812f8350>] domain_context_mapping_one+0x600/0x750
            [<ffffffff812f84df>] domain_context_mapping+0x3f/0x120
            [<ffffffff812f9175>] iommu_prepare_identity_map+0x1c5/0x1e0
            [<ffffffff81ccf1ca>] intel_iommu_init+0x88e/0xb5e
            [<ffffffff81cab204>] pci_iommu_init+0x16/0x41
            [<ffffffff81002165>] do_one_initcall+0x45/0x190
            [<ffffffff81ca3d3f>] kernel_init+0xe3/0x168
            [<ffffffff8157ac24>] kernel_thread_helper+0x4/0x10

     -> #0 (&(&iommu->lock)->rlock){......}:
            [<ffffffff8109bf3e>] __lock_acquire+0x195e/0x1e10
            [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
            [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
            [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230
            [<ffffffff812f8b42>] device_notifier+0x72/0x90
            [<ffffffff8157555c>] notifier_call_chain+0x8c/0xc0
            [<ffffffff81089768>] __blocking_notifier_call_chain+0x78/0xb0
            [<ffffffff810897b6>] blocking_notifier_call_chain+0x16/0x20
            [<ffffffff81373a5c>] __device_release_driver+0xbc/0xe0
            [<ffffffff81373ccf>] device_release_driver+0x2f/0x50
            [<ffffffff81372ee3>] driver_unbind+0xa3/0xc0
            [<ffffffff813724ac>] drv_attr_store+0x2c/0x30
            [<ffffffff811e4506>] sysfs_write_file+0xe6/0x170
            [<ffffffff8117569e>] vfs_write+0xce/0x190
            [<ffffffff811759e4>] sys_write+0x54/0xa0
            [<ffffffff81579a82>] system_call_fastpath+0x16/0x1b

     other info that might help us debug this:

     6 locks held by bash/13954:
      #0:  (&buffer->mutex){+.+.+.}, at: [<ffffffff811e4464>] sysfs_write_file+0x44/0x170
      KangBangKreations#1:  (s_active#3){++++.+}, at: [<ffffffff811e44ed>] sysfs_write_file+0xcd/0x170
      KangBangKreations#2:  (&__lockdep_no_validate__){+.+.+.}, at: [<ffffffff81372edb>] driver_unbind+0x9b/0xc0
      KangBangKreations#3:  (&__lockdep_no_validate__){+.+.+.}, at: [<ffffffff81373cc7>] device_release_driver+0x27/0x50
      KangBangKreations#4:  (&(&priv->bus_notifier)->rwsem){.+.+.+}, at: [<ffffffff8108974f>] __blocking_notifier_call_chain+0x5f/0xb0
      KangBangKreations#5:  (device_domain_lock){-.-...}, at: [<ffffffff812f6508>] domain_remove_one_dev_info+0x208/0x230

     stack backtrace:
     Pid: 13954, comm: bash Not tainted 2.6.39.1+ KangBangKreations#1
     Call Trace:
      [<ffffffff810993a7>] print_circular_bug+0xf7/0x100
      [<ffffffff8109bf3e>] __lock_acquire+0x195e/0x1e10
      [<ffffffff810972bd>] ? trace_hardirqs_off+0xd/0x10
      [<ffffffff8109d57d>] ? trace_hardirqs_on_caller+0x13d/0x180
      [<ffffffff8109ca9d>] lock_acquire+0x9d/0x130
      [<ffffffff812f6421>] ? domain_remove_one_dev_info+0x121/0x230
      [<ffffffff81571475>] _raw_spin_lock_irqsave+0x55/0xa0
      [<ffffffff812f6421>] ? domain_remove_one_dev_info+0x121/0x230
      [<ffffffff810972bd>] ? trace_hardirqs_off+0xd/0x10
      [<ffffffff812f6421>] domain_remove_one_dev_info+0x121/0x230
      [<ffffffff812f8b42>] device_notifier+0x72/0x90
      [<ffffffff8157555c>] notifier_call_chain+0x8c/0xc0
      [<ffffffff81089768>] __blocking_notifier_call_chain+0x78/0xb0
      [<ffffffff810897b6>] blocking_notifier_call_chain+0x16/0x20
      [<ffffffff81373a5c>] __device_release_driver+0xbc/0xe0
      [<ffffffff81373ccf>] device_release_driver+0x2f/0x50
      [<ffffffff81372ee3>] driver_unbind+0xa3/0xc0
      [<ffffffff813724ac>] drv_attr_store+0x2c/0x30
      [<ffffffff811e4506>] sysfs_write_file+0xe6/0x170
      [<ffffffff8117569e>] vfs_write+0xce/0x190
      [<ffffffff811759e4>] sys_write+0x54/0xa0
      [<ffffffff81579a82>] system_call_fastpath+0x16/0x1b

Signed-off-by: Roland Dreier <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
Cc: Steven Rostedt <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
yanniks referenced this issue in yanniks/RowShow-7x30 Jun 20, 2013
commit 412d32e upstream.

A rescue thread exiting TASK_INTERRUPTIBLE can lead to a task scheduling
off, never to be seen again.  In the case where this occurred, an exiting
thread hit reiserfs homebrew conditional resched while holding a mutex,
bringing the box to its knees.

PID: 18105  TASK: ffff8807fd412180  CPU: 5   COMMAND: "kdmflush"
 #0 [ffff8808157e7670] schedule at ffffffff8143f489
 KangBangKreations#1 [ffff8808157e77b8] reiserfs_get_block at ffffffffa038ab2d [reiserfs]
 KangBangKreations#2 [ffff8808157e79a8] __block_write_begin at ffffffff8117fb14
 KangBangKreations#3 [ffff8808157e7a98] reiserfs_write_begin at ffffffffa0388695 [reiserfs]
 KangBangKreations#4 [ffff8808157e7ad8] generic_perform_write at ffffffff810ee9e2
 KangBangKreations#5 [ffff8808157e7b58] generic_file_buffered_write at ffffffff810eeb41
 KangBangKreations#6 [ffff8808157e7ba8] __generic_file_aio_write at ffffffff810f1a3a
 #7 [ffff8808157e7c58] generic_file_aio_write at ffffffff810f1c88
 #8 [ffff8808157e7cc8] do_sync_write at ffffffff8114f850
 #9 [ffff8808157e7dd8] do_acct_process at ffffffff810a268f
    [exception RIP: kernel_thread_helper]
    RIP: ffffffff8144a5c0  RSP: ffff8808157e7f58  RFLAGS: 00000202
    RAX: 0000000000000000  RBX: 0000000000000000  RCX: 0000000000000000
    RDX: 0000000000000000  RSI: ffffffff8107af60  RDI: ffff8803ee491d18
    RBP: 0000000000000000   R8: 0000000000000000   R9: 0000000000000000
    R10: 0000000000000000  R11: 0000000000000000  R12: 0000000000000000
    R13: 0000000000000000  R14: 0000000000000000  R15: 0000000000000000
    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018

Signed-off-by: Mike Galbraith <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
yanniks referenced this issue in yanniks/RowShow-7x30 Jun 20, 2013
commit f7a1dd6 upstream.

The reason for this patch is crash in kmemdup
caused by returning from get_callid with uniialized
matchoff and matchlen.

Removing Zero check of matchlen since it's done by ct_sip_get_header()

BUG: unable to handle kernel paging request at ffff880457b5763f
IP: [<ffffffff810df7fc>] kmemdup+0x2e/0x35
PGD 27f6067 PUD 0
Oops: 0000 [KangBangKreations#1] PREEMPT SMP
Modules linked in: xt_state xt_helper nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_mangle xt_connmark xt_conntrack ip6_tables nf_conntrack_ftp ip_vs_ftp nf_nat xt_tcpudp iptable_mangle xt_mark ip_tables x_tables ip_vs_rr ip_vs_lblcr ip_vs_pe_sip ip_vs nf_conntrack_sip nf_conntrack bonding igb i2c_algo_bit i2c_core
CPU 5
Pid: 0, comm: swapper/5 Not tainted 3.9.0-rc5+ KangBangKreations#5                  /S1200KP
RIP: 0010:[<ffffffff810df7fc>]  [<ffffffff810df7fc>] kmemdup+0x2e/0x35
RSP: 0018:ffff8803fea03648  EFLAGS: 00010282
RAX: ffff8803d61063e0 RBX: 0000000000000003 RCX: 0000000000000003
RDX: 0000000000000003 RSI: ffff880457b5763f RDI: ffff8803d61063e0
RBP: ffff8803fea03658 R08: 0000000000000008 R09: 0000000000000011
R10: 0000000000000011 R11: 00ffffffff81a8a3 R12: ffff880457b5763f
R13: ffff8803d67f786a R14: ffff8803fea03730 R15: ffffffffa0098e90
FS:  0000000000000000(0000) GS:ffff8803fea00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffff880457b5763f CR3: 0000000001a0c000 CR4: 00000000001407e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process swapper/5 (pid: 0, threadinfo ffff8803ee18c000, task ffff8803ee18a480)
Stack:
 ffff8803d822a080 000000000000001c ffff8803fea036c8 ffffffffa000937a
 ffffffff81f0d8a0 000000038135fdd5 ffff880300000014 ffff880300110000
 ffffffff150118ac ffff8803d7e8a000 ffff88031e0118ac 0000000000000000
Call Trace:
 <IRQ>

 [<ffffffffa000937a>] ip_vs_sip_fill_param+0x13a/0x187 [ip_vs_pe_sip]
 [<ffffffffa007b209>] ip_vs_sched_persist+0x2c6/0x9c3 [ip_vs]
 [<ffffffff8107dc53>] ? __lock_acquire+0x677/0x1697
 [<ffffffff8100972e>] ? native_sched_clock+0x3c/0x7d
 [<ffffffff8100972e>] ? native_sched_clock+0x3c/0x7d
 [<ffffffff810649bc>] ? sched_clock_cpu+0x43/0xcf
 [<ffffffffa007bb1e>] ip_vs_schedule+0x181/0x4ba [ip_vs]
...

Signed-off-by: Hans Schillstrom <[email protected]>
Acked-by: Julian Anastasov <[email protected]>
Signed-off-by: Simon Horman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Cc: Pablo Neira Ayuso <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
espmartin referenced this issue in espmartin/htc7x30-3.0 Jul 16, 2013
commit ea88a24
Author: Greg Kroah-Hartman <[email protected]>
Date:   Sat May 11 13:38:25 2013 -0700

    Linux 3.0.78

commit 1183e65
Author: Andre Przywara <[email protected]>
Date:   Wed Oct 31 17:20:50 2012 +0100

    Revert "x86, amd: Disable way access filter on Piledriver CPUs" it is duplicated

    Revert 5e3fe67 which is
    commit 2bbf0a1 upstream.

    Willy pointed out that I messed up and applied this one twice to the
    3.0-stable tree, so revert the second instance of it.

    Reported by: Willy Tarreau <[email protected]>
    Cc: Andre Przywara <[email protected]>
    Cc: H. Peter Anvin <[email protected]>
    Cc: CAI Qian <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

    reverted:

commit dadd72b
Author: Jerry Hoemann <[email protected]>
Date:   Tue Apr 30 15:15:55 2013 -0600

    x86/mm: account for PGDIR_SIZE alignment

    Patch for -stable.  Function find_early_table_space removed upstream.

    Fixes panic in alloc_low_page due to pgt_buf overflow during
    init_memory_mapping.

    find_early_table_space sizes pgt_buf based upon the size of the
    memory being mapped, but it does not take into account the alignment
    of the memory.  When the region being mapped spans a 512GB (PGDIR_SIZE)
    alignment, a panic from alloc_low_pages occurs.

    kernel_physical_mapping_init takes into account PGDIR_SIZE alignment.
    This causes an extra call to alloc_low_page to be made.  This extra call
    isn't accounted for by find_early_table_space and causes a kernel panic.

    Change is to take into account PGDIR_SIZE alignment in find_early_table_space.

    Signed-off-by: Jerry Hoemann <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit d47f90f
Author: Chen Gang <[email protected]>
Date:   Mon Apr 29 15:05:19 2013 -0700

    kernel/audit_tree.c: tree will leak memory when failure occurs in audit_trim_trees()

    commit 12b2f11 upstream.

    audit_trim_trees() calls get_tree().  If a failure occurs we must call
    put_tree().

    [[email protected]: run put_tree() before mutex_lock() for small scalability improvement]
    Signed-off-by: Chen Gang <[email protected]>
    Cc: Al Viro <[email protected]>
    Cc: Eric Paris <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Jonghwan Choi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 07bdcd2
Author: Steven Rostedt (Red Hat) <[email protected]>
Date:   Fri Mar 15 13:10:35 2013 -0400

    tracing: Fix ftrace_dump()

    commit 7fe70b5 upstream.

    ftrace_dump() had a lot of issues. What ftrace_dump() does, is when
    ftrace_dump_on_oops is set (via a kernel parameter or sysctl), it
    will dump out the ftrace buffers to the console when either a oops,
    panic, or a sysrq-z occurs.

    This was written a long time ago when ftrace was fragile to recursion.
    But it wasn't written well even for that.

    There's a possible deadlock that can occur if a ftrace_dump() is happening
    and an NMI triggers another dump. This is because it grabs a lock
    before checking if the dump ran.

    It also totally disables ftrace, and tracing for no good reasons.

    As the ring_buffer now checks if it is read via a oops or NMI, where
    there's a chance that the buffer gets corrupted, it will disable
    itself. No need to have ftrace_dump() do the same.

    ftrace_dump() is now cleaned up where it uses an atomic counter to
    make sure only one dump happens at a time. A simple atomic_inc_return()
    is enough that is needed for both other CPUs and NMIs. No need for
    a spinlock, as if one CPU is running the dump, no other CPU needs
    to do it too.

    The tracing_on variable is turned off and not turned on. The original
    code did this, but it wasn't pretty. By just disabling this variable
    we get the result of not seeing traces that happen between crashes.

    For sysrq-z, it doesn't get turned on, but the user can always write
    a '1' to the tracing_on file. If they are using sysrq-z, then they should
    know about tracing_on.

    The new code is much easier to read and less error prone. No more
    deadlock possibility when an NMI triggers here.

    Reported-by: zhangwei(Jovi) <[email protected]>
    Cc: Thomas Gleixner <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Frederic Weisbecker <[email protected]>
    Signed-off-by: Steven Rostedt <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 82bab2b
Author: Alex Deucher <[email protected]>
Date:   Thu Apr 25 09:29:17 2013 -0400

    drm/radeon: fix possible segfault when parsing pm tables

    commit f8e6bfc upstream.

    If we have a empty power table, bail early and allocate
    the default power state.

    Should fix:
    https://bugs.freedesktop.org/show_bug.cgi?id=63865

    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b085d86
Author: Alex Deucher <[email protected]>
Date:   Wed Apr 24 14:39:31 2013 -0400

    drm/radeon: fix endian bugs in atom_allocate_fb_scratch()

    commit beb71fc upstream.

    Reviwed-by: Michel Dänzer <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 370112b
Author: Alex Deucher <[email protected]>
Date:   Thu Apr 11 12:45:34 2013 -0400

    drm/radeon/evergreen+: don't enable HPD interrupts on eDP/LVDS

    commit 2e97be7 upstream.

    Avoids potential interrupt storms when the display is disabled.

    May fix:
    https://bugzilla.kernel.org/show_bug.cgi?id=56041

    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit b1459cd
Author: Alex Deucher <[email protected]>
Date:   Mon Mar 18 17:12:50 2013 -0400

    drm/radeon: don't use get_engine_clock() on APUs

    commit bf05d99 upstream.

    It doesn't work reliably.  Just report back the currently
    selected engine clock.

    Partially fixes:
    https://bugs.freedesktop.org/show_bug.cgi?id=62493

    Signed-off-by: Alex Deucher <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c2fde23
Author: David Müller <[email protected]>
Date:   Fri Apr 19 10:41:50 2013 +0200

    drm/i915: Fall back to bit banging mode for DVO transmitter detection

    commit e4bfff5 upstream.

    As discussed in this thread
    http://lists.freedesktop.org/archives/dri-devel/2013-April/037411.html
    GMBUS based DVO transmitter detection seems to be unreliable which could
    result in an unusable DVO port.

    The attached patch fixes this by falling back to bit banging mode for
    the time DVO transmitter detection is in progress.

    Signed-off-by: David Müller <[email protected]>
    Tested-by: David Müller <[email protected]>
    Signed-off-by: Daniel Vetter <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit df859dd
Author: Christian Lamparter <[email protected]>
Date:   Wed Apr 3 14:34:11 2013 +0200

    drm/i915: Add no-lvds quirk for Fujitsu Esprimo Q900

    commit 9e9dd0e upstream.

    The "Mobile Sandy Bridge CPUs" in the Fujitsu Esprimo Q900
    mini desktop PCs are probably misleading the LVDS detection
    code in intel_lvds_supported. Nothing is connected to the
    LVDS ports in these systems.

    Signed-off-by: Christian Lamparter <[email protected]>
    Signed-off-by: Daniel Vetter <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 332400f
Author: Hans Schillstrom <[email protected]>
Date:   Sat Apr 27 20:06:14 2013 +0200

    ipvs: ip_vs_sip_fill_param() BUG: bad check of return value

    commit f7a1dd6 upstream.

    The reason for this patch is crash in kmemdup
    caused by returning from get_callid with uniialized
    matchoff and matchlen.

    Removing Zero check of matchlen since it's done by ct_sip_get_header()

    BUG: unable to handle kernel paging request at ffff880457b5763f
    IP: [<ffffffff810df7fc>] kmemdup+0x2e/0x35
    PGD 27f6067 PUD 0
    Oops: 0000 [KangBangKreations#1] PREEMPT SMP
    Modules linked in: xt_state xt_helper nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_mangle xt_connmark xt_conntrack ip6_tables nf_conntrack_ftp ip_vs_ftp nf_nat xt_tcpudp iptable_mangle xt_mark ip_tables x_tables ip_vs_rr ip_vs_lblcr ip_vs_pe_sip ip_vs nf_conntrack_sip nf_conntrack bonding igb i2c_algo_bit i2c_core
    CPU 5
    Pid: 0, comm: swapper/5 Not tainted 3.9.0-rc5+ KangBangKreations#5                  /S1200KP
    RIP: 0010:[<ffffffff810df7fc>]  [<ffffffff810df7fc>] kmemdup+0x2e/0x35
    RSP: 0018:ffff8803fea03648  EFLAGS: 00010282
    RAX: ffff8803d61063e0 RBX: 0000000000000003 RCX: 0000000000000003
    RDX: 0000000000000003 RSI: ffff880457b5763f RDI: ffff8803d61063e0
    RBP: ffff8803fea03658 R08: 0000000000000008 R09: 0000000000000011
    R10: 0000000000000011 R11: 00ffffffff81a8a3 R12: ffff880457b5763f
    R13: ffff8803d67f786a R14: ffff8803fea03730 R15: ffffffffa0098e90
    FS:  0000000000000000(0000) GS:ffff8803fea00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: ffff880457b5763f CR3: 0000000001a0c000 CR4: 00000000001407e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
    Process swapper/5 (pid: 0, threadinfo ffff8803ee18c000, task ffff8803ee18a480)
    Stack:
     ffff8803d822a080 000000000000001c ffff8803fea036c8 ffffffffa000937a
     ffffffff81f0d8a0 000000038135fdd5 ffff880300000014 ffff880300110000
     ffffffff150118ac ffff8803d7e8a000 ffff88031e0118ac 0000000000000000
    Call Trace:
     <IRQ>

     [<ffffffffa000937a>] ip_vs_sip_fill_param+0x13a/0x187 [ip_vs_pe_sip]
     [<ffffffffa007b209>] ip_vs_sched_persist+0x2c6/0x9c3 [ip_vs]
     [<ffffffff8107dc53>] ? __lock_acquire+0x677/0x1697
     [<ffffffff8100972e>] ? native_sched_clock+0x3c/0x7d
     [<ffffffff8100972e>] ? native_sched_clock+0x3c/0x7d
     [<ffffffff810649bc>] ? sched_clock_cpu+0x43/0xcf
     [<ffffffffa007bb1e>] ip_vs_schedule+0x181/0x4ba [ip_vs]
    ...

    Signed-off-by: Hans Schillstrom <[email protected]>
    Acked-by: Julian Anastasov <[email protected]>
    Signed-off-by: Simon Horman <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Cc: Pablo Neira Ayuso <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit eda948e
Author: David Jeffery <[email protected]>
Date:   Mon May 6 13:49:30 2013 +0800

    autofs - remove autofs dentry mount check

    commit ce8a5db upstream.

    When checking if an autofs mount point is busy it isn't sufficient to
    only check if it's a mount point.

    For example, if the mount of an offset mountpoint in a tree is denied
    for this host by its export and the dentry becomes a process working
    directory the check incorrectly returns the mount as not in use at
    expire.

    This can happen since the default when mounting within a tree is
    nostrict, which means ingnore mount fails on mounts within the tree and
    continue.  The nostrict option is meant to allow mounting in this case.

    Signed-off-by: David Jeffery <[email protected]>
    Signed-off-by: Ian Kent <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 5013bcf
Author: Vaidyanathan Srinivasan <[email protected]>
Date:   Fri Mar 22 05:49:35 2013 +0000

    powerpc: fix numa distance for form0 device tree

    commit 7122bee upstream.

    The following commit breaks numa distance setup for old powerpc
    systems that use form0 encoding in device tree.

    commit 41eab6f
    powerpc/numa: Use form 1 affinity to setup node distance

    Device tree node /rtas/ibm,associativity-reference-points would
    index into /cpus/PowerPCxxxx/ibm,associativity based on form0 or
    form1 encoding detected by ibm,architecture-vec-5 property.

    All modern systems use form1 and current kernel code is correct.
    However, on older systems with form0 encoding, the numa distance
    will get hard coded as LOCAL_DISTANCE for all nodes.  This causes
    task scheduling anomaly since scheduler will skip building numa
    level domain (topmost domain with all cpus) if all numa distances
    are same.  (value of 'level' in sched_init_numa() will remain 0)

    Prior to the above commit:
    ((from) == (to) ? LOCAL_DISTANCE : REMOTE_DISTANCE)

    Restoring compatible behavior with this patch for old powerpc systems
    with device tree where numa distance are encoded as form0.

    Signed-off-by: Vaidyanathan Srinivasan <[email protected]>
    Signed-off-by: Michael Ellerman <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
Flinny referenced this issue in Andromadus/htc7x30-3.0 Aug 23, 2013
hwmon: (adt7470) Fix incorrect return code check

commit 93d783b upstream.

In adt7470_write_word_data(), which writes two bytes using
i2c_smbus_write_byte_data(), the return codes are incorrectly AND-ed
together when they should be OR-ed together.

The return code of i2c_smbus_write_byte_data() is zero for success.

The upshot is only the first byte was ever written to the hardware.
The 2nd byte was never written out.

I noticed that trying to set the fan speed limits was not working
correctly on my system.  Setting the fan speed limits is the only
code that uses adt7470_write_word_data().  After making the change
the limit settings work and the alarms work also.

Signed-off-by: Curt Brune <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

virtio: console: fix race with port unplug and open/close

commit 057b82b upstream.

There's a window between find_port_by_devt() returning a port and us
taking a kref on the port, where the port could get unplugged.  Fix it
by taking the reference in find_port_by_devt() itself.

Problem reported and analyzed by Mateusz Guzik.

Reported-by: Mateusz Guzik <[email protected]>
Signed-off-by: Amit Shah <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

virtio: console: fix race in port_fops_open() and port unplug

commit 671bdea upstream.

Between open() being called and processed, the port can be unplugged.
Check if this happened, and bail out.

A simple test script to reproduce this is:

while true; do for i in $(seq 1 100); do echo $i > /dev/vport0p3; done; done;

This opens and closes the port a lot of times; unplugging the port while
this is happening triggers the bug.

Signed-off-by: Amit Shah <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

virtio: console: clean up port data immediately at time of unplug

commit ea3768b upstream.

We used to keep the port's char device structs and the /sys entries
around till the last reference to the port was dropped.  This is
actually unnecessary, and resulted in buggy behaviour:

1. Open port in guest
2. Hot-unplug port
3. Hot-plug a port with the same 'name' property as the unplugged one

This resulted in hot-plug being unsuccessful, as a port with the same
name already exists (even though it was unplugged).

This behaviour resulted in a warning message like this one:

-------------------8<---------------------------------------
WARNING: at fs/sysfs/dir.c:512 sysfs_add_one+0xc9/0x130() (Not tainted)
Hardware name: KVM
sysfs: cannot create duplicate filename
'/devices/pci0000:00/0000:00:04.0/virtio0/virtio-ports/vport0p1'

Call Trace:
 [<ffffffff8106b607>] ? warn_slowpath_common+0x87/0xc0
 [<ffffffff8106b6f6>] ? warn_slowpath_fmt+0x46/0x50
 [<ffffffff811f2319>] ? sysfs_add_one+0xc9/0x130
 [<ffffffff811f23e8>] ? create_dir+0x68/0xb0
 [<ffffffff811f2469>] ? sysfs_create_dir+0x39/0x50
 [<ffffffff81273129>] ? kobject_add_internal+0xb9/0x260
 [<ffffffff812733d8>] ? kobject_add_varg+0x38/0x60
 [<ffffffff812734b4>] ? kobject_add+0x44/0x70
 [<ffffffff81349de4>] ? get_device_parent+0xf4/0x1d0
 [<ffffffff8134b389>] ? device_add+0xc9/0x650

-------------------8<---------------------------------------

Instead of relying on guest applications to release all references to
the ports, we should go ahead and unregister the port from all the core
layers.  Any open/read calls on the port will then just return errors,
and an unplug/plug operation on the host will succeed as expected.

This also caused buggy behaviour in case of the device removal (not just
a port): when the device was removed (which means all ports on that
device are removed automatically as well), the ports with active
users would clean up only when the last references were dropped -- and
it would be too late then to be referencing char device pointers,
resulting in oopses:

-------------------8<---------------------------------------
PID: 6162   TASK: ffff8801147ad500  CPU: 0   COMMAND: "cat"
 #0 [ffff88011b9d5a90] machine_kexec at ffffffff8103232b
 #1 [ffff88011b9d5af0] crash_kexec at ffffffff810b9322
 #2 [ffff88011b9d5bc0] oops_end at ffffffff814f4a50
 #3 [ffff88011b9d5bf0] die at ffffffff8100f26b
 #4 [ffff88011b9d5c20] do_general_protection at ffffffff814f45e2
 #5 [ffff88011b9d5c50] general_protection at ffffffff814f3db5
    [exception RIP: strlen+2]
    RIP: ffffffff81272ae2  RSP: ffff88011b9d5d00  RFLAGS: 00010246
    RAX: 0000000000000000  RBX: ffff880118901c18  RCX: 0000000000000000
    RDX: ffff88011799982c  RSI: 00000000000000d0  RDI: 3a303030302f3030
    RBP: ffff88011b9d5d38   R8: 0000000000000006   R9: ffffffffa0134500
    R10: 0000000000001000  R11: 0000000000001000  R12: ffff880117a1cc10
    R13: 00000000000000d0  R14: 0000000000000017  R15: ffffffff81aff700
    ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
 #6 [ffff88011b9d5d00] kobject_get_path at ffffffff8126dc5d
 #7 [ffff88011b9d5d40] kobject_uevent_env at ffffffff8126e551
 #8 [ffff88011b9d5dd0] kobject_uevent at ffffffff8126e9eb
 #9 [ffff88011b9d5de0] device_del at ffffffff813440c7

-------------------8<---------------------------------------

So clean up when we have all the context, and all that's left to do when
the references to the port have dropped is to free up the port struct
itself.

Reported-by: chayang <[email protected]>
Reported-by: YOGANANTH SUBRAMANIAN <[email protected]>
Reported-by: FuXiangChun <[email protected]>
Reported-by: Qunfang Zhang <[email protected]>
Reported-by: Sibiao Luo <[email protected]>
Signed-off-by: Amit Shah <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

virtio: console: fix raising SIGIO after port unplug

commit 92d3453 upstream.

SIGIO should be sent when a port gets unplugged.  It should only be sent
to prcesses that have the port opened, and have asked for SIGIO to be
delivered.  We were clearing out guest_connected before calling
send_sigio_to_port(), resulting in a sigio not getting sent to
processes.

Fix by setting guest_connected to false after invoking the sigio
function.

Signed-off-by: Amit Shah <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

virtio: console: return -ENODEV on all read operations after unplug

commit 96f97a8 upstream.

If a port gets unplugged while a user is blocked on read(), -ENODEV is
returned.  However, subsequent read()s returned 0, indicating there's no
host-side connection (but not indicating the device went away).

This also happened when a port was unplugged and the user didn't have
any blocking operation pending.  If the user didn't monitor the SIGIO
signal, they won't have a chance to find out if the port went away.

Fix by returning -ENODEV on all read()s after the port gets unplugged.
write() already behaves this way.

Signed-off-by: Amit Shah <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

debugfs: debugfs_remove_recursive() must not rely on list_empty(d_subdirs)

commit 776164c upstream.

debugfs_remove_recursive() is wrong,

1. it wrongly assumes that !list_empty(d_subdirs) means that this
   dir should be removed.

   This is not that bad by itself, but:

2. if d_subdirs does not becomes empty after __debugfs_remove()
   it gives up and silently fails, it doesn't even try to remove
   other entries.

   However ->d_subdirs can be non-empty because it still has the
   already deleted !debugfs_positive() entries.

3. simple_release_fs() is called even if __debugfs_remove() fails.

Suppose we have

	dir1/
		dir2/
			file2
		file1

and someone opens dir1/dir2/file2.

Now, debugfs_remove_recursive(dir1/dir2) succeeds, and dir1/dir2 goes
away.

But debugfs_remove_recursive(dir1) silently fails and doesn't remove
this directory. Because it tries to delete (the already deleted)
dir1/dir2/file2 again and then fails due to "Avoid infinite loop"
logic.

Test-case:

	#!/bin/sh

	cd /sys/kernel/debug/tracing
	echo 'p:probe/sigprocmask sigprocmask' >> kprobe_events
	sleep 1000 < events/probe/sigprocmask/id &
	echo -n >| kprobe_events

	[ -d events/probe ] && echo "ERR!! failed to rm probe"

And after that it is not possible to create another probe entry.

With this patch debugfs_remove_recursive() skips !debugfs_positive()
files although this is not strictly needed. The most important change
is that it does not try to make ->d_subdirs empty, it simply scans
the whole list(s) recursively and removes as much as possible.

Link: http://lkml.kernel.org/r/[email protected]

Acked-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Oleg Nesterov <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

cifs: silence compiler warnings showing up with gcc-4.7.0

commit b2a3ad9 upstream.

gcc-4.7.0 has started throwing these warnings when building cifs.ko.

  CC [M]  fs/cifs/cifssmb.o
fs/cifs/cifssmb.c: In function ‘CIFSSMBSetCIFSACL’:
fs/cifs/cifssmb.c:3905:9: warning: array subscript is above array bounds [-Warray-bounds]
fs/cifs/cifssmb.c: In function ‘CIFSSMBSetFileInfo’:
fs/cifs/cifssmb.c:5711:8: warning: array subscript is above array bounds [-Warray-bounds]
fs/cifs/cifssmb.c: In function ‘CIFSSMBUnixSetFileInfo’:
fs/cifs/cifssmb.c:6001:25: warning: array subscript is above array bounds [-Warray-bounds]

This patch cleans up the code a bit by using the offsetof macro instead
of the funky "&pSMB->hdr.Protocol" construct.

Signed-off-by: Jeff Layton <[email protected]>
Signed-off-by: Steve French <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

tracing: Fix fields of struct trace_iterator that are zeroed by mistake

commit ed5467d upstream.

tracing_read_pipe zeros all fields bellow "seq". The declaration contains
a comment about that, but it doesn't help.

The first field is "snapshot", it's true when current open file is
snapshot. Looks obvious, that it should not be zeroed.

The second field is "started". It was converted from cpumask_t to
cpumask_var_t (v2.6.28-4983-g4462344), in other words it was
converted from cpumask to pointer on cpumask.

Currently the reference on "started" memory is lost after the first read
from tracing_read_pipe and a proper object will never be freed.

The "started" is never dereferenced for trace_pipe, because trace_pipe
can't have the TRACE_FILE_ANNOTATE options.

Link: http://lkml.kernel.org/r/[email protected]

Signed-off-by: Andrew Vagin <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

SCSI: nsp32: use mdelay instead of large udelay constants

commit b497ceb upstream.

ARM cannot handle udelay for more than 2 miliseconds, so we
should use mdelay instead for those.

Signed-off-by: Arnd Bergmann <[email protected]>
Acked-by: GOTO Masanori <[email protected]>
Cc: YOKOTA Hiroshi <[email protected]>
Cc: "James E.J. Bottomley" <[email protected]>
Cc: Guenter Roeck <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

vfs: d_obtain_alias() needs to use "/" as default name.

commit b911a6b upstream.

NFS appears to use d_obtain_alias() to create the root dentry rather than
d_make_root.  This can cause 'prepend_path()' to complain that the root
has a weird name if an NFS filesystem is lazily unmounted.  e.g.  if
"/mnt" is an NFS mount then

 { cd /mnt; umount -l /mnt ; ls -l /proc/self/cwd; }

will cause a WARN message like
   WARNING: at /home/git/linux/fs/dcache.c:2624 prepend_path+0x1d7/0x1e0()
   ...
   Root dentry has weird name <>

to appear in kernel logs.

So change d_obtain_alias() to use "/" rather than "" as the anonymous
name.

Signed-off-by: NeilBrown <[email protected]>
Cc: Trond Myklebust <[email protected]>
Cc: Al Viro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Al Viro <[email protected]>
[bwh: Backported to 3.2: use named initialisers instead of QSTR_INIT()]
Signed-off-by: Ben Hutchings <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

perf tools: Add anonymous huge page recognition

commit d0528b5 upstream.

Judging anonymous memory's vm_area_struct, perf_mmap_event's filename
will be set to "//anon" indicating this vma belongs to anonymous
memory.

Once hugepage is used, vma's vm_file points to hugetlbfs. In this way,
this vma will not be regarded as anonymous memory by is_anon_memory() in
perf user space utility.

Signed-off-by: Joshua Zhu <[email protected]>
Cc: Akihiro Nagai <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Joshua Zhu <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Vinson Lee <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Flinny referenced this issue in Andromadus/htc7x30-3.0 Jan 8, 2014
commit af4bafb
Author: Greg Kroah-Hartman <[email protected]>
Date:   Wed Aug 14 22:55:43 2013 -0700

    Linux 3.0.91

commit 0e4f739
Author: Joshua Zhu <[email protected]>
Date:   Sat Jan 5 13:29:57 2013 +0800

    perf tools: Add anonymous huge page recognition

    commit d0528b5 upstream.

    Judging anonymous memory's vm_area_struct, perf_mmap_event's filename
    will be set to "//anon" indicating this vma belongs to anonymous
    memory.

    Once hugepage is used, vma's vm_file points to hugetlbfs. In this way,
    this vma will not be regarded as anonymous memory by is_anon_memory() in
    perf user space utility.

    Signed-off-by: Joshua Zhu <[email protected]>
    Cc: Akihiro Nagai <[email protected]>
    Cc: Andi Kleen <[email protected]>
    Cc: David Ahern <[email protected]>
    Cc: Ingo Molnar <[email protected]>
    Cc: Jiri Olsa <[email protected]>
    Cc: Joshua Zhu <[email protected]>
    Cc: Namhyung Kim <[email protected]>
    Cc: Paul Mackerras <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Vinson Lee <[email protected]>
    Link: http://lkml.kernel.org/r/[email protected]
    Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 03b9342
Author: NeilBrown <[email protected]>
Date:   Thu Nov 8 16:09:37 2012 -0800

    vfs: d_obtain_alias() needs to use "/" as default name.

    commit b911a6b upstream.

    NFS appears to use d_obtain_alias() to create the root dentry rather than
    d_make_root.  This can cause 'prepend_path()' to complain that the root
    has a weird name if an NFS filesystem is lazily unmounted.  e.g.  if
    "/mnt" is an NFS mount then

     { cd /mnt; umount -l /mnt ; ls -l /proc/self/cwd; }

    will cause a WARN message like
       WARNING: at /home/git/linux/fs/dcache.c:2624 prepend_path+0x1d7/0x1e0()
       ...
       Root dentry has weird name <>

    to appear in kernel logs.

    So change d_obtain_alias() to use "/" rather than "" as the anonymous
    name.

    Signed-off-by: NeilBrown <[email protected]>
    Cc: Trond Myklebust <[email protected]>
    Cc: Al Viro <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Al Viro <[email protected]>
    [bwh: Backported to 3.2: use named initialisers instead of QSTR_INIT()]
    Signed-off-by: Ben Hutchings <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 5fc83a9
Author: Arnd Bergmann <[email protected]>
Date:   Thu Mar 14 15:21:36 2013 +0100

    SCSI: nsp32: use mdelay instead of large udelay constants

    commit b497ceb upstream.

    ARM cannot handle udelay for more than 2 miliseconds, so we
    should use mdelay instead for those.

    Signed-off-by: Arnd Bergmann <[email protected]>
    Acked-by: GOTO Masanori <[email protected]>
    Cc: YOKOTA Hiroshi <[email protected]>
    Cc: "James E.J. Bottomley" <[email protected]>
    Cc: Guenter Roeck <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit c63eea7
Author: Andrew Vagin <[email protected]>
Date:   Fri Aug 2 21:16:43 2013 +0400

    tracing: Fix fields of struct trace_iterator that are zeroed by mistake

    commit ed5467d upstream.

    tracing_read_pipe zeros all fields bellow "seq". The declaration contains
    a comment about that, but it doesn't help.

    The first field is "snapshot", it's true when current open file is
    snapshot. Looks obvious, that it should not be zeroed.

    The second field is "started". It was converted from cpumask_t to
    cpumask_var_t (v2.6.28-4983-g4462344), in other words it was
    converted from cpumask to pointer on cpumask.

    Currently the reference on "started" memory is lost after the first read
    from tracing_read_pipe and a proper object will never be freed.

    The "started" is never dereferenced for trace_pipe, because trace_pipe
    can't have the TRACE_FILE_ANNOTATE options.

    Link: http://lkml.kernel.org/r/[email protected]

    Signed-off-by: Andrew Vagin <[email protected]>
    Signed-off-by: Steven Rostedt <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit a9d8aae
Author: Jeff Layton <[email protected]>
Date:   Mon Mar 26 09:55:29 2012 -0400

    cifs: silence compiler warnings showing up with gcc-4.7.0

    commit b2a3ad9 upstream.

    gcc-4.7.0 has started throwing these warnings when building cifs.ko.

      CC [M]  fs/cifs/cifssmb.o
    fs/cifs/cifssmb.c: In function ‘CIFSSMBSetCIFSACL’:
    fs/cifs/cifssmb.c:3905:9: warning: array subscript is above array bounds [-Warray-bounds]
    fs/cifs/cifssmb.c: In function ‘CIFSSMBSetFileInfo’:
    fs/cifs/cifssmb.c:5711:8: warning: array subscript is above array bounds [-Warray-bounds]
    fs/cifs/cifssmb.c: In function ‘CIFSSMBUnixSetFileInfo’:
    fs/cifs/cifssmb.c:6001:25: warning: array subscript is above array bounds [-Warray-bounds]

    This patch cleans up the code a bit by using the offsetof macro instead
    of the funky "&pSMB->hdr.Protocol" construct.

    Signed-off-by: Jeff Layton <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 1b48f57
Author: Oleg Nesterov <[email protected]>
Date:   Fri Jul 26 17:12:56 2013 +0200

    debugfs: debugfs_remove_recursive() must not rely on list_empty(d_subdirs)

    commit 776164c upstream.

    debugfs_remove_recursive() is wrong,

    1. it wrongly assumes that !list_empty(d_subdirs) means that this
       dir should be removed.

       This is not that bad by itself, but:

    2. if d_subdirs does not becomes empty after __debugfs_remove()
       it gives up and silently fails, it doesn't even try to remove
       other entries.

       However ->d_subdirs can be non-empty because it still has the
       already deleted !debugfs_positive() entries.

    3. simple_release_fs() is called even if __debugfs_remove() fails.

    Suppose we have

        dir1/
            dir2/
                file2
            file1

    and someone opens dir1/dir2/file2.

    Now, debugfs_remove_recursive(dir1/dir2) succeeds, and dir1/dir2 goes
    away.

    But debugfs_remove_recursive(dir1) silently fails and doesn't remove
    this directory. Because it tries to delete (the already deleted)
    dir1/dir2/file2 again and then fails due to "Avoid infinite loop"
    logic.

    Test-case:

        #!/bin/sh

        cd /sys/kernel/debug/tracing
        echo 'p:probe/sigprocmask sigprocmask' >> kprobe_events
        sleep 1000 < events/probe/sigprocmask/id &
        echo -n >| kprobe_events

        [ -d events/probe ] && echo "ERR!! failed to rm probe"

    And after that it is not possible to create another probe entry.

    With this patch debugfs_remove_recursive() skips !debugfs_positive()
    files although this is not strictly needed. The most important change
    is that it does not try to make ->d_subdirs empty, it simply scans
    the whole list(s) recursively and removes as much as possible.

    Link: http://lkml.kernel.org/r/[email protected]

    Acked-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Oleg Nesterov <[email protected]>
    Signed-off-by: Steven Rostedt <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 1336e0d
Author: Amit Shah <[email protected]>
Date:   Mon Jul 29 14:23:21 2013 +0930

    virtio: console: return -ENODEV on all read operations after unplug

    commit 96f97a8 upstream.

    If a port gets unplugged while a user is blocked on read(), -ENODEV is
    returned.  However, subsequent read()s returned 0, indicating there's no
    host-side connection (but not indicating the device went away).

    This also happened when a port was unplugged and the user didn't have
    any blocking operation pending.  If the user didn't monitor the SIGIO
    signal, they won't have a chance to find out if the port went away.

    Fix by returning -ENODEV on all read()s after the port gets unplugged.
    write() already behaves this way.

    Signed-off-by: Amit Shah <[email protected]>
    Signed-off-by: Rusty Russell <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 7ba6337
Author: Amit Shah <[email protected]>
Date:   Mon Jul 29 14:21:32 2013 +0930

    virtio: console: fix raising SIGIO after port unplug

    commit 92d3453 upstream.

    SIGIO should be sent when a port gets unplugged.  It should only be sent
    to prcesses that have the port opened, and have asked for SIGIO to be
    delivered.  We were clearing out guest_connected before calling
    send_sigio_to_port(), resulting in a sigio not getting sent to
    processes.

    Fix by setting guest_connected to false after invoking the sigio
    function.

    Signed-off-by: Amit Shah <[email protected]>
    Signed-off-by: Rusty Russell <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 64aafc3
Author: Amit Shah <[email protected]>
Date:   Mon Jul 29 14:20:29 2013 +0930

    virtio: console: clean up port data immediately at time of unplug

    commit ea3768b upstream.

    We used to keep the port's char device structs and the /sys entries
    around till the last reference to the port was dropped.  This is
    actually unnecessary, and resulted in buggy behaviour:

    1. Open port in guest
    2. Hot-unplug port
    3. Hot-plug a port with the same 'name' property as the unplugged one

    This resulted in hot-plug being unsuccessful, as a port with the same
    name already exists (even though it was unplugged).

    This behaviour resulted in a warning message like this one:

    -------------------8<---------------------------------------
    WARNING: at fs/sysfs/dir.c:512 sysfs_add_one+0xc9/0x130() (Not tainted)
    Hardware name: KVM
    sysfs: cannot create duplicate filename
    '/devices/pci0000:00/0000:00:04.0/virtio0/virtio-ports/vport0p1'

    Call Trace:
     [<ffffffff8106b607>] ? warn_slowpath_common+0x87/0xc0
     [<ffffffff8106b6f6>] ? warn_slowpath_fmt+0x46/0x50
     [<ffffffff811f2319>] ? sysfs_add_one+0xc9/0x130
     [<ffffffff811f23e8>] ? create_dir+0x68/0xb0
     [<ffffffff811f2469>] ? sysfs_create_dir+0x39/0x50
     [<ffffffff81273129>] ? kobject_add_internal+0xb9/0x260
     [<ffffffff812733d8>] ? kobject_add_varg+0x38/0x60
     [<ffffffff812734b4>] ? kobject_add+0x44/0x70
     [<ffffffff81349de4>] ? get_device_parent+0xf4/0x1d0
     [<ffffffff8134b389>] ? device_add+0xc9/0x650

    -------------------8<---------------------------------------

    Instead of relying on guest applications to release all references to
    the ports, we should go ahead and unregister the port from all the core
    layers.  Any open/read calls on the port will then just return errors,
    and an unplug/plug operation on the host will succeed as expected.

    This also caused buggy behaviour in case of the device removal (not just
    a port): when the device was removed (which means all ports on that
    device are removed automatically as well), the ports with active
    users would clean up only when the last references were dropped -- and
    it would be too late then to be referencing char device pointers,
    resulting in oopses:

    -------------------8<---------------------------------------
    PID: 6162   TASK: ffff8801147ad500  CPU: 0   COMMAND: "cat"
     #0 [ffff88011b9d5a90] machine_kexec at ffffffff8103232b
     #1 [ffff88011b9d5af0] crash_kexec at ffffffff810b9322
     #2 [ffff88011b9d5bc0] oops_end at ffffffff814f4a50
     #3 [ffff88011b9d5bf0] die at ffffffff8100f26b
     #4 [ffff88011b9d5c20] do_general_protection at ffffffff814f45e2
     #5 [ffff88011b9d5c50] general_protection at ffffffff814f3db5
        [exception RIP: strlen+2]
        RIP: ffffffff81272ae2  RSP: ffff88011b9d5d00  RFLAGS: 00010246
        RAX: 0000000000000000  RBX: ffff880118901c18  RCX: 0000000000000000
        RDX: ffff88011799982c  RSI: 00000000000000d0  RDI: 3a303030302f3030
        RBP: ffff88011b9d5d38   R8: 0000000000000006   R9: ffffffffa0134500
        R10: 0000000000001000  R11: 0000000000001000  R12: ffff880117a1cc10
        R13: 00000000000000d0  R14: 0000000000000017  R15: ffffffff81aff700
        ORIG_RAX: ffffffffffffffff  CS: 0010  SS: 0018
     #6 [ffff88011b9d5d00] kobject_get_path at ffffffff8126dc5d
     #7 [ffff88011b9d5d40] kobject_uevent_env at ffffffff8126e551
     #8 [ffff88011b9d5dd0] kobject_uevent at ffffffff8126e9eb
     #9 [ffff88011b9d5de0] device_del at ffffffff813440c7

    -------------------8<---------------------------------------

    So clean up when we have all the context, and all that's left to do when
    the references to the port have dropped is to free up the port struct
    itself.

    Reported-by: chayang <[email protected]>
    Reported-by: YOGANANTH SUBRAMANIAN <[email protected]>
    Reported-by: FuXiangChun <[email protected]>
    Reported-by: Qunfang Zhang <[email protected]>
    Reported-by: Sibiao Luo <[email protected]>
    Signed-off-by: Amit Shah <[email protected]>
    Signed-off-by: Rusty Russell <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 6c17607
Author: Amit Shah <[email protected]>
Date:   Mon Jul 29 14:17:13 2013 +0930

    virtio: console: fix race in port_fops_open() and port unplug

    commit 671bdea upstream.

    Between open() being called and processed, the port can be unplugged.
    Check if this happened, and bail out.

    A simple test script to reproduce this is:

    while true; do for i in $(seq 1 100); do echo $i > /dev/vport0p3; done; done;

    This opens and closes the port a lot of times; unplugging the port while
    this is happening triggers the bug.

    Signed-off-by: Amit Shah <[email protected]>
    Signed-off-by: Rusty Russell <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit e3a5a43
Author: Amit Shah <[email protected]>
Date:   Mon Jul 29 14:16:13 2013 +0930

    virtio: console: fix race with port unplug and open/close

    commit 057b82b upstream.

    There's a window between find_port_by_devt() returning a port and us
    taking a kref on the port, where the port could get unplugged.  Fix it
    by taking the reference in find_port_by_devt() itself.

    Problem reported and analyzed by Mateusz Guzik.

    Reported-by: Mateusz Guzik <[email protected]>
    Signed-off-by: Amit Shah <[email protected]>
    Signed-off-by: Rusty Russell <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

commit 2e18e51
Author: Curt Brune <[email protected]>
Date:   Thu Aug 8 12:11:03 2013 -0700

    hwmon: (adt7470) Fix incorrect return code check

    commit 93d783b upstream.

    In adt7470_write_word_data(), which writes two bytes using
    i2c_smbus_write_byte_data(), the return codes are incorrectly AND-ed
    together when they should be OR-ed together.

    The return code of i2c_smbus_write_byte_data() is zero for success.

    The upshot is only the first byte was ever written to the hardware.
    The 2nd byte was never written out.

    I noticed that trying to set the fan speed limits was not working
    correctly on my system.  Setting the fan speed limits is the only
    code that uses adt7470_write_word_data().  After making the change
    the limit settings work and the alarms work also.

    Signed-off-by: Curt Brune <[email protected]>
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants