Commit Graph

442080 Commits

Author SHA1 Message Date
Paolo Valente ac922cd71c block: introduce the BFQ-v7r8 I/O sched for 3.10.8+
Add the BFQ-v7r8 I/O scheduler to 3.10.8+.
The general structure is borrowed from CFQ, as much of the code for
handling I/O contexts Over time, several useful features have been
ported from CFQ as well (details in the changelog in README.BFQ). A
(bfq_)queue is associated to each task doing I/O on a device, and each
time a scheduling decision has to be made a queue is selected and served
until it expires.

    - Slices are given in the service domain: tasks are assigned
      budgets, measured in number of sectors. Once got the disk, a task
      must however consume its assigned budget within a configurable
      maximum time (by default, the maximum possible value of the
      budgets is automatically computed to comply with this timeout).
      This allows the desired latency vs "throughput boosting" tradeoff
      to be set.

    - Budgets are scheduled according to a variant of WF2Q+, implemented
      using an augmented rb-tree to take eligibility into account while
      preserving an O(log N) overall complexity.

    - A low-latency tunable is provided; if enabled, both interactive
      and soft real-time applications are guaranteed a very low latency.

    - Latency guarantees are preserved also in the presence of NCQ.

    - Also with flash-based devices, a high throughput is achieved
      while still preserving latency guarantees.

    - BFQ features Early Queue Merge (EQM), a sort of fusion of the
      cooperating-queue-merging and the preemption mechanisms present
      in CFQ. EQM is in fact a unified mechanism that tries to get a
      sequential read pattern, and hence a high throughput, with any
      set of processes performing interleaved I/O over a contiguous
      sequence of sectors.

    - BFQ supports full hierarchical scheduling, exporting a cgroups
      interface.  Since each node has a full scheduler, each group can
      be assigned its own weight.

    - If the cgroups interface is not used, only I/O priorities can be
      assigned to processes, with ioprio values mapped to weights
      with the relation weight = IOPRIO_BE_NR - ioprio.

    - ioprio classes are served in strict priority order, i.e., lower
      priority queues are not served as long as there are higher
      priority queues.  Among queues in the same class the bandwidth is
      distributed in proportion to the weight of each queue. A very
      thin extra bandwidth is however guaranteed to the Idle class, to
      prevent it from starving.

Change-Id: Iebf9be399041b89d79b54077da1a34a81d4e4238
Signed-off-by: Paolo Valente <paolo.valente@unimore.it>
Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
2017-04-18 04:37:19 +02:00
Arianna Avanzini 3c67a316fd block: cgroups, kconfig, build bits for BFQ-v7r8-3.10.8+
Update Kconfig.iosched and do the related Makefile changes to include
kernel configuration options for BFQ. Also add the bfqio controller
to the cgroups subsystem.

Change-Id: I41b0fe61f036d59b641205ab21902401e7a704c0
Signed-off-by: Paolo Valente <paolo.valente@unimore.it>
Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
Signed-off-by: Josue Rivera <prbassplayer@gmail.com>
2017-04-18 04:37:19 +02:00
Luca Stefani eeee7a4d5a arch/arm64: configs: Enable core ctl
Change-Id: I697b103ce251d0effd6c380c1128647d28d30d52
2017-04-18 04:37:18 +02:00
Pavankumar Kondeti 5a5f645ab8 core_ctl: Manage number of online cores based on system load
The core_ctl module takes input from userspace and CPU load information to
decide how many CPUs to keep online. User space has the following tunables:

- min_cpus: Minimum number of CPUs to keep online. This overrides other
  heuristics.
- max_cpus: Maximum number of CPUs to keep online. This overrides other
  heuristics.
- additional_cpus: Additional idle CPUs to keep ready for use.
- busy_up_thres: The normalized load% threshold that the CPU load should
  exceeded for the CPU to be go from not busy to busy.
  It could be a single threshold for all CPUs in a group, or num_cpus
  thresholds separated by spaces to specify different thresholds based on
  the current number of online CPUs.
- busy_down_thres: The normalized load% threshold that the CPU load should
  be lower than for the CPU to go from busy to not busy.
  It could be a single threshold for all CPUs in a group, or num_cpus
  thresholds separated by spaces to specify different thresholds based on
  the current number of online CPUs.
- offline_delay_ms: The time to wait for before offline cores when the
  number of needed CPUs goes down.

Mot-CRs-fixed: (CR)

Change-Id: Ied1d5bcbb8da5bbd5f3d1a3f042599babace6b65
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
Signed-off-by: Junjie Wu <junjiew@codeaurora.org>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Ravi Chebolu <arc095@motorola.com>
Reviewed-on: http://gerrit.mot.com/866560
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver <sltawvr@motorola.com>
Tested-by: Jira Key <jirakey@motorola.com>
Reviewed-by: Lian-Wei Wang <lian-wei.wang@motorola.com>
Reviewed-by: Christopher Fries <cfries@motorola.com>
Submit-Approved: Jira Key <jirakey@motorola.com>
2017-04-18 04:37:18 +02:00
Luca Stefani ee9890d0e7 arch/arm64: configs: Enable CPUSETS
Change-Id: I9573e135016163f0cd2199d2dd617e33535ff4ef
2017-04-18 04:37:17 +02:00
Riley Andrews 7ca254094c cpuset: Make cpusets restore on hotplug
This deliberately changes the behavior of the per-cpuset
cpus file to not be effected by hotplug. When a cpu is offlined,
it will be removed from the cpuset/cpus file. When a cpu is onlined,
if the cpuset originally requested that that cpu was part of the cpuset, that
cpu will be restored to the cpuset. The cpus files still
have to be hierachical, but the ranges no longer have to be out of
the currently online cpus, just the physically present cpus.

Change-Id: I3efbae24a1f6384be1e603fb56f0d3baef61d924
2017-04-18 04:37:17 +02:00
Riley Andrews bbe2a4a077 cpuset: Add allow_attach hook for cpusets on android.
Change-Id: Ic1b61b2bbb7ce74c9e9422b5e22ee9078251de21
2017-04-18 04:37:16 +02:00
Luca Stefani 7a18b32171 drivers: firmware: Add firmware-modem fw path 2017-04-18 04:17:09 +02:00
Luca Stefani baf265165c arch/arm: dts: samsung: Fix build warning
* Define #address-cells and #size-cells

Change-Id: I7c67a069a20c0f79fc4f41c7e340753d628e95ac
2017-04-18 04:16:34 +02:00
LuK1337 2e888813a7 arch/arm: dts: samsung: Set sound card name to msm8952-tomtom-snd-card
* We don't support rt5659.

Change-Id: I6ed014ba526418db27837b10bc9742154d33be64
2017-04-18 04:16:10 +02:00
LuK1337 2c49f6551c mobicore_driver: TlcTui is dead
Change-Id: I2eec28737ad990b17968a2525367e53a04827c8c
2017-04-18 04:11:35 +02:00
LuK1337 86713deafd arch/arm64: configs: Kill modules support
Change-Id: Id88c734a9c16957fc0196ddb9aa7473bb98f7e76
2017-04-18 04:11:34 +02:00
LuK1337 bae534be0c arch/arm64: configs: Add gts28vewifi_defconfig and gts210vewifi_defconfig
Change-Id: Iffa72886f9033fa884987bdfdff6f7c08a87edba
2017-04-18 04:11:33 +02:00
Christopher R. Palmer 4162ffa391 kconfig: Don't require a VARIANT_DEFCONFIG
Change-Id: I4a652c22ad4e29cd2a7eb31ae533d1e09a015ced
2017-04-18 03:46:37 +02:00
Luca Stefani 44cf03b1cc scripts: Don't create .reverse.dts files 2017-04-18 03:46:37 +02:00
LuK1337 fc9499e55a Import latest Samsung release
* Package version: T713XXU2BQCO

Change-Id: I293d9e7f2df458c512d59b7a06f8ca6add610c99
2017-04-18 03:43:52 +02:00
John Dias faa8430865 perf: protect group_leader from races that cause ctx double-free
When moving a group_leader perf event from a software-context
to a hardware-context, there's a race in checking and
updating that context. The existing locking solution
doesn't work; note that it tries to grab a lock inside
the group_leader's context object, which you can only
get at by going through a pointer that should be protected
from these races. To avoid that problem, and to produce
a simple solution, we can just use a lock per group_leader
to protect all checks on the group_leader's context.
The new lock is grabbed and released when no context locks
are held.

Bug: 30955111
Bug: 31095224
Change-Id: If37124c100ca6f4aa962559fba3bd5dbbec8e052
Git-repo: https://android.googlesource.com/kernel/msm.git
Git-commit: 5b87e00be9ca28ea32cab49b92c0386e4a91f730
Signed-off-by: Dennis Cagle <d-cagle@codeaurora.org>
2016-12-24 08:17:35 -08:00
Bharat Pawar ae34c548e7 Revert "Revert "ARM: dts: msm: update memory map for msm8976/8956/8952 for External release""
This reverts commit 376499ac27.

Change-Id: I68fa86c047a8aef975dcf349d4dc4e8da83f07c5
Signed-off-by: Bharat Pawar <bpawar@codeaurora.org>
2016-12-24 04:47:59 -08:00
Linux Build Service Account d476493a2f Merge "perf: Fix event->ctx locking" into LA.BR.1.3.6_rb1.11 2016-12-24 04:25:26 -08:00
Linux Build Service Account e3116ff2d0 Merge "qseecom: check buffer size when loading firmware images" into LA.BR.1.3.6_rb1.11 2016-12-24 04:25:23 -08:00
Linux Build Service Account a35b4760e8 Merge "binder: blacklist %p kptr_restrict" into LA.BR.1.3.6_rb1.11 2016-12-24 04:25:16 -08:00
Linux Build Service Account 39d3628acb Merge "[PATCH] arm: fix handling of F_OFD_... in oabi_fcntl64()" into LA.BR.1.3.6_rb1.11 2016-12-24 04:25:14 -08:00
Zhen Kong b2617293f6 qseecom: check buffer size when loading firmware images
Make change in __qseecom_load_fw() and qseecom_load_commonlib_image()
to check buffer size before copying img to buffer.

CRs-fixed: 1080290
Change-Id: I0f48666ac948a9571e249598ae7cc19df9036b1d
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
2016-12-24 04:15:00 -08:00
Peter Zijlstra 488b2d0623 perf: Fix event->ctx locking
There have been a few reported issues wrt. the lack of locking around
changing event->ctx. This patch tries to address those.

It avoids the whole rwsem thing and while it appears to work, please
give it some thought in review.

What I did fail at is sensible runtime checks on the use of
event->ctx, the RCU use makes it very hard.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/20150123125834.209535886@infradead.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(cherry picked from commit f63a8daa5812afef4f06c962351687e1ff9ccb2b)

Bug: 30955111
Bug: 31095224

Signed-off-by: Joao Dias <joaodias@google.com>
Change-Id: I8dfc0aae8d1206c177454e0093dacd82b6129c55
Git-repo: https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git
Git-commit: f63a8daa5812afef4f06c962351687e1ff9ccb2b
[rsiddoji@codeaurora.org: resloved some trival confilits]
Signed-off-by: Ravi Kumar Siddojigari <rsiddoji@codeaurora.org>
Signed-off-by: Pradosh Das <prados@codeaurora.org>
Signed-off-by: Kishor PK <kpbhat@codeaurora.org>
2016-12-24 04:10:37 -08:00
Nick Desaulniers f21ae65366 binder: blacklist %p kptr_restrict
Bug: 31495231
Change-Id: Iebc150f6bc939b56e021424ee44fb30ce8d732fd
[d-cagle@codeaurora.org: Applied to correct file location]
Git-repo: https://android.googlesource.com/kernel/msm.git
Git-commit: 0804d7840364fc1a93652632bd43a93c055c658e
Signed-off-by: Dennis Cagle <d-cagle@codeaurora.org>
2016-12-24 04:07:33 -08:00
Al Viro 6af814e88d [PATCH] arm: fix handling of F_OFD_... in oabi_fcntl64()
Change-Id: I4809d4887caf26bcfad505d6a378369b217b5a9e
Cc: stable@vger.kernel.org # 3.15+
Reviewed-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Git-repo: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
Git-commit: 76cc404bfdc0d419c720de4daaf2584542734f42
Signed-off-by: Dennis Cagle <d-cagle@codeaurora.org>
2016-12-24 04:06:54 -08:00
Bharat Pawar dceee43015 defconfig: Enable config IP_NF_MATCH_RPFILTER
Enable config IP_NF_MATCH_RPFILTER.
This option allows you to match packets whose replies would go out via
the interface the packet came in
Change-Id: I2a23346e726a8df8487aeb664d6316b3cf2b9d77
Signed-off-by: Bharat Pawar <bpawar@codeaurora.org>
2016-12-24 04:04:44 -08:00
Linux Build Service Account 6e7e3aec46 Merge AU_LINUX_ANDROID_LA.BR.1.3.6_RB1.07.00.00.255.025 on remote branch
Change-Id: I021ab0699e211d14811e4609adfd6f514d0a055a
2016-12-24 02:12:33 -08:00
Linux Build Service Account 2723298bfe Merge "KEYS: potential uninitialized variable" 2016-12-21 19:50:54 -08:00
Linux Build Service Account fbeeab897d Merge "mm: cma: fix incorrect type conversion for size during dma allocation." 2016-12-21 19:50:51 -08:00
Dan Carpenter 9231ae39e8 KEYS: potential uninitialized variable
If __key_link_begin() failed then "edit" would be uninitialized.  I've
added a check to fix that.

This allows a random user to crash the kernel, though it's quite
difficult to achieve.  There are three ways it can be done as the user
would have to cause an error to occur in __key_link():

 (1) Cause the kernel to run out of memory.  In practice, this is difficult
     to achieve without ENOMEM cropping up elsewhere and aborting the
     attempt.

 (2) Revoke the destination keyring between the keyring ID being looked up
     and it being tested for revocation.  In practice, this is difficult to
     time correctly because the KEYCTL_REJECT function can only be used
     from the request-key upcall process.  Further, users can only make use
     of what's in /sbin/request-key.conf, though this does including a
     rejection debugging test - which means that the destination keyring
     has to be the caller's session keyring in practice.

 (3) Have just enough key quota available to create a key, a new session
     keyring for the upcall and a link in the session keyring, but not then
     sufficient quota to create a link in the nominated destination keyring
     so that it fails with EDQUOT.

The bug can be triggered using option (3) above using something like the
following:

	echo 80 >/proc/sys/kernel/keys/root_maxbytes
	keyctl request2 user debug:fred negate @t

The above sets the quota to something much lower (80) to make the bug
easier to trigger, but this is dependent on the system.  Note also that
the name of the keyring created contains a random number that may be
between 1 and 10 characters in size, so may throw the test off by
changing the amount of quota used.

Assuming the failure occurs, something like the following will be seen:

	kfree_debugcheck: out of range ptr 6b6b6b6b6b6b6b68h
	------------[ cut here ]------------
	kernel BUG at ../mm/slab.c:2821!
	...
	RIP: 0010:[<ffffffff811600f9>] kfree_debugcheck+0x20/0x25
	RSP: 0018:ffff8804014a7de8  EFLAGS: 00010092
	RAX: 0000000000000034 RBX: 6b6b6b6b6b6b6b68 RCX: 0000000000000000
	RDX: 0000000000040001 RSI: 00000000000000f6 RDI: 0000000000000300
	RBP: ffff8804014a7df0 R08: 0000000000000001 R09: 0000000000000000
	R10: ffff8804014a7e68 R11: 0000000000000054 R12: 0000000000000202
	R13: ffffffff81318a66 R14: 0000000000000000 R15: 0000000000000001
	...
	Call Trace:
	  kfree+0xde/0x1bc
	  assoc_array_cancel_edit+0x1f/0x36
	  __key_link_end+0x55/0x63
	  key_reject_and_link+0x124/0x155
	  keyctl_reject_key+0xb6/0xe0
	  keyctl_negate_key+0x10/0x12
	  SyS_keyctl+0x9f/0xe7
	  do_syscall_64+0x63/0x13a
	  entry_SYSCALL64_slow_path+0x25/0x25

Fixes: f70e2e0619 ('KEYS: Do preallocation for __key_link()')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dennis Cagle <d-cagle@codeaurora.org>
Git-repo: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
Git-commit: 38327424b40bcebe2de92d07312c89360ac9229a
(cherry picked from commit 38327424b40bcebe2de92d07312c89360ac9229a)
Change-Id: I07568c78448b9d4bcc19b506ac0cbeb3d8af6961
2016-12-20 22:16:48 -08:00
Linux Build Service Account 8a2a31f9f8 Merge "usb: Avoid exposing kernel addresses" 2016-12-20 02:29:16 -08:00
Rohit Vaswani 833bf4f64a mm: cma: fix incorrect type conversion for size during dma allocation.
This was found during userspace fuzzing test when a large size dma cma
allocation is made by driver(like ion) through userspace.

  show_stack+0x10/0x1c
  dump_stack+0x74/0xc8
  kasan_report_error+0x2b0/0x408
  kasan_report+0x34/0x40
  __asan_storeN+0x15c/0x168
  memset+0x20/0x44
  __dma_alloc_coherent+0x114/0x18c

Change-Id: Ia0c4def2ec27ec56e9faf43ed1b8012381e3b253
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 67a2e213e7e937c41c52ab5bc46bf3f4de469f6e
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
[shashim@codeaurora.org: replace %p by %pK in print format]
Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
2016-12-19 22:18:43 -08:00
Linux Build Service Account f52ed13722 Merge "qcrypto: protect potential integer overflow." 2016-12-17 21:15:28 -08:00
Linux Build Service Account 58c2246dee Merge "net: add additional args validation in ping_common_sendmsg()" 2016-12-17 21:15:26 -08:00
Linux Build Service Account 65cfc9de5e Merge "msm-core: use get_user() API to read userspace data/settings" 2016-12-16 07:26:24 -08:00
Neeraj Soni 3feacd596d qcrypto: protect potential integer overflow.
Adding user passed parameters without check might
lead to Integer overflow and unpredictable system
behaviour.

Change-Id: Iaf8259e3c4a157e1790f1447b1b62a646988b7c4
Signed-off-by: Neeraj Soni <neersoni@codeaurora.org>
Signed-off-by: Yang Guang <guyang@codeaurora.org>
2016-12-16 01:45:00 -08:00
Linux Build Service Account 79d9337ba6 Merge "Revert "ecryptfs: forbid opening files without mmap handler"" 2016-12-16 01:35:18 -08:00
Linux Build Service Account ffe775def5 Merge "ecryptfs: don't allow mmap when the lower fs doesn't support it" 2016-12-16 01:35:18 -08:00
Ravi Kumar Siddojigari f0b31d0414 usb: Avoid exposing kernel addresses
Usage of %p exposes the kernel addresses, an easy target to
kernel write vulnerabilities. With this patch currently
%pK prints only Zeros as address. If you need actual address
echo 0 > /proc/sys/kernel/kptr_restrict

addressing the info leak  issue under following CVEs
CVE-2016-8401, CVE-2016-8402, CVE-2016-8403,
CVE-2016-8404, CVE-2016-8405, CVE-2016-8406,
CVE-2016-8407

Change-Id: Iefe0639416275cfeca6e90b6f88cd0412bb76414
Signed-off-by: Ravi Kumar Siddojigari <rsiddoji@codeaurora.org>
2016-12-16 00:07:44 -08:00
Ravi Kumar Siddojigari 0f1d5a7d25 net: add additional args validation in ping_common_sendmsg()
adding  validation of the len variable in ping_common_sendmsg()
to check if it is less than icmph_len which canleading to
an overflow issue.

Addressing issue reported under CVE-2016-8399.

Change-Id: I98f7b070b41312832b6a347ea1c11b9c700159a7
Signed-off-by: Ravi Kumar Siddojigari <rsiddoji@codeaurora.org>
2016-12-15 02:57:51 -08:00
Ravi Kumar Siddojigari 244f7894a3 Revert "ecryptfs: forbid opening files without mmap handler"
commit 480546c9b2b8 ("ecryptfs: forbid opening

Files without mmap handler")

It fixed a local root exploit but also introduced a dependency on
the lower file system implementing an mmap operation just to open a file,
which is a bit of a heavy hammer.  The right fix is to have mmap depend
on the existence of the mmap handler instead.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Cc: stable@vger.kernel.org
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Git-repo:https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git
Git-commit: 78c4e172412de5d0456dc00d2b34050aa0b683b5
Signed-off-by: Srinivasa Rao Kuppala <srkupp@codeaurora.org>
Change-Id: I7c11ae0215d9b3a5944bb3be73d5423a4d008fcd
2016-12-14 23:37:08 -08:00
Jeff Mahoney d70731e3b5 ecryptfs: don't allow mmap when the lower fs doesn't support it
There are legitimate reasons to disallow mmap on certain files, notably
in sysfs or procfs.  We shouldn't emulate mmap support on file systems
that don't offer support natively.

CVE-2016-1583

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Cc: stable@vger.kernel.org
[tyhicks: clean up f_op check by using ecryptfs_file_to_lower()]
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Git-repo: https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/
Git-commit: f0fe970df3838c202ef6c07a4c2b36838ef0a88b
[rsiddoji@codeaurora.org:  backport and resolved trivial confits ]
Change-Id: I6127049027975ca20a38ee4fb500478db8b3fd5e
Signed-off-by: Ravi Kumar Siddojigari <rsiddoji@codeaurora.org>
2016-12-14 23:32:03 -08:00
Mark Rutland 1cad4595ae arm64: make sys_call_table const
As with x86, mark the sys_call_table const such that it will be placed
in the .rodata section. This will cause attempts to modify the table
(accidental or deliberate) to fail when strict page permissions are in
place. In the absence of strict page permissions, there should be no
functional change.

Change-Id: I5b8fcf486c59cb1d83c117c5246eeb2447ccfb65
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Git-repo: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
Git-commit: c623b33b4e9599c6ac5076f7db7369eb9869aa04
Signed-off-by: Ravi Kumar Siddojigari <rsiddoji@codeaurora.org>
2016-12-14 23:13:46 -08:00
Linux Build Service Account 23f253841d Merge "ARM: dts: msm: Update crypto AB/IB values for msm8976/56" 2016-12-14 13:23:08 -08:00
Puja Gupta 53d063dd80 soc: qcom: pil: Initialize variable to avoid invalid access
Initialize dp_fw to NULL so that we don't try to release it in the
error path err_invalid_fw.

CRs-Fixed: 1095243
Change-Id: I18f549102e626dc788e8fa56d6bb1ea28efe4f88
Signed-off-by: Puja Gupta <pujag@codeaurora.org>
2016-12-13 22:57:04 -08:00
Linux Build Service Account 57054cd24e Merge "BACKPORT: tty: Prevent ldisc drivers from re-using stale tty fields" 2016-12-12 11:28:53 -08:00
Linux Build Service Account 89cce52dff Merge "msm: kgsl: Reserve a context ID slot but don't populate immediately" 2016-12-12 11:28:51 -08:00
Linux Build Service Account da6f691264 Merge "mmc: block: Fix issue with deferred resume when CQ is enabled" 2016-12-12 03:29:30 -08:00
Peter Hurley 5a19a524ea BACKPORT: tty: Prevent ldisc drivers from re-using stale tty fields
(cherry picked from commit dd42bf1197144ede075a9d4793123f7689e164bc)

Line discipline drivers may mistakenly misuse ldisc-related fields
when initializing. For example, a failure to initialize tty->receive_room
in the N_GIGASET_M101 line discipline was recently found and fixed [1].
Now, the N_X25 line discipline has been discovered accessing the previous
line discipline's already-freed private data [2].

Harden the ldisc interface against misuse by initializing revelant
tty fields before instancing the new line discipline.

[1]
    commit fd98e9419d8d622a4de91f76b306af6aa627aa9c
    Author: Tilman Schmidt <tilman@imap.cc>
    Date:   Tue Jul 14 00:37:13 2015 +0200

    isdn/gigaset: reset tty->receive_room when attaching ser_gigaset

[2] Report from Sasha Levin <sasha.levin@oracle.com>
    [  634.336761] ==================================================================
    [  634.338226] BUG: KASAN: use-after-free in x25_asy_open_tty+0x13d/0x490 at addr ffff8800a743efd0
    [  634.339558] Read of size 4 by task syzkaller_execu/8981
    [  634.340359] =============================================================================
    [  634.341598] BUG kmalloc-512 (Not tainted): kasan: bad access detected
    ...
    [  634.405018] Call Trace:
    [  634.405277] dump_stack (lib/dump_stack.c:52)
    [  634.405775] print_trailer (mm/slub.c:655)
    [  634.406361] object_err (mm/slub.c:662)
    [  634.406824] kasan_report_error (mm/kasan/report.c:138 mm/kasan/report.c:236)
    [  634.409581] __asan_report_load4_noabort (mm/kasan/report.c:279)
    [  634.411355] x25_asy_open_tty (drivers/net/wan/x25_asy.c:559 (discriminator 1))
    [  634.413997] tty_ldisc_open.isra.2 (drivers/tty/tty_ldisc.c:447)
    [  634.414549] tty_set_ldisc (drivers/tty/tty_ldisc.c:567)
    [  634.415057] tty_ioctl (drivers/tty/tty_io.c:2646 drivers/tty/tty_io.c:2879)
    [  634.423524] do_vfs_ioctl (fs/ioctl.c:43 fs/ioctl.c:607)
    [  634.427491] SyS_ioctl (fs/ioctl.c:622 fs/ioctl.c:613)
    [  634.427945] entry_SYSCALL_64_fastpath (arch/x86/entry/entry_64.S:188)

Cc: Tilman Schmidt <tilman@imap.cc>
Cc: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Change-Id: Ibed6feadfb9706d478f93feec3b240aecfc64af3
Bug: 30951112
Git-repo: https://android.googlesource.com/kernel/common.git
Git-commit: b307df31b38a2001c751d64deca02d4a6d1f3844
Signed-off-by: Ravi Kumar Siddojigari <rsiddoji@codeaurora.org>
2016-12-12 00:13:43 -08:00