Commit Graph

798259 Commits

Author SHA1 Message Date
Eric Biggers
e82128eb81 ANDROID: scsi: ufs: add ->map_sg_crypto() variant op
Add a variant op ->map_sg_crypto() which runs at the end of
ufshcd_map_sg().

This is needed to support inline crypto on nonstandard hardware that
enables and configures crypto in the PRD entries
(struct ufshcd_sg_entry) instead of in the UTRD
(struct utp_transfer_req_desc) which the UFS standard specifies.

Bug: 129991660
Change-Id: I92bb52d0022d2e9de79a40d9888e84db4a8116b3
Signed-off-by: Eric Biggers <ebiggers@google.com>
2020-03-24 16:53:27 -07:00
Suren Baghdasaryan
ddba2318b3 ANDROID: GKI: Update ABI after fixing vm_event_item diffs
Leaf changes summary: 5 artifacts changed
Changed leaf types summary: 5 leaf types changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

Bug: 149848888
Bug: 151963988
Test: build
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ib0111f80afc5228d4343e7b1a87124ae67b9b47d
2020-03-24 22:26:27 +00:00
Vinayak Menon
34e3bd1772 ANDROID: GKI: mm: vmstat: add pageoutclean
vmstat events currently count pgpgout, but that includes
only the writebacks, and not the reclaim of clean
pages. Add an event to count clean page evictions. This is
helpful to evaluate page thrashing cases.

Bug: 151963988
Test: build
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
(cherry picked from commit f15713432cbe85742b1ffc9db00ace1b2d6acd80)
[surenb: cherry-picked to resolve ABI diffs caused by vm_event_item enum]
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I113cfce495b5b70f0cef88c8425c7252e01291fe
2020-03-24 13:25:06 -07:00
Will McVicker
b85526df37 ANDROID: GKI: mm: add struct/enum fields for SPECULATIVE_PAGE_FAULTS
Add the necessary struct/enum attributes from the SPECULATIVE_PAGE_FAULTS
feature as padding to reduce the ABI diff between vendors and ACK. This
allows vendors to pick the SPECULATIVE_PAGE_FAULTS feature and still be
ABI compatible with ACK-4.19.

Bug: 149848888
Bug: 151963988
Test: build
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
[surenb: Squashed the following commits and kept only struct/enum changes
	396b98086496 mm: provide speculative fault infrastructure
	47e3eb155848 mm: cache some VMA fields in the vm_fault structure
	3f31f748a8ba mm: protect mm_rb tree with a rwlock
	88a78dc2863d mm: VMA sequence count
	0947fbfea499 mm: allow vmas with vm_ops to be speculatively handled ]
Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Merged-In: I1aa561649a836c753b9e52710c3bc1f6eee1dd78
Change-Id: I1aa561649a836c753b9e52710c3bc1f6eee1dd78
2020-03-24 13:24:48 -07:00
Suren Baghdasaryan
6b1424465f ANDROID: GKI: Update ABI after fixing mm diffs
Leaf changes summary: 12 artifacts changed
Changed leaf types summary: 11 leaf types changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 1 Added function
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

1 Added function:

  [A] 'function bool memblock_overlaps_memory(phys_addr_t, phys_addr_t)'

'enum node_stat_item at mmzone.h:158:1' changed:
  type size hasn't changed
  1 enumerator insertion:
    'node_stat_item::NR_UNRECLAIMABLE_PAGES' value '29'
  1 enumerator change:
    'node_stat_item::NR_VM_NODE_STAT_ITEMS' from value '29' to '30' at mmzone.h:158:1

  one impacted interface
'struct lruvec_stat at memcontrol.h:110:1' changed:
  type size changed from 1856 to 1920 (in bits)
  there are data member changes:
    type 'long int[29]' of 'lruvec_stat::count' changed:
      type name changed from 'long int[29]' to 'long int[30]'
      array type size changed from 1856 to 1920
      array type subrange 1 changed length from 29 to 30
    and size changed from 1856 to 1920 (in bits) (by +64 bits)
  1542 impacted interfaces


'struct mem_cgroup at memcontrol.h:197:1' changed:
  type size hasn't changed
  there are data member changes:
    type 'atomic_long_t[35]' of 'mem_cgroup::stat' changed:
      type name changed from 'atomic_long_t[35]' to 'atomic_long_t[36]'
      array type size changed from 2240 to 2304
      array type subrange 1 changed length from 35 to 36
    and size changed from 2240 to 2304 (in bits) (by +64 bits)
    'atomic_long_t mem_cgroup::events[53]' offset changed from 12480 to 12544 (in bits) (by +64 bits)
    'atomic_long_t mem_cgroup::memory_events[7]' offset changed from 15872 to 15936 (in bits) (by +64 bits)
    'unsigned long int mem_cgroup::socket_pressure' offset changed from 16320 to 16384 (in bits) (by +64 bits)
    'bool mem_cgroup::tcpmem_active' offset changed from 16384 to 16448 (in bits) (by +64 bits)
    'int mem_cgroup::tcpmem_pressure' offset changed from 16416 to 16480 (in bits) (by +64 bits)
    'int mem_cgroup::kmemcg_id' offset changed from 16448 to 16512 (in bits) (by +64 bits)
    'memcg_kmem_state mem_cgroup::kmem_state' offset changed from 16480 to 16544 (in bits) (by +64 bits)
    'list_head mem_cgroup::kmem_caches' offset changed from 16512 to 16576 (in bits) (by +64 bits)
    'int mem_cgroup::last_scanned_node' offset changed from 16640 to 16704 (in bits) (by +64 bits)
    'list_head mem_cgroup::cgwb_list' offset changed from 16704 to 16768 (in bits) (by +64 bits)
    'wb_domain mem_cgroup::cgwb_domain' offset changed from 16832 to 16896 (in bits) (by +64 bits)
    'list_head mem_cgroup::event_list' offset changed from 17792 to 17856 (in bits) (by +64 bits)
    'spinlock_t mem_cgroup::event_list_lock' offset changed from 17920 to 17984 (in bits) (by +64 bits)
    'mem_cgroup_per_node* mem_cgroup::nodeinfo[]' offset changed from 17984 to 18048 (in bits) (by +64 bits)
  1542 impacted interfaces


'struct mem_cgroup_per_node at memcontrol.h:126:1' changed:
  type size changed from 5760 to 5824 (in bits)
  there are data member changes:
    type 'atomic_long_t[29]' of 'mem_cgroup_per_node::lruvec_stat' changed:
      type name changed from 'atomic_long_t[29]' to 'atomic_long_t[30]'
      array type size changed from 1856 to 1920
      array type subrange 1 changed length from 29 to 30
    and size changed from 1856 to 1920 (in bits) (by +64 bits)
    'unsigned long int mem_cgroup_per_node::lru_zone_size[2][5]' offset changed from 3008 to 3072 (in bits) (by +64 bits)
    'mem_cgroup_reclaim_iter mem_cgroup_per_node::iter[13]' offset changed from 3648 to 3712 (in bits) (by +64 bits)
    'memcg_shrinker_map* mem_cgroup_per_node::shrinker_map' offset changed from 5312 to 5376 (in bits) (by +64 bits)
    'rb_node mem_cgroup_per_node::tree_node' offset changed from 5376 to 5440 (in bits) (by +64 bits)
    'unsigned long int mem_cgroup_per_node::usage_in_excess' offset changed from 5568 to 5632 (in bits) (by +64 bits)
    'bool mem_cgroup_per_node::on_tree' offset changed from 5632 to 5696 (in bits) (by +64 bits)
    'bool mem_cgroup_per_node::congested' offset changed from 5640 to 5704 (in bits) (by +64 bits)
    'mem_cgroup* mem_cgroup_per_node::memcg' offset changed from 5696 to 5760 (in bits) (by +64 bits)
  1542 impacted interfaces


'struct mem_cgroup_stat_cpu at memcontrol.h:97:1' changed:
  type size changed from 5888 to 5952 (in bits)
  there are data member changes:
    type 'long int[35]' of 'mem_cgroup_stat_cpu::count' changed:
      type name changed from 'long int[35]' to 'long int[36]'
      array type size changed from 2240 to 2304
      array type subrange 1 changed length from 35 to 36
    and size changed from 2240 to 2304 (in bits) (by +64 bits)
    'unsigned long int mem_cgroup_stat_cpu::events[53]' offset changed from 2240 to 2304 (in bits) (by +64 bits)
    'unsigned long int mem_cgroup_stat_cpu::nr_page_events' offset changed from 5632 to 5696 (in bits) (by +64 bits)
    'unsigned long int mem_cgroup_stat_cpu::targets[3]' offset changed from 5696 to 5760 (in bits) (by +64 bits)
  1542 impacted interfaces


'struct net at net_namespace.h:51:1' changed:
  type size changed from 41472 to 44032 (in bits)
  1 data member insertion:
    'netns_sctp net::sctp', at offset 23040 (in bits) at net_namespace.h:116:1
  there are data member changes:
    type 'struct netns_nf' of 'net::nf' changed:
      type size changed from 1920 to 2240 (in bits)
      1 data member insertion:
        'nf_hook_entries* netns_nf::hooks_bridge[5]', at offset 1856 (in bits) at netfilter.h:25:1
      there are data member changes:
        'bool netns_nf::defrag_ipv4' offset changed from 1856 to 2176 (in bits) (by +320 bits)
        'bool netns_nf::defrag_ipv6' offset changed from 1864 to 2184 (in bits) (by +320 bits)
      229 impacted interfaces
    type 'struct netns_xt' of 'net::xt' changed:
      type size changed from 1728 to 1920 (in bits)
      3 data member insertions:
        'ebt_table* netns_xt::broute_table', at offset 1728 (in bits) at x_tables.h:14:1
        'ebt_table* netns_xt::frame_filter', at offset 1792 (in bits) at x_tables.h:15:1
        'ebt_table* netns_xt::frame_nat', at offset 1856 (in bits) at x_tables.h:16:1
      229 impacted interfaces
    'netns_ct net::ct' offset changed from 26688 to 29248 (in bits) (by +2560 bits)
    'netns_nf_frag net::nf_frag' offset changed from 31232 to 33792 (in bits) (by +2560 bits)
    'ctl_table_header* net::nf_frag_frags_hdr' offset changed from 33792 to 36352 (in bits) (by +2560 bits)
    'sock* net::nfnl' offset changed from 33856 to 36416 (in bits) (by +2560 bits)
    'sock* net::nfnl_stash' offset changed from 33920 to 36480 (in bits) (by +2560 bits)
    'sk_buff_head net::wext_nlevents' offset changed from 33984 to 36544 (in bits) (by +2560 bits)
    'net_generic* net::gen' offset changed from 34176 to 36736 (in bits) (by +2560 bits)
    'netns_xfrm net::xfrm' offset changed from 34304 to 36864 (in bits) (by +2560 bits)
    'sock* net::diag_nlsk' offset changed from 40960 to 43520 (in bits) (by +2560 bits)
    'atomic_t net::fnhe_genid' offset changed from 41024 to 43584 (in bits) (by +2560 bits)
  229 impacted interfaces


'struct netns_nf at netfilter.h:11:1' changed:
  details were reported earlier



'struct netns_xt at x_tables.h:10:1' changed:
  details were reported earlier



'struct per_cpu_nodestat at mmzone.h:302:1' changed:
  type size changed from 240 to 248 (in bits)
  there are data member changes:
    type 's8[29]' of 'per_cpu_nodestat::vm_node_stat_diff' changed:
      type name changed from 's8[29]' to 's8[30]'
      array type size changed from 232 to 240
      array type subrange 1 changed length from 29 to 30
    and size changed from 232 to 240 (in bits) (by +8 bits)
  1542 impacted interfaces


'struct pglist_data at mmzone.h:638:1' changed:
  type size hasn't changed
  there are data member changes:
    type 'atomic_long_t[29]' of 'pglist_data::vm_stat' changed:
      type name changed from 'atomic_long_t[29]' to 'atomic_long_t[30]'
      array type size changed from 1856 to 1920
      array type subrange 1 changed length from 29 to 30
    and size changed from 1856 to 1920 (in bits) (by +64 bits)
  1542 impacted interfaces


'struct swap_info_struct at swap.h:231:1' changed:
  type size changed from 2048 to 2112 (in bits)
  2 data member insertions:
    'unsigned int swap_info_struct::write_pending', at offset 2048 (in bits) at swap.h:275:1
    'unsigned int swap_info_struct::max_writes', at offset 2080 (in bits) at swap.h:276:1
  there are data member changes:
    'plist_node swap_info_struct::avail_lists[]' offset changed from 2048 to 2112 (in bits) (by +64 bits)
  1542 impacted interfaces

Test: build
Bug: 151955270
Bug: 150875716
Bug: 151115806
Bug: 150808082
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I6780cf403632d8af7a21a5e0876a11adcba61ca6
2020-03-23 17:30:04 -07:00
Suren Baghdasaryan
a61a29a613 ANDROID: GKI: Add write_pending and max_writes fields to swap_info_struct
This is required to resolve ABI diff in swap_info_struct struct.

Bug: 151955270
Test: build and boot without original sysfs files
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
[swatsrid@codeaurora.org: Fix trivial merge conflicts]
Signed-off-by: Swathi Sridhar <swatsrid@codeaurora.org>
(cherry picked from commit ac4b2c42c81b39bc5602b8201d0e998b455391e7)
[surenb: commit amended to include only swap_info_struct changes]
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Idd145757b12821030bb371b494a41d316ff56d0c
2020-03-23 17:13:57 -07:00
Stephen Boyd
fe48ed944b ANDROID: GKI: memblock: Add memblock_overlaps_memory() to fix ABI diff
This is needed to reduce the ABI diff for vendors.
Add a new function, memblock_overlaps_memory(), to check if a
region overlaps with a memory bank. This will be used by
peripheral loader code to detect when kernel memory would be
overwritten.

Signed-off-by: Swathi Sridhar <swatsrid@codeaurora.org>
(cherry picked from commit bbbc80b6d8b75ffea6a0eb1f53ab503ccf0011f1)
[surenb: cherry-picked parts from:
bbbc80b6d8b75 "ion : Merge ion changes..."
to fix ABI diff caused by memblock_overlaps_memory function]
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Bug: 150875716
Test: build
Change-Id: I6ee723c99ef171f23a621d130eded843222ba4f7
2020-03-23 17:13:29 -07:00
Suren Baghdasaryan
f32f289c4f ANDROID: GKI: net: remove conditional members causing ABI diffs
Remove conditions for including struct net members based on kernel configs
CONFIG_IP_SCTP, CONFIG_NETFILTER_FAMILY_BRIDGE and
CONFIG_BRIDGE_NF_EBTABLES.

Bug: 151115806
Test: build
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I6b0e75f0976ab79ea933fe64bc73ba08c9e7c71a
2020-03-23 17:13:05 -07:00
Vijayanand Jitta
c9b2421c4c ANDROID: GKI: mm: introduce NR_UNRECLAIMABLE_PAGES
Introduce NR_UNRECLAIMABLE_PAGES memory counter which accounts
the pages that cannot be reclaimed under memory pressure.

Signed-off-by: Vijayanand Jitta <vjitta@codeaurora.org>
(cherry picked from commit 66db0cfc656f2616cd4c477295ca28f812c98a68)
[surenb: cherry-picked from:
66db0cfc656f "mm: introduce NR_UNRECLAIMABLE_PAGES" to resolve
ABI diff for per_cpu_nodestat struct]

Bug: 150808082
Test: build
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I8c99dcec04df3c9ead4ea0eebd11c193af9fbc75
2020-03-23 17:11:57 -07:00
Hridya Valsaraju
037cc8ca5c ANDROID: GKI: Update ABI
Changed leaf types summary: 8 leaf types changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 6 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

6 Added functions:

  [A] 'function int extcon_register_blocking_notifier(extcon_dev*, unsigned int, notifier_block*)'
  [A] 'function ktime_t* get_next_event_cpu(unsigned int)'
  [A] 'function int snd_pcm_add_usr_ctls(snd_pcm*, int, const snd_pcm_usr_elem*, int, int, unsigned long int, snd_pcm_usr**)'
  [A] 'function int snd_pcm_add_volume_ctls(snd_pcm*, int, const snd_pcm_volume_elem*, int, unsigned long int, snd_pcm_volume**)'
  [A] 'function void snd_soc_card_change_online_state(snd_soc_card*, int)'
  [A] 'function int snd_soc_info_multi_ext(snd_kcontrol*, snd_ctl_elem_info*)'

'struct extcon_dev at extcon.h:41:1' changed:
  type size changed from 7744 to 7808 (in bits)
  1 data member insertion:
    'blocking_notifier_head* extcon_dev::bnh', at offset 6592 (in bits) at extcon.h:51:1
  there are data member changes:
    'list_head extcon_dev::entry' offset changed from 6592 to 6656 (in bits) (by +64 bits)
    'int extcon_dev::max_supported' offset changed from 6720 to 6784 (in bits) (by +64 bits)
    'spinlock_t extcon_dev::lock' offset changed from 6752 to 6816 (in bits) (by +64 bits)
    'u32 extcon_dev::state' offset changed from 6784 to 6848 (in bits) (by +64 bits)
    'device_type extcon_dev::extcon_dev_type' offset changed from 6848 to 6912 (in bits) (by +64 bits)
    'extcon_cable* extcon_dev::cables' offset changed from 7232 to 7296 (in bits) (by +64 bits)
    'attribute_group extcon_dev::attr_g_muex' offset changed from 7296 to 7360 (in bits) (by +64 bits)
    'attribute** extcon_dev::attrs_muex' offset changed from 7616 to 7680 (in bits) (by +64 bits)
    'device_attribute* extcon_dev::d_attrs_muex' offset changed from 7680 to 7744 (in bits) (by +64 bits)
  13 impacted interfaces

'struct snd_card at core.h:94:1' changed:
  type size changed from 18112 to 18432 (in bits)
  3 data member insertions:
    'int snd_card::offline', at offset 17856 (in bits) at core.h:137:1
    'unsigned long int snd_card::offline_change', at offset 17920 (in bits) at core.h:138:1
    'wait_queue_head_t snd_card::offline_poll_wait', at offset 17984 (in bits) at core.h:139:1
  there are data member changes:
    'unsigned int snd_card::power_state' offset changed from 17856 to 18176 (in bits) (by +320 bits)
    'wait_queue_head_t snd_card::power_sleep' offset changed from 17920 to 18240 (in bits) (by +320 bits)
  72 impacted interfaces
    function int _snd_pcm_lib_alloc_vmalloc_buffer(snd_pcm_substream*, unsigned long int, unsigned int)
    function int devm_snd_soc_register_card(device*, snd_soc_card*)
    function int devm_snd_soc_register_component(device*, const snd_soc_component_driver*, snd_soc_dai_driver*, int)
    function int snd_card_disconnect(snd_card*)
    function int snd_card_free(snd_card*)
    function int snd_card_new(device*, int, const char*, module*, int, snd_card**)
    function int snd_card_register(snd_card*)
    function int snd_component_add(snd_card*, const char*)
    function int snd_ctl_add(snd_card*, snd_kcontrol*)
    function snd_kcontrol* snd_ctl_find_id(snd_card*, snd_ctl_elem_id*)
    function void snd_ctl_notify(snd_card*, unsigned int, snd_ctl_elem_id*)
    function int snd_ctl_remove(snd_card*, snd_kcontrol*)
    function int snd_ctl_remove_id(snd_card*, snd_ctl_elem_id*)
    function int snd_device_new(snd_card*, snd_device_type, void*, snd_device_ops*)
    function int snd_hwdep_new(snd_card*, char*, int, snd_hwdep**)
    function snd_info_entry* snd_info_create_card_entry(snd_card*, const char*, snd_info_entry*)
    function void snd_info_free_entry(snd_info_entry*)
    function int snd_info_register(snd_info_entry*)
    function int snd_jack_set_key(snd_jack*, snd_jack_types, int)
    function int snd_pcm_add_chmap_ctls(snd_pcm*, int, const snd_pcm_chmap_elem*, int, unsigned long int, snd_pcm_chmap**)
    function int snd_pcm_hw_constraint_integer(snd_pcm_runtime*, int)
    function int snd_pcm_hw_constraint_list(snd_pcm_runtime*, unsigned int, snd_pcm_hw_param_t, const snd_pcm_hw_constraint_list*)
    function int snd_pcm_hw_constraint_minmax(snd_pcm_runtime*, int, unsigned int, unsigned int)
    function int snd_pcm_hw_constraint_msbits(snd_pcm_runtime*, unsigned int, unsigned int, unsigned int)
    function int snd_pcm_hw_constraint_step(snd_pcm_runtime*, unsigned int, snd_pcm_hw_param_t, unsigned long int)
    function int snd_pcm_hw_rule_add(snd_pcm_runtime*, unsigned int, int, void ()*, void*, int, ...)
    function int snd_pcm_lib_free_pages(snd_pcm_substream*)
    function int snd_pcm_lib_free_vmalloc_buffer(snd_pcm_substream*)
    function page* snd_pcm_lib_get_vmalloc_page(snd_pcm_substream*, unsigned long int)
    function int snd_pcm_lib_ioctl(snd_pcm_substream*, unsigned int, void*)
    function int snd_pcm_lib_malloc_pages(snd_pcm_substream*, size_t)
    function int snd_pcm_lib_preallocate_pages_for_all(snd_pcm*, int, void*, unsigned long int, unsigned long int)
    function int snd_pcm_limit_hw_rates(snd_pcm_runtime*)
    function int snd_pcm_new(snd_card*, const char*, int, int, int, snd_pcm**)
    function void snd_pcm_period_elapsed(snd_pcm_substream*)
    function void snd_pcm_set_ops(snd_pcm*, int, const snd_pcm_ops*)
    function int snd_pcm_stop(snd_pcm_substream*, int)
    function int snd_pcm_suspend_all(snd_pcm*)
    function int snd_power_wait(snd_card*, unsigned int)
    function int snd_soc_add_component_controls(snd_soc_component*, const snd_kcontrol_new*, unsigned int)
    function snd_kcontrol* snd_soc_card_get_kcontrol(snd_soc_card*, const char*)
    function int snd_soc_card_jack_new(snd_soc_card*, const char*, int, snd_soc_jack*, snd_soc_jack_pin*, unsigned int)
    function int snd_soc_component_disable_pin(snd_soc_component*, const char*)
    function int snd_soc_component_force_enable_pin(snd_soc_component*, const char*)
    function void snd_soc_component_init_regmap(snd_soc_component*, regmap*)
    function unsigned int snd_soc_component_read32(snd_soc_component*, unsigned int)
    function int snd_soc_component_set_sysclk(snd_soc_component*, int, int, unsigned int, int)
    function int snd_soc_component_update_bits(snd_soc_component*, unsigned int, unsigned int, unsigned int)

Test: build
Bug: 150893404
Bug: 150895657
Bug: 151372815
Change-Id: Ie35fae42b4037722dee2ce7c29716fdd15b88d58
Signed-off-by: Hridya Valsaraju <hridya@google.com>
Signed-off-by: Sandeep Patil <sspatil@google.com>
2020-03-23 12:21:05 -07:00
Hridya Valsaraju
2d0b8e026d ANDROID: GKI: sound: soc: Resolve ABI diff for struct snd_compr_stream
Also resolves ABI diff for struct snd_soc_dai_link.
Also adds a new member to struct snd_soc_pcm_runtime to reduce ABI diff.

Test: build
Bug: 151372815
Signed-off-by: Walter Yang <yandongy@codeaurora.org>
Signed-off-by: Fred Oh <fred@codeaurora.org>
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Meng Wang <mwang@codeaurora.org>
Change-Id: I2b523cff2dba1ac45209cf5acb5331e2ed5267e9
(cherry picked from commit 11323a0833b7900dddd2471b9cc39ab3aa350e03)
[hridya: amended to only include ABI diff]
Signed-off-by: Hridya Valsaraju <hridya@google.com>
2020-03-23 12:21:04 -07:00
Hridya Valsaraju
0d9deda221 ANDROID: GKI: sound: pcm: Add field hw_no_buffer to snd_pcm_substream
This is required to resolve ABI diff.

Test: build
Bug: 151372815
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Patrick Lai <plai@codeaurora.org>
Git-commit: efea68f4f76c7d921201bbb1410a370dfd5ce83c
Git-repo: https://source.codeaurora.org/quic/la/kernel/msm/log/?h=msm-2.6.38
[bgoswami@codeaurora.org: Fix checkpatch errors
 for line over 80 characters in commit text.]
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Meng Wang <mwang@codeaurora.org>
Change-Id: I4e16ea255a81643902b23d4f3e7b984ed2cbe9a0
(cherry picked from commit 563a50719ce95deacba1d04f56eaac1258c0281e)
[hridya: commit amended to only include ABI diff]
Signed-off-by: Hridya Valsaraju <hridya@google.com>
2020-03-23 12:21:04 -07:00
Hridya Valsaraju
ca69a0e600 ANDROID: GKI: ALSA: core: Add snd_soc_card_change_online_state() API
Add the snd_soc_card_change_online_state() API to
reduce ABI diff. Also adds a few missing members to
struct snd_card.

Test: build
Bug: 151372815
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: Meng Wang <mwang@codeaurora.org>
Change-Id: Iee4991496138446d88bde5abc827bfd2a4a34074
(cherry picked from commit 473195feada1028a3d7cfc923120c13662a5b90c)
[hridya: amended commit to only include ABI diff,
changed EXPORT_SYMBOL -> EXPORT_SYMBOL_GPL]
Signed-off-by: Hridya Valsaraju <hridya@google.com>
2020-03-23 12:21:04 -07:00
Meng Wang
6a761db51f ANDROID: GKI: SoC: core: Introduce macro SOC_SINGLE_MULTI_EXT
For some of the mixer controls, client would like to register
count as a parameter. Macro adds support to specify the count.

Test: build
Bug: 151372815
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: Meng Wang <mwang@codeaurora.org>
(cherry picked from commit f6fff00067b98998228d61a8b36873a14bd75bd4)
Signed-off-by: Hridya Valsaraju <hridya@google.com>
Change-Id: I57b891ef99a03cb7b5b860e96cf2fc9916073166
2020-03-23 12:21:04 -07:00
Meng Wang
613434fe6f ANDROID: GKI: ALSA: PCM: User control API implementation
Introduced a new helper function snd_pcm_add_usr_ctls() to
create control elements representing the user control for each
PCM (sub)stream

Test: make
Bug: 151372815
Signed-off-by: Jayasena Sangaraboina <jsanga@codeaurora.org>
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: Meng Wang <mwang@codeaurora.org>
(cherry picked from commit d853455a8601a12383cc526523336ea6776b2b09)
Signed-off-by: Hridya Valsaraju <hridya@google.com>
Change-Id: I42a8931a31c5b3e3dd817013230550fdf6cd5849
2020-03-23 12:21:04 -07:00
Meng Wang
73b10269ae ANDROID: GKI: ALSA: PCM: volume API implementation
Introduced a new helper function snd_pcm_add_volume_ctls() to
create control elements representing the volume for each PCM
(sub)stream.

This patch also squashes the logic implemented by below change-

ASoC: Fix freed memory access of pcm stream kctl

Consider sound card instantiate fails due to
audrx init failure. In such case, all dais/ctls
are de-registered and freed. But as part of it,
access to unregistered ctls for pcm_chmap and similar
controls result in crash.  Ctls are freed at disconnection
but the disconnect is called only when it was registered.

Bug: 151372815
Test: build
CRs-Fixed: 1038054
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
Signed-off-by: Damir Didjusto <damird@codeaurora.org>
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: Meng Wang <mwang@codeaurora.org>
(cherry picked from commit cb09747101a64864f3d852dc31c775a7a1ed79f7)
Signed-off-by: Hridya Valsaraju <hridya@google.com>
Change-Id: I0c1f206f2e17fc1746eb83fab0e9b0ce379a5beb
2020-03-23 12:21:04 -07:00
Mahesh Sivasubramanian
db6999554d ANDROID: GKI: kernel: tick-sched: Add API to get the next wakeup for a CPU
Add get_next_event_cpu to get the next wakeup time for the CPU. This
is used by the sleep driver if it has to query the next wakeup for a
CPU other than the thread that its running on.

Test: make
Bug: 150895657
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
Change-Id: I0f0347f9648932a55cb64c630694d0a2e290b633
(cherry picked from commit e948653a6a5cb055b5ed692d52817e52f02a1bb1)
[hridya: also added an EXPORT_SYMBOL_GPL(get_next_event_cpu) to make
the symbol available to kernel modules.]
Signed-off-by: Hridya Valsaraju <hridya@google.com>
2020-03-23 12:21:04 -07:00
Mayank Rana
ea6eb0f3e5 ANDROID: GKI: extcon: Add extcon_register_blocking_notifier API.
This change adds the extcon_register_blocking_notifier
API to register blocking notifier calls
for blocking functionality using extcon framework.

Bug: 150893404
Test: make
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Change-Id: I28d56bd898beea1da1f8c315602cc404e8bc326f
(cherry picked from commit 9dce266c7ad8f075f3b7b13cbbb99e058e57d30b)
[hridya: commit modified to only include ABI diff].
Signed-off-by: Hridya Valsaraju <hridya@google.com>
2020-03-23 12:21:04 -07:00
Greg Kroah-Hartman
cb57b8b85f UPSTREAM: bpf: Explicitly memset some bpf info structures declared on the stack
Trying to initialize a structure with "= {};" will not always clean out
all padding locations in a structure. So be explicit and call memset to
initialize everything for a number of bpf information structures that
are then copied from userspace, sometimes from smaller memory locations
than the size of the structure.

Reported-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20200320162258.GA794295@kroah.com
(cherry picked from commit 269efb7fc478563a7e7b22590d8076823f4ac82a)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I52a2cab20aa310085ec104bd811ac4f2b83657b6
2020-03-23 16:40:45 +01:00
Greg Kroah-Hartman
de2b205fa7 UPSTREAM: bpf: Explicitly memset the bpf_attr structure
For the bpf syscall, we are relying on the compiler to properly zero out
the bpf_attr union that we copy userspace data into. Unfortunately that
doesn't always work properly, padding and other oddities might not be
correctly zeroed, and in some tests odd things have been found when the
stack is pre-initialized to other values.

Fix this by explicitly memsetting the structure to 0 before using it.

Reported-by: Maciej Żenczykowski <maze@google.com>
Reported-by: John Stultz <john.stultz@linaro.org>
Reported-by: Alexander Potapenko <glider@google.com>
Reported-by: Alistair Delva <adelva@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://android-review.googlesource.com/c/kernel/common/+/1235490
Link: https://lore.kernel.org/bpf/20200320094813.GA421650@kroah.com
(cherry picked from commit 8096f22942)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I2dc28cd45024da5cc6861ff4a9b25fae389cc6d8
2020-03-23 16:39:13 +01:00
Sandeep Patil
fa157a9409 ANDROID: ABI: Update abi after enabling CONFIG_USB_PHY
Bug: 151969174
Test: Builds

Signed-off-by: Sandeep Patil <sspatil@google.com>
Change-Id: I85615b4e1c250ec6397917a484fc7710660597c2
2020-03-21 18:11:24 +00:00
Sandeep Patil
5ea2cc2db6 ANDROID: GKI: Enable CONFIG_USB_PHY for usb drivers like dwc3
The configuration is only selected by other drivers, so add it in
the list of hidden gki configurations. USB_PHY also autoselects
CONFIG_EXTCON, so EXTCON now disappears from gki_defconfig

Bug: 151969174
Test: Builds

Signed-off-by: Sandeep Patil <sspatil@google.com>
Change-Id: I0cc55d2f06fcb5a46daf0578629e1f0a653ac48b
2020-03-21 18:11:11 +00:00
Saravana Kannan
6bda934421 UPSTREAM: driver core: Add device link support for SYNC_STATE_ONLY flag
Parent devices might need to create "proxy" device links from themselves
to supplier devices to make sure the supplier devices don't get a
sync_state() before the child consumer devices get a chance to add
device links to the supplier devices.

However, the parent device has no real dependency on the supplier device
and probing, suspend/resume or runtime PM don't need to be affected by
the supplier device.  To capture these cases, create a SYNC_STATE_ONLY
device link flag that only affects sync_state() behavior and doesn't
affect probing, suspend/resume or runtime PM.

Signed-off-by: Saravana Kannan <saravanak@google.com>
Link: https://lore.kernel.org/r/20191028220027.251605-2-saravanak@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 05ef983e0d)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I4034d50f34f199feebed40f3a055d7aa4bd31e2c
2020-03-21 09:54:56 +01:00
Saravana Kannan
dfaca803ef ANDROID: Conflict fix for merging 4.19.112
This fixes the merge issue with 515db266a9 ("driver core: Remove
device link creation limitation")

Change-Id: I848f7ad9ee63aaef74c78488ffd57a751f28a795
Cc: Saravana Kannan <saravanak@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2020-03-21 09:52:25 +01:00
Greg Kroah-Hartman
417d28a44d Merge 4.19.112 into android-4.19
Changes in 4.19.112
	perf/amd/uncore: Replace manual sampling check with CAP_NO_INTERRUPT flag
	mmc: sdhci-omap: Add platform specific reset callback
	mmc: sdhci-omap: Workaround errata regarding SDR104/HS200 tuning failures (i929)
	mmc: host: Fix Kconfig warnings on keystone_defconfig
	ACPI: watchdog: Allow disabling WDAT at boot
	HID: apple: Add support for recent firmware on Magic Keyboards
	HID: i2c-hid: add Trekstor Surfbook E11B to descriptor override
	cfg80211: check reg_rule for NULL in handle_channel_custom()
	scsi: libfc: free response frame from GPN_ID
	net: usb: qmi_wwan: restore mtu min/max values after raw_ip switch
	net: ks8851-ml: Fix IRQ handling and locking
	mac80211: rx: avoid RCU list traversal under mutex
	signal: avoid double atomic counter increments for user accounting
	slip: not call free_netdev before rtnl_unlock in slip_open
	hinic: fix a irq affinity bug
	hinic: fix a bug of setting hw_ioctxt
	net: rmnet: fix NULL pointer dereference in rmnet_newlink()
	net: rmnet: fix NULL pointer dereference in rmnet_changelink()
	net: rmnet: fix suspicious RCU usage
	net: rmnet: remove rcu_read_lock in rmnet_force_unassociate_device()
	net: rmnet: do not allow to change mux id if mux id is duplicated
	net: rmnet: use upper/lower device infrastructure
	net: rmnet: fix bridge mode bugs
	net: rmnet: fix packet forwarding in rmnet bridge mode
	sfc: fix timestamp reconstruction at 16-bit rollover points
	jbd2: fix data races at struct journal_head
	wimax: i2400: fix memory leak
	wimax: i2400: Fix memory leak in i2400m_op_rfkill_sw_toggle
	mmc: sdhci-omap: Don't finish_mrq() on a command error during tuning
	mmc: sdhci-omap: Fix Tuning procedure for temperatures < -20C
	driver core: Remove the link if there is no driver with AUTO flag
	driver core: Fix adding device links to probing suppliers
	driver core: Make driver core own stateful device links
	driver core: Add device link flag DL_FLAG_AUTOPROBE_CONSUMER
	driver core: Remove device link creation limitation
	driver core: Fix creation of device links with PM-runtime flags
	net: qrtr: fix len of skb_put_padto in qrtr_node_enqueue
	ARM: 8957/1: VDSO: Match ARMv8 timer in cntvct_functional()
	ARM: 8958/1: rename missed uaccess .fixup section
	mm: slub: add missing TID bump in kmem_cache_alloc_bulk()
	HID: google: add moonball USB id
	efi: Fix debugobjects warning on 'efi_rts_work'
	ipv4: ensure rcu_read_lock() in cipso_v4_error()
	Linux 4.19.112

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I68bb3ea9d74f698994a1b958d112827a0873a0f7
2020-03-21 08:37:27 +01:00
Saravana Kannan
cbec6a3c0d Revert "ANDROID: driver core: Add device link support for SYNC_STATE_ONLY flag"
This reverts commit 6b3cf9491b.

Change-Id: I39125ddfff9397a7d86d81c6e66597501dc66718
Cc: Saravana Kannan <saravanak@google.com>
Signed-off-by: Saravana Kannan <saravanak@google.com>
2020-03-21 08:36:52 +01:00
Mark Salyzyn
6a8f31853d ANDROID: update the ABI xml representation
added vb2_* functions

Leaf changes summary: 23 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 23 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable

23 Added functions:

  [A] 'function void vb2_buffer_done(vb2_buffer*, vb2_buffer_state)'
  [A] 'function int vb2_dqbuf(vb2_queue*, v4l2_buffer*, bool)'
  [A] 'function int vb2_fop_mmap(file*, vm_area_struct*)'
  [A] 'function __poll_t vb2_fop_poll(file*, poll_table*)'
  [A] 'function ssize_t vb2_fop_read(file*, char*, size_t, loff_t*)'
  [A] 'function int vb2_fop_release(file*)'
  [A] 'function int vb2_ioctl_create_bufs(file*, void*, v4l2_create_buffers*)'
  [A] 'function int vb2_ioctl_dqbuf(file*, void*, v4l2_buffer*)'
  [A] 'function int vb2_ioctl_expbuf(file*, void*, v4l2_exportbuffer*)'
  [A] 'function int vb2_ioctl_qbuf(file*, void*, v4l2_buffer*)'
  [A] 'function int vb2_ioctl_querybuf(file*, void*, v4l2_buffer*)'
  [A] 'function int vb2_ioctl_reqbufs(file*, void*, v4l2_requestbuffers*)'
  [A] 'function int vb2_ioctl_streamoff(file*, void*, v4l2_buf_type)'
  [A] 'function int vb2_ioctl_streamon(file*, void*, v4l2_buf_type)'
  [A] 'function void vb2_ops_wait_finish(vb2_queue*)'
  [A] 'function void vb2_ops_wait_prepare(vb2_queue*)'
  [A] 'function void* vb2_plane_vaddr(vb2_buffer*, unsigned int)'
  [A] 'function int vb2_qbuf(vb2_queue*, v4l2_buffer*)'
  [A] 'function int vb2_queue_init(vb2_queue*)'
  [A] 'function void vb2_queue_release(vb2_queue*)'
  [A] 'function int vb2_reqbufs(vb2_queue*, v4l2_requestbuffers*)'
  [A] 'function int vb2_streamoff(vb2_queue*, v4l2_buf_type)'
  [A] 'function int vb2_streamon(vb2_queue*, v4l2_buf_type)'

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 151246806
Test: abi check, confirm the various vb2_* functions are now available
Change-Id: Icb568b372c3bb0bd7f71b96f98fb3ae3e417b39d
2020-03-20 11:54:49 -07:00
Mark Salyzyn
86ff68c90a ANDROID: GKI: Enable V4L2 hidden configs
V4L2 is disabled by default, enable common features.

23 Added functions:

  void vb2_buffer_done(vb2_buffer*, vb2_buffer_state)
  int vb2_dqbuf(vb2_queue*, v4l2_buffer*, bool)
  int vb2_fop_mmap(file*, vm_area_struct*)
  __poll_t vb2_fop_poll(file*, poll_table*)
  ssize_t vb2_fop_read(file*, char*, size_t, loff_t*)
  int vb2_fop_release(file*)
  int vb2_ioctl_create_bufs(file*, void*, v4l2_create_buffers*)
  int vb2_ioctl_dqbuf(file*, void*, v4l2_buffer*)
  int vb2_ioctl_expbuf(file*, void*, v4l2_exportbuffer*)
  int vb2_ioctl_qbuf(file*, void*, v4l2_buffer*)
  int vb2_ioctl_querybuf(file*, void*, v4l2_buffer*)
  int vb2_ioctl_reqbufs(file*, void*, v4l2_requestbuffers*)
  int vb2_ioctl_streamoff(file*, void*, v4l2_buf_type)
  int vb2_ioctl_streamon(file*, void*, v4l2_buf_type)
  void vb2_ops_wait_finish(vb2_queue*)
  void vb2_ops_wait_prepare(vb2_queue*)
  void* vb2_plane_vaddr(vb2_buffer*, unsigned int)
  int vb2_qbuf(vb2_queue*, v4l2_buffer*)
  int vb2_queue_init(vb2_queue*)
  void vb2_queue_release(vb2_queue*)
  int vb2_reqbufs(vb2_queue*, v4l2_requestbuffers*)
  int vb2_streamoff(vb2_queue*, v4l2_buf_type)
  int vb2_streamon(vb2_queue*, v4l2_buf_type)

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 151246806
Test: abi check, confirm the various vb2_* functions are now available
Change-Id: I6e20c12c645fd45801b24f922c66508b667ea371
2020-03-20 11:54:29 -07:00
Greg Kroah-Hartman
14cfdbd39e Linux 4.19.112 2020-03-20 11:56:00 +01:00
Matteo Croce
b4176d3b1a ipv4: ensure rcu_read_lock() in cipso_v4_error()
commit 3e72dfdf82 upstream.

Similarly to commit c543cb4a5f ("ipv4: ensure rcu_read_lock() in
ipv4_link_failure()"), __ip_options_compile() must be called under rcu
protection.

Fixes: 3da1ed7ac3 ("net: avoid use IPCB in cipso_v4_error")
Suggested-by: Guillaume Nault <gnault@redhat.com>
Signed-off-by: Matteo Croce <mcroce@redhat.com>
Acked-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-20 11:56:00 +01:00
Waiman Long
a44324b0bd efi: Fix debugobjects warning on 'efi_rts_work'
commit ef1491e791 upstream.

The following commit:

  9dbbedaa61 ("efi: Make efi_rts_work accessible to efi page fault handler")

converted 'efi_rts_work' from an auto variable to a global variable.
However, when submitting the work, INIT_WORK_ONSTACK() was still used,
causing the following complaint from debugobjects:

  ODEBUG: object 00000000ed27b500 is NOT on stack 00000000c7d38760, but annotated.

Change the macro to just INIT_WORK() to eliminate the warning.

Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Fixes: 9dbbedaa61 ("efi: Make efi_rts_work accessible to efi page fault handler")
Link: http://lkml.kernel.org/r/20181114175544.12860-2-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-20 11:56:00 +01:00
Chen-Tsung Hsieh
705d1b54a7 HID: google: add moonball USB id
commit 58322a1590 upstream.

Add 1 additional hammer-like device.

Signed-off-by: Chen-Tsung Hsieh <chentsung@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-20 11:55:59 +01:00
Jann Horn
30f6cae722 mm: slub: add missing TID bump in kmem_cache_alloc_bulk()
commit fd4d9c7d0c upstream.

When kmem_cache_alloc_bulk() attempts to allocate N objects from a percpu
freelist of length M, and N > M > 0, it will first remove the M elements
from the percpu freelist, then call ___slab_alloc() to allocate the next
element and repopulate the percpu freelist. ___slab_alloc() can re-enable
IRQs via allocate_slab(), so the TID must be bumped before ___slab_alloc()
to properly commit the freelist head change.

Fix it by unconditionally bumping c->tid when entering the slowpath.

Cc: stable@vger.kernel.org
Fixes: ebe909e0fd ("slub: improve bulk alloc strategy")
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-20 11:55:59 +01:00
Kees Cook
c1a9559a24 ARM: 8958/1: rename missed uaccess .fixup section
commit f87b1c49bc upstream.

When the uaccess .fixup section was renamed to .text.fixup, one case was
missed. Under ld.bfd, the orphaned section was moved close to .text
(since they share the "ax" bits), so things would work normally on
uaccess faults. Under ld.lld, the orphaned section was placed outside
the .text section, making it unreachable.

Link: https://github.com/ClangBuiltLinux/linux/issues/282
Link: https://bugs.chromium.org/p/chromium/issues/detail?id=1020633#c44
Link: https://lore.kernel.org/r/nycvar.YSQ.7.76.1912032147340.17114@knanqh.ubzr
Link: https://lore.kernel.org/lkml/202002071754.F5F073F1D@keescook/

Fixes: c4a84ae39b ("ARM: 8322/1: keep .text and .fixup regions closer together")
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-20 11:55:59 +01:00
Florian Fainelli
8cf58ea4ab ARM: 8957/1: VDSO: Match ARMv8 timer in cntvct_functional()
commit 45939ce292 upstream.

It is possible for a system with an ARMv8 timer to run a 32-bit kernel.
When this happens we will unconditionally have the vDSO code remove the
__vdso_gettimeofday and __vdso_clock_gettime symbols because
cntvct_functional() returns false since it does not match that
compatibility string.

Fixes: ecf99a4391 ("ARM: 8331/1: VDSO initialization, mapping, and synchronization")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-20 11:55:59 +01:00
Carl Huang
bc97a345d9 net: qrtr: fix len of skb_put_padto in qrtr_node_enqueue
commit ce57785bf9 upstream.

The len used for skb_put_padto is wrong, it need to add len of hdr.

In qrtr_node_enqueue, local variable size_t len is assign with
skb->len, then skb_push(skb, sizeof(*hdr)) will add skb->len with
sizeof(*hdr), so local variable size_t len is not same with skb->len
after skb_push(skb, sizeof(*hdr)).

Then the purpose of skb_put_padto(skb, ALIGN(len, 4)) is to add add
pad to the end of the skb's data if skb->len is not aligned to 4, but
unfortunately it use len instead of skb->len, at this line, skb->len
is 32 bytes(sizeof(*hdr)) more than len, for example, len is 3 bytes,
then skb->len is 35 bytes(3 + 32), and ALIGN(len, 4) is 4 bytes, so
__skb_put_padto will do nothing after check size(35) < len(4), the
correct value should be 36(sizeof(*hdr) + ALIGN(len, 4) = 32 + 4),
then __skb_put_padto will pass check size(35) < len(36) and add 1 byte
to the end of skb's data, then logic is correct.

function of skb_push:
void *skb_push(struct sk_buff *skb, unsigned int len)
{
	skb->data -= len;
	skb->len  += len;
	if (unlikely(skb->data < skb->head))
		skb_under_panic(skb, len, __builtin_return_address(0));
	return skb->data;
}

function of skb_put_padto
static inline int skb_put_padto(struct sk_buff *skb, unsigned int len)
{
	return __skb_put_padto(skb, len, true);
}

function of __skb_put_padto
static inline int __skb_put_padto(struct sk_buff *skb, unsigned int len,
				  bool free_on_error)
{
	unsigned int size = skb->len;

	if (unlikely(size < len)) {
		len -= size;
		if (__skb_pad(skb, len, free_on_error))
			return -ENOMEM;
		__skb_put(skb, len);
	}
	return 0;
}

Signed-off-by: Carl Huang <cjhuang@codeaurora.org>
Signed-off-by: Wen Gong <wgong@codeaurora.org>
Cc: Doug Anderson <dianders@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-20 11:55:59 +01:00
Rafael J. Wysocki
cda3bca05e driver core: Fix creation of device links with PM-runtime flags
commit fb583c8eee upstream.

After commit 515db266a9 ("driver core: Remove device link creation
limitation"), if PM-runtime flags are passed to device_link_add(), it
will fail (returning NULL) due to an overly restrictive flags check
introduced by that commit.

Fix this issue by extending the check in question to cover the
PM-runtime flags too.

Fixes: 515db266a9 ("driver core: Remove device link creation limitation")
Reported-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/7674989.cD04D8YV3U@kreacher
Signed-off-by: Saravana Kannan <saravanak@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-20 11:55:58 +01:00
Rafael J. Wysocki
53a895ff19 driver core: Remove device link creation limitation
commit 515db266a9 upstream.

If device_link_add() is called for a consumer/supplier pair with an
existing device link between them and the existing link's type is
not in agreement with the flags passed to that function by its
caller, NULL will be returned.  That is seriously inconvenient,
because it forces the callers of device_link_add() to worry about
what others may or may not do even if that is not relevant to them
for any other reasons.

It turns out, however, that this limitation can be made go away
relatively easily.

The underlying observation is that if DL_FLAG_STATELESS has been
passed to device_link_add() in flags for the given consumer/supplier
pair at least once, calling either device_link_del() or
device_link_remove() to release the link returned by it should work,
but there are no other requirements associated with that flag.  In
turn, if at least one of the callers of device_link_add() for the
given consumer/supplier pair has not passed DL_FLAG_STATELESS to it
in flags, the driver core should track the status of the link and act
on it as appropriate (ie. the link should be treated as "managed").
This means that DL_FLAG_STATELESS needs to be set for managed device
links and it should be valid to call device_link_del() or
device_link_remove() to drop references to them in certain
sutiations.

To allow that to happen, introduce a new (internal) device link flag
called DL_FLAG_MANAGED and make device_link_add() set it automatically
whenever DL_FLAG_STATELESS is not passed to it.  Also make it take
additional references to existing device links that were previously
stateless (that is, with DL_FLAG_STATELESS set and DL_FLAG_MANAGED
unset) and will need to be managed going forward and initialize
their status (which has been DL_STATE_NONE so far).

Accordingly, when a managed device link is dropped automatically
by the driver core, make it clear DL_FLAG_MANAGED, reset the link's
status back to DL_STATE_NONE and drop the reference to it associated
with DL_FLAG_MANAGED instead of just deleting it right away (to
allow it to stay around in case it still needs to be released
explicitly by someone).

With that, since setting DL_FLAG_STATELESS doesn't mean that the
device link in question is not managed any more, replace all of the
status-tracking checks against DL_FLAG_STATELESS with analogous
checks against DL_FLAG_MANAGED and update the documentation to
reflect these changes.

While at it, make device_link_add() reject flags that it does not
recognize, including DL_FLAG_MANAGED.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Saravana Kannan <saravanak@google.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Review-by: Saravana Kannan <saravanak@google.com>
Link: https://lore.kernel.org/r/2305283.AStDPdUUnE@kreacher
Signed-off-by: Saravana Kannan <saravanak@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-20 11:55:58 +01:00
Rafael J. Wysocki
822e87b74f driver core: Add device link flag DL_FLAG_AUTOPROBE_CONSUMER
commit e7dd40105a upstream.

Add a new device link flag, DL_FLAG_AUTOPROBE_CONSUMER, to request the
driver core to probe for a consumer driver automatically after binding
a driver to the supplier device on a persistent managed device link.

As unbinding the supplier driver on a managed device link causes the
consumer driver to be detached from its device automatically, this
flag provides a complementary mechanism which is needed to address
some "composite device" use cases.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Saravana Kannan <saravanak@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-20 11:55:58 +01:00
Rafael J. Wysocki
1f5102cb6b driver core: Make driver core own stateful device links
commit 72175d4ea4 upstream.

Even though stateful device links are managed by the driver core in
principle, their creators are allowed and sometimes even expected
to drop references to them via device_link_del() or
device_link_remove(), but that doesn't really play well with the
"persistent" link concept.

If "persistent" managed device links are created from driver
probe callbacks, device_link_add() called to do that will take a
new reference on the link each time the callback runs and those
references will never be dropped, which kind of isn't nice.

This issues arises because of the link reference counting carried
out by device_link_add() for existing links, but that is only done to
avoid deleting device links that may still be necessary, which
shouldn't be a concern for managed (stateful) links.  These device
links are managed by the driver core and whoever creates one of them
will need it at least as long as until the consumer driver is detached
from its device and deleting it may be left to the driver core just
fine.

For this reason, rework device_link_add() to apply the reference
counting to stateless links only and make device_link_del() and
device_link_remove() drop references to stateless links only too.
After this change, if called to add a stateful device link for
a consumer-supplier pair for which a stateful device link is
present already, device_link_add() will return the existing link
without incrementing its reference counter.  Accordingly,
device_link_del() and device_link_remove() will WARN() and do
nothing when called to drop a reference to a stateful link.  Thus,
effectively, all stateful device links will be owned by the driver
core.

In addition, clean up the handling of the link management flags,
DL_FLAG_AUTOREMOVE_CONSUMER and DL_FLAG_AUTOREMOVE_SUPPLIER, so that
(a) they are never set at the same time and (b) if device_link_add()
is called for a consumer-supplier pair with an existing stateful link
between them, the flags of that link will be combined with the flags
passed to device_link_add() to ensure that the life time of the link
is sufficient for all of the callers of device_link_add() for the
same consumer-supplier pair.

Update the device_link_add() kerneldoc comment to reflect the
above changes.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Saravana Kannan <saravanak@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-20 11:55:58 +01:00
Rafael J. Wysocki
1c89b531db driver core: Fix adding device links to probing suppliers
commit 15cfb09416 upstream.

Currently, it is not valid to add a device link from a consumer
driver ->probe callback to a supplier that is still probing too, but
generally this is a valid use case.  For example, if the consumer has
just acquired a resource that can only be available if the supplier
is functional, adding a device link to that supplier right away
should be safe (and even desirable arguably), but device_link_add()
doesn't handle that case correctly and the initial state of the link
created by it is wrong then.

To address this problem, change the initial state of device links
added between a probing supplier and a probing consumer to
DL_STATE_CONSUMER_PROBE and update device_links_driver_bound() to
skip such links on the supplier side.

With this change, if the supplier probe completes first,
device_links_driver_bound() called for it will skip the link state
update and when it is called for the consumer, the link state will
be updated to "active".  In turn, if the consumer probe completes
first, device_links_driver_bound() called for it will change the
state of the link to "active" and when it is called for the
supplier, the link status update will be skipped.

However, in principle the supplier or consumer probe may still fail
after the link has been added, so modify device_links_no_driver() to
change device links in the "active" or "consumer probe" state to
"dormant" on the supplier side and update __device_links_no_driver()
to change the link state to "available" only if it is "consumer
probe" or "active".

Then, if the supplier probe fails first, the leftover link to the
probing consumer will become "dormant" and device_links_no_driver()
called for the consumer (when its probe fails) will clean it up.
In turn, if the consumer probe fails first, it will either drop the
link, or change its state to "available" and, in the latter case,
when device_links_no_driver() is called for the supplier, it will
update the link state to "dormant".  [If the supplier probe fails,
but the consumer probe succeeds, which should not happen as long as
the consumer driver is correct, the link still will be around, but
it will be "dormant" until the supplier is probed again.]

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Saravana Kannan <saravanak@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-20 11:55:57 +01:00
Yong Wu
b600c5a14e driver core: Remove the link if there is no driver with AUTO flag
commit 0fe6f7874d upstream.

DL_FLAG_AUTOREMOVE_CONSUMER/SUPPLIER means "Remove the link
automatically on consumer/supplier driver unbind", that means we should
remove whole the device_link when there is no this driver no matter what
the ref_count of the link is.

CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Yong Wu <yong.wu@mediatek.com>
Signed-off-by: Saravana Kannan <saravanak@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-20 11:55:57 +01:00
Faiz Abbas
6bdf6513f3 mmc: sdhci-omap: Fix Tuning procedure for temperatures < -20C
[ Upstream commit feb40824d7 ]

According to the App note[1] detailing the tuning algorithm, for
temperatures < -20C, the initial tuning value should be min(largest value
in LPW - 24, ceil(13/16 ratio of LPW)). The largest value in LPW is
(max_window + 4 * (max_len - 1)) and not (max_window + 4 * max_len) itself.
Fix this implementation.

[1] http://www.ti.com/lit/an/spraca9b/spraca9b.pdf

Fixes: 961de0a856 ("mmc: sdhci-omap: Workaround errata regarding SDR104/HS200 tuning failures (i929)")
Cc: stable@vger.kernel.org
Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-03-20 11:55:57 +01:00
Faiz Abbas
3f909e1583 mmc: sdhci-omap: Don't finish_mrq() on a command error during tuning
[ Upstream commit 5c41ea6d52 ]

commit 5b0d62108b ("mmc: sdhci-omap: Add platform specific reset
callback") skips data resets during tuning operation. Because of this,
a data error or data finish interrupt might still arrive after a command
error has been handled and the mrq ended. This ends up with a "mmc0: Got
data interrupt 0x00000002 even though no data operation was in progress"
error message.

Fix this by adding a platform specific callback for sdhci_irq. Mark the
mrq as a failure but wait for a data interrupt instead of calling
finish_mrq().

Fixes: 5b0d62108b ("mmc: sdhci-omap: Add platform specific reset
callback")
Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-03-20 11:55:57 +01:00
Navid Emamdoost
dfb827019b wimax: i2400: Fix memory leak in i2400m_op_rfkill_sw_toggle
[ Upstream commit 6f3ef5c25c ]

In the implementation of i2400m_op_rfkill_sw_toggle() the allocated
buffer for cmd should be released before returning. The
documentation for i2400m_msg_to_dev() says when it returns the buffer
can be reused. Meaning cmd should be released in either case. Move
kfree(cmd) before return to be reached by all execution paths.

Fixes: 2507e6ab7a ("wimax: i2400: fix memory leak")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-03-20 11:55:57 +01:00
Navid Emamdoost
dd5a14630d wimax: i2400: fix memory leak
[ Upstream commit 2507e6ab7a ]

In i2400m_op_rfkill_sw_toggle cmd buffer should be released along with
skb response.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-03-20 11:55:57 +01:00
Qian Cai
b0caab0e61 jbd2: fix data races at struct journal_head
[ Upstream commit 6c5d911249 ]

journal_head::b_transaction and journal_head::b_next_transaction could
be accessed concurrently as noticed by KCSAN,

 LTP: starting fsync04
 /dev/zero: Can't open blockdev
 EXT4-fs (loop0): mounting ext3 file system using the ext4 subsystem
 EXT4-fs (loop0): mounted filesystem with ordered data mode. Opts: (null)
 ==================================================================
 BUG: KCSAN: data-race in __jbd2_journal_refile_buffer [jbd2] / jbd2_write_access_granted [jbd2]

 write to 0xffff99f9b1bd0e30 of 8 bytes by task 25721 on cpu 70:
  __jbd2_journal_refile_buffer+0xdd/0x210 [jbd2]
  __jbd2_journal_refile_buffer at fs/jbd2/transaction.c:2569
  jbd2_journal_commit_transaction+0x2d15/0x3f20 [jbd2]
  (inlined by) jbd2_journal_commit_transaction at fs/jbd2/commit.c:1034
  kjournald2+0x13b/0x450 [jbd2]
  kthread+0x1cd/0x1f0
  ret_from_fork+0x27/0x50

 read to 0xffff99f9b1bd0e30 of 8 bytes by task 25724 on cpu 68:
  jbd2_write_access_granted+0x1b2/0x250 [jbd2]
  jbd2_write_access_granted at fs/jbd2/transaction.c:1155
  jbd2_journal_get_write_access+0x2c/0x60 [jbd2]
  __ext4_journal_get_write_access+0x50/0x90 [ext4]
  ext4_mb_mark_diskspace_used+0x158/0x620 [ext4]
  ext4_mb_new_blocks+0x54f/0xca0 [ext4]
  ext4_ind_map_blocks+0xc79/0x1b40 [ext4]
  ext4_map_blocks+0x3b4/0x950 [ext4]
  _ext4_get_block+0xfc/0x270 [ext4]
  ext4_get_block+0x3b/0x50 [ext4]
  __block_write_begin_int+0x22e/0xae0
  __block_write_begin+0x39/0x50
  ext4_write_begin+0x388/0xb50 [ext4]
  generic_perform_write+0x15d/0x290
  ext4_buffered_write_iter+0x11f/0x210 [ext4]
  ext4_file_write_iter+0xce/0x9e0 [ext4]
  new_sync_write+0x29c/0x3b0
  __vfs_write+0x92/0xa0
  vfs_write+0x103/0x260
  ksys_write+0x9d/0x130
  __x64_sys_write+0x4c/0x60
  do_syscall_64+0x91/0xb05
  entry_SYSCALL_64_after_hwframe+0x49/0xbe

 5 locks held by fsync04/25724:
  #0: ffff99f9911093f8 (sb_writers#13){.+.+}, at: vfs_write+0x21c/0x260
  #1: ffff99f9db4c0348 (&sb->s_type->i_mutex_key#15){+.+.}, at: ext4_buffered_write_iter+0x65/0x210 [ext4]
  #2: ffff99f5e7dfcf58 (jbd2_handle){++++}, at: start_this_handle+0x1c1/0x9d0 [jbd2]
  #3: ffff99f9db4c0168 (&ei->i_data_sem){++++}, at: ext4_map_blocks+0x176/0x950 [ext4]
  #4: ffffffff99086b40 (rcu_read_lock){....}, at: jbd2_write_access_granted+0x4e/0x250 [jbd2]
 irq event stamp: 1407125
 hardirqs last  enabled at (1407125): [<ffffffff980da9b7>] __find_get_block+0x107/0x790
 hardirqs last disabled at (1407124): [<ffffffff980da8f9>] __find_get_block+0x49/0x790
 softirqs last  enabled at (1405528): [<ffffffff98a0034c>] __do_softirq+0x34c/0x57c
 softirqs last disabled at (1405521): [<ffffffff97cc67a2>] irq_exit+0xa2/0xc0

 Reported by Kernel Concurrency Sanitizer on:
 CPU: 68 PID: 25724 Comm: fsync04 Tainted: G L 5.6.0-rc2-next-20200221+ #7
 Hardware name: HPE ProLiant DL385 Gen10/ProLiant DL385 Gen10, BIOS A40 07/10/2019

The plain reads are outside of jh->b_state_lock critical section which result
in data races. Fix them by adding pairs of READ|WRITE_ONCE().

Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Qian Cai <cai@lca.pw>
Link: https://lore.kernel.org/r/20200222043111.2227-1-cai@lca.pw
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-03-20 11:55:56 +01:00
Alex Maftei (amaftei)
04a244c8e6 sfc: fix timestamp reconstruction at 16-bit rollover points
[ Upstream commit 23797b9890 ]

We can't just use the top bits of the last sync event as they could be
off-by-one every 65,536 seconds, giving an error in reconstruction of
65,536 seconds.

This patch uses the difference in the bottom 16 bits (mod 2^16) to
calculate an offset that needs to be applied to the last sync event to
get to the current time.

Signed-off-by: Alexandru-Mihai Maftei <amaftei@solarflare.com>
Acked-by: Martin Habets <mhabets@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-03-20 11:55:56 +01:00
Taehee Yoo
5043d35d37 net: rmnet: fix packet forwarding in rmnet bridge mode
[ Upstream commit ad3cc31b59 ]

Packet forwarding is not working in rmnet bridge mode.
Because when a packet is forwarded, skb_push() for an ethernet header
is needed. But it doesn't call skb_push().
So, the ethernet header will be lost.

Test commands:
    modprobe rmnet
    ip netns add nst
    ip netns add nst2
    ip link add veth0 type veth peer name veth1
    ip link add veth2 type veth peer name veth3
    ip link set veth1 netns nst
    ip link set veth3 netns nst2

    ip link add rmnet0 link veth0 type rmnet mux_id 1
    ip link set veth2 master rmnet0
    ip link set veth0 up
    ip link set veth2 up
    ip link set rmnet0 up
    ip a a 192.168.100.1/24 dev rmnet0

    ip netns exec nst ip link set veth1 up
    ip netns exec nst ip a a 192.168.100.2/24 dev veth1
    ip netns exec nst2 ip link set veth3 up
    ip netns exec nst2 ip a a 192.168.100.3/24 dev veth3
    ip netns exec nst2 ping 192.168.100.2

Fixes: 60d58f971c ("net: qualcomm: rmnet: Implement bridge mode")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-03-20 11:55:56 +01:00
Taehee Yoo
8cf81bf8ec net: rmnet: fix bridge mode bugs
[ Upstream commit d939b6d30b ]

In order to attach a bridge interface to the rmnet interface,
"master" operation is used.
(e.g. ip link set dummy1 master rmnet0)
But, in the rmnet_add_bridge(), which is a callback of ->ndo_add_slave()
doesn't register lower interface.
So, ->ndo_del_slave() doesn't work.
There are other problems too.
1. It couldn't detect circular upper/lower interface relationship.
2. It couldn't prevent stack overflow because of too deep depth
of upper/lower interface
3. It doesn't check the number of lower interfaces.
4. Panics because of several reasons.

The root problem of these issues is actually the same.
So, in this patch, these all problems will be fixed.

Test commands:
    modprobe rmnet
    ip link add dummy0 type dummy
    ip link add rmnet0 link dummy0 type rmnet mux_id 1
    ip link add dummy1 master rmnet0 type dummy
    ip link add dummy2 master rmnet0 type dummy
    ip link del rmnet0
    ip link del dummy2
    ip link del dummy1

Splat looks like:
[   41.867595][ T1164] general protection fault, probably for non-canonical address 0xdffffc0000000101I
[   41.869993][ T1164] KASAN: null-ptr-deref in range [0x0000000000000808-0x000000000000080f]
[   41.872950][ T1164] CPU: 0 PID: 1164 Comm: ip Not tainted 5.6.0-rc1+ #447
[   41.873915][ T1164] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[   41.875161][ T1164] RIP: 0010:rmnet_unregister_bridge.isra.6+0x71/0xf0 [rmnet]
[   41.876178][ T1164] Code: 48 89 ef 48 89 c6 5b 5d e9 fc fe ff ff e8 f7 f3 ff ff 48 8d b8 08 08 00 00 48 ba 00 7
[   41.878925][ T1164] RSP: 0018:ffff8880c4d0f188 EFLAGS: 00010202
[   41.879774][ T1164] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000101
[   41.887689][ T1164] RDX: dffffc0000000000 RSI: ffffffffb8cf64f0 RDI: 0000000000000808
[   41.888727][ T1164] RBP: ffff8880c40e4000 R08: ffffed101b3c0e3c R09: 0000000000000001
[   41.889749][ T1164] R10: 0000000000000001 R11: ffffed101b3c0e3b R12: 1ffff110189a1e3c
[   41.890783][ T1164] R13: ffff8880c4d0f200 R14: ffffffffb8d56160 R15: ffff8880ccc2c000
[   41.891794][ T1164] FS:  00007f4300edc0c0(0000) GS:ffff8880d9c00000(0000) knlGS:0000000000000000
[   41.892953][ T1164] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   41.893800][ T1164] CR2: 00007f43003bc8c0 CR3: 00000000ca53e001 CR4: 00000000000606f0
[   41.894824][ T1164] Call Trace:
[   41.895274][ T1164]  ? rcu_is_watching+0x2c/0x80
[   41.895895][ T1164]  rmnet_config_notify_cb+0x1f7/0x590 [rmnet]
[   41.896687][ T1164]  ? rmnet_unregister_bridge.isra.6+0xf0/0xf0 [rmnet]
[   41.897611][ T1164]  ? rmnet_unregister_bridge.isra.6+0xf0/0xf0 [rmnet]
[   41.898508][ T1164]  ? __module_text_address+0x13/0x140
[   41.899162][ T1164]  notifier_call_chain+0x90/0x160
[   41.899814][ T1164]  rollback_registered_many+0x660/0xcf0
[   41.900544][ T1164]  ? netif_set_real_num_tx_queues+0x780/0x780
[   41.901316][ T1164]  ? __lock_acquire+0xdfe/0x3de0
[   41.901958][ T1164]  ? memset+0x1f/0x40
[   41.902468][ T1164]  ? __nla_validate_parse+0x98/0x1ab0
[   41.903166][ T1164]  unregister_netdevice_many.part.133+0x13/0x1b0
[   41.903988][ T1164]  rtnl_delete_link+0xbc/0x100
[ ... ]

Fixes: 60d58f971c ("net: qualcomm: rmnet: Implement bridge mode")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-03-20 11:55:56 +01:00