1. 09 Aug, 2012 14 commits
    • Theodore Ts'o's avatar
      random: make 'add_interrupt_randomness()' do something sane · 70696784
      Theodore Ts'o authored
      commit 775f4b29 upstream.
      
      We've been moving away from add_interrupt_randomness() for various
      reasons: it's too expensive to do on every interrupt, and flooding the
      CPU with interrupts could theoretically cause bogus floods of entropy
      from a somewhat externally controllable source.
      
      This solves both problems by limiting the actual randomness addition
      to just once a second or after 64 interrupts, whicever comes first.
      During that time, the interrupt cycle data is buffered up in a per-cpu
      pool.  Also, we make sure the the nonblocking pool used by urandom is
      initialized before we start feeding the normal input pool.  This
      assures that /dev/urandom is returning unpredictable data as soon as
      possible.
      
      (Based on an original patch by Linus, but significantly modified by
      tytso.)
      Tested-by: default avatarEric Wustrow <ewust@umich.edu>
      Reported-by: default avatarEric Wustrow <ewust@umich.edu>
      Reported-by: default avatarNadia Heninger <nadiah@cs.ucsd.edu>
      Reported-by: default avatarZakir Durumeric <zakir@umich.edu>
      Reported-by: J. Alex Halderman <jhalderm@umich.edu>.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      70696784
    • H. Peter Anvin's avatar
      random: Adjust the number of loops when initializing · 5046e32b
      H. Peter Anvin authored
      commit 2dac8e54 upstream.
      
      When we are initializing using arch_get_random_long() we only need to
      loop enough times to touch all the bytes in the buffer; using
      poolwords for that does twice the number of operations necessary on a
      64-bit machine, since in the random number generator code "word" means
      32 bits.
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Link: http://lkml.kernel.org/r/1324589281-31931-1-git-send-email-tytso@mit.eduSigned-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      5046e32b
    • Theodore Ts'o's avatar
      random: Use arch-specific RNG to initialize the entropy store · 1d1e71f1
      Theodore Ts'o authored
      commit 3e88bdff upstream.
      
      If there is an architecture-specific random number generator (such as
      RDRAND for Intel architectures), use it to initialize /dev/random's
      entropy stores.  Even in the worst case, if RDRAND is something like
      AES(NSA_KEY, counter++), it won't hurt, and it will definitely help
      against any other adversaries.
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Link: http://lkml.kernel.org/r/1324589281-31931-1-git-send-email-tytso@mit.eduSigned-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      1d1e71f1
    • Linus Torvalds's avatar
      random: Use arch_get_random_int instead of cycle counter if avail · e50d73fc
      Linus Torvalds authored
      commit cf833d0b upstream.
      
      We still don't use rdrand in /dev/random, which just seems stupid. We
      accept the *cycle*counter* as a random input, but we don't accept
      rdrand? That's just broken.
      
      Sure, people can do things in user space (write to /dev/random, use
      rdrand in addition to /dev/random themselves etc etc), but that
      *still* seems to be a particularly stupid reason for saying "we
      shouldn't bother to try to do better in /dev/random".
      
      And even if somebody really doesn't trust rdrand as a source of random
      bytes, it seems singularly stupid to trust the cycle counter *more*.
      
      So I'd suggest the attached patch. I'm not going to even bother
      arguing that we should add more bits to the entropy estimate, because
      that's not the point - I don't care if /dev/random fills up slowly or
      not, I think it's just stupid to not use the bits we can get from
      rdrand and mix them into the strong randomness pool.
      
      Link: http://lkml.kernel.org/r/CA%2B55aFwn59N1=m651QAyTy-1gO1noGbK18zwKDwvwqnravA84A@mail.gmail.comAcked-by: default avatar"David S. Miller" <davem@davemloft.net>
      Acked-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Cc: Matt Mackall <mpm@selenic.com>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e50d73fc
    • J. Bruce Fields's avatar
      nfsd4: our filesystems are normally case sensitive · bab9409a
      J. Bruce Fields authored
      commit 2930d381 upstream.
      
      Actually, xfs and jfs can optionally be case insensitive; we'll handle
      that case in later patches.
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      bab9409a
    • Luis Henriques's avatar
      ene_ir: Fix driver initialisation · 492ef858
      Luis Henriques authored
      commit b31b0219 upstream.
      
      commit 9ef449c6 ("[media] rc: Postpone ISR
      registration") fixed an early ISR registration on several drivers.  It did
      however also introduced a bug by moving the invocation of pnp_port_start()
      to the end of the probe function.
      
      This patch fixes this issue by moving the invocation of pnp_port_start() to
      an earlier stage in the probe function.
      
      Cc: Jarod Wilson <jarod@redhat.com>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      492ef858
    • Mikael Pettersson's avatar
      m68k: Correct the Atari ALLOWINT definition · 1f5d7d0b
      Mikael Pettersson authored
      commit c6636005 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: default avatarMikael Pettersson <mikpe@it.uu.se>
      Tested-by: Michael Schmitz <schmitzmic@googlemail.com> (on Falcon/CT60)
      [Geert Uytterhoeven: This version applies to v3.2..v3.4.]
      Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      1f5d7d0b
    • Liang Li's avatar
      cfg80211: fix interface combinations check for ADHOC(IBSS) · f0618dab
      Liang Li authored
      partial of commit 8e8b41f9 upstream.
      
      As part of commit 463454b5 ("cfg80211: fix interface
      combinations check"), this extra check was introduced:
      
             if ((all_iftypes & used_iftypes) != used_iftypes)
                     goto cont;
      
      However, most wireless NIC drivers did not advertise ADHOC in
      wiphy.iface_combinations[i].limits[] and hence we'll get -EBUSY
      when we bring up a ADHOC wlan with commands similar to:
      
       # iwconfig wlan0 mode ad-hoc && ifconfig wlan0 up
      
      In commit 8e8b41f9 ("cfg80211: enforce lack of interface
      combinations"), the change below fixes the issue:
      
             if (total == 1)
                     return 0;
      
      But it also introduces other dependencies for stable. For example,
      a full cherry pick of 8e8b41f9 would introduce additional
      regressions unless we also start cherry picking driver specific
      fixes like the following:
      
        9b4760e3  ath5k: add possible wiphy interface combinations
        1ae2fc25  mac80211_hwsim: advertise interface combinations
        20c8e8dc  ath9k: add possible wiphy interface combinations
      
      And the purpose of the 'if (total == 1)' is to cover the specific
      use case (IBSS, adhoc) that was mentioned above. So we just pick
      the specific part out from 8e8b41f9 here.
      
      Doing so gives stable kernels a way to fix the change introduced
      by 463454b5, without having to make cherry picks specific to
      various NIC drivers.
      Signed-off-by: default avatarLiang Li <liang.li@windriver.com>
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      f0618dab
    • David Henningsson's avatar
      ALSA: hda - add dock support for Thinkpad X230 Tablet · b27a5970
      David Henningsson authored
      commit 108cc108 upstream.
      
      Also add a model/fixup string "lenovo-dock", so that other Thinkpad
      users will be able to test this fixup easily, to see if it enables
      dock I/O for them as well.
      
      BugLink: https://bugs.launchpad.net/bugs/1026953Tested-by: default avatarJohn McCarron <john.mccarron@canonical.com>
      Signed-off-by: default avatarDavid Henningsson <david.henningsson@canonical.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b27a5970
    • Paul Gortmaker's avatar
      stable: update references to older 2.6 versions for 3.x · 6b6deb8a
      Paul Gortmaker authored
      commit 2584f521 upstream.
      
      Also add information on where the respective trees are.
      Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      Acked-by: default avatarRob Landley <rob@landley.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      6b6deb8a
    • Jarod Wilson's avatar
      lirc_sir: make device registration work · 76a65f00
      Jarod Wilson authored
      commit 4b71ca6b upstream.
      
      For one, the driver device pointer needs to be filled in, or the lirc core
      will refuse to load the driver. And we really need to wire up all the
      platform_device bits. This has been tested via the lirc sourceforge tree
      and verified to work, been sitting there for months, finally getting
      around to sending it. :\
      
      CC: Josh Boyer <jwboyer@redhat.com>
      Signed-off-by: default avatarJarod Wilson <jarod@redhat.com>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      76a65f00
    • Stefano Stabellini's avatar
      xen: mark local pages as FOREIGN in the m2p_override · a044f552
      Stefano Stabellini authored
      commit b9e0d95c upstream.
      
      When the frontend and the backend reside on the same domain, even if we
      add pages to the m2p_override, these pages will never be returned by
      mfn_to_pfn because the check "get_phys_to_machine(pfn) != mfn" will
      always fail, so the pfn of the frontend will be returned instead
      (resulting in a deadlock because the frontend pages are already locked).
      
      INFO: task qemu-system-i38:1085 blocked for more than 120 seconds.
      "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      qemu-system-i38 D ffff8800cfc137c0     0  1085      1 0x00000000
       ffff8800c47ed898 0000000000000282 ffff8800be4596b0 00000000000137c0
       ffff8800c47edfd8 ffff8800c47ec010 00000000000137c0 00000000000137c0
       ffff8800c47edfd8 00000000000137c0 ffffffff82213020 ffff8800be4596b0
      Call Trace:
       [<ffffffff81101ee0>] ? __lock_page+0x70/0x70
       [<ffffffff81a0fdd9>] schedule+0x29/0x70
       [<ffffffff81a0fe80>] io_schedule+0x60/0x80
       [<ffffffff81101eee>] sleep_on_page+0xe/0x20
       [<ffffffff81a0e1ca>] __wait_on_bit_lock+0x5a/0xc0
       [<ffffffff81101ed7>] __lock_page+0x67/0x70
       [<ffffffff8106f750>] ? autoremove_wake_function+0x40/0x40
       [<ffffffff811867e6>] ? bio_add_page+0x36/0x40
       [<ffffffff8110b692>] set_page_dirty_lock+0x52/0x60
       [<ffffffff81186021>] bio_set_pages_dirty+0x51/0x70
       [<ffffffff8118c6b4>] do_blockdev_direct_IO+0xb24/0xeb0
       [<ffffffff811e71a0>] ? ext3_get_blocks_handle+0xe00/0xe00
       [<ffffffff8118ca95>] __blockdev_direct_IO+0x55/0x60
       [<ffffffff811e71a0>] ? ext3_get_blocks_handle+0xe00/0xe00
       [<ffffffff811e91c8>] ext3_direct_IO+0xf8/0x390
       [<ffffffff811e71a0>] ? ext3_get_blocks_handle+0xe00/0xe00
       [<ffffffff81004b60>] ? xen_mc_flush+0xb0/0x1b0
       [<ffffffff81104027>] generic_file_aio_read+0x737/0x780
       [<ffffffff813bedeb>] ? gnttab_map_refs+0x15b/0x1e0
       [<ffffffff811038f0>] ? find_get_pages+0x150/0x150
       [<ffffffff8119736c>] aio_rw_vect_retry+0x7c/0x1d0
       [<ffffffff811972f0>] ? lookup_ioctx+0x90/0x90
       [<ffffffff81198856>] aio_run_iocb+0x66/0x1a0
       [<ffffffff811998b8>] do_io_submit+0x708/0xb90
       [<ffffffff81199d50>] sys_io_submit+0x10/0x20
       [<ffffffff81a18d69>] system_call_fastpath+0x16/0x1b
      
      The explanation is in the comment within the code:
      
      We need to do this because the pages shared by the frontend
      (xen-blkfront) can be already locked (lock_page, called by
      do_read_cache_page); when the userspace backend tries to use them
      with direct_IO, mfn_to_pfn returns the pfn of the frontend, so
      do_blockdev_direct_IO is going to try to lock the same pages
      again resulting in a deadlock.
      
      A simplified call graph looks like this:
      
      pygrub                          QEMU
      -----------------------------------------------
      do_read_cache_page              io_submit
        |                              |
      lock_page                       ext3_direct_IO
                                       |
                                      bio_add_page
                                       |
                                      lock_page
      
      Internally the xen-blkback uses m2p_add_override to swizzle (temporarily)
      a 'struct page' to have a different MFN (so that it can point to another
      guest). It also can easily find out whether another pfn corresponding
      to the mfn exists in the m2p, and can set the FOREIGN bit
      in the p2m, making sure that mfn_to_pfn returns the pfn of the backend.
      
      This allows the backend to perform direct_IO on these pages, but as a
      side effect prevents the frontend from using get_user_pages_fast on
      them while they are being shared with the backend.
      Signed-off-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      a044f552
    • Vivek Goyal's avatar
      floppy: Cleanup disk->queue before caling put_disk() if add_disk() was never called · e5dd68eb
      Vivek Goyal authored
      commit 3f9a5aab upstream.
      
      add_disk() takes gendisk reference on request queue. If driver failed during
      initialization and never called add_disk() then that extra reference is not
      taken. That reference is put in put_disk(). floppy driver allocates the
      disk, allocates queue, sets disk->queue and then relizes that floppy
      controller is not present. It tries to tear down everything and tries to
      put a reference down in put_disk() which was never taken.
      
      In such error cases cleanup disk->queue before calling put_disk() so that
      we never try to put down a reference which was never taken in first place.
      Reported-and-tested-by: default avatarSuresh Jayaraman <sjayaraman@suse.com>
      Tested-by: default avatarDirk Gouders <gouders@et.bocholt.fh-gelsenkirchen.de>
      Signed-off-by: default avatarVivek Goyal <vgoyal@redhat.com>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e5dd68eb
    • Peter Zijlstra's avatar
      sched: Fix race in task_group() · b75bfc42
      Peter Zijlstra authored
      commit 8323f26c upstream
      
      Stefan reported a crash on a kernel before a3e5d109 ("sched:
      Don't call task_group() too many times in set_task_rq()"), he
      found the reason to be that the multiple task_group()
      invocations in set_task_rq() returned different values.
      
      Looking at all that I found a lack of serialization and plain
      wrong comments.
      
      The below tries to fix it using an extra pointer which is
      updated under the appropriate scheduler locks. Its not pretty,
      but I can't really see another way given how all the cgroup
      stuff works.
      Reported-and-tested-by: default avatarStefan Bader <stefan.bader@canonical.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1340364965.18025.71.camel@twinsSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      
      (backported to previous file names and layout)
      Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b75bfc42
  2. 04 Aug, 2012 2 commits
  3. 02 Aug, 2012 24 commits