Skip to content
Snippets Groups Projects
  1. Mar 02, 2017
  2. Feb 25, 2017
    • j00365487's avatar
      power: charger: optimize charging scheme in retail mode · 5cac15c2
      j00365487 authored
      1.disable charging when capacity is above 70.
      2.enable charging when capacity is below 60.
      
      Change-Id: I631e2aee0d6b93138687a7453d934b71e1cfac2f
      5cac15c2
    • Amir Samuelov's avatar
      spcom: check buf_size validity for user send command · 824a6794
      Amir Samuelov authored
      
      CVE-2016-5856
      
      Check command buf size before allocating kernel buffer.
      
      CRs-Fixed: 1094078
      Change-Id: Ib03cd8c79966ff35863c1bde99089cac018ab45c
      Signed-off-by: default avatarAmir Samuelov <amirs@codeaurora.org>
      824a6794
    • Karthikeyan Ramasubramanian's avatar
      net: ipc_router: Register services only on client port · 53aeaedb
      Karthikeyan Ramasubramanian authored
      
      CVE-2017-0463
      
      Allowing services to be registered on a non-client port will cause either
      an existing service or a control port to be over-written. This will cause
      undefined functional behavior.
      
      Allow the services to be registered only on client ports.
      
      CRs-Fixed: 1101792
      Change-Id: If6cfc75e9314204b7b44957f1598a8a2e1a45325
      Signed-off-by: default avatarKarthikeyan Ramasubramanian <kramasub@codeaurora.org>
      53aeaedb
    • Jim Lin's avatar
      FROMLIST: CHROMIUM: usb: gadget: configfs: Fix KASAN use-after-free · 036735bf
      Jim Lin authored
      
      CVE-2017-0537
      
      When gadget is disconnected, running sequence is like this.
      . android_work: sent uevent USB_STATE=DISCONNECTED
      . Call trace:
        usb_string_copy+0xd0/0x128
        gadget_config_name_configuration_store+0x4
        gadget_config_name_attr_store+0x40/0x50
        configfs_write_file+0x198/0x1f4
        vfs_write+0x100/0x220
        SyS_write+0x58/0xa8
      . configfs_composite_unbind
      . configfs_composite_bind
      
      In configfs_composite_bind, it has
      "cn->strings.s = cn->configuration;"
      
      When usb_string_copy is invoked. it would
      allocate memory, copy input string, release previous pointed memory space,
      and use new allocated memory.
      
      When gadget is connected, host sends down request to get information.
      Call trace:
        usb_gadget_get_string+0xec/0x168
        lookup_string+0x64/0x98
        composite_setup+0xa34/0x1ee8
        android_setup+0xb4/0x140
      
      If gadget is disconnected and connected quickly, in the failed case,
      cn->configuration memory has been released by usb_string_copy kfree but
      configfs_composite_bind hasn't been run in time to assign new allocated
      "cn->configuration" pointer to "cn->strings.s".
      
      When "strlen(s->s) of usb_gadget_get_string is being executed, the dangling
      memory is accessed, "BUG: KASAN: use-after-free" error occurs.
      
      BUG=chrome-os-partner:58412
      TEST=After smaug device was connected to ubuntu PC host, detached and attached
      type-C cable quickly several times without seeing
      "BUG: KASAN: use-after-free in usb_gadget_get_string".
      
      Bug: 31614969
      Change-Id: I58240ee7c55ae8f8fb8597d14f09c5ac07abb032
      Signed-off-by: default avatarJim Lin <jilin@nvidia.com>
      Signed-off-by: default avatarSiqi Lin <siqilin@google.com>
      (am from https://chromium-review.googlesource.com/#/c/428059/3)
      036735bf
    • Andrey Ryabinin's avatar
      mpi: Fix NULL ptr dereference in mpi_powm() [ver #3] · f205d5f8
      Andrey Ryabinin authored
      CVE-2016-8650
      
      If mpi_powm() is given a zero exponent, it wants to immediately return
      either 1 or 0, depending on the modulus.  However, if the result was
      initalised with zero limb space, no limbs space is allocated and a
      NULL-pointer exception ensues.
      
      Fix this by allocating a minimal amount of limb space for the result when
      the 0-exponent case when the result is 1 and not touching the limb space
      when the result is 0.
      
      This affects the use of RSA keys and X.509 certificates that carry them.
      
      BUG: unable to handle kernel NULL pointer dereference at           (null)
      IP: [<ffffffff8138ce5d>] mpi_powm+0x32/0x7e6
      PGD 0
      Oops: 0002 [#1] SMP
      Modules linked in:
      CPU: 3 PID: 3014 Comm: keyctl Not tainted 4.9.0-rc6-fscache+ #278
      Hardware name: ASUS All Series/H97-PLUS, BIOS 2306 10/09/2014
      task: ffff8804011944c0 task.stack: ffff880401294000
      RIP: 0010:[<ffffffff8138ce5d>]  [<ffffffff8138ce5d>] mpi_powm+0x32/0x7e6
      RSP: 0018:ffff880401297ad8  EFLAGS: 00010212
      RAX: 0000000000000000 RBX: ffff88040868bec0 RCX: ffff88040868bba0
      RDX: ffff88040868b260 RSI: ffff88040868bec0 RDI: ffff88040868bee0
      RBP: ffff880401297ba8 R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000047 R11: ffffffff8183b210 R12: 0000000000000000
      R13: ffff8804087c7600 R14: 000000000000001f R15: ffff880401297c50
      FS:  00007f7a7918c700(0000) GS:ffff88041fb80000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000000 CR3: 0000000401250000 CR4: 00000000001406e0
      Stack:
       ffff88040868bec0 0000000000000020 ffff880401297b00 ffffffff81376cd4
       0000000000000100 ffff880401297b10 ffffffff81376d12 ffff880401297b30
       ffffffff81376f37 0000000000000100 0000000000000000 ffff880401297ba8
      Call Trace:
       [<ffffffff81376cd4>] ? __sg_page_iter_next+0x43/0x66
       [<ffffffff81376d12>] ? sg_miter_get_next_page+0x1b/0x5d
       [<ffffffff81376f37>] ? sg_miter_next+0x17/0xbd
       [<ffffffff8138ba3a>] ? mpi_read_raw_from_sgl+0xf2/0x146
       [<ffffffff8132a95c>] rsa_verify+0x9d/0xee
       [<ffffffff8132acca>] ? pkcs1pad_sg_set_buf+0x2e/0xbb
       [<ffffffff8132af40>] pkcs1pad_verify+0xc0/0xe1
       [<ffffffff8133cb5e>] public_key_verify_signature+0x1b0/0x228
       [<ffffffff8133d974>] x509_check_for_self_signed+0xa1/0xc4
       [<ffffffff8133cdde>] x509_cert_parse+0x167/0x1a1
       [<ffffffff8133d609>] x509_key_preparse+0x21/0x1a1
       [<ffffffff8133c3d7>] asymmetric_key_preparse+0x34/0x61
       [<ffffffff812fc9f3>] key_create_or_update+0x145/0x399
       [<ffffffff812fe227>] SyS_add_key+0x154/0x19e
       [<ffffffff81001c2b>] do_syscall_64+0x80/0x191
       [<ffffffff816825e4>] entry_SYSCALL64_slow_path+0x25/0x25
      Code: 56 41 55 41 54 53 48 81 ec a8 00 00 00 44 8b 71 04 8b 42 04 4c 8b 67 18 45 85 f6 89 45 80 0f 84 b4 06 00 00 85 c0 75 2f 41 ff ce <49> c7 04 24 01 00 00 00 b0 01 75 0b 48 8b 41 18 48 83 38 01 0f
      RIP  [<ffffffff8138ce5d>] mpi_powm+0x32/0x7e6
       RSP <ffff880401297ad8>
      CR2: 0000000000000000
      ---[ end trace d82015255d4a5d8d ]---
      
      Basically, this is a backport of a libgcrypt patch:
      
      	http://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=patch;h=6e1adb05d290aeeb1c230c763970695f4a538526
      
      
      
      Change-Id: I217208b0dbee5511cd4ca01a8f200431d8137f48
      Fixes: cdec9cb5 ("crypto: GnuPG based MPI lib - source files (part 1)")
      Signed-off-by: default avatarAndrey Ryabinin <aryabinin@virtuozzo.com>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
      cc: linux-ima-devel@lists.sourceforge.net
      cc: stable@vger.kernel.org
      Signed-off-by: default avatarJames Morris <james.l.morris@oracle.com>
      f205d5f8
    • Mohammed Khajapasha's avatar
      msm-core: use get_user() API to read userspace data/settings · 66829984
      Mohammed Khajapasha authored
      
      CVE-2016-8483
      
      Currently userspace data is getting accessed directly
      and leading to crash, So use get_user() API to copy
      userspace data/settings to kernel space.
      
      Change-Id: I3a75ec9503d8207829640bf88e1c3160bf72c9f0
      Signed-off-by: default avatarMohammed Khajapasha <mkhaja@codeaurora.org>
      66829984
    • Subash Abhinov Kasiviswanathan's avatar
      net: rmnet_data: Fix incorrect netlink handling · a1b665a9
      Subash Abhinov Kasiviswanathan authored
      
      CVE-2017-0460
      
      rmnet_data netlink handler currently does not check for the
      incoming process pid and instead just loops back the pid.
      A malicious root user could potentially send a message with
      source pid 0 and this could cause rmnet_data to loop the message
      back till an out of memory situation occurs.
      
      rmnet_data also does not check for the message length of the
      incoming netlink messages and instead casts the netlink message
      without checking for the boundary.
      
      Fix these two scenarios by adding the pid and message length checks
      respectively.
      
      Bug: 31252965
      CRs-Fixed: 1098801
      Change-Id: I172c1a7112e67e82959b397af7ddfd963d819bdc
      Signed-off-by: default avatarSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
      a1b665a9
    • gwx419604's avatar
      msm: ipa: Prevent multiple header deletion from user space · 1c70f84b
      gwx419604 authored
      CVE-2017-0525
      
      An IPA header or processing context can be added once
      and later deleted once from user space.
      Multiple deletion may cause invalid state of the headers
      software cache.
      
      Change-Id: I7dc2b6e5fc3d45e9f6b9afa59240c72995019a77
      1c70f84b
    • gwx419604's avatar
      msm: crypto: fix issues on digest buf and copy_from_user in qcedev.c · 98922ae2
      gwx419604 authored
      CVE-2017-0520
      
      Make the digest length not larger than the size of the buffer
      qcedev_areq.sha_op_req.digest; and use the checked variants of
      the copy_from/to_user() APIs to avoid small race window of their
      unchecked variants.
      
      Change-Id: I6e9da34c24b34ebe0fd762aeb28caeff033eeb39
      98922ae2
    • gwx419604's avatar
      QBT1000: copy qseecom handle to user when loading/unloading app · cc2c7425
      gwx419604 authored
      
      CVE-2017-0518
      CVE-2017-0519
      
      BT1000 provides IOCTLs for loading and unloading a QSEE app.
      In the input structure for these IOCTLs there is a pointer
      to a qseecom handle which serves as an output parameter for
      the IOCTLs. That is, the given handle (in client address space)
      should be set to a valid handle value on load, and should be set
      to 0 on unload.
      
      The driver was missing a proper copy_to_user() call for this handle,
      which sometimes resulted in unload not setting the handle to 0.
      
      Bug: 32372915
      Bug: 32370896
      Change-Id: If47d833e9c4ea3bcce8e39bc7e0ad268a6618643
      CRs-fixed: 1059327
      Signed-off-by: default avatarLior Barenboim <liorb@codeaurora.org>
      Signed-off-by: default avatarDennis Cagle <d-cagle@codeaurora.org>
      cc2c7425
    • gwx419604's avatar
      msm: ADSPRPC: Buffer length to be copied is truncated · 04b11840
      gwx419604 authored
      
      CVE-2017-0457
      
      The buffer length that is being used to allocate gets truncated
      due to it being assigned to wrong type causing a much smaller
      buffer to be allocated than what is required for copying.
      
      Bug: 31695439
      Change-Id: I9328840c15ee8bc83ddf379980327f289f6e1664
      CRs-Fixed: 1100695
      Signed-off-by: default avatarSathish Ambley <sathishambley@codeaurora.org>
      Signed-off-by: default avatarBiswajit Paul <biswajitpaul@codeaurora.org>
      Signed-off-by: default avatarWei Wang <wvw@google.com>
      04b11840
    • gwx419604's avatar
      input: misc: fix heap overflow issue in hbtp_input.c · 4ff54b2c
      gwx419604 authored
      
      CVE-2017-0516
      
      Add the boundary check for ABS code before setting ABS params,
      to avoid heap overflow.
      
      Bug: 32341680
      Change-Id: Ie46e3adbb000a6d53597e1124821be96dc16425b
      CRs-fixed: 1096301
      Signed-off-by: default avatarVevek Venkatesan <vevekv@codeaurora.org>
      Signed-off-by: default avatarDennis Cagle <d-cagle@codeaurora.org>
      4ff54b2c
    • gwx419604's avatar
      net: avoid signed overflows for SO_{SND|RCV}BUFFORCE · ba3e70a0
      gwx419604 authored
      
      CVE-2016-9793
      
      CAP_NET_ADMIN users should not be allowed to set negative
      sk_sndbuf or sk_rcvbuf values, as it can lead to various memory
      corruptions, crashes, OOM...
      
      Note that before commit 82981930 ("net: cleanups in
      sock_setsockopt()"), the bug was even more serious, since SO_SNDBUF
      and SO_RCVBUF were vulnerable.
      
      This needs to be backported to all known linux kernels.
      
      Again, many thanks to syzkaller team for discovering this gem.
      
      Change-Id: I936dc1ebd7447204785bff09900179080b7d60f6
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reported-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ba3e70a0
    • gwx419604's avatar
      packet: fix race condition in packet_set_ring · ce98e35f
      gwx419604 authored
      
      CVE-2016-8655
      
      When packet_set_ring creates a ring buffer it will initialize a
      struct timer_list if the packet version is TPACKET_V3. This value
      can then be raced by a different thread calling setsockopt to
      set the version to TPACKET_V1 before packet_set_ring has finished.
      
      This leads to a use-after-free on a function pointer in the
      struct timer_list when the socket is closed as the previously
      initialized timer will not be deleted.
      
      The bug is fixed by taking lock_sock(sk) in packet_setsockopt when
      changing the packet version while also taking the lock at the start
      of packet_set_ring.
      
      Change-Id: Ia2b2ea8a2fd1703d2d939aa4ea660873877d3d6a
      Fixes: f6fb8f10 ("af-packet: TPACKET_V3 flexible buffer implementation.")
      Signed-off-by: default avatarPhilip Pettersson <philip.pettersson@gmail.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ce98e35f
    • gwx419604's avatar
      msm: kgsl: Reserve a context ID slot but don't populate immediately · 99a6dd57
      gwx419604 authored
      
      CVE-2016-8479
      
      When creating a context allocate an ID but don't populate the slot
      with the context pointer until we are done setup up the rest of the
      process. This avoids a race if somebody tries to free the same
      identifier before the create operation is complete.
      
      Bug: 31824853
      Change-Id: If020cefc9f68c0d2dec123f9f4bb182a6b5bc8a2
      Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
      99a6dd57
    • gwx419604's avatar
      l2tp: fix racy SOCK_ZAPPED flag check in l2tp_ip{,6}_bind() · 117f3574
      gwx419604 authored
      
      CVE-2016-10200
      
      Lock socket before checking the SOCK_ZAPPED flag in l2tp_ip6_bind().
      Without lock, a concurrent call could modify the socket flags between
      the sock_flag(sk, SOCK_ZAPPED) test and the lock_sock() call. This way,
      a socket could be inserted twice in l2tp_ip6_bind_table. Releasing it
      would then leave a stale pointer there, generating use-after-free
      errors when walking through the list or modifying adjacent entries.
      
      BUG: KASAN: use-after-free in l2tp_ip6_close+0x22e/0x290 at addr ffff8800081b0ed8
      Write of size 8 by task syz-executor/10987
      CPU: 0 PID: 10987 Comm: syz-executor Not tainted 4.8.0+ #39
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.8.2-0-g33fbe13 by qemu-project.org 04/01/2014
       ffff880031d97838 ffffffff829f835b ffff88001b5a1640 ffff8800081b0ec0
       ffff8800081b15a0 ffff8800081b6d20 ffff880031d97860 ffffffff8174d3cc
       ffff880031d978f0 ffff8800081b0e80 ffff88001b5a1640 ffff880031d978e0
      Call Trace:
       [<ffffffff829f835b>] dump_stack+0xb3/0x118 lib/dump_stack.c:15
       [<ffffffff8174d3cc>] kasan_object_err+0x1c/0x70 mm/kasan/report.c:156
       [<     inline     >] print_address_description mm/kasan/report.c:194
       [<ffffffff8174d666>] kasan_report_error+0x1f6/0x4d0 mm/kasan/report.c:283
       [<     inline     >] kasan_report mm/kasan/report.c:303
       [<ffffffff8174db7e>] __asan_report_store8_noabort+0x3e/0x40 mm/kasan/report.c:329
       [<     inline     >] __write_once_size ./include/linux/compiler.h:249
       [<     inline     >] __hlist_del ./include/linux/list.h:622
       [<     inline     >] hlist_del_init ./include/linux/list.h:637
       [<ffffffff8579047e>] l2tp_ip6_close+0x22e/0x290 net/l2tp/l2tp_ip6.c:239
       [<ffffffff850b2dfd>] inet_release+0xed/0x1c0 net/ipv4/af_inet.c:415
       [<ffffffff851dc5a0>] inet6_release+0x50/0x70 net/ipv6/af_inet6.c:422
       [<ffffffff84c4581d>] sock_release+0x8d/0x1d0 net/socket.c:570
       [<ffffffff84c45976>] sock_close+0x16/0x20 net/socket.c:1017
       [<ffffffff817a108c>] __fput+0x28c/0x780 fs/file_table.c:208
       [<ffffffff817a1605>] ____fput+0x15/0x20 fs/file_table.c:244
       [<ffffffff813774f9>] task_work_run+0xf9/0x170
       [<ffffffff81324aae>] do_exit+0x85e/0x2a00
       [<ffffffff81326dc8>] do_group_exit+0x108/0x330
       [<ffffffff81348cf7>] get_signal+0x617/0x17a0 kernel/signal.c:2307
       [<ffffffff811b49af>] do_signal+0x7f/0x18f0
       [<ffffffff810039bf>] exit_to_usermode_loop+0xbf/0x150 arch/x86/entry/common.c:156
       [<     inline     >] prepare_exit_to_usermode arch/x86/entry/common.c:190
       [<ffffffff81006060>] syscall_return_slowpath+0x1a0/0x1e0 arch/x86/entry/common.c:259
       [<ffffffff85e4d726>] entry_SYSCALL_64_fastpath+0xc4/0xc6
      Object at ffff8800081b0ec0, in cache L2TP/IPv6 size: 1448
      Allocated:
      PID = 10987
       [ 1116.897025] [<ffffffff811ddcb6>] save_stack_trace+0x16/0x20
       [ 1116.897025] [<ffffffff8174c736>] save_stack+0x46/0xd0
       [ 1116.897025] [<ffffffff8174c9ad>] kasan_kmalloc+0xad/0xe0
       [ 1116.897025] [<ffffffff8174cee2>] kasan_slab_alloc+0x12/0x20
       [ 1116.897025] [<     inline     >] slab_post_alloc_hook mm/slab.h:417
       [ 1116.897025] [<     inline     >] slab_alloc_node mm/slub.c:2708
       [ 1116.897025] [<     inline     >] slab_alloc mm/slub.c:2716
       [ 1116.897025] [<ffffffff817476a8>] kmem_cache_alloc+0xc8/0x2b0 mm/slub.c:2721
       [ 1116.897025] [<ffffffff84c4f6a9>] sk_prot_alloc+0x69/0x2b0 net/core/sock.c:1326
       [ 1116.897025] [<ffffffff84c58ac8>] sk_alloc+0x38/0xae0 net/core/sock.c:1388
       [ 1116.897025] [<ffffffff851ddf67>] inet6_create+0x2d7/0x1000 net/ipv6/af_inet6.c:182
       [ 1116.897025] [<ffffffff84c4af7b>] __sock_create+0x37b/0x640 net/socket.c:1153
       [ 1116.897025] [<     inline     >] sock_create net/socket.c:1193
       [ 1116.897025] [<     inline     >] SYSC_socket net/socket.c:1223
       [ 1116.897025] [<ffffffff84c4b46f>] SyS_socket+0xef/0x1b0 net/socket.c:1203
       [ 1116.897025] [<ffffffff85e4d685>] entry_SYSCALL_64_fastpath+0x23/0xc6
      Freed:
      PID = 10987
       [ 1116.897025] [<ffffffff811ddcb6>] save_stack_trace+0x16/0x20
       [ 1116.897025] [<ffffffff8174c736>] save_stack+0x46/0xd0
       [ 1116.897025] [<ffffffff8174cf61>] kasan_slab_free+0x71/0xb0
       [ 1116.897025] [<     inline     >] slab_free_hook mm/slub.c:1352
       [ 1116.897025] [<     inline     >] slab_free_freelist_hook mm/slub.c:1374
       [ 1116.897025] [<     inline     >] slab_free mm/slub.c:2951
       [ 1116.897025] [<ffffffff81748b28>] kmem_cache_free+0xc8/0x330 mm/slub.c:2973
       [ 1116.897025] [<     inline     >] sk_prot_free net/core/sock.c:1369
       [ 1116.897025] [<ffffffff84c541eb>] __sk_destruct+0x32b/0x4f0 net/core/sock.c:1444
       [ 1116.897025] [<ffffffff84c5aca4>] sk_destruct+0x44/0x80 net/core/sock.c:1452
       [ 1116.897025] [<ffffffff84c5ad33>] __sk_free+0x53/0x220 net/core/sock.c:1460
       [ 1116.897025] [<ffffffff84c5af23>] sk_free+0x23/0x30 net/core/sock.c:1471
       [ 1116.897025] [<ffffffff84c5cb6c>] sk_common_release+0x28c/0x3e0 ./include/net/sock.h:1589
       [ 1116.897025] [<ffffffff8579044e>] l2tp_ip6_close+0x1fe/0x290 net/l2tp/l2tp_ip6.c:243
       [ 1116.897025] [<ffffffff850b2dfd>] inet_release+0xed/0x1c0 net/ipv4/af_inet.c:415
       [ 1116.897025] [<ffffffff851dc5a0>] inet6_release+0x50/0x70 net/ipv6/af_inet6.c:422
       [ 1116.897025] [<ffffffff84c4581d>] sock_release+0x8d/0x1d0 net/socket.c:570
       [ 1116.897025] [<ffffffff84c45976>] sock_close+0x16/0x20 net/socket.c:1017
       [ 1116.897025] [<ffffffff817a108c>] __fput+0x28c/0x780 fs/file_table.c:208
       [ 1116.897025] [<ffffffff817a1605>] ____fput+0x15/0x20 fs/file_table.c:244
       [ 1116.897025] [<ffffffff813774f9>] task_work_run+0xf9/0x170
       [ 1116.897025] [<ffffffff81324aae>] do_exit+0x85e/0x2a00
       [ 1116.897025] [<ffffffff81326dc8>] do_group_exit+0x108/0x330
       [ 1116.897025] [<ffffffff81348cf7>] get_signal+0x617/0x17a0 kernel/signal.c:2307
       [ 1116.897025] [<ffffffff811b49af>] do_signal+0x7f/0x18f0
       [ 1116.897025] [<ffffffff810039bf>] exit_to_usermode_loop+0xbf/0x150 arch/x86/entry/common.c:156
       [ 1116.897025] [<     inline     >] prepare_exit_to_usermode arch/x86/entry/common.c:190
       [ 1116.897025] [<ffffffff81006060>] syscall_return_slowpath+0x1a0/0x1e0 arch/x86/entry/common.c:259
       [ 1116.897025] [<ffffffff85e4d726>] entry_SYSCALL_64_fastpath+0xc4/0xc6
      Memory state around the buggy address:
       ffff8800081b0d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
       ffff8800081b0e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      >ffff8800081b0e80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                                          ^
       ffff8800081b0f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
       ffff8800081b0f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      
      ==================================================================
      
      The same issue exists with l2tp_ip_bind() and l2tp_ip_bind_table.
      
      Change-Id: I7b279d4421ce3cf6cd59599814eec071c2dba555
      Fixes: c51ce497 ("l2tp: fix oops in L2TP IP sockets for connect() AF_UNSPEC case")
      Reported-by: default avatarBaozeng Ding <sploving1@gmail.com>
      Reported-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Tested-by: default avatarBaozeng Ding <sploving1@gmail.com>
      Signed-off-by: default avatarGuillaume Nault <g.nault@alphalink.fr>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      117f3574
    • gwx419604's avatar
      android: fiq_debugger: restrict access to critical commands. · 9940b12f
      gwx419604 authored
      
      CVE-2017-0510
      
      Sysrq must be enabled via /proc/sys/kernel/sysrq as a security
      measure to enable various critical fiq debugger commands that
      either leak information or can be used as a system attack.
      
      Default disabled, this will leave the reboot, reset, irqs, sleep,
      nosleep, console and ps commands.  Reboot and reset commands
      will be restricted from taking any parameters.  We will also
      switch to showing the limited command set in this mode.
      
      Change-Id: I1a5e33e08d9d10cfe343176d2f6319ad48a90876
      Signed-off-by: default avatarMark Salyzyn <salyzyn@google.com>
      Bug: 32402555
      9940b12f
    • gwx419604's avatar
      ANDROID: ion: check for kref overflow · ebcd41cb
      gwx419604 authored
      
      CVE-2017-0507
      
      Userspace can cause the kref to handles to increment
      arbitrarily high. Ensure it does not overflow.
      
      Change-Id: I989e479c2dde81f5ae51d83bba96733f99e994fa
      Signed-off-by: default avatarDaniel Rosenberg <drosen@google.com>
      Bug: 31992382
      Test: See bug for poc
      ebcd41cb
    • gwx419604's avatar
      netlink: Fix dump skb leak/double free · a1aa156d
      gwx419604 authored
      
      CVE-2016-9806
      
      When we free cb->skb after a dump, we do it after releasing the
      lock.  This means that a new dump could have started in the time
      being and we'll end up freeing their skb instead of ours.
      
      This patch saves the skb and module before we unlock so we free
      the right memory.
      
      Change-Id: Ifdc0853389cc96fc5f63f3f514ae3374b7baa31f
      Fixes: 16b304f3 ("netlink: Eliminate kmalloc in netlink dump operation.")
      Reported-by: default avatarBaozeng Ding <sploving1@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a1aa156d
  3. Feb 23, 2017
    • 伟 张's avatar
    • 伟 张's avatar
    • j00365487's avatar
      power: ulpm: optimize battery capacity display · 0383f8c5
      j00365487 authored
      1.modify magic numbers.
      2.modify condition of soc can not decrease to avoid print log frequently.
      3.update last_soc to repsoc if repsoc decrease 5% when usb is present.
      
      Change-Id: I2cd6619f6ca06e8a0ef92568b7b988c179dd7b07
      0383f8c5
    • j00365487's avatar
      power: modify huawei license · f41e1ece
      j00365487 authored
      Change-Id: If92e2373791c14f4cbbf78d402152edd66b305bf
      f41e1ece
    • gwx419604's avatar
      BACKPORT: aio: mark AIO pseudo-fs noexec · c4499dde
      gwx419604 authored
      CVE-2016-10044
      
      This ensures that do_mmap() won't implicitly make AIO memory mappings
      executable if the READ_IMPLIES_EXEC personality flag is set.  Such
      behavior is problematic because the security_mmap_file LSM hook doesn't
      catch this case, potentially permitting an attacker to bypass a W^X
      policy enforced by SELinux.
      
      I have tested the patch on my machine.
      
      To test the behavior, compile and run this:
      
          #define _GNU_SOURCE
          #include <unistd.h>
          #include <sys/personality.h>
          #include <linux/aio_abi.h>
          #include <err.h>
          #include <stdlib.h>
          #include <stdio.h>
          #include <sys/syscall.h>
      
          int main(void) {
              personality(READ_IMPLIES_EXEC);
              aio_context_t ctx = 0;
              if (syscall(__NR_io_setup, 1, &ctx))
                  err(1, "io_setup");
      
              char cmd[1000];
              sprintf(cmd, "cat /proc/%d/maps | grep -F '/[aio]'",
                  (int)getpid());
              system(cmd);
              return 0;
          }
      
      In the output, "rw-s" is good, "rwxs" is bad.
      
      
      Bug: 31711619
      c4499dde
    • gwx419604's avatar
      fs/proc/array.c: make safe access to group_leader · 9d33e3fe
      gwx419604 authored
      
      CVE-2017-0427
      
      As mentioned in commit 52ee2dfd
      ("pids: refactor vnr/nr_ns helpers to make them safe"). *_nr_ns
      helpers used to be buggy. The commit addresses most of the helpers but
      is missing task_tgid_xxx()
      
      Without this protection there is a possible use after free reported by
      kasan instrumented kernel:
      
      ==================================================================
      BUG: KASAN: use-after-free in task_tgid_nr_ns+0x2c/0x44 at addr ***
      Read of size 8 by task cat/2472
      CPU: 1 PID: 2472 Comm: cat Tainted: ****
      Hardware name: Google Tegra210 Smaug Rev 1,3+ (DT)
      Call trace:
      [<ffffffc00020ad2c>] dump_backtrace+0x0/0x17c
      [<ffffffc00020aec0>] show_stack+0x18/0x24
      [<ffffffc0011573d0>] dump_stack+0x94/0x100
      [<ffffffc0003c7dc0>] kasan_report+0x308/0x554
      [<ffffffc0003c7518>] __asan_load8+0x20/0x7c
      [<ffffffc00025a54c>] task_tgid_nr_ns+0x28/0x44
      [<ffffffc00046951c>] proc_pid_status+0x444/0x1080
      [<ffffffc000460f60>] proc_single_show+0x8c/0xdc
      [<ffffffc0004081b0>] seq_read+0x2e8/0x6f0
      [<ffffffc0003d1420>] vfs_read+0xd8/0x1e0
      [<ffffffc0003d1b98>] SyS_read+0x68/0xd4
      
      Accessing group_leader while holding rcu_lock and using the now safe
      helpers introduced in the commit mentioned, this race condition is
      addressed.
      
      Change-Id: I7457dda477b34d889b42420ccdf04eeebf573cf1
      Signed-off-by: default avatarAdrian Salido <salidoa@google.com>
      Bug: 31495866
      9d33e3fe
  4. Feb 16, 2017
  5. Feb 15, 2017
  6. Feb 09, 2017
  7. Feb 08, 2017
    • j00365487's avatar
      power: ulpm: optimize ulpm idle time · 58614951
      j00365487 authored
      1.enter ulpm according to battery ocv.
      2.hold soc in early state.
      3.catchup soc in late state.
      
      Change-Id: I879b441b7e6a19244605a79e94a0716b3804827d
      58614951
    • j00365487's avatar
      power: charger: add mp2661 temperature protection hysteresis scheme · c485ca19
      j00365487 authored
      1.enable charging when batt temp is above 3 degree in cold status
      2.enable charging when batt temp is below 42 degree in hot status
      
      Change-Id: I312545d1e2dae1443ce3f8c0badea51c09be64bb
      c485ca19
    • l00228880's avatar
      power: usb: fix a bug about msm_otg wake lock preventing system from sleeping · 08de8926
      l00228880 authored
      Usually, when usb is gone, usb_usage_count is 1 and and msm_sm_work function will release msm_otg lock.
      Howerverer, when pugin and unplugin usb quickly, usb_usage_count may be not released by charger detection work and is larger than 1.
      It will prevent system from sleeping. So fix usb_usage_count to 1 when unplugin the charger.
      
      Change-Id: I00f4e1b57f7229c537cee4a7107edc129af4e9da
      08de8926
  8. Jan 12, 2017
Loading