1. 17 Jun, 2015 32 commits
  2. 16 Jun, 2015 8 commits
    • Nicolas Schichan's avatar
      ARM: net: delegate filter to kernel interpreter when imm_offset() return value... · a39d787c
      Nicolas Schichan authored
      ARM: net: delegate filter to kernel interpreter when imm_offset() return value can't fit into 12bits.
      
      commit 0b59d880 upstream.
      
      The ARM JIT code emits "ldr rX, [pc, #offset]" to access the literal
      pool. #offset maximum value is 4095 and if the generated code is too
      large, the #offset value can overflow and not point to the expected
      slot in the literal pool. Additionally, when overflow occurs, bits of
      the overflow can end up changing the destination register of the ldr
      instruction.
      
      Fix that by detecting the overflow in imm_offset() and setting a flag
      that is checked for each BPF instructions converted in
      build_body(). As of now it can only be detected in the second pass. As
      a result the second build_body() call can now fail, so add the
      corresponding cleanup code in that case.
      
      Using multiple literal pools in the JITed code is going to require
      lots of intrusive changes to the JIT code (which would better be done
      as a feature instead of fix), just delegating to the kernel BPF
      interpreter in that case is a more straight forward, minimal fix and
      easy to backport.
      
      Fixes: ddecdfce ("ARM: 7259/3: net: JIT compiler for packet filters")
      Signed-off-by: default avatarNicolas Schichan <nschichan@freebox.fr>
      Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      a39d787c
    • Toshiaki Makita's avatar
      igb: Fix NULL assignment to incorrect variable in igb_reset_q_vector · 6db73ac3
      Toshiaki Makita authored
      commit 2439fc4d upstream.
      
      adapter->tx_ring is set to NULL where rx_ring should be.
      
      Fixes: 5536d210 ("igb: Combine q_vector and ring allocation into a single function")
      Signed-off-by: default avatarToshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
      Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      6db73ac3
    • Pelle Nilsson's avatar
      spi: bitbang: Make setup_transfer() callback optional · 01d70850
      Pelle Nilsson authored
      commit 7d0ec8b6 upstream.
      
      Some controller drivers have no need of this callback (spi-altera even
      causes a NULL pointer dereference because it doesn't register the callback,
      falsely assuming that it is already optional).
      
      Fixes: 30af9b55 ("spi/bitbang: Drop empty setup() functions")
      Signed-off-by: default avatarPelle Nilsson <per.nilsson@xelmo.com>
      Reviewed-by: default avatarEzequiel Garcia <ezequiel.garcia@vanguardiasur.com.ar>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      01d70850
    • Mel Gorman's avatar
      mm, numa: really disable NUMA balancing by default on single node machines · 62fdba8a
      Mel Gorman authored
      commit b0dc2b9b upstream.
      
      NUMA balancing is meant to be disabled by default on UMA machines but
      the check is using nr_node_ids (highest node) instead of
      num_online_nodes (online nodes).
      
      The consequences are that a UMA machine with a node ID of 1 or higher
      will enable NUMA balancing.  This will incur useless overhead due to
      minor faults with the impact depending on the workload.  These are the
      impact on the stats when running a kernel build on a single node machine
      whose node ID happened to be 1:
      
        			       vanilla     patched
        NUMA base PTE updates          5113158           0
        NUMA huge PMD updates              643           0
        NUMA page range updates        5442374           0
        NUMA hint faults               2109622           0
        NUMA hint local faults         2109622           0
        NUMA hint local percent            100         100
        NUMA pages migrated                  0           0
      Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
      Reviewed-by: default avatarRik van Riel <riel@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      62fdba8a
    • Darrick J. Wong's avatar
      jbd2: fix r_count overflows leading to buffer overflow in journal recovery · 69daefc6
      Darrick J. Wong authored
      commit e531d0bc upstream.
      
      The journal revoke block recovery code does not check r_count for
      sanity, which means that an evil value of r_count could result in
      the kernel reading off the end of the revoke table and into whatever
      garbage lies beyond.  This could crash the kernel, so fix that.
      
      However, in testing this fix, I discovered that the code to write
      out the revoke tables also was not correctly checking to see if the
      block was full -- the current offset check is fine so long as the
      revoke table space size is a multiple of the record size, but this
      is not true when either journal_csum_v[23] are set.
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      69daefc6
    • Eryu Guan's avatar
      ext4: check for zero length extent explicitly · d4a8b02d
      Eryu Guan authored
      commit 2f974865 upstream.
      
      The following commit introduced a bug when checking for zero length extent
      
      5946d089 ext4: check for overlapping extents in ext4_valid_extent_entries()
      
      Zero length extent could pass the check if lblock is zero.
      
      Adding the explicit check for zero length back.
      Signed-off-by: default avatarEryu Guan <guaneryu@gmail.com>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      d4a8b02d
    • Lukas Czerner's avatar
      ext4: fix NULL pointer dereference when journal restart fails · a616aba8
      Lukas Czerner authored
      commit 9d506594 upstream.
      
      Currently when journal restart fails, we'll have the h_transaction of
      the handle set to NULL to indicate that the handle has been effectively
      aborted. We handle this situation quietly in the jbd2_journal_stop() and just
      free the handle and exit because everything else has been done before we
      attempted (and failed) to restart the journal.
      
      Unfortunately there are a number of problems with that approach
      introduced with commit
      
      41a5b913 "jbd2: invalidate handle if jbd2_journal_restart()
      fails"
      
      First of all in ext4 jbd2_journal_stop() will be called through
      __ext4_journal_stop() where we would try to get a hold of the superblock
      by dereferencing h_transaction which in this case would lead to NULL
      pointer dereference and crash.
      
      In addition we're going to free the handle regardless of the refcount
      which is bad as well, because others up the call chain will still
      reference the handle so we might potentially reference already freed
      memory.
      
      Moreover it's expected that we'll get aborted handle as well as detached
      handle in some of the journalling function as the error propagates up
      the stack, so it's unnecessary to call WARN_ON every time we get
      detached handle.
      
      And finally we might leak some memory by forgetting to free reserved
      handle in jbd2_journal_stop() in the case where handle was detached from
      the transaction (h_transaction is NULL).
      
      Fix the NULL pointer dereference in __ext4_journal_stop() by just
      calling jbd2_journal_stop() quietly as suggested by Jan Kara. Also fix
      the potential memory leak in jbd2_journal_stop() and use proper
      handle refcounting before we attempt to free it to avoid use-after-free
      issues.
      
      And finally remove all WARN_ON(!transaction) from the code so that we do
      not get random traces when something goes wrong because when journal
      restart fails we will get to some of those functions.
      Signed-off-by: default avatarLukas Czerner <lczerner@redhat.com>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      a616aba8
    • Jean Delvare's avatar
      firmware: dmi_scan: Fix ordering of product_uuid · 35562f8a
      Jean Delvare authored
      commit 5c1ac56b upstream.
      
      In function dmi_present(), dmi_walk_early() calls dmi_table(), which
      calls dmi_decode(), which ultimately calls dmi_save_uuid(). This last
      function makes a decision based on the value of global variable
      dmi_ver. The problem is that this variable is set right _after_
      dmi_walk_early() returns. So dmi_save_uuid() always sees dmi_ver == 0
      regardless of the actual version implemented.
      
      This causes /sys/class/dmi/id/product_uuid to always use the old
      ordering even on systems implementing DMI/SMBIOS 2.6 or later, which
      should use the new ordering.
      
      This is broken since kernel v3.8 for legacy DMI implementations and
      since kernel v3.10 for SMBIOS 2 implementations. SMBIOS 3
      implementations with the 64-bit entry point are not affected.
      
      The first breakage does not matter much as in practice legacy DMI
      implementations are always for versions older than 2.6, which is when
      the UUID ordering changed. The second breakage is more problematic as
      it affects the vast majority of x86 systems manufactured since 2009.
      Signed-off-by: default avatarJean Delvare <jdelvare@suse.de>
      Fixes: 9f9c9cbb ("drivers/firmware/dmi_scan.c: fetch dmi version from SMBIOS if it exists")
      Fixes: 79bae42d ("dmi_scan: refactor dmi_scan_machine(), {smbios,dmi}_present()")
      Acked-by: default avatarZhenzhong Duan <zhenzhong.duan@oracle.com>
      Cc: Ben Hutchings <ben@decadent.org.uk>
      Cc: Artem Savkov <artem.savkov@gmail.com>
      Cc: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
      Cc: Matt Fleming <matt.fleming@intel.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      35562f8a