1. 19 12月, 2014 8 次提交
  2. 18 12月, 2014 1 次提交
    • M
      Bluetooth: Fix bug with filter in service discovery optimization · ea8ae251
      Marcel Holtmann 提交于
      The optimization for filtering out extended inquiry results, advertising
      reports or scan response data based on provided UUID list has a logic
      bug. In case no match is found in the advertising data, the scan
      response is ignored and not checked against the filter. This will lead
      to events being filtered wrongly.
      
      Change the code to actually only drop the events when the scan response
      data is not present. If it is present, it needs to be checked against
      the provided filter.
      
      The patch is a bit more complex than it needs to be. That is because
      it also fixes this compiler warning that some gcc versions produce.
      
        CC      net/bluetooth/mgmt.o
      net/bluetooth/mgmt.c: In function ‘mgmt_device_found’:
      net/bluetooth/mgmt.c:7028:7: warning: ‘match’ may be used uninitialized in this function [-Wmaybe-uninitialized]
        bool match;
             ^
      
      It seems that gcc can not clearly figure out the context of the match
      variable. So just change the branches for the extended inquiry response
      and advertising data around so that it is clear.
      Reported-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      ea8ae251
  3. 17 12月, 2014 4 次提交
  4. 16 12月, 2014 2 次提交
    • G
      rds: Fix min() warning in rds_message_inc_copy_to_user() · 6ff4a8ad
      Geert Uytterhoeven 提交于
      net/rds/message.c: In function ‘rds_message_inc_copy_to_user’:
      net/rds/message.c:328: warning: comparison of distinct pointer types lacks a cast
      
      Use min_t(unsigned long, ...) like is done in
      rds_message_copy_from_user().
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6ff4a8ad
    • T
      gre: fix the inner mac header in nbma tunnel xmit path · 8a0033a9
      Timo Teräs 提交于
      The NBMA GRE tunnels temporarily push GRE header that contain the
      per-packet NBMA destination on the skb via header ops early in xmit
      path. It is the later pulled before the real GRE header is constructed.
      
      The inner mac was thus set differently in nbma case: the GRE header
      has been pushed by neighbor layer, and mac header points to beginning
      of the temporary gre header (set by dev_queue_xmit).
      
      Now that the offloads expect mac header to point to the gre payload,
      fix the xmit patch to:
       - pull first the temporary gre header away
       - and reset mac header to point to gre payload
      
      This fixes tso to work again with nbma tunnels.
      
      Fixes: 14051f04 ("gre: Use inner mac length when computing tunnel length")
      Signed-off-by: NTimo Teräs <timo.teras@iki.fi>
      Cc: Tom Herbert <therbert@google.com>
      Cc: Alexander Duyck <alexander.h.duyck@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8a0033a9
  5. 12 12月, 2014 18 次提交
  6. 11 12月, 2014 7 次提交
    • J
      Bluetooth: Fix missing hci_dev_lock/unlock in hci_event · 5c1a4c8f
      Jaganath Kanakkassery 提交于
      mgmt_pending_remove() should be called with hci_dev_lock protection and
      all hci_event.c functions which calls mgmt_complete() (which eventually
      calls mgmt_pending_remove()) should hold the lock.
      So this patch fixes the same
      Signed-off-by: NJaganath Kanakkassery <jaganath.k@samsung.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      5c1a4c8f
    • J
      Bluetooth: Fix missing hci_dev_lock/unlock in mgmt req_complete() · 3ad67582
      Jaganath Kanakkassery 提交于
      mgmt_pending_remove() should be called with hci_dev_lock protection
      and currently the rule to take dev lock is that all mgmt req_complete
      functions should take dev lock. So this patch fixes the same in the
      missing functions
      
      Without this patch there is a chance of invalid memory access while
      accessing the mgmt_pending list like below
      
      bluetoothd:  392] [0] Backtrace:
      bluetoothd:  392] [0] [<c04ec770>] (pending_eir_or_class+0x0/0x68) from [<c04f1830>] (add_uuid+0x34/0x1c4)
      bluetoothd:  392] [0] [<c04f17fc>] (add_uuid+0x0/0x1c4) from [<c04f3cc4>] (mgmt_control+0x204/0x274)
      bluetoothd:  392] [0] [<c04f3ac0>] (mgmt_control+0x0/0x274) from [<c04f609c>] (hci_sock_sendmsg+0x80/0x308)
      bluetoothd:  392] [0] [<c04f601c>] (hci_sock_sendmsg+0x0/0x308) from [<c03d4d68>] (sock_aio_write+0x144/0x174)
      bluetoothd:  392] [0]  r8:00000000 r7 7c1be90 r6 7c1be18 r5:00000017 r4 a90ea80
      bluetoothd:  392] [0] [<c03d4c24>] (sock_aio_write+0x0/0x174) from [<c00e2d4c>] (do_sync_write+0xb0/0xe0)
      bluetoothd:  392] [0] [<c00e2c9c>] (do_sync_write+0x0/0xe0) from [<c00e371c>] (vfs_write+0x134/0x13c)
      bluetoothd:  392] [0]  r8:00000000 r7 7c1bf70 r6:beeca5c8 r5:00000017 r4 7c05900
      bluetoothd:  392] [0] [<c00e35e8>] (vfs_write+0x0/0x13c) from [<c00e3910>] (sys_write+0x44/0x70)
      bluetoothd:  392] [0]  r8:00000000 r7:00000004 r6:00000017 r5:beeca5c8 r4 7c05900
      bluetoothd:  392] [0] [<c00e38cc>] (sys_write+0x0/0x70) from [<c000e3c0>] (ret_fast_syscall+0x0/0x30)
      bluetoothd:  392] [0]  r9 7c1a000d r8:c000e568 r6:400b5f10 r5:403896d8 r4:beeca604
      bluetoothd:  392] [0] Code: e28cc00c e152000c 0a00000f e3a00001 (e1d210b8)
      bluetoothd:  392] [0] ---[ end trace 67b6ac67435864c4 ]---
      bluetoothd:  392] [0] Kernel panic - not syncing: Fatal exception
      Signed-off-by: NJaganath Kanakkassery <jaganath.k@samsung.com>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      3ad67582
    • A
      net: sock: fix access via invalid file descriptor · 198bf1b0
      Alexei Starovoitov 提交于
      0day robot reported the following crash:
      [   21.233581] BUG: unable to handle kernel NULL pointer dereference at 0000000000000007
      [   21.234709] IP: [<ffffffff8156ebda>] sk_attach_bpf+0x39/0xc2
      
      It's due to bpf_prog_get() returning ERR_PTR.
      Check it properly.
      Reported-by: NFengguang Wu <fengguang.wu@intel.com>
      Fixes: 89aa0758 ("net: sock: allow eBPF programs to be attached to sockets")
      Signed-off-by: NAlexei Starovoitov <ast@plumgrid.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      198bf1b0
    • G
      net: introduce helper macro for_each_cmsghdr · f95b414e
      Gu Zheng 提交于
      Introduce helper macro for_each_cmsghdr as a wrapper of the enumerating
      cmsghdr from msghdr, just cleanup.
      Signed-off-by: NGu Zheng <guz.fnst@cn.fujitsu.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f95b414e
    • J
      mm: memcontrol: lockless page counters · 3e32cb2e
      Johannes Weiner 提交于
      Memory is internally accounted in bytes, using spinlock-protected 64-bit
      counters, even though the smallest accounting delta is a page.  The
      counter interface is also convoluted and does too many things.
      
      Introduce a new lockless word-sized page counter API, then change all
      memory accounting over to it.  The translation from and to bytes then only
      happens when interfacing with userspace.
      
      The removed locking overhead is noticable when scaling beyond the per-cpu
      charge caches - on a 4-socket machine with 144-threads, the following test
      shows the performance differences of 288 memcgs concurrently running a
      page fault benchmark:
      
      vanilla:
      
         18631648.500498      task-clock (msec)         #  140.643 CPUs utilized            ( +-  0.33% )
               1,380,638      context-switches          #    0.074 K/sec                    ( +-  0.75% )
                  24,390      cpu-migrations            #    0.001 K/sec                    ( +-  8.44% )
           1,843,305,768      page-faults               #    0.099 M/sec                    ( +-  0.00% )
      50,134,994,088,218      cycles                    #    2.691 GHz                      ( +-  0.33% )
         <not supported>      stalled-cycles-frontend
         <not supported>      stalled-cycles-backend
       8,049,712,224,651      instructions              #    0.16  insns per cycle          ( +-  0.04% )
       1,586,970,584,979      branches                  #   85.176 M/sec                    ( +-  0.05% )
           1,724,989,949      branch-misses             #    0.11% of all branches          ( +-  0.48% )
      
           132.474343877 seconds time elapsed                                          ( +-  0.21% )
      
      lockless:
      
         12195979.037525      task-clock (msec)         #  133.480 CPUs utilized            ( +-  0.18% )
                 832,850      context-switches          #    0.068 K/sec                    ( +-  0.54% )
                  15,624      cpu-migrations            #    0.001 K/sec                    ( +- 10.17% )
           1,843,304,774      page-faults               #    0.151 M/sec                    ( +-  0.00% )
      32,811,216,801,141      cycles                    #    2.690 GHz                      ( +-  0.18% )
         <not supported>      stalled-cycles-frontend
         <not supported>      stalled-cycles-backend
       9,999,265,091,727      instructions              #    0.30  insns per cycle          ( +-  0.10% )
       2,076,759,325,203      branches                  #  170.282 M/sec                    ( +-  0.12% )
           1,656,917,214      branch-misses             #    0.08% of all branches          ( +-  0.55% )
      
            91.369330729 seconds time elapsed                                          ( +-  0.45% )
      
      On top of improved scalability, this also gets rid of the icky long long
      types in the very heart of memcg, which is great for 32 bit and also makes
      the code a lot more readable.
      
      Notable differences between the old and new API:
      
      - res_counter_charge() and res_counter_charge_nofail() become
        page_counter_try_charge() and page_counter_charge() resp. to match
        the more common kernel naming scheme of try_do()/do()
      
      - res_counter_uncharge_until() is only ever used to cancel a local
        counter and never to uncharge bigger segments of a hierarchy, so
        it's replaced by the simpler page_counter_cancel()
      
      - res_counter_set_limit() is replaced by page_counter_limit(), which
        expects its callers to serialize against themselves
      
      - res_counter_memparse_write_strategy() is replaced by
        page_counter_limit(), which rounds down to the nearest page size -
        rather than up.  This is more reasonable for explicitely requested
        hard upper limits.
      
      - to keep charging light-weight, page_counter_try_charge() charges
        speculatively, only to roll back if the result exceeds the limit.
        Because of this, a failing bigger charge can temporarily lock out
        smaller charges that would otherwise succeed.  The error is bounded
        to the difference between the smallest and the biggest possible
        charge size, so for memcg, this means that a failing THP charge can
        send base page charges into reclaim upto 2MB (4MB) before the limit
        would have been reached.  This should be acceptable.
      
      [akpm@linux-foundation.org: add includes for WARN_ON_ONCE and memparse]
      [akpm@linux-foundation.org: add includes for WARN_ON_ONCE, memparse, strncmp, and PAGE_SIZE]
      Signed-off-by: NJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: NMichal Hocko <mhocko@suse.cz>
      Acked-by: NVladimir Davydov <vdavydov@parallels.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3e32cb2e
    • J
      irda: Convert function pointer arrays and uses to const · 785c20a0
      Joe Perches 提交于
      Making things const is a good thing.
      
      (x86-64 defconfig with all irda)
      $ size net/irda/built-in.o*
         text	   data	    bss	    dec	    hex	filename
       109276	   1868	    244	 111388	  1b31c	net/irda/built-in.o.new
       108828	   2316	    244	 111388	  1b31c	net/irda/built-in.o.old
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      785c20a0
    • J
      llc: Make llc_sap_action_t function pointer arrays const · 22bbf5f3
      Joe Perches 提交于
      It's better when function pointer arrays aren't modifiable.
      
      Net change:
      
      $ size net/llc/built-in.o.*
         text	   data	    bss	    dec	    hex	filename
        61193	  12758	   1344	  75295	  1261f	net/llc/built-in.o.new
        47113	  27030	   1344	  75487	  126df	net/llc/built-in.o.old
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      22bbf5f3