1. 13 Apr, 2012 18 commits
    • Lars-Peter Clausen's avatar
      net: Remove redundant spi driver bus initialization · 60dfc629
      Lars-Peter Clausen authored
      In ancient times it was necessary to manually initialize the bus field of an
      spi_driver to spi_bus_type. These days this is done in spi_driver_register() so
      we can drop the manual assignment.
      
      The patch was generated using the following coccinelle semantic patch:
      // <smpl>
      @@
      identifier _driver;
      @@
      struct spi_driver _driver = {
      	.driver = {
      -		.bus = &spi_bus_type,
      	},
      };
      // </smpl>
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Gabor Juhos <juhosg@openwrt.org>
      Cc: Frederic Lambert <frdrc66@gmail.com>
      Cc: netdev@vger.kernel.org
      Acked-by: default avatarGabor Juhos <juhosg@openwrt.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      60dfc629
    • David Ward's avatar
      net/garp: fix GID rbtree ordering · 6f66cdc3
      David Ward authored
      The comparison operators were backwards in both garp_attr_lookup and
      garp_attr_create, so the entire GID rbtree was in reverse order.
      (There was no practical side effect to this though, except that PDUs
      were sent with attributes listed in reverse order, which is still
      valid by the protocol. This change is only for clarity.)
      Signed-off-by: default avatarDavid Ward <david.ward@ll.mit.edu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6f66cdc3
    • David Woodhouse's avatar
      pppoatm: Fix excessive queue bloat · 9d02daf7
      David Woodhouse authored
      We discovered that PPPoATM has an excessively deep transmit queue. A
      queue the size of the default socket send buffer (wmem_default) is
      maintained between the PPP generic core and the ATM device.
      
      Fix it to queue a maximum of *two* packets. The one the ATM device is
      currently working on, and one more for the ATM driver to process
      immediately in its TX done interrupt handler. The PPP core is designed
      to feed packets to the channel with minimal latency, so that really
      ought to be enough to keep the ATM device busy.
      
      While we're at it, fix the fact that we were triggering the wakeup
      tasklet on *every* pppoatm_pop() call. The comment saying "this is
      inefficient, but doing it right is too hard" turns out to be overly
      pessimistic... I think :)
      
      On machines like the Traverse Geos, with a slow Geode CPU and two
      high-speed ADSL2+ interfaces, there were reports of extremely high CPU
      usage which could partly be attributed to the extra wakeups.
      
      (The wakeup handling could actually be made a whole lot easier if we
       stop checking sk->sk_sndbuf altogether. Given that we now only queue
       *two* packets ever, one wonders what the point is. As it is, you could
       already deadlock the thing by setting the sk_sndbuf to a value lower
       than the MTU of the device, and it'd just block for ever.)
      Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9d02daf7
    • sjur.brandeland@stericsson.com's avatar
      caif-hsi: Postpone init of HSI until open() · 39abbaef
      sjur.brandeland@stericsson.com authored
      Do the initialization of the HSI interface when the
      interface is opened, instead of upon registration.
      When the interface is closed the HSI interface is
      de-initialized, allowing other modules to use the
      HSI interface.
      Signed-off-by: default avatarSjur Brændeland <sjur.brandeland@stericsson.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      39abbaef
    • sjur.brandeland@stericsson.com's avatar
      caif-hsi: Remove stop/start of queue. · 2df1fe7f
      sjur.brandeland@stericsson.com authored
      CAIF HSI is currently a virtual device. Stopping/starting the
      queues is wrong on a virtual device.
      Signed-off-by: default avatarSjur Brændeland <sjur.brandeland@stericsson.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2df1fe7f
    • Dmitry Tarnyagin's avatar
      caif-hsi: robust frame aggregation for HSI · ece367d5
      Dmitry Tarnyagin authored
      Implement aggregation algorithm, combining more data into a single
      HSI transfer. 4 different traffic categories are supported:
       1. TC_PRIO_CONTROL .. TC_PRIO_MAX (CTL)
       2. TC_PRIO_INTERACTIVE            (VO)
       3. TC_PRIO_INTERACTIVE_BULK       (VI)
       4. TC_PRIO_BESTEFFORT, TC_PRIO_BULK, TC_PRIO_FILLER (BEBK)
      Signed-off-by: default avatarDmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ece367d5
    • Dmitry Tarnyagin's avatar
      caif: set traffic class for caif packets · 44764812
      Dmitry Tarnyagin authored
      Set traffic class for CAIF packets, based on socket
      priority, CAIF protocol type, or type of message.
      
      Traffic class mapping for different packet types:
       - control:       TC_PRIO_CONTROL;
       - flow control:  TC_PRIO_CONTROL;
       - at:            TC_PRIO_CONTROL;
       - rfm:           TC_PRIO_INTERACTIVE_BULK;
       - other sockets: equals to socket's TC;
       - network data:  no change.
      Signed-off-by: default avatarDmitry Tarnyagin <dmitry.tarnyagin@stericsson.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      44764812
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · e65ac4d5
      David S. Miller authored
      Pull in the 'net' tree to get CAIF bug fixes upon which
      the following set of CAIF feature patches depend.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e65ac4d5
    • Kim Lilliestierna XX's avatar
      caif_hsi: use dev_dbg not dev_err for reporting · d62f8dbb
      Kim Lilliestierna XX authored
      Use dev_dbg instead of dev_err for reporting in cfhsi_wakeup_cb.
      Signed-off-by: default avatarKim Lilliestierna <kim.xx.lilliestierna@stericsson.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d62f8dbb
    • sjur.brandeland@stericsson.com's avatar
      caif-hsi: Free flip_buffer at shutdown · 5f614e6b
      sjur.brandeland@stericsson.com authored
      Fix memory leak of RX flip-buffer.
      Signed-off-by: default avatarSjur Brændeland <sjur.brandeland@stericsson.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5f614e6b
    • Tomasz Gregorek's avatar
      caif: Fix memory leakage in the chnl_net.c. · 5c699fb7
      Tomasz Gregorek authored
      Added kfree_skb() calls in the chnk_net.c file on
      the error paths.
      Signed-off-by: default avatarSjur Brændeland <sjur.brandeland@stericsson.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5c699fb7
    • James Chapman's avatar
      l2tp: don't overwrite source address in l2tp_ip_bind() · c9be48dc
      James Chapman authored
      Applications using L2TP/IP sockets want to be able to bind() an L2TP/IP
      socket to set the local tunnel id while leaving the auto-assigned source
      address alone. So if no source address is supplied, don't overwrite
      the address already stored in the socket.
      Signed-off-by: default avatarJames Chapman <jchapman@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c9be48dc
    • James Chapman's avatar
      l2tp: fix refcount leak in l2tp_ip sockets · d1f224ae
      James Chapman authored
      The l2tp_ip socket close handler does not update the module refcount
      correctly which prevents module unload after the first bind() call on
      an L2TPv3 IP encapulation socket.
      Signed-off-by: default avatarJames Chapman <jchapman@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d1f224ae
    • Torsten Kaiser's avatar
      net: Fix misplaced parenthesis in virtio_net.c · 31304165
      Torsten Kaiser authored
      Commit 2e57b79c misplaced its
      parenthesis and now tx_fifo_errors will only be incremented if an
      ENOMEM error is not written to the syslog.
      
      Correct the parenthesis and indentation to the original goal of
      counting all non ENOMEM errors and ratelimiting only the messages.
      Signed-of-by: default avatarTorsten Kaiser <just.for.lkml@googlemail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      31304165
    • Julia Lawall's avatar
      net/key/af_key.c: add missing kfree_skb · 89eb06f1
      Julia Lawall authored
      At the point of this error-handling code, alloc_skb has succeded, so free
      the resulting skb by jumping to the err label.
      Signed-off-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      89eb06f1
    • Eric W. Biederman's avatar
      phonet: Sort out initiailziation and cleanup code. · 03478756
      Eric W. Biederman authored
      Recently an oops was reported in phonet if there was a failure during
      network namespace creation.
      
      [  163.733755] ------------[ cut here ]------------
      [  163.734501] kernel BUG at include/net/netns/generic.h:45!
      [  163.734501] invalid opcode: 0000 [#1] PREEMPT SMP
      [  163.734501] CPU 2
      [  163.734501] Pid: 19145, comm: trinity Tainted: G        W 3.4.0-rc1-next-20120405-sasha-dirty #57
      [  163.734501] RIP: 0010:[<ffffffff824d6062>]  [<ffffffff824d6062>] phonet_pernet+0x182/0x1a0
      [  163.734501] RSP: 0018:ffff8800674d5ca8  EFLAGS: 00010246
      [  163.734501] RAX: 000000003fffffff RBX: 0000000000000000 RCX: ffff8800678c88d8
      [  163.734501] RDX: 00000000003f4000 RSI: ffff8800678c8910 RDI: 0000000000000282
      [  163.734501] RBP: ffff8800674d5cc8 R08: 0000000000000000 R09: 0000000000000000
      [  163.734501] R10: 0000000000000000 R11: 0000000000000000 R12: ffff880068bec920
      [  163.734501] R13: ffffffff836b90c0 R14: 0000000000000000 R15: 0000000000000000
      [  163.734501] FS:  00007f055e8de700(0000) GS:ffff88007d000000(0000) knlGS:0000000000000000
      [  163.734501] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [  163.734501] CR2: 00007f055e6bb518 CR3: 0000000070c16000 CR4: 00000000000406e0
      [  163.734501] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  163.734501] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      [  163.734501] Process trinity (pid: 19145, threadinfo ffff8800674d4000, task ffff8800678c8000)
      [  163.734501] Stack:
      [  163.734501]  ffffffff824d5f00 ffffffff810e2ec1 ffff880067ae0000 00000000ffffffd4
      [  163.734501]  ffff8800674d5cf8 ffffffff824d667a ffff880067ae0000 00000000ffffffd4
      [  163.734501]  ffffffff836b90c0 0000000000000000 ffff8800674d5d18 ffffffff824d707d
      [  163.734501] Call Trace:
      [  163.734501]  [<ffffffff824d5f00>] ? phonet_pernet+0x20/0x1a0
      [  163.734501]  [<ffffffff810e2ec1>] ? get_parent_ip+0x11/0x50
      [  163.734501]  [<ffffffff824d667a>] phonet_device_destroy+0x1a/0x100
      [  163.734501]  [<ffffffff824d707d>] phonet_device_notify+0x3d/0x50
      [  163.734501]  [<ffffffff810dd96e>] notifier_call_chain+0xee/0x130
      [  163.734501]  [<ffffffff810dd9d1>] raw_notifier_call_chain+0x11/0x20
      [  163.734501]  [<ffffffff821cce12>] call_netdevice_notifiers+0x52/0x60
      [  163.734501]  [<ffffffff821cd235>] rollback_registered_many+0x185/0x270
      [  163.734501]  [<ffffffff821cd334>] unregister_netdevice_many+0x14/0x60
      [  163.734501]  [<ffffffff823123e3>] ipip_exit_net+0x1b3/0x1d0
      [  163.734501]  [<ffffffff82312230>] ? ipip_rcv+0x420/0x420
      [  163.734501]  [<ffffffff821c8515>] ops_exit_list+0x35/0x70
      [  163.734501]  [<ffffffff821c911b>] setup_net+0xab/0xe0
      [  163.734501]  [<ffffffff821c9416>] copy_net_ns+0x76/0x100
      [  163.734501]  [<ffffffff810dc92b>] create_new_namespaces+0xfb/0x190
      [  163.734501]  [<ffffffff810dca21>] unshare_nsproxy_namespaces+0x61/0x80
      [  163.734501]  [<ffffffff810afd1f>] sys_unshare+0xff/0x290
      [  163.734501]  [<ffffffff8187622e>] ? trace_hardirqs_on_thunk+0x3a/0x3f
      [  163.734501]  [<ffffffff82665539>] system_call_fastpath+0x16/0x1b
      [  163.734501] Code: e0 c3 fe 66 0f 1f 44 00 00 48 c7 c2 40 60 4d 82 be 01 00 00 00 48 c7 c7 80 d1 23 83 e8 48 2a c4 fe e8 73 06 c8 fe 48 85 db 75 0e <0f> 0b 0f 1f 40 00 eb fe 66 0f 1f 44 00 00 48 83 c4 10 48 89 d8
      [  163.734501] RIP  [<ffffffff824d6062>] phonet_pernet+0x182/0x1a0
      [  163.734501]  RSP <ffff8800674d5ca8>
      [  163.861289] ---[ end trace fb5615826c548066 ]---
      
      After investigation it turns out there were two issues.
      1) Phonet was not implementing network devices but was using register_pernet_device
         instead of register_pernet_subsys.
      
         This was allowing there to be cases when phonenet was not initialized and
         the phonet net_generic was not set for a network namespace when network
         device events were being reported on the netdevice_notifier for a network
         namespace leading to the oops above.
      
      2) phonet_exit_net was implementing a confusing and special case of handling all
         network devices from going away that it was hard to see was correct, and would
         only occur when the phonet module was removed.
      
         Now that unregister_netdevice_notifier has been modified to synthesize unregistration
         events for the network devices that are extant when called this confusing special
         case in phonet_exit_net is no longer needed.
      Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      Acked-by: default avatarRémi Denis-Courmont <remi.denis-courmont@nokia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      03478756
    • Eric W. Biederman's avatar
      net: In unregister_netdevice_notifier unregister the netdevices. · 7d3d43da
      Eric W. Biederman authored
      We already synthesize events in register_netdevice_notifier and synthesizing
      events in unregister_netdevice_notifier allows to us remove the need for
      special case cleanup code.
      
      This change should be safe as it adds no new cases for existing callers
      of unregiser_netdevice_notifier to handle.
      Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7d3d43da
    • David S. Miller's avatar
  2. 12 Apr, 2012 22 commits
    • David S. Miller's avatar
    • Eldad Zack's avatar
      net/ipv6/exthdrs.c: Strict PadN option checking · c1412fce
      Eldad Zack authored
      Added strict checking of PadN, as PadN can be used to increase header
      size and thus push the protocol header into the 2nd fragment.
      
      PadN is used to align the options within the Hop-by-Hop or
      Destination Options header to 64-bit boundaries. The maximum valid
      size is thus 7 bytes.
      RFC 4942 recommends to actively check the "payload" itself and
      ensure that it contains only zeroes.
      
      See also RFC 4942 section 2.1.9.5.
      Signed-off-by: default avatarEldad Zack <eldad@fogrefinery.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c1412fce
    • Linus Torvalds's avatar
      Merge branch 'akpm' (Andrew's patch-bomb) · ecca5c3a
      Linus Torvalds authored
      Merge fixes from Andrew Morton.
      
      * emailed from Andrew Morton <akpm@linux-foundation.org>: (14 patches)
        panic: fix stack dump print on direct call to panic()
        drivers/rtc/rtc-pl031.c: enable clock on all ST variants
        Revert "mm: vmscan: fix misused nr_reclaimed in shrink_mem_cgroup_zone()"
        hugetlb: fix race condition in hugetlb_fault()
        drivers/rtc/rtc-twl.c: use static register while reading time
        drivers/rtc/rtc-s3c.c: add placeholder for driver private data
        drivers/rtc/rtc-s3c.c: fix compilation error
        MAINTAINERS: add PCDP console maintainer
        memcg: do not open code accesses to res_counter members
        drivers/rtc/rtc-efi.c: fix section mismatch warning
        drivers/rtc/rtc-r9701.c: reset registers if invalid values are detected
        drivers/char/random.c: fix boot id uniqueness race
        memcg: fix broken boolen expression
        memcg: fix up documentation on global LRU
      ecca5c3a
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 174808af
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) Fix bluetooth userland regression reported by Keith Packard, from
          Gustavo Padovan.
      
       2) Revert ath9k PS idle change, from Sujith Manoharan.
      
       3) Correct default TCP memory limits (again), from Eric Dumazet.
      
       4) Fix tcp_rcv_rtt_update() accidental use of unscaled RTT, from Neal
          Cardwell.
      
       5) We made a facility for layers like wireless to say how much tailroom
          they need in the SKB for link layer stuff such as wireless
          encryption etc., but TCP works hard to fill every SKB out to the end
          defeating this specification.
      
          This leads to every TCP packet getting reallocated by the wireless
          code in order to have the right amount of tailroom available.
      
          Fix TCP to only fill SKBs out to the real amount of data area it
          asked for during the allocation, this way it won't eat into the
          slack added for the device's tailroom needs.
      
          Reported by Marc Merlin and fixed by Eric Dumazet.
      
       6) Leaks, endian bugs, and new device IDs in bluetooth from Santosh
          Nayak, João Paulo Rechi Vita, Cho, Yu-Chen, Andrei Emeltchenko,
          AceLan Kao, and Andrei Emeltchenko.
      
       7) OOPS on tty_close fix in bluetooth's hci_ldisc from Johan Hovold.
      
       8) netfilter erroneously scales TCP window twice, fix from Changli Gao.
      
       9) Memleak fix in wext-core from Julia Lawall.
      
      10) Consistently handle invalid TCP packets in ipv4 vs.  ipv6 conntrack,
          from Jozsef Kadlecsik.
      
      11) Validate IP header length properly in netfilter conntrack's
          ipv4_get_l4proto().
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (39 commits)
        NFC: Fix the LLCP Tx fragmentation loop
        rtlwifi: Add missing DMA buffer unmapping for PCI drivers
        rtlwifi: Preallocate USB read buffers and eliminate kalloc in read routine
        tcp: avoid order-1 allocations on wifi and tx path
        net: allow pskb_expand_head() to get maximum tailroom
        bridge: Do not send queries on multicast group leaves
        MAINTAINERS: Mark NATSEMI driver as orphan'd.
        tcp: fix tcp_rcv_rtt_update() use of an unscaled RTT sample
        tcp: restore correct limit
        Revert "ath9k: fix going to full-sleep on PS idle"
        rt2x00: Fix rfkill_polling register function.
        bcma: fix build error on MIPS; implicit pcibios_enable_device
        netfilter: nf_conntrack: fix incorrect logic in nf_conntrack_init_net
        netfilter: nf_ct_ipv4: packets with wrong ihl are invalid
        netfilter: nf_ct_ipv4: handle invalid IPv4 and IPv6 packets consistently
        net/wireless/wext-core.c: add missing kfree
        rtlwifi: Fix oops on rate-control failure
        mac80211: Convert WARN_ON to WARN_ON_ONCE
        rtlwifi: rtl8192de: Fix firmware initialization
        nl80211: ensure interface is up in various APIs
        ...
      174808af
    • Linus Torvalds's avatar
      Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux · 778c2dee
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Mostly exynos and intel.
      
        Intel has 3 regression fixers (more info in intel merge commit), along
        with some other make hw work fixes, exynos has some cleanups and an
        ioctl fix.
      
        A couple of radeon fixes, couple of build fixes, and a savage
        userspace interface possible overflow fix."
      
      * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (23 commits)
        drm/exynos: fixed exynos broken ioctl
        drm/i915: clear fencing tracking state when retiring requests
        drm/exynos: fix to pointer manager member of struct exynos_drm_subdrv
        drm/exynos: fix struct for operation callback functions to driver name
        drm/exynos: use define instead of default_win member in struct mixer_context
        drm/exynos: rename s/HDMI_OVERLAY_NUMBER/MIXER_WIN_NR
        drm/exynos: remove unused codes in hdmi and mixer
        drm/exynos: remove unnecessary type conversion of hdmi and mixer
        drm/i915: make rc6 module parameter read-only
        drm/i915: implement ColorBlt w/a
        drm/i915/ringbuffer: Exclude last 2 cachlines of ring on 845g
        Revert "drm/i915: reenable gmbus on gen3+ again"
        drm/radeon: only add the mm i2c bus if the hw_i2c module param is set
        vgaarb.h: fix build warnings
        drm/i915: properly compute dp dithering for user-created modes
        drm/radeon/kms: fix DVO setup on some r4xx chips
        drm/savage: fix integer overflows in savage_bci_cmdbuf()
        drm/radeon: replace udelay with mdelay for long timeouts
        drm/i915: Finish any pending operations on the framebuffer before disabling
        drm/i915: Removed IVB forced enable of sprite dest key.
        ...
      778c2dee
    • Jeffrin Jose's avatar
      net: Fixed coding style issues relating to braces. · 46ba5b23
      Jeffrin Jose authored
      Fixed coding style issues in net/core/utils.c
      in relation with braces placement.
      Signed-off-by: default avatarJeffrin Jose <ahiliation@yahoo.co.in>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      46ba5b23
    • Eldad Zack's avatar
      net/ipv6/ipv6_sockglue.c: Removed redundant extern · 6fdbd164
      Eldad Zack authored
      extern int sysctl_mld_max_msf is already defined in linux/ipv6.h.
      Signed-off-by: default avatarEldad Zack <eldad@fogrefinery.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6fdbd164
    • Linus Torvalds's avatar
      Merge tag 'md-3.4-fixes' of git://neil.brown.name/md · e42bd6e4
      Linus Torvalds authored
      Pull a few more fixes for md from NeilBrown:
       "Two are tagged for -stable.  They can cause an oops, but very rarely."
      
      * tag 'md-3.4-fixes' of git://neil.brown.name/md:
        md/bitmap: prevent bitmap_daemon_work running while initialising bitmap
        md/raid1,raid10: Fix calculation of 'vcnt' when processing error recovery.
        MD: Bitmap version cleanup.
      e42bd6e4
    • Jason Wessel's avatar
      panic: fix stack dump print on direct call to panic() · 026ee1f6
      Jason Wessel authored
      Commit 6e6f0a1f ("panic: don't print redundant backtraces on oops")
      causes a regression where no stack trace will be printed at all for the
      case where kernel code calls panic() directly while not processing an
      oops, and of course there are 100's of instances of this type of call.
      
      The original commit executed the check (!oops_in_progress), but this will
      always be false because just before the dump_stack() there is a call to
      bust_spinlocks(1), which does the following:
      
        void __attribute__((weak)) bust_spinlocks(int yes)
        {
      	if (yes) {
      		++oops_in_progress;
      
      The proper way to resolve the problem that original commit tried to
      solve is to avoid printing a stack dump from panic() when the either of
      the following conditions is true:
      
        1) TAINT_DIE has been set (this is done by oops_end())
           This indicates and oops has already been printed.
        2) oops_in_progress > 1
           This guards against the rare case where panic() is invoked
           a second time, or in between oops_begin() and oops_end()
      Signed-off-by: default avatarJason Wessel <jason.wessel@windriver.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: <stable@vger.kernel.org>	[3.3+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      026ee1f6
    • Linus Walleij's avatar
      drivers/rtc/rtc-pl031.c: enable clock on all ST variants · 2f397216
      Linus Walleij authored
      The ST variants of the PL031 all require bit 26 in the control register
      to be set before they work properly.  Discovered this when testing on
      the Nomadik board where it would suprisingly just stand still.
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Cc: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
      Cc: Alessandro Rubini <rubini@unipv.it>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2f397216
    • Ying Han's avatar
      Revert "mm: vmscan: fix misused nr_reclaimed in shrink_mem_cgroup_zone()" · 41c93088
      Ying Han authored
      This reverts commit c38446cc.
      
      Before the commit, the code makes senses to me but not after the commit.
      The "nr_reclaimed" is the number of pages reclaimed by scanning through
      the memcg's lru lists.  The "nr_to_reclaim" is the target value for the
      whole function.  For example, we like to early break the reclaim if
      reclaimed 32 pages under direct reclaim (not DEF_PRIORITY).
      
      After the reverted commit, the target "nr_to_reclaim" is decremented each
      time by "nr_reclaimed" but we still use it to compare the "nr_reclaimed".
      It just doesn't make sense to me...
      Signed-off-by: default avatarYing Han <yinghan@google.com>
      Acked-by: default avatarHugh Dickins <hughd@google.com>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Hillf Danton <dhillf@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      41c93088
    • Chris Metcalf's avatar
      hugetlb: fix race condition in hugetlb_fault() · 66aebce7
      Chris Metcalf authored
      The race is as follows:
      
      Suppose a multi-threaded task forks a new process (on cpu A), thus
      bumping up the ref count on all the pages.  While the fork is occurring
      (and thus we have marked all the PTEs as read-only), another thread in
      the original process (on cpu B) tries to write to a huge page, taking an
      access violation from the write-protect and calling hugetlb_cow().  Now,
      suppose the fork() fails.  It will undo the COW and decrement the ref
      count on the pages, so the ref count on the huge page drops back to 1.
      Meanwhile hugetlb_cow() also decrements the ref count by one on the
      original page, since the original address space doesn't need it any
      more, having copied a new page to replace the original page.  This
      leaves the ref count at zero, and when we call unlock_page(), we panic.
      
      	fork on CPU A				fault on CPU B
      	=============				==============
      	...
      	down_write(&parent->mmap_sem);
      	down_write_nested(&child->mmap_sem);
      	...
      	while duplicating vmas
      		if error
      			break;
      	...
      	up_write(&child->mmap_sem);
      	up_write(&parent->mmap_sem);		...
      						down_read(&parent->mmap_sem);
      						...
      						lock_page(page);
      						handle COW
      						page_mapcount(old_page) == 2
      						alloc and prepare new_page
      	...
      	handle error
      	page_remove_rmap(page);
      	put_page(page);
      	...
      						fold new_page into pte
      						page_remove_rmap(page);
      						put_page(page);
      						...
      				oops ==>	unlock_page(page);
      						up_read(&parent->mmap_sem);
      
      The solution is to take an extra reference to the page while we are
      holding the lock on it.
      Signed-off-by: default avatarChris Metcalf <cmetcalf@tilera.com>
      Cc: Hillf Danton <dhillf@gmail.com>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      66aebce7
    • Konstantin Shlyakhovoy's avatar
      drivers/rtc/rtc-twl.c: use static register while reading time · f3ec434c
      Konstantin Shlyakhovoy authored
      RTC stores time and date in several registers.  Due to the fact that
      these registers can't be read instantaneously, there is a chance that
      reading from counting registers gives an error of one minute, one hour,
      one day, etc.
      
      To address this issue, the RTC has hardware support to copy the RTC
      counting registers to static shadowed registers.  The current
      implementation does not use this feature, and in a stress test, we can
      reproduce this error at a rate of around two times per 300000 readings.
      
      Fix the implementation to ensure that the right snapshot of time is
      captured.
      Signed-off-by: default avatarKonstantin Shlyakhovoy <x0155534@ti.com>
      Signed-off-by: default avatarNishanth Menon <nm@ti.com>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Cc: Benoit Cousson <b-cousson@ti.com>
      Cc: linux-omap <linux-omap@vger.kernel.org>
      Acked-by: default avatarMykola Oleksiienko <x0174904@ti.com>
      Acked-by: default avatarOleksandr Dmytryshyn <oleksandr.dmytryshyn@ti.com>
      Acked-by: default avatarGraeme Gregory <gg@slimlogic.co.uk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f3ec434c
    • Tushar Behera's avatar
      drivers/rtc/rtc-s3c.c: add placeholder for driver private data · c3cba928
      Tushar Behera authored
      Driver data field is a pointer, hence assigning that to an integer results
      in compilation warnings.
      
      Fixes following compilation warnings:
      
        drivers/rtc/rtc-s3c.c: In function `s3c_rtc_get_driver_data':
        drivers/rtc/rtc-s3c.c:452:3: warning: return makes integer from pointer without a cast [enabled by default]
        drivers/rtc/rtc-s3c.c: At top level:
        drivers/rtc/rtc-s3c.c:674:3: warning: initialization makes pointer from integer without a cast [enabled by default]
        drivers/rtc/rtc-s3c.c:674:3: warning: (near initialization for `s3c_rtc_dt_match[1].data') [enabled by default]
        drivers/rtc/rtc-s3c.c:677:3: warning: initialization makes pointer from integer without a cast [enabled by default]
        drivers/rtc/rtc-s3c.c:677:3: warning: (near initialization for `s3c_rtc_dt_match[2].data') [enabled by default]
        drivers/rtc/rtc-s3c.c:680:3: warning: initialization makes pointer from integer without a cast [enabled by default]
        drivers/rtc/rtc-s3c.c:680:3: warning: (near initialization for `s3c_rtc_dt_match[3].data') [enabled by default]
      Signed-off-by: default avatarTushar Behera <tushar.behera@linaro.org>
      Cc: Heiko Stuebner <heiko@sntech.de>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c3cba928
    • Tushar Behera's avatar
      drivers/rtc/rtc-s3c.c: fix compilation error · cd1e6f9e
      Tushar Behera authored
      Fix this error:
      
        drivers/rtc/rtc-s3c.c: At top level:
        drivers/rtc/rtc-s3c.c:671:3: error: request for member `data' in something not a structure or union
        drivers/rtc/rtc-s3c.c:674:3: error: request for member `data' in something not a structure or union
        drivers/rtc/rtc-s3c.c:677:3: error: request for member `data' in something not a structure or union
        drivers/rtc/rtc-s3c.c:680:3: error: request for member `data' in something not a structure or union
      Signed-off-by: default avatarTushar Behera <tushar.behera@linaro.org>
      Cc: Heiko Stuebner <heiko@sntech.de>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cd1e6f9e
    • Khalid Aziz's avatar
      MAINTAINERS: add PCDP console maintainer · 3971dae5
      Khalid Aziz authored
      Add missing maintainer info for PCDP console code.
      Signed-off-by: default avatarKhalid Aziz <khalid.aziz@hp.com>
      Cc: Joe Perches <joe@perches.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3971dae5
    • Glauber Costa's avatar
      memcg: do not open code accesses to res_counter members · 569530fb
      Glauber Costa authored
      We should use the accessor res_counter_read_u64 for that.
      
      Although a purely cosmetic change is sometimes better delayed, to avoid
      conflicting with other people's work, we are starting to have people
      touching this code as well, and reproducing the open code behavior
      because that's the standard =)
      
      Time to fix it, then.
      Signed-off-by: default avatarGlauber Costa <glommer@parallels.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      569530fb
    • Jan Beulich's avatar
      drivers/rtc/rtc-efi.c: fix section mismatch warning · 32050017
      Jan Beulich authored
      efi_rtc_init() uses platform_driver_probe(), so there's no need to also
      set efi_rtc_driver's probe member (as it won't be used anyway).  This
      fixes a modpost section mismatch warning (as efi_rtc_probe() validly is
      __init).
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      Cc: Matthew Garrett <mjg@redhat.com>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      32050017
    • Andreas Dumberger's avatar
      drivers/rtc/rtc-r9701.c: reset registers if invalid values are detected · bb58da08
      Andreas Dumberger authored
      hwclock refuses to set date/time if RTC registers contain invalid
      values.  Check the date/time register values at probe time and
      initialize them to make hwclock happy.
      Signed-off-by: default avatarAndreas Dumberger <andreas.dumberger@tqs.de>
      Signed-off-by: default avatarAnatolij Gustschin <agust@denx.de>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bb58da08
    • Mathieu Desnoyers's avatar
      drivers/char/random.c: fix boot id uniqueness race · 44e4360f
      Mathieu Desnoyers authored
      /proc/sys/kernel/random/boot_id can be read concurrently by userspace
      processes.  If two (or more) user-space processes concurrently read
      boot_id when sysctl_bootid is not yet assigned, a race can occur making
      boot_id differ between the reads.  Because the whole point of the boot id
      is to be unique across a kernel execution, fix this by protecting this
      operation with a spinlock.
      
      Given that this operation is not frequently used, hitting the spinlock
      on each call should not be an issue.
      Signed-off-by: default avatarMathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Matt Mackall <mpm@selenic.com>
      Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Cc: Greg Kroah-Hartman <greg@kroah.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      44e4360f
    • Kirill A. Shutemov's avatar
      memcg: fix broken boolen expression · d833049b
      Kirill A. Shutemov authored
      action != CPU_DEAD || action != CPU_DEAD_FROZEN is always true.
      Signed-off-by: default avatarKirill A. Shutemov <kirill@shutemov.name>
      Acked-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d833049b
    • Ying Han's avatar
      memcg: fix up documentation on global LRU · 6252efcc
      Ying Han authored
      In v3.3-rc1, the global LRU was removed in commit 925b7673 ("mm:
      make per-memcg LRU lists exclusive").  The patch fixes up the memcg
      docs.
      
      I left the swap session to someone who has better understanding of
      'memory+swap'.
      Signed-off-by: default avatarYing Han <yinghan@google.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
      Acked-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6252efcc