/********************************************************************* * * Filename: irlan_common.h * Version: 0.8 * Description: IrDA LAN access layer * Status: Experimental. * Author: Dag Brattli * Created at: Sun Aug 31 20:14:37 1997 * Modified at: Sun Oct 31 19:41:24 1999 * Modified by: Dag Brattli * * Copyright (c) 1998-1999 Dag Brattli , * All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * Neither Dag Brattli nor University of Tromsø admit liability nor * provide warranty for any of this software. This material is * provided "AS-IS" and at no charge. * ********************************************************************/ #ifndef IRLAN_H #define IRLAN_H #include /* for HZ */ #include #include #include #include #include #include #define IRLAN_MTU 1518 #define IRLAN_TIMEOUT 10*HZ /* 10 seconds */ /* Command packet types */ #define CMD_GET_PROVIDER_INFO 0 #define CMD_GET_MEDIA_CHAR 1 #define CMD_OPEN_DATA_CHANNEL 2 #define CMD_CLOSE_DATA_CHAN 3 #define CMD_RECONNECT_DATA_CHAN 4 #define CMD_FILTER_OPERATION 5 /* Some responses */ #define RSP_SUCCESS 0 #define RSP_INSUFFICIENT_RESOURCES 1 #define RSP_INVALID_COMMAND_FORMAT 2 #define RSP_COMMAND_NOT_SUPPORTED 3 #define RSP_PARAM_NOT_SUPPORTED 4 #define RSP_VALUE_NOT_SUPPORTED 5 #define RSP_NOT_OPEN 6 #define RSP_AUTHENTICATION_REQUIRED 7 #define RSP_INVALID_PASSWORD 8 #define RSP_PROTOCOL_ERROR 9 #define RSP_ASYNCHRONOUS_ERROR 255 /* Media types */ #define MEDIA_802_3 1 #define MEDIA_802_5 2 /* Filter parameters */ #define DATA_CHAN 1 #define FILTER_TYPE 2 #define FILTER_MODE 3 /* Filter types */ #define IRLAN_DIRECTED 0x01 #define IRLAN_FUNCTIONAL 0x02 #define IRLAN_GROUP 0x04 #define IRLAN_MAC_FRAME 0x08 #define IRLAN_MULTICAST 0x10 #define IRLAN_BROADCAST 0x20 #define IRLAN_IPX_SOCKET 0x40 /* Filter modes */ #define ALL 1 #define FILTER 2 #define NONE 3 /* Filter operations */ #define GET 1 #define CLEAR 2 #define ADD 3 #define REMOVE 4 #define DYNAMIC 5 /* Access types */ #define ACCESS_DIRECT 1 #define ACCESS_PEER 2 #define ACCESS_HOSTED 3 #define IRLAN_BYTE 0 #define IRLAN_SHORT 1 #define IRLAN_ARRAY 2 /* IrLAN sits on top if IrTTP */ #define IRLAN_MAX_HEADER (TTP_HEADER+LMP_HEADER) /* 1 byte for the command code and 1 byte for the parameter count */ #define IRLAN_CMD_HEADER 2 #define IRLAN_STRING_PARAMETER_LEN(name, value) (1 + strlen((name)) + 2 \ + strlen ((value))) #define IRLAN_BYTE_PARAMETER_LEN(name) (1 + strlen((name)) + 2 + 1) #define IRLAN_SHORT_PARAMETER_LEN(name) (1 + strlen((name)) + 2 + 2) /* * IrLAN client */ struct irlan_client_cb { int state; int open_retries; struct tsap_cb *tsap_ctrl; __u32 max_sdu_size; __u8 max_header_size; int access_type; /* Access type of provider */ __u8 reconnect_key[255]; __u8 key_len; __u16 recv_arb_val; __u16 max_frame; int filter_type; int unicast_open; int broadcast_open; int tx_busy; struct sk_buff_head txq; /* Transmit control queue */ struct iriap_cb *iriap; struct timer_list kick_timer; }; /* * IrLAN provider */ struct irlan_provider_cb { int state; struct tsap_cb *tsap_ctrl; __u32 max_sdu_size; __u8 max_header_size; /* * Store some values here which are used by the provider to parse * the filter operations */ int data_chan; int filter_type; int filter_mode; int filter_operation; int filter_entry; int access_type; /* Access type */ __u16 send_arb_val; __u8 mac_address[ETH_ALEN]; /* Generated MAC address for peer device */ }; /* * IrLAN control block */ struct irlan_cb { int magic; struct list_head dev_list; struct net_device *dev; /* Ethernet device structure*/ __u32 saddr; /* Source device address */ __u32 daddr; /* Destination device address */ int disconnect_reason; /* Why we got disconnected */ int media; /* Media type */ __u8 version[2]; /* IrLAN version */ struct tsap_cb *tsap_data; /* Data TSAP */ int use_udata; /* Use Unit Data transfers */ __u8 stsap_sel_data; /* Source data TSAP selector */ __u8 dtsap_sel_data; /* Destination data TSAP selector */ __u8 dtsap_sel_ctrl; /* Destination ctrl TSAP selector */ struct irlan_client_cb client; /* Client specific fields */ struct irlan_provider_cb provider; /* Provider specific fields */ __u32 max_sdu_size; __u8 max_header_size; wait_queue_head_t open_wait; struct timer_list watchdog_timer; }; void irlan_close(struct irlan_cb *self); void irlan_close_tsaps(struct irlan_cb *self); int irlan_register_netdev(struct irlan_cb *self); void irlan_ias_register(struct irlan_cb *self, __u8 tsap_sel); void irlan_start_watchdog_timer(struct irlan_cb *self, int timeout); void irlan_open_data_tsap(struct irlan_cb *self); int irlan_run_ctrl_tx_queue(struct irlan_cb *self); struct irlan_cb *irlan_get_any(void); void irlan_get_provider_info(struct irlan_cb *self); void irlan_get_media_char(struct irlan_cb *self); void irlan_open_data_channel(struct irlan_cb *self); void irlan_close_data_channel(struct irlan_cb *self); void irlan_set_multicast_filter(struct irlan_cb *self, int status); void irlan_set_broadcast_filter(struct irlan_cb *self, int status); int irlan_insert_byte_param(struct sk_buff *skb, char *param, __u8 value); int irlan_insert_short_param(struct sk_buff *skb, char *param, __u16 value); int irlan_insert_string_param(struct sk_buff *skb, char *param, char *value); int irlan_insert_array_param(struct sk_buff *skb, char *name, __u8 *value, __u16 value_len); int irlan_extract_param(__u8 *buf, char *name, char *value, __u16 *len); #endif Solve this by only freeing the event in the atomic ioctl when it allocated its own event. This has been broken twice. The first time when the code was introduced, but only in the corner case when an event is allocated, but more crtc's were included by atomic check and then failing. This can mostly happen when you do an atomic modeset in i915 and the display clock is changed, which forces all crtc's to be included to the state. This has been broken worse by adding in-fences support, which caused the double free to be done unconditionally. [IGT] kms_rotation_crc: starting subtest primary-rotation-180 ============================================================================= BUG kmalloc-128 (Tainted: G U ): Object already free ----------------------------------------------------------------------------- Disabling lock debugging due to kernel taint INFO: Allocated in drm_atomic_helper_setup_commit+0x285/0x2f0 [drm_kms_helper] age=0 cpu=3 pid=1529 ___slab_alloc+0x308/0x3b0 __slab_alloc+0xd/0x20 kmem_cache_alloc_trace+0x92/0x1c0 drm_atomic_helper_setup_commit+0x285/0x2f0 [drm_kms_helper] intel_atomic_commit+0x35/0x4f0 [i915] drm_atomic_commit+0x46/0x50 [drm] drm_mode_atomic_ioctl+0x7d4/0xab0 [drm] drm_ioctl+0x2b3/0x490 [drm] do_vfs_ioctl+0x69c/0x700 SyS_ioctl+0x4e/0x80 entry_SYSCALL_64_fastpath+0x13/0x94 INFO: Freed in drm_event_cancel_free+0xa3/0xb0 [drm] age=0 cpu=3 pid=1529 __slab_free+0x48/0x2e0 kfree+0x159/0x1a0 drm_event_cancel_free+0xa3/0xb0 [drm] drm_mode_atomic_ioctl+0x86d/0xab0 [drm] drm_ioctl+0x2b3/0x490 [drm] do_vfs_ioctl+0x69c/0x700 SyS_ioctl+0x4e/0x80 entry_SYSCALL_64_fastpath+0x13/0x94 INFO: Slab 0xffffde1f0997b080 objects=17 used=2 fp=0xffff92fb65ec2578 flags=0x200000000008101 INFO: Object 0xffff92fb65ec2578 @offset=1400 fp=0xffff92fb65ec2ae8 Redzone ffff92fb65ec2570: bb bb bb bb bb bb bb bb ........ Object ffff92fb65ec2578: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ffff92fb65ec2588: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ffff92fb65ec2598: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ffff92fb65ec25a8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ffff92fb65ec25b8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ffff92fb65ec25c8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ffff92fb65ec25d8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk Object ffff92fb65ec25e8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5 kkkkkkkkkkkkkkk. Redzone ffff92fb65ec25f8: bb bb bb bb bb bb bb bb ........ Padding ffff92fb65ec2738: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ CPU: 3 PID: 180 Comm: kworker/3:2 Tainted: G BU 4.10.0-rc6-patser+ #5039 Hardware name: /NUC5PPYB, BIOS PYBSWCEL.86A.0031.2015.0601.1712 06/01/2015 Workqueue: events intel_atomic_helper_free_state [i915] Call Trace: dump_stack+0x4d/0x6d print_trailer+0x20c/0x220 free_debug_processing+0x1c6/0x330 ? drm_atomic_state_default_clear+0xf7/0x1c0 [drm] __slab_free+0x48/0x2e0 ? drm_atomic_state_default_clear+0xf7/0x1c0 [drm] kfree+0x159/0x1a0 drm_atomic_state_default_clear+0xf7/0x1c0 [drm] ? drm_atomic_state_clear+0x30/0x30 [drm] intel_atomic_state_clear+0xd/0x20 [i915] drm_atomic_state_clear+0x1a/0x30 [drm] __drm_atomic_state_free+0x13/0x60 [drm] intel_atomic_helper_free_state+0x5d/0x70 [i915] process_one_work+0x260/0x4a0 worker_thread+0x2d1/0x4f0 kthread+0x127/0x130 ? process_one_work+0x4a0/0x4a0 ? kthread_stop+0x120/0x120 ret_from_fork+0x29/0x40 FIX kmalloc-128: Object at 0xffff92fb65ec2578 not freed Fixes: 3b24f7d67581 ("drm/atomic: Add struct drm_crtc_commit to track async updates") Fixes: 9626014258a5 ("drm/fence: add in-fences support") Cc: <stable@vger.kernel.org> # v4.8+ Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Gustavo Padovan <gustavo.padovan@collabora.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1485854725-27640-1-git-send-email-maarten.lankhorst@linux.intel.com
Diffstat (limited to 'sound/soc/codecs/wm9081.h')