1. 03 Jan, 2014 40 commits
    • Stephen M. Cameron's avatar
      hpsa: return 0 from driver probe function on success, not 1 · e4394d61
      Stephen M. Cameron authored
      commit 88bf6d62 upstream.
      
      A return value of 1 is interpreted as an error.  See pci_driver.
      in local_pci_probe().  If you're wondering how this ever could
      have worked, it's because it used to be the case that only return
      values less than zero were interpreted as failure.  But even in
      the current kernel if the driver registers its various entry
      points with the kernel, and then returns a value which is
      interpreted as failure, those registrations aren't undone, so
      the driver still mostly works.  However, the driver's remove
      function wouldn't be called on rmmod, and pci power management
      functions wouldn't work.  In the case of Smart Array, since it
      has a battery backed cache (or else no cache) even if the driver
      is not shut down properly as long as there is no outstanding
      i/o, nothing too bad happens, which is why it took so long to
      notice.
      
      Requesting backport to stable because the change to pci-driver.c
      which requires driver probe functions to return 0 occurred between
      2.6.35 and 2.6.36 (the pci power management breakage) and again
      between 3.7 and 3.8 (pci_dev->driver getting set to NULL in
      local_pci_probe() preventing driver remove function from being
      called on rmmod.)
      Signed-off-by: default avatarStephen M. Cameron <scameron@beardog.cce.hp.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e4394d61
    • Stephen M. Cameron's avatar
      hpsa: do not discard scsi status on aborted commands · 249e9834
      Stephen M. Cameron authored
      commit 2e311fba upstream.
      
      We inadvertantly discarded the scsi status for aborted commands.
      For some commands (e.g. reads from tape drives) these can't be retried,
      and if we discarded the scsi status, the scsi mid layer couldn't notice
      anything was wrong and the error was not reported.
      Signed-off-by: default avatarStephen M. Cameron <scameron@beardog.cce.hp.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      249e9834
    • Russell King's avatar
      ARM: footbridge: fix VGA initialisation · cb80debe
      Russell King authored
      commit 43659222 upstream.
      
      It's no good setting vga_base after the VGA console has been
      initialised, because if we do that we get this:
      
      Unable to handle kernel paging request at virtual address 000b8000
      pgd = c0004000
      [000b8000] *pgd=07ffc831, *pte=00000000, *ppte=00000000
      0Internal error: Oops: 5017 [#1] ARM
      Modules linked in:
      CPU: 0 PID: 0 Comm: swapper Not tainted 3.12.0+ #49
      task: c03e2974 ti: c03d8000 task.ti: c03d8000
      PC is at vgacon_startup+0x258/0x39c
      LR is at request_resource+0x10/0x1c
      pc : [<c01725d0>]    lr : [<c0022b50>]    psr: 60000053
      sp : c03d9f68  ip : 000b8000  fp : c03d9f8c
      r10: 000055aa  r9 : 4401a103  r8 : ffffaa55
      r7 : c03e357c  r6 : c051b460  r5 : 000000ff  r4 : 000c0000
      r3 : 000b8000  r2 : c03e0514  r1 : 00000000  r0 : c0304971
      Flags: nZCv  IRQs on  FIQs off  Mode SVC_32  ISA ARM  Segment kernel
      
      which is an access to the 0xb8000 without the PCI offset required to
      make it work.
      
      Fixes: cc22b4c1 ("ARM: set vga memory base at run-time")
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      cb80debe
    • Shawn Landden's avatar
      net: update consumers of MSG_MORE to recognize MSG_SENDPAGE_NOTLAST · 23e32f51
      Shawn Landden authored
      commit d3f7d56a upstream.
      
      Commit 35f9c09f (tcp: tcp_sendpages() should call tcp_push() once)
      added an internal flag MSG_SENDPAGE_NOTLAST, similar to
      MSG_MORE.
      
      algif_hash, algif_skcipher, and udp used MSG_MORE from tcp_sendpages()
      and need to see the new flag as identical to MSG_MORE.
      
      This fixes sendfile() on AF_ALG.
      
      v3: also fix udp
      
      Cc: Tom Herbert <therbert@google.com>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: David S. Miller <davem@davemloft.net>
      Reported-and-tested-by: default avatarShawn Landden <shawnlandden@gmail.com>
      Original-patch: Richard Weinberger <richard@nod.at>
      Signed-off-by: default avatarShawn Landden <shawn@churchofgit.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      23e32f51
    • Linus Walleij's avatar
      net: smc91: fix crash regression on the versatile · 824a6ef9
      Linus Walleij authored
      commit a0c20fb0 upstream.
      
      After commit e9e4ea74
      "net: smc91x: dont't use SMC_outw for fixing up halfword-aligned data"
      The Versatile SMSC LAN91C111 is crashing like this:
      
      ------------[ cut here ]------------
      kernel BUG at /home/linus/linux/drivers/net/ethernet/smsc/smc91x.c:599!
      Internal error: Oops - BUG: 0 [#1] ARM
      Modules linked in:
      CPU: 0 PID: 43 Comm: udhcpc Not tainted 3.13.0-rc1+ #24
      task: c6ccfaa0 ti: c6cd0000 task.ti: c6cd0000
      PC is at smc_hardware_send_pkt+0x198/0x22c
      LR is at smc_hardware_send_pkt+0x24/0x22c
      pc : [<c01be324>]    lr : [<c01be1b0>]    psr: 20000013
      sp : c6cd1d08  ip : 00000001  fp : 00000000
      r10: c02adb08  r9 : 00000000  r8 : c6ced802
      r7 : c786fba0  r6 : 00000146  r5 : c8800000  r4 : c78d6000
      r3 : 0000000f  r2 : 00000146  r1 : 00000000  r0 : 00000031
      Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
      Control: 0005317f  Table: 06cf4000  DAC: 00000015
      Process udhcpc (pid: 43, stack limit = 0xc6cd01c0)
      Stack: (0xc6cd1d08 to 0xc6cd2000)
      1d00:                   00000010 c8800000 c78d6000 c786fba0 c78d6000 c01be868
      1d20: c01be7a4 00004000 00000000 c786fba0 c6c12b80 c0208554 000004d0 c780fc60
      1d40: 00000220 c01fb734 00000000 00000000 00000000 c6c9a440 c6c12b80 c78d6000
      1d60: c786fba0 c6c9a440 00000000 c021d1d8 00000000 00000000 c6c12b80 c78d6000
      1d80: c786fba0 00000001 c6c9a440 c02087f8 c6c9a4a0 00080008 00000000 00000000
      1da0: c78d6000 c786fba0 c78d6000 00000138 00000000 00000000 00000000 00000000
      1dc0: 00000000 c027ba74 00000138 00000138 00000001 00000010 c6cedc00 00000000
      1de0: 00000008 c7404400 c6cd1eec c6cd1f14 c067a73c c065c0b8 00000000 c067a740
      1e00: 01ffffff 002040d0 00000000 00000000 00000000 00000000 00000000 ffffffff
      1e20: 43004400 00110022 c6cdef20 c027ae8c c6ccfaa0 be82d65c 00000014 be82d3cc
      1e40: 00000000 00000000 00000000 c01f2870 00000000 00000000 00000000 c6cd1e88
      1e60: c6ccfaa0 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      1e80: 00000000 00000000 00000031 c7802310 c7802300 00000138 c7404400 c0771da0
      1ea0: 00000000 c6cd1eec c7800340 00000138 be82d65c 00000014 be82d3cc c6cd1f08
      1ec0: 00000014 00000000 c7404400 c7404400 00000138 c01f4628 c78d6000 00000000
      1ee0: 00000000 be82d3cc 00000138 c6cd1f08 00000014 c6cd1ee4 00000001 00000000
      1f00: 00000000 00000000 00080011 00000002 06000000 ffffffff 0000ffff 00000002
      1f20: 06000000 ffffffff 0000ffff c00928c8 c065c520 c6cd1f58 00000003 c009299c
      1f40: 00000003 c065c520 c7404400 00000000 c7404400 c01f2218 c78106b0 c7441cb0
      1f60: 00000000 00000006 c06799fc 00000000 00000000 00000006 00000000 c01f3ee0
      1f80: 00000000 00000000 be82d678 be82d65c 00000014 00000001 00000122 c00139c8
      1fa0: c6cd0000 c0013840 be82d65c 00000014 00000006 be82d3cc 00000138 00000000
      1fc0: be82d65c 00000014 00000001 00000122 00000000 00000000 00018cb1 00000000
      1fe0: 00003801 be82d3a8 0003a0c7 b6e9af08 60000010 00000006 00000000 00000000
      [<c01be324>] (smc_hardware_send_pkt+0x198/0x22c) from [<c01be868>] (smc_hard_start_xmit+0xc4/0x1e8)
      [<c01be868>] (smc_hard_start_xmit+0xc4/0x1e8) from [<c0208554>] (dev_hard_start_xmit+0x460/0x4cc)
      [<c0208554>] (dev_hard_start_xmit+0x460/0x4cc) from [<c021d1d8>] (sch_direct_xmit+0x94/0x18c)
      [<c021d1d8>] (sch_direct_xmit+0x94/0x18c) from [<c02087f8>] (dev_queue_xmit+0x238/0x42c)
      [<c02087f8>] (dev_queue_xmit+0x238/0x42c) from [<c027ba74>] (packet_sendmsg+0xbe8/0xd28)
      [<c027ba74>] (packet_sendmsg+0xbe8/0xd28) from [<c01f2870>] (sock_sendmsg+0x84/0xa8)
      [<c01f2870>] (sock_sendmsg+0x84/0xa8) from [<c01f4628>] (SyS_sendto+0xb8/0xdc)
      [<c01f4628>] (SyS_sendto+0xb8/0xdc) from [<c0013840>] (ret_fast_syscall+0x0/0x2c)
      Code: e3130002 1a000001 e3130001 0affffcd (e7f001f2)
      ---[ end trace 81104fe70e8da7fe ]---
      Kernel panic - not syncing: Fatal exception in interrupt
      
      This is because the macro operations in smc91x.h defined
      for Versatile are missing SMC_outsw() as used in this
      commit.
      
      The Versatile needs and uses the same accessors as the other
      platforms in the first if(...) clause, just switch it to using
      that and we have one problem less to worry about.
      
      This includes a hunk of a patch from Will Deacon fixin
      the other 32bit platforms as well: Innokom, Ramses, PXA,
      PCM027.
      
      Checkpatch complains about spacing, but I have opted to
      follow the style of this .h-file.
      
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Nicolas Pitre <nico@fluxnic.net>
      Cc: Eric Miao <eric.y.miao@gmail.com>
      Cc: Jonathan Cameron <jic23@cam.ac.uk>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      824a6ef9
    • Wei Yongjun's avatar
      saa7164: fix return value check in saa7164_initdev() · 47c55eb0
      Wei Yongjun authored
      commit 89f4d45b upstream.
      
      In case of error, the function kthread_run() returns ERR_PTR()
      and never returns NULL. The NULL test in the return value check
      should be replaced with IS_ERR().
      Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
      Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
      [bwh: Backported to 3.2: adjust filename]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      47c55eb0
    • Horia Geanta's avatar
      crypto: ccm - Fix handling of zero plaintext when computing mac · ba25ea52
      Horia Geanta authored
      commit 5638cabf upstream.
      
      There are cases when cryptlen can be zero in crypto_ccm_auth():
      -encryptiom: input scatterlist length is zero (no plaintext)
      -decryption: input scatterlist contains only the mac
      plus the condition of having different source and destination buffers
      (or else scatterlist length = max(plaintext_len, ciphertext_len)).
      
      These are not handled correctly, leading to crashes like:
      
      root@p4080ds:~/crypto# insmod tcrypt.ko mode=45
      ------------[ cut here ]------------
      kernel BUG at crypto/scatterwalk.c:37!
      Oops: Exception in kernel mode, sig: 5 [#1]
      SMP NR_CPUS=8 P4080 DS
      Modules linked in: tcrypt(+) crc32c xts xcbc vmac pcbc ecb gcm ghash_generic gf128mul ccm ctr seqiv
      CPU: 3 PID: 1082 Comm: cryptomgr_test Not tainted 3.11.0 #14
      task: ee12c5b0 ti: eecd0000 task.ti: eecd0000
      NIP: c0204d98 LR: f9225848 CTR: c0204d80
      REGS: eecd1b70 TRAP: 0700   Not tainted  (3.11.0)
      MSR: 00029002 <CE,EE,ME>  CR: 22044022  XER: 20000000
      
      GPR00: f9225c94 eecd1c20 ee12c5b0 eecd1c28 ee879400 ee879400 00000000 ee607464
      GPR08: 00000001 00000001 00000000 006b0000 c0204d80 00000000 00000002 c0698e20
      GPR16: ee987000 ee895000 fffffff4 ee879500 00000100 eecd1d58 00000001 00000000
      GPR24: ee879400 00000020 00000000 00000000 ee5b2800 ee607430 00000004 ee607460
      NIP [c0204d98] scatterwalk_start+0x18/0x30
      LR [f9225848] get_data_to_compute+0x28/0x2f0 [ccm]
      Call Trace:
      [eecd1c20] [f9225974] get_data_to_compute+0x154/0x2f0 [ccm] (unreliable)
      [eecd1c70] [f9225c94] crypto_ccm_auth+0x184/0x1d0 [ccm]
      [eecd1cb0] [f9225d40] crypto_ccm_encrypt+0x60/0x2d0 [ccm]
      [eecd1cf0] [c020d77c] __test_aead+0x3ec/0xe20
      [eecd1e20] [c020f35c] test_aead+0x6c/0xe0
      [eecd1e40] [c020f420] alg_test_aead+0x50/0xd0
      [eecd1e60] [c020e5e4] alg_test+0x114/0x2e0
      [eecd1ee0] [c020bd1c] cryptomgr_test+0x4c/0x60
      [eecd1ef0] [c0047058] kthread+0xa8/0xb0
      [eecd1f40] [c000eb0c] ret_from_kernel_thread+0x5c/0x64
      Instruction dump:
      0f080000 81290024 552807fe 0f080000 5529003a 4bffffb4 90830000 39400000
      39000001 8124000c 2f890000 7d28579e <0f090000> 81240008 91230004 4e800020
      ---[ end trace 6d652dfcd1be37bd ]---
      
      Cc: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
      Signed-off-by: default avatarHoria Geanta <horia.geanta@freescale.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      ba25ea52
    • Gerald Schaefer's avatar
      crypto: s390 - Fix aes-xts parameter corruption · 8ccf25d7
      Gerald Schaefer authored
      commit 9dda2769 upstream.
      
      Some s390 crypto algorithms incorrectly use the crypto_tfm structure to
      store private data. As the tfm can be shared among multiple threads, this
      can result in data corruption.
      
      This patch fixes aes-xts by moving the xts and pcc parameter blocks from
      the tfm onto the stack (48 + 96 bytes).
      Signed-off-by: default avatarGerald Schaefer <gerald.schaefer@de.ibm.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      8ccf25d7
    • Tom Lendacky's avatar
      crypto: scatterwalk - Set the chain pointer indication bit · ae77e564
      Tom Lendacky authored
      commit 41da8b5a upstream.
      
      The scatterwalk_crypto_chain function invokes the scatterwalk_sg_chain
      function to chain two scatterlists, but the chain pointer indication
      bit is not set.  When the resulting scatterlist is used, for example,
      by sg_nents to count the number of scatterlist entries, a segfault occurs
      because sg_nents does not follow the chain pointer to the chained scatterlist.
      
      Update scatterwalk_sg_chain to set the chain pointer indication bit as is
      done by the sg_chain function.
      Signed-off-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      ae77e564
    • Tom Lendacky's avatar
      crypto: authenc - Find proper IV address in ablkcipher callback · 2543b0df
      Tom Lendacky authored
      commit fc019c71 upstream.
      
      When performing an asynchronous ablkcipher operation the authenc
      completion callback routine is invoked, but it does not locate and use
      the proper IV.
      
      The callback routine, crypto_authenc_encrypt_done, is updated to use
      the same method of calculating the address of the IV as is done in
      crypto_authenc_encrypt function which sets up the callback.
      Signed-off-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      2543b0df
    • Peter Zijlstra's avatar
      cpuset: Fix memory allocator deadlock · d8d9e54e
      Peter Zijlstra authored
      commit 0fc0287c upstream.
      
      Juri hit the below lockdep report:
      
      [    4.303391] ======================================================
      [    4.303392] [ INFO: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected ]
      [    4.303394] 3.12.0-dl-peterz+ #144 Not tainted
      [    4.303395] ------------------------------------------------------
      [    4.303397] kworker/u4:3/689 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:
      [    4.303399]  (&p->mems_allowed_seq){+.+...}, at: [<ffffffff8114e63c>] new_slab+0x6c/0x290
      [    4.303417]
      [    4.303417] and this task is already holding:
      [    4.303418]  (&(&q->__queue_lock)->rlock){..-...}, at: [<ffffffff812d2dfb>] blk_execute_rq_nowait+0x5b/0x100
      [    4.303431] which would create a new lock dependency:
      [    4.303432]  (&(&q->__queue_lock)->rlock){..-...} -> (&p->mems_allowed_seq){+.+...}
      [    4.303436]
      
      [    4.303898] the dependencies between the lock to be acquired and SOFTIRQ-irq-unsafe lock:
      [    4.303918] -> (&p->mems_allowed_seq){+.+...} ops: 2762 {
      [    4.303922]    HARDIRQ-ON-W at:
      [    4.303923]                     [<ffffffff8108ab9a>] __lock_acquire+0x65a/0x1ff0
      [    4.303926]                     [<ffffffff8108cbe3>] lock_acquire+0x93/0x140
      [    4.303929]                     [<ffffffff81063dd6>] kthreadd+0x86/0x180
      [    4.303931]                     [<ffffffff816ded6c>] ret_from_fork+0x7c/0xb0
      [    4.303933]    SOFTIRQ-ON-W at:
      [    4.303933]                     [<ffffffff8108abcc>] __lock_acquire+0x68c/0x1ff0
      [    4.303935]                     [<ffffffff8108cbe3>] lock_acquire+0x93/0x140
      [    4.303940]                     [<ffffffff81063dd6>] kthreadd+0x86/0x180
      [    4.303955]                     [<ffffffff816ded6c>] ret_from_fork+0x7c/0xb0
      [    4.303959]    INITIAL USE at:
      [    4.303960]                    [<ffffffff8108a884>] __lock_acquire+0x344/0x1ff0
      [    4.303963]                    [<ffffffff8108cbe3>] lock_acquire+0x93/0x140
      [    4.303966]                    [<ffffffff81063dd6>] kthreadd+0x86/0x180
      [    4.303969]                    [<ffffffff816ded6c>] ret_from_fork+0x7c/0xb0
      [    4.303972]  }
      
      Which reports that we take mems_allowed_seq with interrupts enabled. A
      little digging found that this can only be from
      cpuset_change_task_nodemask().
      
      This is an actual deadlock because an interrupt doing an allocation will
      hit get_mems_allowed()->...->__read_seqcount_begin(), which will spin
      forever waiting for the write side to complete.
      
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Mel Gorman <mgorman@suse.de>
      Reported-by: default avatarJuri Lelli <juri.lelli@gmail.com>
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Tested-by: default avatarJuri Lelli <juri.lelli@gmail.com>
      Acked-by: default avatarLi Zefan <lizefan@huawei.com>
      Acked-by: default avatarMel Gorman <mgorman@suse.de>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      d8d9e54e
    • Greg Kroah-Hartman's avatar
      Staging: tidspbridge: disable driver · 2908084d
      Greg Kroah-Hartman authored
      commit 930ba4a3 upstream.
      
      There seems to be no active maintainer for the driver, and there is an
      unfixed security bug, so disable the driver for now.
      
      Hopefully someone steps up to be the maintainer, and works to get this
      out of staging, otherwise it will be deleted soon.
      Reported-by: default avatarNico Golde <nico@ngolde.de>
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Cc: Omar Ramirez Luna <omar.ramirez@copitl.com>
      Cc: Omar Ramirez Luna <omar.ramirez@ti.com>
      Cc: Kanigeri, Hari <h-kanigeri2@ti.com>
      Cc: Ameya Palande <ameya.palande@nokia.com>
      Cc: Guzman Lugo, Fernando <fernando.lugo@ti.com>
      Cc: Hebbar, Shivananda <x0hebbar@ti.com>
      Cc: Ramos Falcon, Ernesto <ernesto@ti.com>
      Cc: Felipe Contreras <felipe.contreras@gmail.com>
      Cc: Anna, Suman <s-anna@ti.com>
      Cc: Gupta, Ramesh <grgupta@ti.com>
      Cc: Gomez Castellanos, Ivan <ivan.gomez@ti.com>
      Cc: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
      Cc: Armando Uribe De Leon <x0095078@ti.com>
      Cc: Deepak Chitriki <deepak.chitriki@ti.com>
      Cc: Menon, Nishanth <nm@ti.com>
      Cc: Phil Carmody <ext-phil.2.carmody@nokia.com>
      Cc: Ohad Ben-Cohen <ohad@wizery.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [bwh: Backported to 3.2: adjust context; no dependency on !ARCH_MULTIPLATFORM]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      2908084d
    • Dan Williams's avatar
      libsas: fix usage of ata_tf_to_fis · 8525fdf4
      Dan Williams authored
      commit ae5fbae0 upstream.
      
      Since commit 110dd8f1 "[SCSI] libsas: fix scr_read/write users and
      update the libata documentation" we have been passing pmp=1 and is_cmd=0
      to ata_tf_to_fis().  Praveen reports that eSATA attached drives do not
      discover correctly.  His investigation found that the BIOS was passing
      pmp=0 while Linux was passing pmp=1 and failing to discover the drives.
      Update libsas to follow the libata example of pulling the pmp setting
      from the ata_link and correct is_cmd to be 1 since all tf's submitted
      through ->qc_issue are commands.  Presumably libsas lldds do not care
      about is_cmd as they have sideband mechanisms to perform link
      management.
      
      http://marc.info/?l=linux-scsi&m=138179681726990
      
      [jejb: checkpatch fix]
      Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
      Reported-by: default avatarPraveen Murali <pmurali@logicube.com>
      Tested-by: default avatarPraveen Murali <pmurali@logicube.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      8525fdf4
    • Steven Rostedt (Red Hat)'s avatar
      tracing: Allow events to have NULL strings · e8a972ca
      Steven Rostedt (Red Hat) authored
      commit 4e58e547 upstream.
      
      If an TRACE_EVENT() uses __assign_str() or __get_str on a NULL pointer
      then the following oops will happen:
      
      BUG: unable to handle kernel NULL pointer dereference at   (null)
      IP: [<c127a17b>] strlen+0x10/0x1a
      *pde = 00000000 ^M
      Oops: 0000 [#1] PREEMPT SMP
      Modules linked in:
      CPU: 1 PID: 0 Comm: swapper/1 Not tainted 3.13.0-rc1-test+ #2
      Hardware name:                  /DG965MQ, BIOS MQ96510J.86A.0372.2006.0605.1717 06/05/2006^M
      task: f5cde9f0 ti: f5e5e000 task.ti: f5e5e000
      EIP: 0060:[<c127a17b>] EFLAGS: 00210046 CPU: 1
      EIP is at strlen+0x10/0x1a
      EAX: 00000000 EBX: c2472da8 ECX: ffffffff EDX: c2472da8
      ESI: c1c5e5fc EDI: 00000000 EBP: f5e5fe84 ESP: f5e5fe80
       DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
      CR0: 8005003b CR2: 00000000 CR3: 01f32000 CR4: 000007d0
      Stack:
       f5f18b90 f5e5feb8 c10687a8 0759004f 00000005 00000005 00000005 00200046
       00000002 00000000 c1082a93 f56c7e28 c2472da8 c1082a93 f5e5fee4 c106bc61^M
       00000000 c1082a93 00000000 00000000 00000001 00200046 00200082 00000000
      Call Trace:
       [<c10687a8>] ftrace_raw_event_lock+0x39/0xc0
       [<c1082a93>] ? ktime_get+0x29/0x69
       [<c1082a93>] ? ktime_get+0x29/0x69
       [<c106bc61>] lock_release+0x57/0x1a5
       [<c1082a93>] ? ktime_get+0x29/0x69
       [<c10824dd>] read_seqcount_begin.constprop.7+0x4d/0x75
       [<c1082a93>] ? ktime_get+0x29/0x69^M
       [<c1082a93>] ktime_get+0x29/0x69
       [<c108a46a>] __tick_nohz_idle_enter+0x1e/0x426
       [<c10690e8>] ? lock_release_holdtime.part.19+0x48/0x4d
       [<c10bc184>] ? time_hardirqs_off+0xe/0x28
       [<c1068c82>] ? trace_hardirqs_off_caller+0x3f/0xaf
       [<c108a8cb>] tick_nohz_idle_enter+0x59/0x62
       [<c1079242>] cpu_startup_entry+0x64/0x192
       [<c102299c>] start_secondary+0x277/0x27c
      Code: 90 89 c6 89 d0 88 c4 ac 38 e0 74 09 84 c0 75 f7 be 01 00 00 00 89 f0 48 5e 5d c3 55 89 e5 57 66 66 66 66 90 83 c9 ff 89 c7 31 c0 <f2> ae f7 d1 8d 41 ff 5f 5d c3 55 89 e5 57 66 66 66 66 90 31 ff
      EIP: [<c127a17b>] strlen+0x10/0x1a SS:ESP 0068:f5e5fe80
      CR2: 0000000000000000
      ---[ end trace 01bc47bf519ec1b2 ]---
      
      New tracepoints have been added that have allowed for NULL pointers
      being assigned to strings. To fix this, change the TRACE_EVENT() code
      to check for NULL and if it is, it will assign "(null)" to it instead
      (similar to what glibc printf does).
      Reported-by: default avatarShuah Khan <shuah.kh@samsung.com>
      Reported-by: default avatarJovi Zhangwei <jovi.zhangwei@gmail.com>
      Link: http://lkml.kernel.org/r/CAGdX0WFeEuy+DtpsJzyzn0343qEEjLX97+o1VREFkUEhndC+5Q@mail.gmail.com
      Link: http://lkml.kernel.org/r/528D6972.9010702@samsung.com
      Fixes: 9cbf1176 ("tracing/events: provide string with undefined size support")
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e8a972ca
    • Kailang Yang's avatar
      ALSA: hda/realtek - Set pcbeep amp for ALC668 · 5547e2c6
      Kailang Yang authored
      commit 9ad54547 upstream.
      
      Set the missing pcbeep default amp for ALC668.
      Signed-off-by: default avatarKailang Yang <kailang@realtek.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      5547e2c6
    • Kailang Yang's avatar
      ALSA: hda/realtek - Add support of ALC231 codec · b7536448
      Kailang Yang authored
      commit ba4c4d0a upstream.
      
      It's compatible with ALC269.
      Signed-off-by: default avatarKailang Yang <kailang@realtek.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b7536448
    • Laxman Dewangan's avatar
      irq: Enable all irqs unconditionally in irq_resume · 58ed97c6
      Laxman Dewangan authored
      commit ac01810c upstream.
      
      When the system enters suspend, it disables all interrupts in
      suspend_device_irqs(), including the interrupts marked EARLY_RESUME.
      
      On the resume side things are different. The EARLY_RESUME interrupts
      are reenabled in sys_core_ops->resume and the non EARLY_RESUME
      interrupts are reenabled in the normal system resume path.
      
      When suspend_noirq() failed or suspend is aborted for any other
      reason, we might omit the resume side call to sys_core_ops->resume()
      and therefor the interrupts marked EARLY_RESUME are not reenabled and
      stay disabled forever.
      
      To solve this, enable all irqs unconditionally in irq_resume()
      regardless whether interrupts marked EARLY_RESUMEhave been already
      enabled or not.
      
      This might try to reenable already enabled interrupts in the non
      failure case, but the only affected platform is XEN and it has been
      confirmed that it does not cause any side effects.
      
      [ tglx: Massaged changelog. ]
      Signed-off-by: default avatarLaxman Dewangan <ldewangan@nvidia.com>
      Acked-by-and-tested-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Acked-by: default avatarHeiko Stuebner <heiko@sntech.de>
      Reviewed-by: default avatarPavel Machek <pavel@ucw.cz>
      Cc: <ian.campbell@citrix.com>
      Cc: <rjw@rjwysocki.net>
      Cc: <len.brown@intel.com>
      Cc: <gregkh@linuxfoundation.org>
      Link: http://lkml.kernel.org/r/1385388587-16442-1-git-send-email-ldewangan@nvidia.comSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      58ed97c6
    • Oliver Hartkopp's avatar
      can: sja1000: fix {pre,post}_irq() handling and IRQ handler return value · 6f484718
      Oliver Hartkopp authored
      commit 2fea6cd3 upstream.
      
      This patch fixes the issue that the sja1000_interrupt() function may have
      returned IRQ_NONE without processing the optional pre_irq() and post_irq()
      function before. Further the irq processing counter 'n' is moved to the end of
      the while statement to return correct IRQ_[NONE|HANDLED] values at error
      conditions.
      Reported-by: default avatarWolfgang Grandegger <wg@grandegger.com>
      Acked-by: default avatarWolfgang Grandegger <wg@grandegger.com>
      Signed-off-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      [bwh: Backported to 3.2: s/SJA1000_IER/REG_IER/; s/SJA1000_IR/REG_IR/]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      6f484718
    • Rashika Kheria's avatar
      Staging: zram: Fix memory leak by refcount mismatch · e06c3387
      Rashika Kheria authored
      commit 1b672224 upstream.
      
      As suggested by Minchan Kim and Jerome Marchand "The code in reset_store
      get the block device (bdget_disk()) but it does not put it (bdput()) when
      it's done using it. The usage count is therefore incremented but never
      decremented."
      
      This patch also puts bdput() for all error cases.
      Acked-by: default avatarMinchan Kim <minchan@kernel.org>
      Acked-by: default avatarJerome Marchand <jmarchan@redhat.com>
      Signed-off-by: default avatarRashika Kheria <rashika.kheria@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [bwh: Backported to 3.2: adjust filename, context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e06c3387
    • Rashika Kheria's avatar
      Staging: zram: Fix access of NULL pointer · dccfb68c
      Rashika Kheria authored
      commit 46a51c80 upstream.
      
      This patch fixes the bug in reset_store caused by accessing NULL pointer.
      
      The bdev gets its value from bdget_disk() which could fail when memory
      pressure is severe and hence can return NULL because allocation of
      inode in bdget could fail.
      
      Hence, this patch introduces a check for bdev to prevent reference to a
      NULL pointer in the later part of the code. It also removes unnecessary
      check of bdev for fsync_bdev().
      Acked-by: default avatarJerome Marchand <jmarchan@redhat.com>
      Signed-off-by: default avatarRashika Kheria <rashika.kheria@gmail.com>
      Acked-by: default avatarMinchan Kim <minchan@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [bwh: Backported to 3.2: adjust filename]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      dccfb68c
    • Alan Stern's avatar
      usb: dwc3: fix implementation of endpoint wedge · 65310681
      Alan Stern authored
      commit a535d81c upstream.
      
      The dwc3 UDC driver doesn't implement endpoint wedging correctly.
      When an endpoint is wedged, the gadget driver should be allowed to
      clear the wedge by calling usb_ep_clear_halt().  Only the host is
      prevented from resetting the endpoint.
      
      This patch fixes the implementation.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Tested-by: default avatarPratyush Anand <pratyush.anand@st.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      65310681
    • Michael Grzeschik's avatar
      usb: gadget: composite: reset delayed_status on reset_config · eeddb0ad
      Michael Grzeschik authored
      commit 2bac51a1 upstream.
      
      The delayed_status value is used to keep track of status response
      packets on ep0. It needs to be reset or the set_config function would
      still delay the answer, if the usb device got unplugged while waiting
      for setup_continue to be called.
      Signed-off-by: default avatarMichael Grzeschik <m.grzeschik@pengutronix.de>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      eeddb0ad
    • Johan Hovold's avatar
      USB: serial: fix race in generic write · 757bf43d
      Johan Hovold authored
      commit 6f648546 upstream.
      
      Fix race in generic write implementation, which could lead to
      temporarily degraded throughput.
      
      The current generic write implementation introduced by commit
      27c7acf2 ("USB: serial: reimplement generic fifo-based writes") has
      always had this bug, although it's fairly hard to trigger and the
      consequences are not likely to be noticed.
      
      Specifically, a write() on one CPU while the completion handler is
      running on another could result in only one of the two write urbs being
      utilised to empty the remainder of the write fifo (unless there is a
      second write() that doesn't race during that time).
      Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [bwh: Backported to 3.2: deleted code is a bit different]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      757bf43d
    • Johannes Berg's avatar
      mac80211: don't attempt to reorder multicast frames · aea59757
      Johannes Berg authored
      commit 051a41fa upstream.
      
      Multicast frames can't be transmitted as part of an aggregation
      session (such a session couldn't even be set up) so don't try to
      reorder them. Trying to do so would cause the reorder to stop
      working correctly since multicast QoS frames (as transmitted by
      the Aruba APs this was found with) would cause sequence number
      confusion in the buffer.
      Reported-by: default avatarBlaise Gassend <blaise@suitabletech.com>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      aea59757
    • Mark Brown's avatar
      ASoC: wm8990: Mark the register map as dirty when powering down · 9d2a8873
      Mark Brown authored
      commit 2ab2b742 upstream.
      
      Otherwise we'll skip sync on resume.
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      Acked-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      9d2a8873
    • Michael Neuling's avatar
      powerpc/signals: Improved mark VSX not saved with small contexts fix · 286cfe15
      Michael Neuling authored
      commit ec67ad82 upstream.
      
      In a recent patch:
        commit c13f20ac
        Author: Michael Neuling <mikey@neuling.org>
        powerpc/signals: Mark VSX not saved with small contexts
      
      We fixed an issue but an improved solution was later discussed after the patch
      was merged.
      
      Firstly, this patch doesn't handle the 64bit signals case, which could also hit
      this issue (but has never been reported).
      
      Secondly, the original patch isn't clear what MSR VSX should be set to.  The
      new approach below always clears the MSR VSX bit (to indicate no VSX is in the
      context) and sets it only in the specific case where VSX is available (ie. when
      VSX has been used and the signal context passed has space to provide the
      state).
      
      This reverts the original patch and replaces it with the improved solution.  It
      also adds a 64 bit version.
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      286cfe15
    • Samir Benmendil's avatar
      ahci: add Marvell 9230 to the AHCI PCI device list · 9ed46e8a
      Samir Benmendil authored
      commit 6d5278a6 upstream.
      
      Tested with a DAWICONTROL DC-624e on 3.10.10
      Signed-off-by: default avatarSamir Benmendil <samir.benmendil@gmail.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reviewed-by: default avatarLevente Kurusa <levex@linux.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      9ed46e8a
    • Xiangliang Yu's avatar
      PCI: Define macro for Marvell vendor ID · 56f1f4bb
      Xiangliang Yu authored
      commit 8e7ee6f5 upstream.
      
      Define PCI_VENDOR_ID_MARVELL_EXT macro for 0x1b4b vendor ID
      Signed-off-by: default avatarXiangliang Yu <yuxiangl@marvell.com>
      Signed-off-by: default avatarMyron Stowe <myron.stowe@redhat.com>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      56f1f4bb
    • Alistair Popple's avatar
      ahci: add support for IBM Akebono platform device · 6b7cfe5a
      Alistair Popple authored
      commit 2435dcb9 upstream.
      
      The new IBM Akebono board has a PPC476GTR SoC with an AHCI compliant
      SATA controller. This patch adds a compatible property for the new SoC
      to the AHCI platform driver.
      Signed-off-by: default avatarAlistair Popple <alistair@popple.id.au>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      6b7cfe5a
    • Junxiao Bi's avatar
      configfs: fix race between dentry put and lookup · fd7d0ba4
      Junxiao Bi authored
      commit 76ae281f upstream.
      
      A race window in configfs, it starts from one dentry is UNHASHED and end
      before configfs_d_iput is called.  In this window, if a lookup happen,
      since the original dentry was UNHASHED, so a new dentry will be
      allocated, and then in configfs_attach_attr(), sd->s_dentry will be
      updated to the new dentry.  Then in configfs_d_iput(),
      BUG_ON(sd->s_dentry != dentry) will be triggered and system panic.
      
      sys_open:                     sys_close:
       ...                           fput
                                      dput
                                       dentry_kill
                                        __d_drop <--- dentry unhashed here,
                                                 but sd->dentry still point
                                                 to this dentry.
      
       lookup_real
        configfs_lookup
         configfs_attach_attr---> update sd->s_dentry
                                  to new allocated dentry here.
      
                                         d_kill
                                           configfs_d_iput <--- BUG_ON(sd->s_dentry != dentry)
                                                           triggered here.
      
      To fix it, change configfs_d_iput to not update sd->s_dentry if
      sd->s_count > 2, that means there are another dentry is using the sd
      beside the one that is going to be put.  Use configfs_dirent_lock in
      configfs_attach_attr to sync with configfs_d_iput.
      
      With the following steps, you can reproduce the bug.
      
      1. enable ocfs2, this will mount configfs at /sys/kernel/config and
         fill configure in it.
      
      2. run the following script.
      	while [ 1 ]; do cat /sys/kernel/config/cluster/$your_cluster_name/idle_timeout_ms > /dev/null; done &
      	while [ 1 ]; do cat /sys/kernel/config/cluster/$your_cluster_name/idle_timeout_ms > /dev/null; done &
      Signed-off-by: default avatarJunxiao Bi <junxiao.bi@oracle.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      fd7d0ba4
    • Eric Seppanen's avatar
      iscsi-target: chap auth shouldn't match username with trailing garbage · 47e67db4
      Eric Seppanen authored
      commit 86784c6b upstream.
      
      In iSCSI negotiations with initiator CHAP enabled, usernames with
      trailing garbage are permitted, because the string comparison only
      checks the strlen of the configured username.
      
      e.g. "usernameXXXXX" will be permitted to match "username".
      
      Just check one more byte so the trailing null char is also matched.
      Signed-off-by: default avatarEric Seppanen <eric@purestorage.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      47e67db4
    • Eric Seppanen's avatar
      iscsi-target: fix extract_param to handle buffer length corner case · 6d8fcca0
      Eric Seppanen authored
      commit 369653e4 upstream.
      
      extract_param() is called with max_length set to the total size of the
      output buffer.  It's not safe to allow a parameter length equal to the
      buffer size as the terminating null would be written one byte past the
      end of the output buffer.
      Signed-off-by: default avatarEric Seppanen <eric@purestorage.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      6d8fcca0
    • Michael Neuling's avatar
      powerpc/signals: Mark VSX not saved with small contexts · 3bf4e8c8
      Michael Neuling authored
      commit c13f20ac upstream.
      
      The VSX MSR bit in the user context indicates if the context contains VSX
      state.  Currently we set this when the process has touched VSX at any stage.
      
      Unfortunately, if the user has not provided enough space to save the VSX state,
      we can't save it but we currently still set the MSR VSX bit.
      
      This patch changes this to clear the MSR VSX bit when the user doesn't provide
      enough space.  This indicates that there is no valid VSX state in the user
      context.
      
      This is needed to support get/set/make/swapcontext for applications that use
      VSX but only provide a small context.  For example, getcontext in glibc
      provides a smaller context since the VSX registers don't need to be saved over
      the glibc function call.  But since the program calling getcontext may have
      used VSX, the kernel currently says the VSX state is valid when it's not.  If
      the returned context is then used in setcontext (ie. a small context without
      VSX but with MSR VSX set), the kernel will refuse the context.  This situation
      has been reported by the glibc community.
      
      Based on patch from Carlos O'Donell.
      Tested-by: default avatarHaren Myneni <haren@linux.vnet.ibm.com>
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      3bf4e8c8
    • Anton Blanchard's avatar
      powerpc/pseries: Duplicate dtl entries sometimes sent to userspace · 36d04a55
      Anton Blanchard authored
      commit 84b07386 upstream.
      
      When reading from the dispatch trace log (dtl) userspace interface, I
      sometimes see duplicate entries. One example:
      
      # hexdump -C dtl.out
      
      00000000  07 04 00 0c 00 00 48 44  00 00 00 00 00 00 00 00
      00000010  00 0c a0 b4 16 83 6d 68  00 00 00 00 00 00 00 00
      00000020  00 00 00 00 10 00 13 50  80 00 00 00 00 00 d0 32
      
      00000030  07 04 00 0c 00 00 48 44  00 00 00 00 00 00 00 00
      00000040  00 0c a0 b4 16 83 6d 68  00 00 00 00 00 00 00 00
      00000050  00 00 00 00 10 00 13 50  80 00 00 00 00 00 d0 32
      
      The problem is in scan_dispatch_log() where we call dtl_consumer()
      but bail out before incrementing the index.
      
      To fix this I moved dtl_consumer() after the timebase comparison.
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      36d04a55
    • Yinghai Lu's avatar
      PCI: Remove duplicate pci_disable_device() from pcie_portdrv_remove() · 22007773
      Yinghai Lu authored
      commit e7cc5cf7 upstream.
      
      The pcie_portdrv .probe() method calls pci_enable_device() once, in
      pcie_port_device_register(), but the .remove() method calls
      pci_disable_device() twice, in pcie_port_device_remove() and in
      pcie_portdrv_remove().
      
      That causes a "disabling already-disabled device" warning when removing a
      PCIe port device.  This happens all the time when removing Thunderbolt
      devices, but is also easy to reproduce with, e.g.,
      "echo 0000:00:1c.3 > /sys/bus/pci/drivers/pcieport/unbind"
      
      This patch removes the disable from pcie_portdrv_remove().
      
      [bhelgaas: changelog, tag for stable]
      Reported-by: default avatarDavid Bulkow <David.Bulkow@stratus.com>
      Reported-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      22007773
    • Trond Myklebust's avatar
      NFSv4: Update list of irrecoverable errors on DELEGRETURN · 3b327af6
      Trond Myklebust authored
      commit c97cf606 upstream.
      
      If the DELEGRETURN errors out with something like NFS4ERR_BAD_STATEID
      then there is no recovery possible. Just quit without returning an error.
      
      Also, note that the client must not assume that the NFSv4 lease has been
      renewed when it sees an error on DELEGRETURN.
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      3b327af6
    • Andy Adamson's avatar
      NFSv4 wait on recovery for async session errors · a687a58f
      Andy Adamson authored
      commit 4a82fd7c upstream.
      
      When the state manager is processing the NFS4CLNT_DELEGRETURN flag, session
      draining is off, but DELEGRETURN can still get a session error.
      The async handler calls nfs4_schedule_session_recovery returns -EAGAIN, and
      the DELEGRETURN done then restarts the RPC task in the prepare state.
      With the state manager still processing the NFS4CLNT_DELEGRETURN flag with
      session draining off, these DELEGRETURNs will cycle with errors filling up the
      session slots.
      
      This prevents OPEN reclaims (from nfs_delegation_claim_opens) required by the
      NFS4CLNT_DELEGRETURN state manager processing from completing, hanging the
      state manager in the __rpc_wait_for_completion_task in nfs4_run_open_task
      as seen in this kernel thread dump:
      
      kernel: 4.12.32.53-ma D 0000000000000000     0  3393      2 0x00000000
      kernel: ffff88013995fb60 0000000000000046 ffff880138cc5400 ffff88013a9df140
      kernel: ffff8800000265c0 ffffffff8116eef0 ffff88013fc10080 0000000300000001
      kernel: ffff88013a4ad058 ffff88013995ffd8 000000000000fbc8 ffff88013a4ad058
      kernel: Call Trace:
      kernel: [<ffffffff8116eef0>] ? cache_alloc_refill+0x1c0/0x240
      kernel: [<ffffffffa0358110>] ? rpc_wait_bit_killable+0x0/0xa0 [sunrpc]
      kernel: [<ffffffffa0358152>] rpc_wait_bit_killable+0x42/0xa0 [sunrpc]
      kernel: [<ffffffff8152914f>] __wait_on_bit+0x5f/0x90
      kernel: [<ffffffffa0358110>] ? rpc_wait_bit_killable+0x0/0xa0 [sunrpc]
      kernel: [<ffffffff815291f8>] out_of_line_wait_on_bit+0x78/0x90
      kernel: [<ffffffff8109b520>] ? wake_bit_function+0x0/0x50
      kernel: [<ffffffffa035810d>] __rpc_wait_for_completion_task+0x2d/0x30 [sunrpc]
      kernel: [<ffffffffa040d44c>] nfs4_run_open_task+0x11c/0x160 [nfs]
      kernel: [<ffffffffa04114e7>] nfs4_open_recover_helper+0x87/0x120 [nfs]
      kernel: [<ffffffffa0411646>] nfs4_open_recover+0xc6/0x150 [nfs]
      kernel: [<ffffffffa040cc6f>] ? nfs4_open_recoverdata_alloc+0x2f/0x60 [nfs]
      kernel: [<ffffffffa0414e1a>] nfs4_open_delegation_recall+0x6a/0xa0 [nfs]
      kernel: [<ffffffffa0424020>] nfs_end_delegation_return+0x120/0x2e0 [nfs]
      kernel: [<ffffffff8109580f>] ? queue_work+0x1f/0x30
      kernel: [<ffffffffa0424347>] nfs_client_return_marked_delegations+0xd7/0x110 [nfs]
      kernel: [<ffffffffa04225d8>] nfs4_run_state_manager+0x548/0x620 [nfs]
      kernel: [<ffffffffa0422090>] ? nfs4_run_state_manager+0x0/0x620 [nfs]
      kernel: [<ffffffff8109b0f6>] kthread+0x96/0xa0
      kernel: [<ffffffff8100c20a>] child_rip+0xa/0x20
      kernel: [<ffffffff8109b060>] ? kthread+0x0/0xa0
      kernel: [<ffffffff8100c200>] ? child_rip+0x0/0x20
      
      The state manager can not therefore process the DELEGRETURN session errors.
      Change the async handler to wait for recovery on session errors.
      Signed-off-by: default avatarAndy Adamson <andros@netapp.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      [bwh: Backported to 3.2:
       - Adjust context
       - There's no restart_call label]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      a687a58f
    • Andreas Bießmann's avatar
      avr32: fix out-of-range jump in large kernels · 1c7fd312
      Andreas Bießmann authored
      commit d617b338 upstream.
      
      This patch fixes following error (for big kernels):
      
      ---8<---
      arch/avr32/boot/u-boot/head.o: In function `no_tag_table':
      (.init.text+0x44): relocation truncated to fit: R_AVR32_22H_PCREL against symbol `panic' defined in .text.unlikely section in kernel/built-in.o
      arch/avr32/kernel/built-in.o: In function `bad_return':
      (.ex.text+0x236): relocation truncated to fit: R_AVR32_22H_PCREL against symbol `panic' defined in .text.unlikely section in kernel/built-in.o
      --->8---
      
      It comes up when the kernel increases and 'panic()' is too far away to fit in
      the +/- 2MiB range. Which in turn issues from the 21-bit displacement in
      'br{cond4}' mnemonic which is one of the two ways to do jumps (rjmp has just
      10-bit displacement and therefore a way smaller range). This fact was stated
      before in 8d29b7b9.
      One solution to solve this is to add a local storage for the symbol address
      and just load the $pc with that value.
      Signed-off-by: default avatarAndreas Bießmann <andreas@biessmann.de>
      Acked-by: default avatarHans-Christian Egtvedt <egtvedt@samfundet.no>
      Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      1c7fd312
    • Andreas Bießmann's avatar
      avr32: setup crt for early panic() · 3f308887
      Andreas Bießmann authored
      commit 7a2a74f4 upstream.
      
      Before the CRT was (fully) set up in kernel_entry (bss cleared before in
      _start, but also not before jump to panic() in no_tag_table case).
      
      This patch fixes this up to have a fully working CRT when branching to panic()
      in no_tag_table.
      Signed-off-by: default avatarAndreas Bießmann <andreas@biessmann.de>
      Acked-by: default avatarHans-Christian Egtvedt <egtvedt@samfundet.no>
      Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      3f308887
    • J. Bruce Fields's avatar
      nfsd4: fix xdr decoding of large non-write compounds · bca06620
      J. Bruce Fields authored
      commit 365da4ad upstream.
      
      This fixes a regression from 24750082
      "nfsd4: fix decoding of compounds across page boundaries".  The previous
      code was correct: argp->pagelist is initialized in
      nfs4svc_deocde_compoundargs to rqstp->rq_arg.pages, and is therefore a
      pointer to the page *after* the page we are currently decoding.
      
      The reason that patch nevertheless fixed a problem with decoding
      compounds containing write was a bug in the write decoding introduced by
      5a80a54d "nfsd4: reorganize write
      decoding", after which write decoding no longer adhered to the rule that
      argp->pagelist point to the next page.
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      [bwh: Backported to 3.2: adjust context; there is only one instance to fix]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      bca06620