Commit graph

879,455 commits

Author SHA1 Message Date
zhaoyouyi
7dd4f5d051 ANDROID: ABI/Whitelist: update for allwinner.
Add initial ABI whitelist file for Allwinner SoC,
and updates the ABI representation accordingly.

Total of 154 functions and 2 variables were added.

Leaf changes summary: 156 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 154 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 2 Added variables

154 Added functions:

  [A] 'function void __dev_kfree_skb_irq(sk_buff*, skb_free_reason)'
  [A] 'function void __devm_release_region(device*, resource*, resource_size_t, resource_size_t)'
  [A] 'function void __hw_addr_init(netdev_hw_addr_list*)'
  [A] 'function int __hw_addr_sync(netdev_hw_addr_list*, netdev_hw_addr_list*, int)'
  [A] 'function void __hw_addr_unsync(netdev_hw_addr_list*, netdev_hw_addr_list*, int)'
  [A] 'function void __lock_page(page*)'
  [A] 'function int __media_entity_setup_link(media_link*, u32)'
  [A] 'function unsigned int __sw_hweight16(unsigned int)'
  [A] 'function void* __vmalloc(unsigned long int, gfp_t, pgprot_t)'
  [A] 'function void __wait_on_buffer(buffer_head*)'
  [A] 'function int block_is_partially_uptodate(page*, unsigned long int, unsigned long int)'
  [A] 'function int buffer_migrate_page(address_space*, page*, page*, migrate_mode)'
  [A] 'function void cfg80211_assoc_timeout(net_device*, cfg80211_bss*)'
  [A] 'function void cfg80211_auth_timeout(net_device*, const u8*)'
  [A] 'function unsigned int cfg80211_classify8021d(sk_buff*, cfg80211_qos_map*)'
  [A] 'function void cfg80211_cqm_pktloss_notify(net_device*, const u8*, u32, gfp_t)'
  [A] 'function void cfg80211_rx_assoc_resp(net_device*, cfg80211_bss*, const u8*, size_t, int, const u8*, size_t)'
  [A] 'function void cfg80211_rx_mlme_mgmt(net_device*, const u8*, size_t)'
  [A] 'function void cfg80211_sched_scan_stopped(wiphy*, u64)'
  [A] 'function void cfg80211_tx_mlme_mgmt(net_device*, const u8*, size_t)'
  [A] 'function int class_create_file_ns(class*, const class_attribute*, void*)'
  [A] 'function void class_remove_file_ns(class*, const class_attribute*, void*)'
  [A] 'function int clk_notifier_register(clk*, notifier_block*)'
  [A] 'function unsigned int crc32_be(unsigned int, const unsigned char*, unsigned long int)'
  [A] 'function void create_empty_buffers(page*, unsigned long int, unsigned long int)'
  [A] 'function int crypto_register_ahash(ahash_alg*)'
  [A] 'function int crypto_register_rng(rng_alg*)'
  [A] 'function int crypto_unregister_ahash(ahash_alg*)'
  [A] 'function void crypto_unregister_rng(rng_alg*)'
  [A] 'function dentry* d_add_ci(dentry*, inode*, qstr*)'
  [A] 'function dentry* d_obtain_alias(inode*)'
  [A] 'function int dev_pm_set_wake_irq(device*, int)'
  [A] 'function void device_remove_groups(device*, const attribute_group**)'
  [A] 'function int devm_devfreq_register_opp_notifier(device*, devfreq*)'
  [A] 'function void* devm_of_iomap(device*, device_node*, int, resource_size_t*)'
  [A] 'function int down_interruptible(semaphore*)'
  [A] 'function void dump_page(page*, const char*)'
  [A] 'function void end_buffer_read_sync(buffer_head*, int)'
  [A] 'function frame_vector* frame_vector_create(unsigned int)'
  [A] 'function void frame_vector_destroy(frame_vector*)'
  [A] 'function int frame_vector_to_pages(frame_vector*)'
  [A] 'function void frame_vector_to_pfns(frame_vector*)'
  [A] 'function unsigned long int gen_pool_best_fit(unsigned long int*, unsigned long int, unsigned long int, unsigned int, void*, gen_pool*, unsigned long int)'
  [A] 'function void gen_pool_set_algo(gen_pool*, void ()*, void*)'
  [A] 'function long long unsigned int gen_pool_virt_to_phys(gen_pool*, unsigned long int)'
  [A] 'function int generic_error_remove_page(address_space*, page*)'
  [A] 'function int generic_file_open(inode*, file*)'
  [A] 'function int get_tree_bdev(fs_context*, void ()*)'
  [A] 'function int get_vaddr_frames(unsigned long int, unsigned int, unsigned int, frame_vector*)'
  [A] 'function void handle_fasteoi_irq(irq_desc*)'
  [A] 'function void ieee80211_amsdu_to_8023s(sk_buff*, sk_buff_head*, const u8*, nl80211_iftype, const unsigned int, const u8*, const u8*)'
  [A] 'function const element* ieee80211_bss_get_elem(cfg80211_bss*, u8)'
  [A] 'function int ieee80211_data_to_8023_exthdr(sk_buff*, ethhdr*, const u8*, nl80211_iftype, u8)'
  [A] 'function int ieee80211_radiotap_iterator_init(ieee80211_radiotap_iterator*, ieee80211_radiotap_header*, int, const ieee80211_radiotap_vendor_namespaces*)'
  [A] 'function int ieee80211_radiotap_iterator_next(ieee80211_radiotap_iterator*)'
  [A] 'function void iget_failed(inode*)'
  [A] 'function inode* iget_locked(super_block*, unsigned long int)'
  [A] 'function void ihold(inode*)'
  [A] 'function void inode_nohighmem(inode*)'
  [A] 'function void int_to_scsilun(u64, scsi_lun*)'
  [A] 'function void io_schedule()'
  [A] 'function iommu_group* iommu_group_alloc()'
  [A] 'function int iommu_group_register_notifier(iommu_group*, notifier_block*)'
  [A] 'function bool is_bad_inode(inode*)'
  [A] 'function void kernel_param_lock(module*)'
  [A] 'function void kernel_param_unlock(module*)'
  [A] 'function void* kmalloc_order(size_t, gfp_t, unsigned int)'
  [A] 'function void ll_rw_block(int, int, int, buffer_head**)'
  [A] 'function nls_table* load_nls_default()'
  [A] 'function void logfc(fs_context*, const char*, ...)'
  [A] 'function void make_bad_inode(inode*)'
  [A] 'function int media_create_pad_link(media_entity*, u16, media_entity*, u16, u32)'
  [A] 'function media_link* media_entity_find_link(media_pad*, media_pad*)'
  [A] 'function media_pad* media_entity_remote_pad(const media_pad*)'
  [A] 'function int media_entity_setup_link(media_link*, u32)'
  [A] 'function int media_graph_walk_init(media_graph*, media_device*)'
  [A] 'function media_entity* media_graph_walk_next(media_graph*)'
  [A] 'function void media_graph_walk_start(media_graph*, media_entity*)'
  [A] 'function int of_clk_hw_register(device_node*, clk_hw*)'
  [A] 'function i2c_client* of_find_i2c_device_by_node(device_node*)'
  [A] 'function device_node* of_find_node_by_type(device_node*, const char*)'
  [A] 'function void* of_io_request_and_map(device_node*, int, const char*)'
  [A] 'function pwm_device* of_pwm_xlate_with_flags(pwm_chip*, const of_phandle_args*)'
  [A] 'function const char* page_get_link(dentry*, inode*, delayed_call*)'
  [A] 'function page* pagecache_get_page(address_space*, unsigned long int, int, unsigned int)'
  [A] 'function pinctrl* pinctrl_get(device*)'
  [A] 'function int pinctrl_gpio_set_config(unsigned int, unsigned long int)'
  [A] 'function void put_vaddr_frames(frame_vector*)'
  [A] 'function page* read_cache_page(address_space*, unsigned long int, void ()*, void*)'
  [A] 'function int reset_controller_register(reset_controller_dev*)'
  [A] 'function unsigned long int round_jiffies_relative(unsigned long int)'
  [A] 'function void rq_flush_dcache_pages(request*)'
  [A] 'function void scmd_printk(const char*, const scsi_cmnd*, const char*, ...)'
  [A] 'function void scsi_block_requests(Scsi_Host*)'
  [A] 'function int scsi_change_queue_depth(scsi_device*, int)'
  [A] 'function void scsi_print_command(scsi_cmnd*)'
  [A] 'function void scsi_unblock_requests(Scsi_Host*)'
  [A] 'function unsigned int sdio_align_size(sdio_func*, unsigned int)'
  [A] 'function int setup_irq(unsigned int, irqaction*)'
  [A] 'function int snd_dmaengine_pcm_close_release_chan(snd_pcm_substream*)'
  [A] 'function dma_chan* snd_dmaengine_pcm_get_chan(snd_pcm_substream*)'
  [A] 'function int snd_dmaengine_pcm_open_request_chan(snd_pcm_substream*, dma_filter_fn, void*)'
  [A] 'function snd_pcm_uframes_t snd_dmaengine_pcm_pointer(snd_pcm_substream*)'
  [A] 'function int snd_dmaengine_pcm_trigger(snd_pcm_substream*, int)'
  [A] 'function int snd_hwparams_to_dma_slave_config(const snd_pcm_substream*, const snd_pcm_hw_params*, dma_slave_config*)'
  [A] 'function int snd_soc_add_card_controls(snd_soc_card*, const snd_kcontrol_new*, int)'
  [A] 'function int snd_soc_dai_set_clkdiv(snd_soc_dai*, int, int)'
  [A] 'function int snd_soc_dai_set_pll(snd_soc_dai*, int, int, unsigned int, unsigned int)'
  [A] 'function int snd_soc_register_card(snd_soc_card*)'
  [A] 'function spi_controller* spi_busnum_to_master(u16)'
  [A] 'function void spi_unregister_device(spi_device*)'
  [A] 'function void truncate_inode_pages_final(address_space*)'
  [A] 'function unsigned int uart_get_divisor(uart_port*, unsigned int)'
  [A] 'function void uart_handle_cts_change(uart_port*, unsigned int)'
  [A] 'function void uart_handle_dcd_change(uart_port*, unsigned int)'
  [A] 'function void uart_insert_char(uart_port*, unsigned int, unsigned int, unsigned int, unsigned int)'
  [A] 'function int unregister_console(console*)'
  [A] 'function void unregister_syscore_ops(syscore_ops*)'
  [A] 'function int usb_alloc_streams(usb_interface*, usb_host_endpoint**, unsigned int, unsigned int, gfp_t)'
  [A] 'function int usb_bulk_msg(usb_device*, unsigned int, void*, int, int*, int)'
  [A] 'function int usb_free_streams(usb_interface*, usb_host_endpoint**, unsigned int, gfp_t)'
  [A] 'function void usb_kill_anchored_urbs(usb_anchor*)'
  [A] 'function int usb_reset_configuration(usb_device*)'
  [A] 'function int usb_set_interface(usb_device*, int, int)'
  [A] 'function void usb_unanchor_urb(urb*)'
  [A] 'function int usb_wait_anchor_empty_timeout(usb_anchor*, unsigned int)'
  [A] 'function void v4l2_ctrl_cluster(unsigned int, v4l2_ctrl**)'
  [A] 'function v4l2_ctrl* v4l2_ctrl_new_int_menu(v4l2_ctrl_handler*, const v4l2_ctrl_ops*, u32, u8, u8, const s64*)'
  [A] 'function int v4l2_ctrl_subdev_subscribe_event(v4l2_subdev*, v4l2_fh*, v4l2_event_subscription*)'
  [A] 'function int v4l2_ctrl_subscribe_event(v4l2_fh*, const v4l2_event_subscription*)'
  [A] 'function int v4l2_event_subdev_unsubscribe(v4l2_subdev*, v4l2_fh*, v4l2_event_subscription*)'
  [A] 'function int v4l2_g_ctrl(v4l2_ctrl_handler*, v4l2_control*)'
  [A] 'function v4l2_subdev* v4l2_i2c_new_subdev(v4l2_device*, i2c_adapter*, const char*, u8, const unsigned short int*)'
  [A] 'function void v4l2_i2c_subdev_init(v4l2_subdev*, i2c_client*, const v4l2_subdev_ops*)'
  [A] 'function v4l2_subdev* v4l2_spi_new_subdev(v4l2_device*, spi_controller*, spi_board_info*)'
  [A] 'function void v4l_bound_align_image(u32*, unsigned int, unsigned int, unsigned int, u32*, unsigned int, unsigned int, unsigned int, unsigned int)'
  [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_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_cookie(vb2_buffer*, unsigned int)'
  [A] 'function int zlib_inflate(z_stream_s*, int)'
  [A] 'function int zlib_inflateEnd(z_stream_s*)'
  [A] 'function int zlib_inflateInit2(z_stream_s*, int)'
  [A] 'function int zlib_inflate_workspacesize()'

2 Added variables:

  [A] 'const unsigned char bridge_tunnel_header[6]'
  [A] 'const file_operations generic_ro_fops'

Bug: 155001886
Change-Id: Iea31e0b21432c399c1dcb6b808954520f15b515b
Signed-off-by: zhaoyouyi <zhaoyouyi@allwinnertech.com>
2020-04-26 16:59:58 +00:00
huangshuosheng
dd7b0d0aaa ANDROID: gki_defconfig: enable CONFIG_PM_DEVFREQ_EVENT.
Enable support for devfreq driver to adjust DDR frequency.

Bug: 154672404
Change-Id: Ic42139c54c62c6ee1bea1da002af06088e2ef268
Signed-off-by: huangshuosheng <huangshuosheng@allwinnertech.com>
2020-04-26 16:18:03 +08:00
Paul Lawrence
48794a1b63 ANDROID: Incremental fs: Use simple compression in log buffer
Bug: 154342202
Test: incfs_test passes
Signed-off-by: Paul Lawrence <paullawrence@google.com>
Change-Id: Ibcc641dd92596018c9f10b5bc7bd0db2642a80c7
(cherry picked from commit b6b4a3a404ccd9c62347e27c4fc7883d776c2cbb)
2020-04-25 13:33:53 +00:00
hyeongseok.kim
f651e6024c ANDROID: dm-bow: Fix not to skip trim at framented range
If free blocks hole is smaller than discard_granularity,
TRIM to this range can be skipped.
Fix this by changing the granularity to 4kb at dm-bow layer,
not to skip TRIM to every tiny free blocks.

Bug: 154411183
Signed-off-by: hyeongseok.kim <hyeongseok@gmail.com>
Cc: hyeongseok.kim <hyeongseok.kim@lge.com>
Change-Id: Ic7c33d94a016d0ad5a75514eae1056c328c9c1ba
(cherry picked from commit ca986e448cf2f92f1bb672fe9bc0b651fa6b76c5)
Signed-off-by: Paul Lawrence <paullawrence@google.com>
2020-04-24 21:53:22 +00:00
Alistair Delva
a50509b2d5 ANDROID: Remove VLA from uid_sys_stats.c
Remove one more VLA that was not caught.

Bug: 154930031
Change-Id: I2c6c1f6d5e6ef23769c117a47689e1539b85c882
Signed-off-by: Alistair Delva <adelva@google.com>
2020-04-24 17:09:50 +00:00
Liangcai Fan
a2aae965c6 ANDROID: ABI/Whitelist: add net whitelist to unisoc Whitelist
Update whitelist for the symbols used by the unisoc device of and
updates the ABI representation accordingly.

add list:
 - NET
 - CRYPTO
 - NF

Leaf changes summary: 214 artifacts changed
Changed leaf types summary: 0 leaf type changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 205 Added functions
Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 9 Added variables

205 Added functions:

  [A] 'function int __clocksource_register_scale(clocksource*, u32, u32)'
  [A] 'function unsigned long int __crypto_memneq(void*, void*, size_t)'
  [A] 'function void __crypto_xor(u8*, const u8*, const u8*, unsigned int)'
  [A] 'function int __fib_lookup(net*, flowi4*, fib_result*, unsigned int)'
  [A] 'function nf_conntrack_expect* __nf_ct_expect_find(net*, const nf_conntrack_zone*, const nf_conntrack_tuple*)'
  [A] 'function void __nf_ct_refresh_acct(nf_conn*, ip_conntrack_info, const sk_buff*, u32, bool)'
  [A] 'function int __nf_ip6_route(net*, dst_entry**, flowi*, bool)'
  [A] 'function bool __nf_nat_mangle_tcp_packet(sk_buff*, nf_conn*, ip_conntrack_info, unsigned int, unsigned int, unsigned int, const char*, unsigned int, bool)'
  [A] 'function sock* __raw_v4_lookup(net*, sock*, unsigned short int, __be32, __be32, int, int)'
  [A] 'function sock* __raw_v6_lookup(net*, sock*, unsigned short int, const in6_addr*, const in6_addr*, int, int)'
  [A] 'function int __sk_receive_skb(sock*, sk_buff*, const int, unsigned int, bool)'
  [A] 'function void __xfrm_state_destroy(xfrm_state*, bool)'
  [A] 'function void aes_encrypt(const crypto_aes_ctx*, unsigned char*, const unsigned char*)'
  [A] 'function int aes_expandkey(crypto_aes_ctx*, const unsigned char*, unsigned int)'
  [A] 'function void arc4_crypt(arc4_ctx*, unsigned char*, const unsigned char*, unsigned int)'
  [A] 'function int arc4_setkey(arc4_ctx*, const unsigned char*, unsigned int)'
  [A] 'function request_queue* blk_mq_init_sq_queue(blk_mq_tag_set*, const blk_mq_ops*, unsigned int, unsigned int)'
  [A] 'function int ce_aes_expandkey(crypto_aes_ctx*, const unsigned char*, unsigned int)'
  [A] 'function void clockevents_config_and_register(clock_event_device*, u32, unsigned long int, unsigned long int)'
  [A] 'function bool cpu_have_feature(unsigned int)'
  [A] 'function int crypto_ahash_digest(ahash_request*)'
  [A] 'function int crypto_ahash_setkey(crypto_ahash*, const unsigned char*, unsigned int)'
  [A] 'function crypto_ahash* crypto_alloc_ahash(const char*, unsigned int, unsigned int)'
  [A] 'function void* crypto_alloc_instance(const char*, crypto_alg*, unsigned int)'
  [A] 'function crypto_alg* crypto_attr_alg2(rtattr*, const crypto_type*, unsigned int, unsigned int)'
  [A] 'function int crypto_check_attr_type(rtattr**, unsigned int)'
  [A] 'function void crypto_inc(unsigned char*, unsigned int)'
  [A] 'function int crypto_init_spawn(crypto_spawn*, crypto_alg*, crypto_instance*, unsigned int)'
  [A] 'function void crypto_mod_put(crypto_alg*)'
  [A] 'function int crypto_register_aead(aead_alg*)'
  [A] 'function int crypto_register_shash(shash_alg*)'
  [A] 'function int crypto_register_shashes(shash_alg*, int)'
  [A] 'function int crypto_register_skcipher(skcipher_alg*)'
  [A] 'function int crypto_register_skciphers(skcipher_alg*, int)'
  [A] 'function int crypto_register_template(crypto_template*)'
  [A] 'function int crypto_sha1_finup(shash_desc*, const u8*, unsigned int, u8*)'
  [A] 'function int crypto_sha1_update(shash_desc*, const u8*, unsigned int)'
  [A] 'function int crypto_shash_digest(shash_desc*, const unsigned char*, unsigned int, unsigned char*)'
  [A] 'function crypto_tfm* crypto_spawn_tfm(crypto_spawn*, unsigned int, unsigned int)'
  [A] 'function void crypto_unregister_aead(aead_alg*)'
  [A] 'function int crypto_unregister_shash(shash_alg*)'
  [A] 'function int crypto_unregister_shashes(shash_alg*, int)'
  [A] 'function void crypto_unregister_skcipher(skcipher_alg*)'
  [A] 'function void crypto_unregister_skciphers(skcipher_alg*, int)'
  [A] 'function void crypto_unregister_template(crypto_template*)'
  [A] 'function net_device* dev_get_by_name_rcu(net*, const char*)'
  [A] 'function void devm_thermal_zone_of_sensor_unregister(device*, thermal_zone_device*)'
  [A] 'function bool fib_info_nh_uses_dev(fib_info*, const net_device*)'
  [A] 'function int fib_table_lookup(fib_table*, const flowi4*, fib_result*, int)'
  [A] 'function int generic_key_instantiate(key*, key_preparsed_payload*)'
  [A] 'function void gf128mul_lle(be128*, const be128*)'
  [A] 'function i2c_client* i2c_new_dummy_device(i2c_adapter*, u16)'
  [A] 'function void icmpv6_send(sk_buff*, unsigned char, unsigned char, unsigned int)'
  [A] 'function unsigned int inet_dev_addr_type(net*, const net_device*, __be32)'
  [A] 'function int inet_diag_bc_sk(const nlattr*, sock*)'
  [A] 'function int inet_diag_register(const inet_diag_handler*)'
  [A] 'function void inet_diag_unregister(const inet_diag_handler*)'
  [A] 'function void inet_proto_csum_replace4(unsigned short int*, sk_buff*, unsigned int, unsigned int, bool)'
  [A] 'function int inet_sk_diag_fill(sock*, inet_connection_sock*, sk_buff*, const inet_diag_req_v2*, user_namespace*, unsigned int, unsigned int, unsigned short int, const nlmsghdr*, bool)'
  [A] 'function int input_scancode_to_scalar(const input_keymap_entry*, unsigned int*)'
  [A] 'function void ip6_redirect(sk_buff*, net*, int, unsigned int, __anonymous_struct__)'
  [A] 'function void ip6_update_pmtu(sk_buff*, net*, unsigned int, int, unsigned int, __anonymous_struct__)'
  [A] 'function void* ip6t_alloc_initial_table(const xt_table*)'
  [A] 'function unsigned int ip6t_do_table(sk_buff*, const nf_hook_state*, xt_table*)'
  [A] 'function int ip6t_register_table(net*, const xt_table*, const ip6t_replace*, const nf_hook_ops*, xt_table**)'
  [A] 'function void ip6t_unregister_table(net*, xt_table*, const nf_hook_ops*)'
  [A] 'function int ip_route_me_harder(net*, sk_buff*, unsigned int)'
  [A] 'function void ipcomp_destroy(xfrm_state*)'
  [A] 'function int ipcomp_init_state(xfrm_state*)'
  [A] 'function int ipcomp_input(xfrm_state*, sk_buff*)'
  [A] 'function int ipcomp_output(xfrm_state*, sk_buff*)'
  [A] 'function void ipv4_redirect(sk_buff*, net*, int, unsigned char)'
  [A] 'function void ipv4_update_pmtu(sk_buff*, net*, unsigned int, int, unsigned char)'
  [A] 'function void kernel_neon_begin()'
  [A] 'function void kernel_neon_end()'
  [A] 'function void key_invalidate(key*)'
  [A] 'function void key_put(key*)'
  [A] 'function void key_revoke(key*)'
  [A] 'function int key_validate(const key*)'
  [A] 'function key* keyring_alloc(const char*, __anonymous_struct__, __anonymous_struct__1, const cred*, unsigned int, unsigned long int, key_restriction*, key*)'
  [A] 'function char* kmemdup_nul(const char*, unsigned long int, unsigned int)'
  [A] 'function char* kobject_get_path(kobject*, unsigned int)'
  [A] 'function u32* led_get_default_pattern(led_classdev*, unsigned int*)'
  [A] 'function void led_set_brightness(led_classdev*, led_brightness)'
  [A] 'function int led_trigger_register(led_trigger*)'
  [A] 'function void led_trigger_unregister(led_trigger*)'
  [A] 'function int mod_timer_pending(timer_list*, unsigned long int)'
  [A] 'function bool netlink_net_capable(const sk_buff*, int)'
  [A] 'function int nf_conntrack_helpers_register(nf_conntrack_helper*, unsigned int)'
  [A] 'function void nf_conntrack_helpers_unregister(nf_conntrack_helper*, unsigned int)'
  [A] 'function nf_conntrack_expect* nf_ct_expect_alloc(nf_conn*)'
  [A] 'function void nf_ct_expect_init(nf_conntrack_expect*, unsigned int, unsigned char, const nf_inet_addr*, const nf_inet_addr*, unsigned char, const unsigned short int*, const unsigned short int*)'
  [A] 'function void nf_ct_expect_put(nf_conntrack_expect*)'
  [A] 'function int nf_ct_expect_related_report(nf_conntrack_expect*, unsigned int, int, unsigned int)'
  [A] 'function void* nf_ct_ext_add(nf_conn*, nf_ct_ext_id, unsigned int)'
  [A] 'function int nf_ct_extend_register(const nf_ct_ext_type*)'
  [A] 'function void nf_ct_extend_unregister(const nf_ct_ext_type*)'
  [A] 'function void nf_ct_helper_expectfn_register(nf_ct_helper_expectfn*)'
  [A] 'function void nf_ct_helper_expectfn_unregister(nf_ct_helper_expectfn*)'
  [A] 'function void nf_ct_helper_init(nf_conntrack_helper*, unsigned short int, unsigned short int, const char*, unsigned short int, unsigned short int, unsigned int, const nf_conntrack_expect_policy*, unsigned int, void ()*, void ()*, module*)'
  [A] 'function void nf_ct_helper_log(sk_buff*, const nf_conn*, const char*, ...)'
  [A] 'function int nf_ct_netns_get(net*, unsigned char)'
  [A] 'function void nf_ct_netns_put(net*, unsigned char)'
  [A] 'function bool nf_ct_remove_expect(nf_conntrack_expect*)'
  [A] 'function int nf_ct_seqadj_init(nf_conn*, ip_conntrack_info, s32)'
  [A] 'function int nf_ct_seqadj_set(nf_conn*, ip_conntrack_info, __be32, s32)'
  [A] 'function nf_conn* nf_ct_tmpl_alloc(net*, const nf_conntrack_zone*, unsigned int)'
  [A] 'function void nf_ct_tmpl_free(nf_conn*)'
  [A] 'function void nf_ct_unexpect_related(nf_conntrack_expect*)'
  [A] 'function __sum16 nf_ip6_checksum(sk_buff*, unsigned int, unsigned int, u8)'
  [A] 'function __sum16 nf_ip_checksum(sk_buff*, unsigned int, unsigned int, u8)'
  [A] 'function int nf_ip_route(net*, dst_entry**, flowi*, bool)'
  [A] 'function int nf_log_buf_add(nf_log_buf*, const char*, ...)'
  [A] 'function void nf_log_buf_close(nf_log_buf*)'
  [A] 'function nf_log_buf* nf_log_buf_open()'
  [A] 'function void nf_log_packet(net*, unsigned char, unsigned int, const sk_buff*, const net_device*, const net_device*, const nf_loginfo*, const char*, ...)'
  [A] 'function int nf_log_register(unsigned char, nf_logger*)'
  [A] 'function int nf_log_set(net*, u_int8_t, const nf_logger*)'
  [A] 'function void nf_log_unregister(nf_logger*)'
  [A] 'function void nf_log_unset(net*, const nf_logger*)'
  [A] 'function int nf_logger_find_get(int, nf_log_type)'
  [A] 'function void nf_logger_put(int, nf_log_type)'
  [A] 'function void nf_nat_helper_register(nf_conntrack_nat_helper*)'
  [A] 'function void nf_nat_helper_unregister(nf_conntrack_nat_helper*)'
  [A] 'function int nf_nat_ipv6_register_fn(net*, const nf_hook_ops*)'
  [A] 'function void nf_nat_ipv6_unregister_fn(net*, const nf_hook_ops*)'
  [A] 'function bool nf_nat_mangle_udp_packet(sk_buff*, nf_conn*, ip_conntrack_info, unsigned int, unsigned int, unsigned int, const char*, unsigned int)'
  [A] 'function unsigned int nf_nat_setup_info(nf_conn*, const nf_nat_range2*, nf_nat_manip_type)'
  [A] 'function int of_parse_phandle_with_fixed_args(const device_node*, const char*, int, int, of_phandle_args*)'
  [A] 'function int ppp_channel_index(ppp_channel*)'
  [A] 'function void ppp_input(ppp_channel*, sk_buff*)'
  [A] 'function void ppp_input_error(ppp_channel*, int)'
  [A] 'function void ppp_output_wakeup(ppp_channel*)'
  [A] 'function int ppp_register_channel(ppp_channel*)'
  [A] 'function int ppp_register_net_channel(net*, ppp_channel*)'
  [A] 'function int ppp_unit_number(ppp_channel*)'
  [A] 'function void ppp_unregister_channel(ppp_channel*)'
  [A] 'function int pppox_compat_ioctl(socket*, unsigned int, unsigned long int)'
  [A] 'function int pppox_ioctl(socket*, unsigned int, unsigned long int)'
  [A] 'function void pppox_unbind_sock(sock*)'
  [A] 'function cred* prepare_kernel_cred(task_struct*)'
  [A] 'function int register_key_type(key_type*)'
  [A] 'function int register_pppox_proto(int, const pppox_proto*)'
  [A] 'function int register_tcf_proto_ops(tcf_proto_ops*)'
  [A] 'function key* request_key_tag(key_type*, const char*, key_tag*, const char*)'
  [A] 'function scatterlist* scatterwalk_ffwd(scatterlist*, scatterlist*, unsigned int)'
  [A] 'function void shash_free_instance(crypto_instance*)'
  [A] 'function int shash_register_instance(crypto_template*, shash_instance*)'
  [A] 'function simd_skcipher_alg* simd_skcipher_create_compat(const char*, const char*, const char*)'
  [A] 'function void simd_skcipher_free(simd_skcipher_alg*)'
  [A] 'function int skb_cow_data(sk_buff*, int, sk_buff**)'
  [A] 'function int skb_ensure_writable(sk_buff*, int)'
  [A] 'function int skb_to_sgvec_nomark(sk_buff*, scatterlist*, int, int)'
  [A] 'function int skcipher_walk_aead_decrypt(skcipher_walk*, aead_request*, bool)'
  [A] 'function int skcipher_walk_aead_encrypt(skcipher_walk*, aead_request*, bool)'
  [A] 'function int skcipher_walk_done(skcipher_walk*, int)'
  [A] 'function int skcipher_walk_virt(skcipher_walk*, skcipher_request*, bool)'
  [A] 'function int sock_diag_destroy(sock*, int)'
  [A] 'function sk_buff* sock_wmalloc(sock*, unsigned long int, int, unsigned int)'
  [A] 'function void start_tty(tty_struct*)'
  [A] 'function void static_key_slow_dec(static_key*)'
  [A] 'function void static_key_slow_inc(static_key*)'
  [A] 'function void stop_tty(tty_struct*)'
  [A] 'function int tcf_action_exec(sk_buff*, tc_action**, int, tcf_result*)'
  [A] 'function void tcf_exts_destroy(tcf_exts*)'
  [A] 'function int tcf_exts_dump(sk_buff*, tcf_exts*)'
  [A] 'function int tcf_exts_dump_stats(sk_buff*, tcf_exts*)'
  [A] 'function int tcf_exts_validate(net*, tcf_proto*, nlattr**, nlattr*, tcf_exts*, bool, bool, netlink_ext_ack*)'
  [A] 'function bool tcf_queue_work(rcu_work*, void ()*)'
  [A] 'function int tty_mode_ioctl(tty_struct*, file*, unsigned int, unsigned long int)'
  [A] 'function void unregister_key_type(key_type*)'
  [A] 'function void unregister_pppox_proto(int)'
  [A] 'function int unregister_tcf_proto_ops(tcf_proto_ops*)'
  [A] 'function void user_destroy(key*)'
  [A] 'function long int user_read(const key*, char*, size_t)'
  [A] 'function void user_revoke(key*)'
  [A] 'function void virtio_break_device(virtio_device*)'
  [A] 'function int xfrm4_protocol_deregister(xfrm4_protocol*, unsigned char)'
  [A] 'function int xfrm4_protocol_register(xfrm4_protocol*, unsigned char)'
  [A] 'function int xfrm4_rcv(sk_buff*)'
  [A] 'function int xfrm4_tunnel_deregister(xfrm_tunnel*, unsigned short int)'
  [A] 'function int xfrm4_tunnel_register(xfrm_tunnel*, unsigned short int)'
  [A] 'function int xfrm6_find_1stfragopt(xfrm_state*, sk_buff*, u8**)'
  [A] 'function int xfrm6_protocol_deregister(xfrm6_protocol*, unsigned char)'
  [A] 'function int xfrm6_protocol_register(xfrm6_protocol*, unsigned char)'
  [A] 'function int xfrm6_rcv(sk_buff*)'
  [A] 'function xfrm_algo_desc* xfrm_aalg_get_byname(const char*, int)'
  [A] 'function int xfrm_init_state(xfrm_state*)'
  [A] 'function int xfrm_input(sk_buff*, int, unsigned int, int)'
  [A] 'function int xfrm_input_resume(sk_buff*, int)'
  [A] 'function int xfrm_output_resume(sk_buff*, int)'
  [A] 'function int xfrm_register_type(const xfrm_type*, unsigned short int)'
  [A] 'function xfrm_state* xfrm_state_alloc(net*)'
  [A] 'function void xfrm_state_insert(xfrm_state*)'
  [A] 'function xfrm_state* xfrm_state_lookup(net*, unsigned int, const __anonymous_union__2*, unsigned int, unsigned char, unsigned short int)'
  [A] 'function void xfrm_unregister_type(const xfrm_type*, unsigned short int)'
  [A] 'function nf_hook_ops* xt_hook_ops_alloc(const xt_table*, void ()*)'
  [A] 'function int xt_register_match(xt_match*)'
  [A] 'function int xt_register_matches(xt_match*, unsigned int)'
  [A] 'function int xt_register_target(xt_target*)'
  [A] 'function int xt_register_targets(xt_target*, unsigned int)'
  [A] 'function void xt_unregister_match(xt_match*)'
  [A] 'function void xt_unregister_matches(xt_match*, unsigned int)'
  [A] 'function void xt_unregister_target(xt_target*)'
  [A] 'function void xt_unregister_targets(xt_target*, unsigned int)'

9 Added variables:

  [A] 'const u16 crc_ccitt_table[256]'
  [A] 'bool fpsimd_context_busy'
  [A] 'spinlock_t nf_conntrack_expect_lock'
  [A] 'const nf_conntrack_zone nf_ct_zone_dflt'
  [A] 'bool nf_skb_duplicated'
  [A] 'raw_hashinfo raw_v4_hashinfo'
  [A] 'raw_hashinfo raw_v6_hashinfo'
  [A] 'int sysctl_nf_log_all_netns'
  [A] 'static_key xt_tee_enabled'

Bug: 147075469
Change-Id: Id2ad758ad1eacc85ff71aece131ec9c7b18fc76e
Signed-off-by: Liangcai Fan <liangcai.fan@unisoc.com>
2020-04-24 19:38:18 +08:00
Satya Tangirala
2c6b2164e6 ANDROID: gki_defconfig: enable CONFIG_MMC_CRYPTO
Enable inline encryption support in MMC core.

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

'struct hc_driver at hcd.h:255:1' changed:
  type size changed from 3136 to 3264 (in bits)
  1 data member insertion:
    'unsigned long int hc_driver::android_vendor_data[2]', at offset 2880 (in bits) at hcd.h:419:1
  there are data member changes:
    'u64 hc_driver::android_kabi_reserved1' offset changed from 2880 to 3008 (in bits) (by +128 bits)
    'u64 hc_driver::android_kabi_reserved2' offset changed from 2944 to 3072 (in bits) (by +128 bits)
    'u64 hc_driver::android_kabi_reserved3' offset changed from 3008 to 3136 (in bits) (by +128 bits)
    'u64 hc_driver::android_kabi_reserved4' offset changed from 3072 to 3200 (in bits) (by +128 bits)
  16 impacted interfaces

'struct mmc_host at host.h:271:1' changed:
  type size changed from 12288 to 13312 (in bits)
  2 data member insertions:
    'keyslot_manager* mmc_host::ksm', at offset 12288 (in bits) at host.h:467:1
    'void* mmc_host::crypto_DO_NOT_USE[7]', at offset 12352 (in bits) at host.h:468:1
  there are data member changes:
    'bool mmc_host::hsq_enabled' offset changed from 12272 to 12800 (in bits) (by +528 bits)
    'unsigned long int mmc_host::private[]' offset changed from 12288 to 13312 (in bits) (by +1024 bits)
  87 impacted interfaces

'struct mmc_request at core.h:147:1' changed:
  type size changed from 1024 to 1216 (in bits)
  3 data member insertions:
    'int mmc_request::crypto_key_slot', at offset 1024 (in bits) at core.h:169:1
    'u64 mmc_request::data_unit_num', at offset 1088 (in bits) at core.h:170:1
    'const blk_crypto_key* mmc_request::crypto_key', at offset 1152 (in bits) at core.h:171:1
  87 impacted interfaces

'struct ufs_hba at ufshcd.h:589:1' changed:
  type size changed from 29440 to 29952 (in bits)
  1 data member insertion:
    'void* ufs_hba::crypto_DO_NOT_USE[8]', at offset 29184 (in bits) at ufshcd.h:826:1
  there are data member changes:
    'u64 ufs_hba::android_kabi_reserved1' offset changed from 29184 to 29696 (in bits) (by +512 bits)
    'u64 ufs_hba::android_kabi_reserved2' offset changed from 29248 to 29760 (in bits) (by +512 bits)
    'u64 ufs_hba::android_kabi_reserved3' offset changed from 29312 to 29824 (in bits) (by +512 bits)
    'u64 ufs_hba::android_kabi_reserved4' offset changed from 29376 to 29888 (in bits) (by +512 bits)
  13 impacted interfaces

'struct ufs_hba_crypto_variant_ops at ufshcd.h:371:1' changed:
  type size changed from 1024 to 1536 (in bits)
  1 data member insertion:
    'void* ufs_hba_crypto_variant_ops::crypto_DO_NOT_USE[8]', at offset 768 (in bits) at ufshcd.h:391:1
  there are data member changes:
    'u64 ufs_hba_crypto_variant_ops::android_kabi_reserved1' offset changed from 768 to 1280 (in bits) (by +512 bits)
    'u64 ufs_hba_crypto_variant_ops::android_kabi_reserved2' offset changed from 832 to 1344 (in bits) (by +512 bits)
    'u64 ufs_hba_crypto_variant_ops::android_kabi_reserved3' offset changed from 896 to 1408 (in bits) (by +512 bits)
    'u64 ufs_hba_crypto_variant_ops::android_kabi_reserved4' offset changed from 960 to 1472 (in bits) (by +512 bits)
  13 impacted interfaces

Bug: 153512828
Bug: 144046242
Change-Id: I1bdf922c2373c0d756864df2c329d7a8179fe09e
Signed-off-by: Satya Tangirala <satyat@google.com>
2020-04-23 21:17:05 +00:00
Satya Tangirala
5dfea78d00 ANDROID: Add padding for crypto related structs in UFS and MMC
Add padding to ufshcd_host and ufshcd_hba_variant_ops UFS, and mmc_host
in MMC to allow expansions in future if necessary, while keeping the
ABI stable. These fields are only for the purposes of keeping the ABI
stable, and in particular are *NOT* for vendor use.

Bug: 153512828
Bug: 144046242
Bug: 137270441
Change-Id: I7b780680bf3e8a3121c6f77b35a2a16d41f3bea6
Signed-off-by: Satya Tangirala <satyat@google.com>
2020-04-23 20:48:15 +00:00
Satya Tangirala
555cf12eb6 ANDROID: mmc: MMC crypto API
Make mmc core able to use the blk-crypto framework for inline
encryption. This patch introduces a pointer to struct keyslot_manager
to struct mmc_host, and handles setting up the request_queue for
devices using that keyslot_manager appropriately. It also inits struct
mmc_request's inline encryption fields before it's passed to
mmc_host::ops->request.

Users of the core code in host/ (e.g. cqhci.c) should initialize the
keyslot_manager in struct mmc_host appropriately, if they want to
support inline encryption. They should also handle any inline
encryption related work necessary when mmc_host::ops->request is
called.

This patch is only compile tested, as I don't have a device to
actually test these patches. Enable CONFIG_MMC_CRYPTO to test

Bug: 153512828
Bug: 144046242
Change-Id: I6f98ffadfa6e39d7fdc3752b069210ad97babd8b
Co-developed-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Satya Tangirala <satyat@google.com>
2020-04-23 20:45:48 +00:00
Orson Zhai
5f5805ee7b ANDROID: GKI: USB: Add vendor specified variables to hc_driver
These data is used by Android vendor for specific purpose.

Bug: 154693739
Change-Id: I6fa39d3e79168105103a1a5ed67d1e690a599c1b
Signed-off-by: Orson Zhai <orson.zhai@unisoc.com>
2020-04-23 18:30:56 +00:00
Yongqin Liu
e986f06508 ANDROID: hikey960_gki.fragment enable CONFIG_SDCARD_FS=m
as the config of CONFIG_SDCARD_FS was disbaled in the gki_defconfig file
with the change here:
    https://android-review.googlesource.com/c/kernel/common/+/1235239

and we need to enable the sdcardfs module to have the sdcard directories
created to install apk files and to push files

Test: adb push xxx /sdcard/sdcard/Music/xxx works

Fixes: f0212822fa ("ANDROID: gki_defconfig: Disable SDCARD_FS")
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Change-Id: I2ddd6a6ac383d55171fe842956f52b4e11775003
2020-04-23 18:05:34 +00:00
Greg Kroah-Hartman
ae42f3a91e ANDROID: GKI: update abi.xml due to additional Android ABI padding
Leaf changes summary: 13 artifacts changed
Changed leaf types summary: 12 leaf types changed
Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added function
Removed/Changed/Added variables summary: 0 Removed, 1 Changed, 0 Added variable

1 Changed variable:

  [C] 'bio_set fs_bio_set' was changed at bio.c:47:1:
    type of variable changed:
      type size changed from 1920 to 2176 (in bits)
      4 data member insertions:
        'u64 bio_set::android_kabi_reserved1', at offset 1920 (in bits) at bio.h:729:1
        'u64 bio_set::android_kabi_reserved2', at offset 1984 (in bits) at bio.h:730:1
        'u64 bio_set::android_kabi_reserved3', at offset 2048 (in bits) at bio.h:731:1
        'u64 bio_set::android_kabi_reserved4', at offset 2112 (in bits) at bio.h:732:1
      126 impacted interfaces:

'struct bio_set at bio.h:704:1' changed:
  details were reported earlier

'struct dentry at dcache.h:89:1' changed:
  type size changed from 1536 to 1664 (in bits)
  2 data member insertions:
    'u64 dentry::android_kabi_reserved1', at offset 1536 (in bits) at dcache.h:123:1
    'u64 dentry::android_kabi_reserved2', at offset 1600 (in bits) at dcache.h:124:1
  2518 impacted interfaces:

'struct dentry_operations at dcache.h:135:1' changed:
  type size changed from 1024 to 1536 (in bits)
  4 data member insertions:
    'u64 dentry_operations::android_kabi_reserved1', at offset 896 (in bits) at dcache.h:155:1
    'u64 dentry_operations::android_kabi_reserved2', at offset 960 (in bits) at dcache.h:156:1
    'u64 dentry_operations::android_kabi_reserved3', at offset 1024 (in bits) at dcache.h:157:1
    'u64 dentry_operations::android_kabi_reserved4', at offset 1088 (in bits) at dcache.h:158:1
  2518 impacted interfaces:

'struct elevator_mq_ops at elevator.h:29:1' changed:
  type size changed from 1408 to 1664 (in bits)
  4 data member insertions:
    'u64 elevator_mq_ops::android_kabi_reserved1', at offset 1408 (in bits) at elevator.h:55:1
    'u64 elevator_mq_ops::android_kabi_reserved2', at offset 1472 (in bits) at elevator.h:56:1
    'u64 elevator_mq_ops::android_kabi_reserved3', at offset 1536 (in bits) at elevator.h:57:1
    'u64 elevator_mq_ops::android_kabi_reserved4', at offset 1600 (in bits) at elevator.h:58:1
  126 impacted interfaces:

'struct elevator_type at elevator.h:66:1' changed:
  type size changed from 2240 to 2624 (in bits)
  2 data member insertions:
    'u64 elevator_type::android_kabi_reserved1', at offset 2496 (in bits) at elevator.h:96:1
    'u64 elevator_type::android_kabi_reserved2', at offset 2560 (in bits) at elevator.h:97:1
  there are data member changes:
    type 'struct elevator_mq_ops' of 'elevator_type::ops' changed as reported earlier
    and size changed from 1408 to 1664 (in bits) (by +256 bits)
    'size_t elevator_type::icq_size' offset changed from 1472 to 1728 (in bits) (by +256 bits)
    'size_t elevator_type::icq_align' offset changed from 1536 to 1792 (in bits) (by +256 bits)
    'elv_fs_entry* elevator_type::elevator_attrs' offset changed from 1600 to 1856 (in bits) (by +256 bits)
    'const char* elevator_type::elevator_name' offset changed from 1664 to 1920 (in bits) (by +256 bits)
    'const char* elevator_type::elevator_alias' offset changed from 1728 to 1984 (in bits) (by +256 bits)
    'const unsigned int elevator_type::elevator_features' offset changed from 1792 to 2048 (in bits) (by +256 bits)
    'module* elevator_type::elevator_owner' offset changed from 1856 to 2112 (in bits) (by +256 bits)
    'char elevator_type::icq_cache_name[22]' offset changed from 1920 to 2176 (in bits) (by +256 bits)
    'list_head elevator_type::list' offset changed from 2112 to 2368 (in bits) (by +256 bits)
  126 impacted interfaces:

'struct request_queue at blkdev.h:395:1' changed:
  type size changed from 15488 to 15744 (in bits)
  there are data member changes:
    type 'struct bio_set' of 'request_queue::bio_split' changed as reported earlier
    and size changed from 1920 to 2176 (in bits) (by +256 bits)
    'bool request_queue::mq_sysfs_init_done' offset changed from 14656 to 14912 (in bits) (by +256 bits)
    'size_t request_queue::cmd_size' offset changed from 14720 to 14976 (in bits) (by +256 bits)
    'work_struct request_queue::release_work' offset changed from 14784 to 15040 (in bits) (by +256 bits)
    'u64 request_queue::write_hints[5]' offset changed from 15168 to 15424 (in bits) (by +256 bits)
  126 impacted interfaces:

'struct scsi_cmnd at scsi_cmnd.h:67:1' changed:
  type size changed from 3520 to 3776 (in bits)
  4 data member insertions:
    'u64 scsi_cmnd::android_kabi_reserved1', at offset 3520 (in bits) at scsi_cmnd.h:146:1
    'u64 scsi_cmnd::android_kabi_reserved2', at offset 3584 (in bits) at scsi_cmnd.h:147:1
    'u64 scsi_cmnd::android_kabi_reserved3', at offset 3648 (in bits) at scsi_cmnd.h:148:1
    'u64 scsi_cmnd::android_kabi_reserved4', at offset 3712 (in bits) at scsi_cmnd.h:149:1
  32 impacted interfaces:

'struct scsi_device at scsi_device.h:101:1' changed:
  type size changed from 18048 to 18304 (in bits)
  4 data member insertions:
    'u64 scsi_device::android_kabi_reserved1', at offset 18048 (in bits) at scsi_device.h:235:1
    'u64 scsi_device::android_kabi_reserved2', at offset 18112 (in bits) at scsi_device.h:236:1
    'u64 scsi_device::android_kabi_reserved3', at offset 18176 (in bits) at scsi_device.h:237:1
    'u64 scsi_device::android_kabi_reserved4', at offset 18240 (in bits) at scsi_device.h:238:1
  32 impacted interfaces:

'struct scsi_host_template at scsi_host.h:45:1' changed:
  type size changed from 2752 to 3008 (in bits)
  4 data member insertions:
    'u64 scsi_host_template::android_kabi_reserved1', at offset 2752 (in bits) at scsi_host.h:494:1
    'u64 scsi_host_template::android_kabi_reserved2', at offset 2816 (in bits) at scsi_host.h:495:1
    'u64 scsi_host_template::android_kabi_reserved3', at offset 2880 (in bits) at scsi_host.h:496:1
    'u64 scsi_host_template::android_kabi_reserved4', at offset 2944 (in bits) at scsi_host.h:497:1
  32 impacted interfaces:

'struct ufs_hba at ufshcd.h:578:1' changed:
  type size changed from 29184 to 29440 (in bits)
  4 data member insertions:
    'u64 ufs_hba::android_kabi_reserved1', at offset 29184 (in bits) at ufshcd.h:827:1
    'u64 ufs_hba::android_kabi_reserved2', at offset 29248 (in bits) at ufshcd.h:828:1
    'u64 ufs_hba::android_kabi_reserved3', at offset 29312 (in bits) at ufshcd.h:829:1
    'u64 ufs_hba::android_kabi_reserved4', at offset 29376 (in bits) at ufshcd.h:830:1
  13 impacted interfaces:

'struct ufs_hba_crypto_variant_ops at ufshcd.h:365:1' changed:
  type size changed from 768 to 1024 (in bits)
  4 data member insertions:
    'u64 ufs_hba_crypto_variant_ops::android_kabi_reserved1', at offset 768 (in bits) at ufshcd.h:392:1
    'u64 ufs_hba_crypto_variant_ops::android_kabi_reserved2', at offset 832 (in bits) at ufshcd.h:393:1
    'u64 ufs_hba_crypto_variant_ops::android_kabi_reserved3', at offset 896 (in bits) at ufshcd.h:394:1
    'u64 ufs_hba_crypto_variant_ops::android_kabi_reserved4', at offset 960 (in bits) at ufshcd.h:395:1
  13 impacted interfaces:

'struct ufs_hba_variant_ops at ufshcd.h:329:1' changed:
  type size changed from 1344 to 1600 (in bits)
  4 data member insertions:
    'u64 ufs_hba_variant_ops::android_kabi_reserved1', at offset 1344 (in bits) at ufshcd.h:364:1
    'u64 ufs_hba_variant_ops::android_kabi_reserved2', at offset 1408 (in bits) at ufshcd.h:365:1
    'u64 ufs_hba_variant_ops::android_kabi_reserved3', at offset 1472 (in bits) at ufshcd.h:366:1
    'u64 ufs_hba_variant_ops::android_kabi_reserved4', at offset 1536 (in bits) at ufshcd.h:367:1
  13 impacted interfaces:

Bug: 151154716
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ib8a5bd9c4917fc3cf93cf975718928c8027d583e
2020-04-23 19:26:28 +02:00
Greg Kroah-Hartman
e23d12164a ANDROID: GKI: elevator: add Android ABI padding to some structures
Try to mitigate potential future driver core api changes by adding a
padding to struct elevator_mq_ops and struct elevator_type.

Based on a change made to the RHEL/CENTOS 8 kernel.

Bug: 151154716
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ia4c2667fd5ca9e6dd2e0d30b95a0f8d5eb7921dc
2020-04-23 19:26:27 +02:00
Greg Kroah-Hartman
86d41d3381 ANDROID: GKI: dentry: add Android ABI padding to some structures
Try to mitigate potential future driver core api changes by adding a
padding to struct dentry and struct dentry_operations.

Based on a change made to the RHEL/CENTOS 8 kernel.

Bug: 151154716
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Idde3c6e99bd4af3a91ba115b8ec148e3e1cdd4a9
2020-04-23 19:26:27 +02:00
Greg Kroah-Hartman
2ac4455a10 ANDROID: GKI: bio: add Android ABI padding to some structures
Try to mitigate potential future driver core api changes by adding a
padding to struct bio_integrity_payload and struct bio_set.

Based on a change made to the RHEL/CENTOS 8 kernel.

Bug: 151154716
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I0397ede2e11560ad9422cd7765434fcd4f7a6dd8
2020-04-23 19:26:27 +02:00
Greg Kroah-Hartman
eded03f55b ANDROID: GKI: scsi: add Android ABI padding to some structures
Try to mitigate potential future driver core api changes by adding a
padding to struct scsi_cmnd, struct scsi_device, and struct
scsi_host_template.

Based on a change made to the RHEL/CENTOS 8 kernel.

Bug: 151154716
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ie6a2b91970e8f9063bf00e96a0dff661f77b8e8d
2020-04-23 19:26:27 +02:00
Greg Kroah-Hartman
764e461bad ANDROID: GKI: ufs: add Android ABI padding to some structures
Try to mitigate potential future driver core api changes by adding
padding to struct ufs_hba_variant_ops, struct
ufs_hba_crypto_variant_ops, and struct ufs_hba.

Bug: 151154716
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ib881e531d87eae1f7a5ca312bd36086d62ccaf94
2020-04-23 19:26:27 +02:00
Greg Kroah-Hartman
9e69f3ecca ANDROID: sdcardfs: fix export symbol types
In commit c0dbfed5ff ("ANDROID: sdcardfs: Enable modular sdcardfs") a
number of core vfs functions were exported, but they needed to be set as
_GPL symbols.

Fix this up by properly setting the export type of these symbols.

Bug: 35142419
Cc: Daniel Rosenberg <drosen@google.com>
Cc: Alistair Strachan <astrachan@google.com>
Cc: Yongqin Liu <yongqin.liu@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I3169efeb5b525c536958b1354318cf0fcd07e6e1
2020-04-23 14:21:31 +02:00
Greg Kroah-Hartman
5e713c48ff This is the 5.4.35 stable release
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl6hU54ACgkQONu9yGCS
 aT5/3BAAlSOFEbVYeiAjDQYfA5DvieeVN3qKk0HnErIPRm35UHqCYSMyEDiJ2c8E
 01V2aFpvAZDyj/pE/prBrUH5FnKyil9tPQrg/da2f54yMiXQvQ6iFdmH/N5Zp5eu
 oY6qFUo4jePTbmI/TBzz08XZ9B4VxccNRhSdF0dO4SInt3eC+vJho3dCXH8H3B7o
 cDf4uIXQqyGn6t9yQQlSVRYTCK1JMwkSVxCU7uMWS5TfJSN3EyZvMMfXyTCTmgIy
 13Vv3+nSHxGqgyAA3fsClCGGAeQyFGQXP28OqyzesPuYyi5z3nDKtgZcAVtvyw9I
 eDsfnOUrw76StiJwRfnKkbg8TBKDWn4N9VyLyBvjRvRovSzTJ31jKVBLhByKDJQt
 cnsi/Ttkm2CYmChozdJrm1Pfm6HH5etEXh6rq4sqeGLkpi+k1UiQgYlavJPOI3nz
 n6dMQEyeg1dmAIBXqgvSvGVfyZuRi37ApPHMHEY4klALbRaSj2Vu/pblyeRezIXL
 G5D7olchwI0X18khdoBYOT1+tmid1pDZ00WB6Iq5IKIjR5x8KBf5uMcvprAc3LsP
 mhGP9+MYXhWQ/GjHjA6TZq76qhYlEZBIHBarIaNjrl3IShLTQXzxAwS8rGtI5wZP
 fTlCc+FBg5w1LDiVcEYJHXR583jSgsFTd3qbtpeaaQyKcC/fkEk=
 =3/4K
 -----END PGP SIGNATURE-----

Merge 5.4.35 into android-5.4-stable

Changes in 5.4.35
	ext4: use non-movable memory for superblock readahead
	watchdog: sp805: fix restart handler
	xsk: Fix out of boundary write in __xsk_rcv_memcpy
	arm, bpf: Fix bugs with ALU64 {RSH, ARSH} BPF_K shift by 0
	arm, bpf: Fix offset overflow for BPF_MEM BPF_DW
	objtool: Fix switch table detection in .text.unlikely
	scsi: sg: add sg_remove_request in sg_common_write
	ALSA: hda: Honor PM disablement in PM freeze and thaw_noirq ops
	ARM: dts: imx6: Use gpc for FEC interrupt controller to fix wake on LAN.
	kbuild, btf: Fix dependencies for DEBUG_INFO_BTF
	netfilter: nf_tables: report EOPNOTSUPP on unsupported flags/object type
	irqchip/mbigen: Free msi_desc on device teardown
	ALSA: hda: Don't release card at firmware loading error
	xsk: Add missing check on user supplied headroom size
	of: unittest: kmemleak on changeset destroy
	of: unittest: kmemleak in of_unittest_platform_populate()
	of: unittest: kmemleak in of_unittest_overlay_high_level()
	of: overlay: kmemleak in dup_and_fixup_symbol_prop()
	x86/Hyper-V: Unload vmbus channel in hv panic callback
	x86/Hyper-V: Trigger crash enlightenment only once during system crash.
	x86/Hyper-V: Report crash register data or kmsg before running crash kernel
	x86/Hyper-V: Report crash register data when sysctl_record_panic_msg is not set
	x86/Hyper-V: Report crash data in die() when panic_on_oops is set
	afs: Fix missing XDR advance in xdr_decode_{AFS,YFS}FSFetchStatus()
	afs: Fix decoding of inline abort codes from version 1 status records
	afs: Fix rename operation status delivery
	afs: Fix afs_d_validate() to set the right directory version
	afs: Fix race between post-modification dir edit and readdir/d_revalidate
	block, bfq: turn put_queue into release_process_ref in __bfq_bic_change_cgroup
	block, bfq: make reparent_leaf_entity actually work only on leaf entities
	block, bfq: invoke flush_idle_tree after reparent_active_queues in pd_offline
	rbd: avoid a deadlock on header_rwsem when flushing notifies
	rbd: call rbd_dev_unprobe() after unwatching and flushing notifies
	x86/Hyper-V: Free hv_panic_page when fail to register kmsg dump
	drm/ttm: flush the fence on the bo after we individualize the reservation object
	clk: Don't cache errors from clk_ops::get_phase()
	clk: at91: usb: continue if clk_hw_round_rate() return zero
	net/mlx5e: Enforce setting of a single FEC mode
	f2fs: fix the panic in do_checkpoint()
	ARM: dts: rockchip: fix vqmmc-supply property name for rk3188-bqedison2qc
	arm64: dts: allwinner: a64: Fix display clock register range
	power: supply: bq27xxx_battery: Silence deferred-probe error
	clk: tegra: Fix Tegra PMC clock out parents
	arm64: tegra: Add PCIe endpoint controllers nodes for Tegra194
	arm64: tegra: Fix Tegra194 PCIe compatible string
	arm64: dts: clearfog-gt-8k: set gigabit PHY reset deassert delay
	soc: imx: gpc: fix power up sequencing
	dma-coherent: fix integer overflow in the reserved-memory dma allocation
	rtc: 88pm860x: fix possible race condition
	NFS: alloc_nfs_open_context() must use the file cred when available
	NFSv4/pnfs: Return valid stateids in nfs_layout_find_inode_by_stateid()
	NFSv4.2: error out when relink swapfile
	ARM: dts: rockchip: fix lvds-encoder ports subnode for rk3188-bqedison2qc
	KVM: PPC: Book3S HV: Fix H_CEDE return code for nested guests
	f2fs: fix to show norecovery mount option
	phy: uniphier-usb3ss: Add Pro5 support
	NFS: direct.c: Fix memory leak of dreq when nfs_get_lock_context fails
	f2fs: Fix mount failure due to SPO after a successful online resize FS
	f2fs: Add a new CP flag to help fsck fix resize SPO issues
	s390/cpuinfo: fix wrong output when CPU0 is offline
	hibernate: Allow uswsusp to write to swap
	btrfs: add RCU locks around block group initialization
	powerpc/prom_init: Pass the "os-term" message to hypervisor
	powerpc/maple: Fix declaration made after definition
	s390/cpum_sf: Fix wrong page count in error message
	ext4: do not commit super on read-only bdev
	um: ubd: Prevent buffer overrun on command completion
	cifs: Allocate encryption header through kmalloc
	mm/hugetlb: fix build failure with HUGETLB_PAGE but not HUGEBTLBFS
	drm/nouveau/svm: check for SVM initialized before migrating
	drm/nouveau/svm: fix vma range check for migration
	include/linux/swapops.h: correct guards for non_swap_entry()
	percpu_counter: fix a data race at vm_committed_as
	compiler.h: fix error in BUILD_BUG_ON() reporting
	KVM: s390: vsie: Fix possible race when shadowing region 3 tables
	drm/nouveau: workaround runpm fail by disabling PCI power management on certain intel bridges
	leds: core: Fix warning message when init_data
	x86: ACPI: fix CPU hotplug deadlock
	csky: Fixup cpu speculative execution to IO area
	drm/amdkfd: kfree the wrong pointer
	NFS: Fix memory leaks in nfs_pageio_stop_mirroring()
	csky: Fixup get wrong psr value from phyical reg
	f2fs: fix NULL pointer dereference in f2fs_write_begin()
	ACPICA: Fixes for acpiExec namespace init file
	um: falloc.h needs to be directly included for older libc
	drm/vc4: Fix HDMI mode validation
	iommu/virtio: Fix freeing of incomplete domains
	iommu/vt-d: Fix mm reference leak
	SUNRPC: fix krb5p mount to provide large enough buffer in rq_rcvsize
	ext2: fix empty body warnings when -Wextra is used
	iommu/vt-d: Silence RCU-list debugging warning in dmar_find_atsr()
	iommu/vt-d: Fix page request descriptor size
	ext2: fix debug reference to ext2_xattr_cache
	sunrpc: Fix gss_unwrap_resp_integ() again
	csky: Fixup init_fpu compile warning with __init
	power: supply: axp288_fuel_gauge: Broaden vendor check for Intel Compute Sticks.
	libnvdimm: Out of bounds read in __nd_ioctl()
	iommu/amd: Fix the configuration of GCR3 table root pointer
	f2fs: fix to wait all node page writeback
	drm/nouveau/gr/gp107,gp108: implement workaround for HW hanging during init
	net: dsa: bcm_sf2: Fix overflow checks
	dma-debug: fix displaying of dma allocation type
	fbdev: potential information leak in do_fb_ioctl()
	ARM: dts: sunxi: Fix DE2 clocks register range
	iio: si1133: read 24-bit signed integer for measurement
	fbmem: Adjust indentation in fb_prepare_logo and fb_blank
	tty: evh_bytechan: Fix out of bounds accesses
	locktorture: Print ratio of acquisitions, not failures
	mtd: rawnand: free the nand_device object
	mtd: spinand: Explicitly use MTD_OPS_RAW to write the bad block marker to OOB
	docs: Fix path to MTD command line partition parser
	mtd: lpddr: Fix a double free in probe()
	mtd: phram: fix a double free issue in error path
	KEYS: Don't write out to userspace while holding key semaphore
	bpf: fix buggy r0 retval refinement for tracing helpers
	bpf: Test_verifier, bpf_get_stack return value add <0
	bpf: Test_progs, add test to catch retval refine error handling
	bpf, test_verifier: switch bpf_get_stack's 0 s> r8 test
	Linux 5.4.35

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I702aba533097c8533c12561c7f1a51f3a96f6f09
2020-04-23 11:15:10 +02:00
Greg Kroah-Hartman
0c418786cb Linux 5.4.35 2020-04-23 10:36:46 +02:00
Daniel Borkmann
a801a05ca7 bpf, test_verifier: switch bpf_get_stack's 0 s> r8 test
[ no upstream commit ]

Switch the comparison, so that is_branch_taken() will recognize that below
branch is never taken:

  [...]
  17: [...] R1_w=inv0 [...] R8_w=inv(id=0,smin_value=-2147483648,smax_value=-1,umin_value=18446744071562067968,var_off=(0xffffffff80000000; 0x7fffffff)) [...]
  17: (67) r8 <<= 32
  18: [...] R8_w=inv(id=0,smax_value=-4294967296,umin_value=9223372036854775808,umax_value=18446744069414584320,var_off=(0x8000000000000000; 0x7fffffff00000000)) [...]
  18: (c7) r8 s>>= 32
  19: [...] R8_w=inv(id=0,smin_value=-2147483648,smax_value=-1,umin_value=18446744071562067968,var_off=(0xffffffff80000000; 0x7fffffff)) [...]
  19: (6d) if r1 s> r8 goto pc+16
  [...] R1_w=inv0 [...] R8_w=inv(id=0,smin_value=-2147483648,smax_value=-1,umin_value=18446744071562067968,var_off=(0xffffffff80000000; 0x7fffffff)) [...]
  [...]

Currently we check for is_branch_taken() only if either K is source, or source
is a scalar value that is const. For upstream it would be good to extend this
properly to check whether dst is const and src not.

For the sake of the test_verifier, it is probably not needed here:

  # ./test_verifier 101
  #101/p bpf_get_stack return R0 within range OK
  Summary: 1 PASSED, 0 SKIPPED, 0 FAILED

I haven't seen this issue in test_progs* though, they are passing fine:

  # ./test_progs-no_alu32 -t get_stack
  Switching to flavor 'no_alu32' subdirectory...
  #20 get_stack_raw_tp:OK
  Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED

  # ./test_progs -t get_stack
  #20 get_stack_raw_tp:OK
  Summary: 1/0 PASSED, 0 SKIPPED, 0 FAILED

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:46 +02:00
John Fastabend
8781011a30 bpf: Test_progs, add test to catch retval refine error handling
commit d2db08c7a14e0b5eed6132baf258b80622e041a9 upstream.

Before this series the verifier would clamp return bounds of
bpf_get_stack() to [0, X] and this led the verifier to believe
that a JMP_JSLT 0 would be false and so would prune that path.

The result is anything hidden behind that JSLT would be unverified.
Add a test to catch this case by hiding an goto pc-1 behind the
check which will cause an infinite loop if not rejected.

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/158560423908.10843.11783152347709008373.stgit@john-Precision-5820-Tower
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:46 +02:00
John Fastabend
37e1cdff90 bpf: Test_verifier, bpf_get_stack return value add <0
commit 9ac26e9973bac5716a2a542e32f380c84db2b88c upstream.

With current ALU32 subreg handling and retval refine fix from last
patches we see an expected failure in test_verifier. With verbose
verifier state being printed at each step for clarity we have the
following relavent lines [I omit register states that are not
necessarily useful to see failure cause],

#101/p bpf_get_stack return R0 within range FAIL
Failed to load prog 'Success'!
[..]
14: (85) call bpf_get_stack#67
 R0_w=map_value(id=0,off=0,ks=8,vs=48,imm=0)
 R3_w=inv48
15:
 R0=inv(id=0,smax_value=48,var32_off=(0x0; 0xffffffff))
15: (b7) r1 = 0
16:
 R0=inv(id=0,smax_value=48,var32_off=(0x0; 0xffffffff))
 R1_w=inv0
16: (bf) r8 = r0
17:
 R0=inv(id=0,smax_value=48,var32_off=(0x0; 0xffffffff))
 R1_w=inv0
 R8_w=inv(id=0,smax_value=48,var32_off=(0x0; 0xffffffff))
17: (67) r8 <<= 32
18:
 R0=inv(id=0,smax_value=48,var32_off=(0x0; 0xffffffff))
 R1_w=inv0
 R8_w=inv(id=0,smax_value=9223372032559808512,
               umax_value=18446744069414584320,
               var_off=(0x0; 0xffffffff00000000),
               s32_min_value=0,
               s32_max_value=0,
               u32_max_value=0,
               var32_off=(0x0; 0x0))
18: (c7) r8 s>>= 32
19
 R0=inv(id=0,smax_value=48,var32_off=(0x0; 0xffffffff))
 R1_w=inv0
 R8_w=inv(id=0,smin_value=-2147483648,
               smax_value=2147483647,
               var32_off=(0x0; 0xffffffff))
19: (cd) if r1 s< r8 goto pc+16
 R0=inv(id=0,smax_value=48,var32_off=(0x0; 0xffffffff))
 R1_w=inv0
 R8_w=inv(id=0,smin_value=-2147483648,
               smax_value=0,
               var32_off=(0x0; 0xffffffff))
20:
 R0=inv(id=0,smax_value=48,var32_off=(0x0; 0xffffffff))
 R1_w=inv0
 R8_w=inv(id=0,smin_value=-2147483648,
               smax_value=0,
 R9=inv48
20: (1f) r9 -= r8
21: (bf) r2 = r7
22:
 R2_w=map_value(id=0,off=0,ks=8,vs=48,imm=0)
22: (0f) r2 += r8
value -2147483648 makes map_value pointer be out of bounds

After call bpf_get_stack() on line 14 and some moves we have at line 16
an r8 bound with max_value 48 but an unknown min value. This is to be
expected bpf_get_stack call can only return a max of the input size but
is free to return any negative error in the 32-bit register space. The
C helper is returning an int so will use lower 32-bits.

Lines 17 and 18 clear the top 32 bits with a left/right shift but use
ARSH so we still have worst case min bound before line 19 of -2147483648.
At this point the signed check 'r1 s< r8' meant to protect the addition
on line 22 where dst reg is a map_value pointer may very well return
true with a large negative number. Then the final line 22 will detect
this as an invalid operation and fail the program. What we want to do
is proceed only if r8 is positive non-error. So change 'r1 s< r8' to
'r1 s> r8' so that we jump if r8 is negative.

Next we will throw an error because we access past the end of the map
value. The map value size is 48 and sizeof(struct test_val) is 48 so
we walk off the end of the map value on the second call to
get bpf_get_stack(). Fix this by changing sizeof(struct test_val) to
24 by using 'sizeof(struct test_val) / 2'. After this everything passes
as expected.

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/158560426019.10843.3285429543232025187.stgit@john-Precision-5820-Tower
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:46 +02:00
Daniel Borkmann
3bd5bcafbb bpf: fix buggy r0 retval refinement for tracing helpers
[ no upstream commit ]

See the glory details in 100605035e15 ("bpf: Verifier, do_refine_retval_range
may clamp umin to 0 incorrectly") for why 849fa50662 ("bpf/verifier: refine
retval R0 state for bpf_get_stack helper") is buggy. The whole series however
is not suitable for stable since it adds significant amount [0] of verifier
complexity in order to add 32bit subreg tracking. Something simpler is needed.

Unfortunately, reverting 849fa50662 ("bpf/verifier: refine retval R0 state
for bpf_get_stack helper") or just cherry-picking 100605035e15 ("bpf: Verifier,
do_refine_retval_range may clamp umin to 0 incorrectly") is not an option since
it will break existing tracing programs badly (at least those that are using
bpf_get_stack() and bpf_probe_read_str() helpers). Not fixing it in stable is
also not an option since on 4.19 kernels an error will cause a soft-lockup due
to hitting dead-code sanitized branch since we don't hard-wire such branches
in old kernels yet. But even then for 5.x 849fa50662 ("bpf/verifier: refine
retval R0 state for bpf_get_stack helper") would cause wrong bounds on the
verifier simluation when an error is hit.

In one of the earlier iterations of mentioned patch series for upstream there
was the concern that just using smax_value in do_refine_retval_range() would
nuke bounds by subsequent <<32 >>32 shifts before the comparison against 0 [1]
which eventually led to the 32bit subreg tracking in the first place. While I
initially went for implementing the idea [1] to pattern match the two shift
operations, it turned out to be more complex than actually needed, meaning, we
could simply treat do_refine_retval_range() similarly to how we branch off
verification for conditionals or under speculation, that is, pushing a new
reg state to the stack for later verification. This means, instead of verifying
the current path with the ret_reg in [S32MIN, msize_max_value] interval where
later bounds would get nuked, we split this into two: i) for the success case
where ret_reg can be in [0, msize_max_value], and ii) for the error case with
ret_reg known to be in interval [S32MIN, -1]. Latter will preserve the bounds
during these shift patterns and can match reg < 0 test. test_progs also succeed
with this approach.

  [0] https://lore.kernel.org/bpf/158507130343.15666.8018068546764556975.stgit@john-Precision-5820-Tower/
  [1] https://lore.kernel.org/bpf/158015334199.28573.4940395881683556537.stgit@john-XPS-13-9370/T/#m2e0ad1d5949131014748b6daa48a3495e7f0456d

Fixes: 849fa50662 ("bpf/verifier: refine retval R0 state for bpf_get_stack helper")
Reported-by: Lorenzo Fontana <fontanalorenz@gmail.com>
Reported-by: Leonardo Di Donato <leodidonato@gmail.com>
Reported-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Tested-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:45 +02:00
Waiman Long
f1afcf9488 KEYS: Don't write out to userspace while holding key semaphore
commit d3ec10aa95819bff18a0d936b18884c7816d0914 upstream.

A lockdep circular locking dependency report was seen when running a
keyutils test:

[12537.027242] ======================================================
[12537.059309] WARNING: possible circular locking dependency detected
[12537.088148] 4.18.0-147.7.1.el8_1.x86_64+debug #1 Tainted: G OE    --------- -  -
[12537.125253] ------------------------------------------------------
[12537.153189] keyctl/25598 is trying to acquire lock:
[12537.175087] 000000007c39f96c (&mm->mmap_sem){++++}, at: __might_fault+0xc4/0x1b0
[12537.208365]
[12537.208365] but task is already holding lock:
[12537.234507] 000000003de5b58d (&type->lock_class){++++}, at: keyctl_read_key+0x15a/0x220
[12537.270476]
[12537.270476] which lock already depends on the new lock.
[12537.270476]
[12537.307209]
[12537.307209] the existing dependency chain (in reverse order) is:
[12537.340754]
[12537.340754] -> #3 (&type->lock_class){++++}:
[12537.367434]        down_write+0x4d/0x110
[12537.385202]        __key_link_begin+0x87/0x280
[12537.405232]        request_key_and_link+0x483/0xf70
[12537.427221]        request_key+0x3c/0x80
[12537.444839]        dns_query+0x1db/0x5a5 [dns_resolver]
[12537.468445]        dns_resolve_server_name_to_ip+0x1e1/0x4d0 [cifs]
[12537.496731]        cifs_reconnect+0xe04/0x2500 [cifs]
[12537.519418]        cifs_readv_from_socket+0x461/0x690 [cifs]
[12537.546263]        cifs_read_from_socket+0xa0/0xe0 [cifs]
[12537.573551]        cifs_demultiplex_thread+0x311/0x2db0 [cifs]
[12537.601045]        kthread+0x30c/0x3d0
[12537.617906]        ret_from_fork+0x3a/0x50
[12537.636225]
[12537.636225] -> #2 (root_key_user.cons_lock){+.+.}:
[12537.664525]        __mutex_lock+0x105/0x11f0
[12537.683734]        request_key_and_link+0x35a/0xf70
[12537.705640]        request_key+0x3c/0x80
[12537.723304]        dns_query+0x1db/0x5a5 [dns_resolver]
[12537.746773]        dns_resolve_server_name_to_ip+0x1e1/0x4d0 [cifs]
[12537.775607]        cifs_reconnect+0xe04/0x2500 [cifs]
[12537.798322]        cifs_readv_from_socket+0x461/0x690 [cifs]
[12537.823369]        cifs_read_from_socket+0xa0/0xe0 [cifs]
[12537.847262]        cifs_demultiplex_thread+0x311/0x2db0 [cifs]
[12537.873477]        kthread+0x30c/0x3d0
[12537.890281]        ret_from_fork+0x3a/0x50
[12537.908649]
[12537.908649] -> #1 (&tcp_ses->srv_mutex){+.+.}:
[12537.935225]        __mutex_lock+0x105/0x11f0
[12537.954450]        cifs_call_async+0x102/0x7f0 [cifs]
[12537.977250]        smb2_async_readv+0x6c3/0xc90 [cifs]
[12538.000659]        cifs_readpages+0x120a/0x1e50 [cifs]
[12538.023920]        read_pages+0xf5/0x560
[12538.041583]        __do_page_cache_readahead+0x41d/0x4b0
[12538.067047]        ondemand_readahead+0x44c/0xc10
[12538.092069]        filemap_fault+0xec1/0x1830
[12538.111637]        __do_fault+0x82/0x260
[12538.129216]        do_fault+0x419/0xfb0
[12538.146390]        __handle_mm_fault+0x862/0xdf0
[12538.167408]        handle_mm_fault+0x154/0x550
[12538.187401]        __do_page_fault+0x42f/0xa60
[12538.207395]        do_page_fault+0x38/0x5e0
[12538.225777]        page_fault+0x1e/0x30
[12538.243010]
[12538.243010] -> #0 (&mm->mmap_sem){++++}:
[12538.267875]        lock_acquire+0x14c/0x420
[12538.286848]        __might_fault+0x119/0x1b0
[12538.306006]        keyring_read_iterator+0x7e/0x170
[12538.327936]        assoc_array_subtree_iterate+0x97/0x280
[12538.352154]        keyring_read+0xe9/0x110
[12538.370558]        keyctl_read_key+0x1b9/0x220
[12538.391470]        do_syscall_64+0xa5/0x4b0
[12538.410511]        entry_SYSCALL_64_after_hwframe+0x6a/0xdf
[12538.435535]
[12538.435535] other info that might help us debug this:
[12538.435535]
[12538.472829] Chain exists of:
[12538.472829]   &mm->mmap_sem --> root_key_user.cons_lock --> &type->lock_class
[12538.472829]
[12538.524820]  Possible unsafe locking scenario:
[12538.524820]
[12538.551431]        CPU0                    CPU1
[12538.572654]        ----                    ----
[12538.595865]   lock(&type->lock_class);
[12538.613737]                                lock(root_key_user.cons_lock);
[12538.644234]                                lock(&type->lock_class);
[12538.672410]   lock(&mm->mmap_sem);
[12538.687758]
[12538.687758]  *** DEADLOCK ***
[12538.687758]
[12538.714455] 1 lock held by keyctl/25598:
[12538.732097]  #0: 000000003de5b58d (&type->lock_class){++++}, at: keyctl_read_key+0x15a/0x220
[12538.770573]
[12538.770573] stack backtrace:
[12538.790136] CPU: 2 PID: 25598 Comm: keyctl Kdump: loaded Tainted: G
[12538.844855] Hardware name: HP ProLiant DL360 Gen9/ProLiant DL360 Gen9, BIOS P89 12/27/2015
[12538.881963] Call Trace:
[12538.892897]  dump_stack+0x9a/0xf0
[12538.907908]  print_circular_bug.isra.25.cold.50+0x1bc/0x279
[12538.932891]  ? save_trace+0xd6/0x250
[12538.948979]  check_prev_add.constprop.32+0xc36/0x14f0
[12538.971643]  ? keyring_compare_object+0x104/0x190
[12538.992738]  ? check_usage+0x550/0x550
[12539.009845]  ? sched_clock+0x5/0x10
[12539.025484]  ? sched_clock_cpu+0x18/0x1e0
[12539.043555]  __lock_acquire+0x1f12/0x38d0
[12539.061551]  ? trace_hardirqs_on+0x10/0x10
[12539.080554]  lock_acquire+0x14c/0x420
[12539.100330]  ? __might_fault+0xc4/0x1b0
[12539.119079]  __might_fault+0x119/0x1b0
[12539.135869]  ? __might_fault+0xc4/0x1b0
[12539.153234]  keyring_read_iterator+0x7e/0x170
[12539.172787]  ? keyring_read+0x110/0x110
[12539.190059]  assoc_array_subtree_iterate+0x97/0x280
[12539.211526]  keyring_read+0xe9/0x110
[12539.227561]  ? keyring_gc_check_iterator+0xc0/0xc0
[12539.249076]  keyctl_read_key+0x1b9/0x220
[12539.266660]  do_syscall_64+0xa5/0x4b0
[12539.283091]  entry_SYSCALL_64_after_hwframe+0x6a/0xdf

One way to prevent this deadlock scenario from happening is to not
allow writing to userspace while holding the key semaphore. Instead,
an internal buffer is allocated for getting the keys out from the
read method first before copying them out to userspace without holding
the lock.

That requires taking out the __user modifier from all the relevant
read methods as well as additional changes to not use any userspace
write helpers. That is,

  1) The put_user() call is replaced by a direct copy.
  2) The copy_to_user() call is replaced by memcpy().
  3) All the fault handling code is removed.

Compiling on a x86-64 system, the size of the rxrpc_read() function is
reduced from 3795 bytes to 2384 bytes with this patch.

Fixes: ^1da177e4c3 ("Linux-2.6.12-rc2")
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Waiman Long <longman@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:45 +02:00
Wen Yang
5d53bfdce0 mtd: phram: fix a double free issue in error path
commit 49c64df880570034308e4a9a49c4bc95cf8cdb33 upstream.

The variable 'name' is released multiple times in the error path,
which may cause double free issues.
This problem is avoided by adding a goto label to release the memory
uniformly. And this change also makes the code a bit more cleaner.

Fixes: 4f678a58d3 ("mtd: fix memory leaks in phram_setup")
Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
Cc: Joern Engel <joern@lazybastard.org>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Vignesh Raghavendra <vigneshr@ti.com>
Cc: linux-mtd@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200318153156.25612-1-wenyang@linux.alibaba.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:45 +02:00
Dan Carpenter
4191ebe1fc mtd: lpddr: Fix a double free in probe()
commit 4da0ea71ea934af18db4c63396ba2af1a679ef02 upstream.

This function is only called from lpddr_probe().  We free "lpddr" both
here and in the caller, so it's a double free.  The best place to free
"lpddr" is in lpddr_probe() so let's delete this one.

Fixes: 8dc004395d ("[MTD] LPDDR qinfo probing.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200228092554.o57igp3nqhyvf66t@kili.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:45 +02:00
Jonathan Neuschäfer
7d4adb1d3c docs: Fix path to MTD command line partition parser
commit fb2511247dc4061fd122d0195838278a4a0b7b59 upstream.

cmdlinepart.c has been moved to drivers/mtd/parsers/.

Fixes: a3f12a35c9 ("mtd: parsers: Move CMDLINE parser")
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:45 +02:00
Frieder Schrempf
318d5088fd mtd: spinand: Explicitly use MTD_OPS_RAW to write the bad block marker to OOB
commit 621a7b780bd8b7054647d53d5071961f2c9e0873 upstream.

When writing the bad block marker to the OOB area the access mode
should be set to MTD_OPS_RAW as it is done for reading the marker.
Currently this only works because req.mode is initialized to
MTD_OPS_PLACE_OOB (0) and spinand_write_to_cache_op() checks for
req.mode != MTD_OPS_AUTO_OOB.

Fix this by explicitly setting req.mode to MTD_OPS_RAW.

Fixes: 7529df4652 ("mtd: nand: Add core infrastructure to support SPI NANDs")
Signed-off-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200218100432.32433-3-frieder.schrempf@kontron.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:44 +02:00
Christophe Kerello
700bccb8e9 mtd: rawnand: free the nand_device object
commit 009264605cdf1b12962c3a46f75818d05452e890 upstream.

This patch releases the resources allocated in nanddev_init function.

Fixes: a7ab085d7c ("mtd: rawnand: Initialize the nand_device object")
Signed-off-by: Christophe Kerello <christophe.kerello@st.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/1579767768-32295-1-git-send-email-christophe.kerello@st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:44 +02:00
Paul E. McKenney
0c72ec11d8 locktorture: Print ratio of acquisitions, not failures
commit 80c503e0e68fbe271680ab48f0fe29bc034b01b7 upstream.

The __torture_print_stats() function in locktorture.c carefully
initializes local variable "min" to statp[0].n_lock_acquired, but
then compares it to statp[i].n_lock_fail.  Given that the .n_lock_fail
field should normally be zero, and given the initialization, it seems
reasonable to display the maximum and minimum number acquisitions
instead of miscomputing the maximum and minimum number of failures.
This commit therefore switches from failures to acquisitions.

And this turns out to be not only a day-zero bug, but entirely my
own fault.  I hate it when that happens!

Fixes: 0af3fe1efa ("locktorture: Add a lock-torture kernel module")
Reported-by: Will Deacon <will@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Acked-by: Will Deacon <will@kernel.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:44 +02:00
Stephen Rothwell
01c9e2a9fc tty: evh_bytechan: Fix out of bounds accesses
commit 3670664b5da555a2a481449b3baafff113b0ac35 upstream.

ev_byte_channel_send() assumes that its third argument is a 16 byte
array. Some places where it is called it may not be (or we can't
easily tell if it is). Newer compilers have started producing warnings
about this, so make sure we actually pass a 16 byte array.

There may be more elegant solutions to this, but the driver is quite
old and hasn't been updated in many years.

The warnings (from a powerpc allyesconfig build) are:

  In file included from include/linux/byteorder/big_endian.h:5,
                   from arch/powerpc/include/uapi/asm/byteorder.h:14,
                   from include/asm-generic/bitops/le.h:6,
                   from arch/powerpc/include/asm/bitops.h:250,
                   from include/linux/bitops.h:29,
                   from include/linux/kernel.h:12,
                   from include/asm-generic/bug.h:19,
                   from arch/powerpc/include/asm/bug.h:109,
                   from include/linux/bug.h:5,
                   from include/linux/mmdebug.h:5,
                   from include/linux/gfp.h:5,
                   from include/linux/slab.h:15,
                   from drivers/tty/ehv_bytechan.c:24:
  drivers/tty/ehv_bytechan.c: In function ‘ehv_bc_udbg_putc’:
  arch/powerpc/include/asm/epapr_hcalls.h:298:20: warning: array subscript 1 is outside array bounds of ‘const char[1]’ [-Warray-bounds]
    298 |  r6 = be32_to_cpu(p[1]);
  include/uapi/linux/byteorder/big_endian.h:40:51: note: in definition of macro ‘__be32_to_cpu’
     40 | #define __be32_to_cpu(x) ((__force __u32)(__be32)(x))
        |                                                   ^
  arch/powerpc/include/asm/epapr_hcalls.h:298:7: note: in expansion of macro ‘be32_to_cpu’
    298 |  r6 = be32_to_cpu(p[1]);
        |       ^~~~~~~~~~~
  drivers/tty/ehv_bytechan.c:166:13: note: while referencing ‘data’
    166 | static void ehv_bc_udbg_putc(char c)
        |             ^~~~~~~~~~~~~~~~

Fixes: dcd83aaff1 ("tty/powerpc: introduce the ePAPR embedded hypervisor byte channel driver")
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Tested-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
[mpe: Trim warnings from change log]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200109183912.5fcb52aa@canb.auug.org.au
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:44 +02:00
Nathan Chancellor
f656649089 fbmem: Adjust indentation in fb_prepare_logo and fb_blank
commit 93166f5f2e4dc593cff8ca77ef828ac6f148b0f3 upstream.

Clang warns:

../drivers/video/fbdev/core/fbmem.c:665:3: warning: misleading
indentation; statement is not part of the previous 'else'
[-Wmisleading-indentation]
        if (fb_logo.depth > 4 && depth > 4) {
        ^
../drivers/video/fbdev/core/fbmem.c:661:2: note: previous statement is
here
        else
        ^
../drivers/video/fbdev/core/fbmem.c:1075:3: warning: misleading
indentation; statement is not part of the previous 'if'
[-Wmisleading-indentation]
        return ret;
        ^
../drivers/video/fbdev/core/fbmem.c:1072:2: note: previous statement is
here
        if (!ret)
        ^
2 warnings generated.

This warning occurs because there are spaces before the tabs on these
lines. Normalize the indentation in these functions so that it is
consistent with the Linux kernel coding style and clang no longer warns.

Fixes: 1692b37c99 ("fbdev: Fix logo if logo depth is less than framebuffer depth")
Link: https://github.com/ClangBuiltLinux/linux/issues/825
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191218030025.10064-1-natechancellor@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:43 +02:00
Maxime Roussin-Bélanger
47e4d791d5 iio: si1133: read 24-bit signed integer for measurement
commit 328b50e9a0ad1fe8accdf8c19923deebab5e0c01 upstream.

The chip is configured in 24 bit mode. The values read from
it must always be treated as is. This fixes the issue by
replacing the previous 16 bits value by a 24 bits buffer.

This changes affects the value output by previous version of
the driver, since the least significant byte was missing.
The upper half of 16 bit values previously output are now
the upper half of a 24 bit value.

Fixes: e01e7eaf37 ("iio: light: introduce si1133")

Reported-by: Simon Goyette <simon.goyette@gmail.com>
Co-authored-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
Signed-off-by: Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com>
Signed-off-by: Guillaume Champagne <champagne.guillaume.c@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:43 +02:00
Jernej Skrabec
a2a385aae5 ARM: dts: sunxi: Fix DE2 clocks register range
commit da180322582bd9db07f29e6d4a2d170afde0703f upstream.

As it can be seen from DE2 manual, clock range is 0x10000.

Fix it.

Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Fixes: 73f122c827 ("ARM: dts: sun8i: a83t: Add display pipeline")
Fixes: 05a43a262d ("ARM: dts: sun8i: r40: Add HDMI pipeline")
Fixes: 21b2992093 ("ARM: sun8i: v3s: add device nodes for DE2 display pipeline")
Fixes: d8c6f1f029 ("ARM: sun8i: h3/h5: add DE2 CCU device node for H3")
[wens@csie.org: added fixes tags]
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:43 +02:00
Dan Carpenter
7e141c3078 fbdev: potential information leak in do_fb_ioctl()
commit d3d19d6fc5736a798b118971935ce274f7deaa82 upstream.

The "fix" struct has a 2 byte hole after ->ywrapstep and the
"fix = info->fix;" assignment doesn't necessarily clear it.  It depends
on the compiler.  The solution is just to replace the assignment with an
memcpy().

Fixes: 1f5e31d7e5 ("fbmem: don't call copy_from/to_user() with mutex held")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Andrea Righi <righi.andrea@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Peter Rosin <peda@axentia.se>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200113100132.ixpaymordi24n3av@kili.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:43 +02:00
Grygorii Strashko
f093874687 dma-debug: fix displaying of dma allocation type
commit 9bb50ed7470944238ec8e30a94ef096caf9056ee upstream.

The commit 2e05ea5cdc ("dma-mapping: implement dma_map_single_attrs using
dma_map_page_attrs") removed "dma_debug_page" enum, but missed to update
type2name string table. This causes incorrect displaying of dma allocation
type.
Fix it by removing "page" string from type2name string table and switch to
use named initializers.

Before (dma_alloc_coherent()):
k3-ringacc 4b800000.ringacc: scather-gather idx 2208 P=d1140000 N=d114 D=d1140000 L=40 DMA_BIDIRECTIONAL dma map error check not applicable
k3-ringacc 4b800000.ringacc: scather-gather idx 2216 P=d1150000 N=d115 D=d1150000 L=40 DMA_BIDIRECTIONAL dma map error check not applicable

After:
k3-ringacc 4b800000.ringacc: coherent idx 2208 P=d1140000 N=d114 D=d1140000 L=40 DMA_BIDIRECTIONAL dma map error check not applicable
k3-ringacc 4b800000.ringacc: coherent idx 2216 P=d1150000 N=d115 D=d1150000 L=40 DMA_BIDIRECTIONAL dma map error check not applicable

Fixes: 2e05ea5cdc ("dma-mapping: implement dma_map_single_attrs using dma_map_page_attrs")
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:43 +02:00
Florian Fainelli
bc69709c54 net: dsa: bcm_sf2: Fix overflow checks
commit d0802dc411f469569a537283b6f3833af47aece9 upstream.

Commit f949a12fd6 ("net: dsa: bcm_sf2: fix buffer overflow doing
set_rxnfc") tried to fix the some user controlled buffer overflows in
bcm_sf2_cfp_rule_set() and bcm_sf2_cfp_rule_del() but the fix was using
CFP_NUM_RULES, which while it is correct not to overflow the bitmaps, is
not representative of what the device actually supports. Correct that by
using bcm_sf2_cfp_rule_size() instead.

The latter subtracts the number of rules by 1, so change the checks from
greater than or equal to greater than accordingly.

Fixes: f949a12fd6 ("net: dsa: bcm_sf2: fix buffer overflow doing set_rxnfc")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-23 10:36:42 +02:00
Ben Skeggs
762d35aa90 drm/nouveau/gr/gp107,gp108: implement workaround for HW hanging during init
[ Upstream commit 028a12f5aa829b4ba6ac011530b815eda4960e89 ]

Certain boards with GP107/GP108 chipsets hang (often, but randomly) for
unknown reasons during GR initialisation.

The first tell-tale symptom of this issue is:

nouveau 0000:01:00.0: bus: MMIO read of 00000000 FAULT at 409800 [ TIMEOUT ]

appearing in dmesg, likely followed by many other failures being logged.

Karol found this WAR for the issue a while back, but efforts to isolate
the root cause and proper fix have not yielded success so far.  I've
modified the original patch to include a few more details, limit it to
GP107/GP108 by default, and added a config option to override this choice.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-23 10:36:42 +02:00
Chao Yu
a156e67acf f2fs: fix to wait all node page writeback
[ Upstream commit dc5a941223edd803f476a153abd950cc3a83c3e1 ]

There is a race condition that we may miss to wait for all node pages
writeback, fix it.

- fsync()				- shrink
 - f2fs_do_sync_file
					 - __write_node_page
					  - set_page_writeback(page#0)
					  : remove DIRTY/TOWRITE flag
  - f2fs_fsync_node_pages
  : won't find page #0 as TOWRITE flag was removeD
  - f2fs_wait_on_node_pages_writeback
  : wont' wait page #0 writeback as it was not in fsync_node_list list.
					   - f2fs_add_fsync_node_entry

Fixes: 50fa53eccf ("f2fs: fix to avoid broken of dnode block list")
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-23 10:36:42 +02:00
Adrian Huang
f08e4e70b0 iommu/amd: Fix the configuration of GCR3 table root pointer
[ Upstream commit c20f36534666e37858a14e591114d93cc1be0d34 ]

The SPA of the GCR3 table root pointer[51:31] masks 20 bits. However,
this requires 21 bits (Please see the AMD IOMMU specification).
This leads to the potential failure when the bit 51 of SPA of
the GCR3 table root pointer is 1'.

Signed-off-by: Adrian Huang <ahuang12@lenovo.com>
Fixes: 52815b7568 ("iommu/amd: Add support for IOMMUv2 domain mode")
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-23 10:36:42 +02:00
Dan Carpenter
436af737c3 libnvdimm: Out of bounds read in __nd_ioctl()
[ Upstream commit f84afbdd3a9e5e10633695677b95422572f920dc ]

The "cmd" comes from the user and it can be up to 255.  It it's more
than the number of bits in long, it results out of bounds read when we
check test_bit(cmd, &cmd_mask).  The highest valid value for "cmd" is
ND_CMD_CALL (10) so I added a compare against that.

Fixes: 62232e45f4 ("libnvdimm: control (ioctl) messages for nvdimm_bus and nvdimm devices")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200225162055.amtosfy7m35aivxg@kili.mountain
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-23 10:36:42 +02:00
Jeffery Miller
dcb122749f power: supply: axp288_fuel_gauge: Broaden vendor check for Intel Compute Sticks.
[ Upstream commit e42fe5b29ac07210297e75f36deefe54edbdbf80 ]

The Intel Compute Stick `STK1A32SC` can have a system vendor of
"Intel(R) Client Systems".
Broaden the Intel Compute Stick DMI checks so that they match "Intel
Corporation" as well as "Intel(R) Client Systems".

This fixes an issue where the STK1A32SC compute sticks were still
exposing a battery with the existing blacklist entry.

Signed-off-by: Jeffery Miller <jmiller@neverware.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-23 10:36:41 +02:00
Guo Ren
760eecac99 csky: Fixup init_fpu compile warning with __init
[ Upstream commit 12879bda3c2a974b7e4fe199a9c21f0c5f6bca04 ]

WARNING: vmlinux.o(.text+0x2366): Section mismatch in reference from the
function csky_start_secondary() to the function .init.text:init_fpu()

The function csky_start_secondary() references
the function __init init_fpu().
This is often because csky_start_secondary lacks a __init
annotation or the annotation of init_fpu is wrong.

Reported-by: Lu Chongzhi <chongzhi.lcz@alibaba-inc.com>
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-23 10:36:41 +02:00
Chuck Lever
1500c70031 sunrpc: Fix gss_unwrap_resp_integ() again
[ Upstream commit 4047aa909c4a40fceebc36fff708d465a4d3c6e2 ]

xdr_buf_read_mic() tries to find unused contiguous space in a
received xdr_buf in order to linearize the checksum for the call
to gss_verify_mic. However, the corner cases in this code are
numerous and we seem to keep missing them. I've just hit yet
another buffer overrun related to it.

This overrun is at the end of xdr_buf_read_mic():

1284         if (buf->tail[0].iov_len != 0)
1285                 mic->data = buf->tail[0].iov_base + buf->tail[0].iov_len;
1286         else
1287                 mic->data = buf->head[0].iov_base + buf->head[0].iov_len;
1288         __read_bytes_from_xdr_buf(&subbuf, mic->data, mic->len);
1289         return 0;

This logic assumes the transport has set the length of the tail
based on the size of the received message. base + len is then
supposed to be off the end of the message but still within the
actual buffer.

In fact, the length of the tail is set by the upper layer when the
Call is encoded so that the end of the tail is actually the end of
the allocated buffer itself. This causes the logic above to set
mic->data to point past the end of the receive buffer.

The "mic->data = head" arm of this if statement is no less fragile.

As near as I can tell, this has been a problem forever. I'm not sure
that minimizing au_rslack recently changed this pathology much.

So instead, let's use a more straightforward approach: kmalloc a
separate buffer to linearize the checksum. This is similar to
how gss_validate() currently works.

Coming back to this code, I had some trouble understanding what
was going on. So I've cleaned up the variable naming and added
a few comments that point back to the XDR definition in RFC 2203
to help guide future spelunkers, including myself.

As an added clean up, the functionality that was in
xdr_buf_read_mic() is folded directly into gss_unwrap_resp_integ(),
as that is its only caller.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-23 10:36:41 +02:00
Jan Kara
ddb8812a21 ext2: fix debug reference to ext2_xattr_cache
[ Upstream commit 32302085a8d90859c40cf1a5e8313f575d06ec75 ]

Fix a debug-only build error in ext2/xattr.c:

When building without extra debugging, (and with another patch that uses
no_printk() instead of <empty> for the ext2-xattr debug-print macros,
this build error happens:

../fs/ext2/xattr.c: In function ‘ext2_xattr_cache_insert’:
../fs/ext2/xattr.c:869:18: error: ‘ext2_xattr_cache’ undeclared (first use in
this function); did you mean ‘ext2_xattr_list’?
     atomic_read(&ext2_xattr_cache->c_entry_count));

Fix the problem by removing cached entry count from the debug message
since otherwise we'd have to export the mbcache structure just for that.

Fixes: be0726d33c ("ext2: convert to mbcache2")
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-23 10:36:41 +02:00
Jacob Pan
24191c8c9b iommu/vt-d: Fix page request descriptor size
[ Upstream commit 52355fb1919ef7ed9a38e0f3de6e928de1f57217 ]

Intel VT-d might support PRS (Page Reqest Support) when it's
running in the scalable mode. Each page request descriptor
occupies 32 bytes and is 32-bytes aligned. The page request
descriptor offset mask should be 32-bytes aligned.

Fixes: 5b438f4ba3 ("iommu/vt-d: Support page request in scalable mode")
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Liu Yi L <yi.l.liu@intel.com>
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-23 10:36:41 +02:00
Qian Cai
a5a1d567a0 iommu/vt-d: Silence RCU-list debugging warning in dmar_find_atsr()
[ Upstream commit c6f4ebdeba4cff590594df931ff1ee610c426431 ]

dmar_find_atsr() calls list_for_each_entry_rcu() outside of an RCU read
side critical section but with dmar_global_lock held. Silence this
false positive.

 drivers/iommu/intel-iommu.c:4504 RCU-list traversed in non-reader section!!
 1 lock held by swapper/0/1:
 #0: ffffffff9755bee8 (dmar_global_lock){+.+.}, at: intel_iommu_init+0x1a6/0xe19

 Call Trace:
  dump_stack+0xa4/0xfe
  lockdep_rcu_suspicious+0xeb/0xf5
  dmar_find_atsr+0x1ab/0x1c0
  dmar_parse_one_atsr+0x64/0x220
  dmar_walk_remapping_entries+0x130/0x380
  dmar_table_init+0x166/0x243
  intel_iommu_init+0x1ab/0xe19
  pci_iommu_init+0x1a/0x44
  do_one_initcall+0xae/0x4d0
  kernel_init_freeable+0x412/0x4c5
  kernel_init+0x19/0x193

Signed-off-by: Qian Cai <cai@lca.pw>
Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-23 10:36:40 +02:00
Randy Dunlap
21439dff91 ext2: fix empty body warnings when -Wextra is used
[ Upstream commit 44a52022e7f15cbaab957df1c14f7a4f527ef7cf ]

When EXT2_ATTR_DEBUG is not defined, modify the 2 debug macros
to use the no_printk() macro instead of <nothing>.
This fixes gcc warnings when -Wextra is used:

../fs/ext2/xattr.c:252:42: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
../fs/ext2/xattr.c:258:42: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
../fs/ext2/xattr.c:330:42: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
../fs/ext2/xattr.c:872:45: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]

I have verified that the only object code change (with gcc 7.5.0) is
the reversal of some instructions from 'cmp a,b' to 'cmp b,a'.

Link: https://lore.kernel.org/r/e18a7395-61fb-2093-18e8-ed4f8cf56248@infradead.org
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Jan Kara <jack@suse.com>
Cc: linux-ext4@vger.kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-23 10:36:40 +02:00
Olga Kornievskaia
d00041a48c SUNRPC: fix krb5p mount to provide large enough buffer in rq_rcvsize
[ Upstream commit df513a7711712758b9cb1a48d86712e7e1ee03f4 ]

Ever since commit 2c94b8eca1 ("SUNRPC: Use au_rslack when computing
reply buffer size"). It changed how "req->rq_rcvsize" is calculated. It
used to use au_cslack value which was nice and large and changed it to
au_rslack value which turns out to be too small.

Since 5.1, v3 mount with sec=krb5p fails against an Ontap server
because client's receive buffer it too small.

For gss krb5p, we need to account for the mic token in the verifier,
and the wrap token in the wrap token.

RFC 4121 defines:
mic token
Octet no   Name        Description
         --------------------------------------------------------------
         0..1     TOK_ID     Identification field.  Tokens emitted by
                             GSS_GetMIC() contain the hex value 04 04
                             expressed in big-endian order in this
                             field.
         2        Flags      Attributes field, as described in section
                             4.2.2.
         3..7     Filler     Contains five octets of hex value FF.
         8..15    SND_SEQ    Sequence number field in clear text,
                             expressed in big-endian order.
         16..last SGN_CKSUM  Checksum of the "to-be-signed" data and
                             octet 0..15, as described in section 4.2.4.

that's 16bytes (GSS_KRB5_TOK_HDR_LEN) + chksum

wrap token
Octet no   Name        Description
         --------------------------------------------------------------
          0..1     TOK_ID    Identification field.  Tokens emitted by
                             GSS_Wrap() contain the hex value 05 04
                             expressed in big-endian order in this
                             field.
          2        Flags     Attributes field, as described in section
                             4.2.2.
          3        Filler    Contains the hex value FF.
          4..5     EC        Contains the "extra count" field, in big-
                             endian order as described in section 4.2.3.
          6..7     RRC       Contains the "right rotation count" in big-
                             endian order, as described in section
                             4.2.5.
          8..15    SND_SEQ   Sequence number field in clear text,
                             expressed in big-endian order.
          16..last Data      Encrypted data for Wrap tokens with
                             confidentiality, or plaintext data followed
                             by the checksum for Wrap tokens without
                             confidentiality, as described in section
                             4.2.4.

Also 16bytes of header (GSS_KRB5_TOK_HDR_LEN), encrypted data, and cksum
(other things like padding)

RFC 3961 defines known cksum sizes:
Checksum type              sumtype        checksum         section or
                                value            size         reference
   ---------------------------------------------------------------------
   CRC32                            1               4           6.1.3
   rsa-md4                          2              16           6.1.2
   rsa-md4-des                      3              24           6.2.5
   des-mac                          4              16           6.2.7
   des-mac-k                        5               8           6.2.8
   rsa-md4-des-k                    6              16           6.2.6
   rsa-md5                          7              16           6.1.1
   rsa-md5-des                      8              24           6.2.4
   rsa-md5-des3                     9              24             ??
   sha1 (unkeyed)                  10              20             ??
   hmac-sha1-des3-kd               12              20            6.3
   hmac-sha1-des3                  13              20             ??
   sha1 (unkeyed)                  14              20             ??
   hmac-sha1-96-aes128             15              20         [KRB5-AES]
   hmac-sha1-96-aes256             16              20         [KRB5-AES]
   [reserved]                  0x8003               ?         [GSS-KRB5]

Linux kernel now mainly supports type 15,16 so max cksum size is 20bytes.
(GSS_KRB5_MAX_CKSUM_LEN)

Re-use already existing define of GSS_KRB5_MAX_SLACK_NEEDED that's used
for encoding the gss_wrap tokens (same tokens are used in reply).

Fixes: 2c94b8eca1 ("SUNRPC: Use au_rslack when computing reply buffer size")
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-04-23 10:36:40 +02:00