/* * Copyright(c) 2007 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. * * Maintained at www.Open-FCoE.org */ #ifndef _FC_NS_H_ #define _FC_NS_H_ #include /* * Fibre Channel Services - Name Service (dNS) * From T11.org FC-GS-2 Rev 5.3 November 1998. */ /* * Common-transport sub-type for Name Server. */ #define FC_NS_SUBTYPE 2 /* fs_ct_hdr.ct_fs_subtype */ /* * Name server Requests. * Note: this is an incomplete list, some unused requests are omitted. */ enum fc_ns_req { FC_NS_GA_NXT = 0x0100, /* get all next */ FC_NS_GI_A = 0x0101, /* get identifiers - scope */ FC_NS_GPN_ID = 0x0112, /* get port name by ID */ FC_NS_GNN_ID = 0x0113, /* get node name by ID */ FC_NS_GSPN_ID = 0x0118, /* get symbolic port name */ FC_NS_GID_PN = 0x0121, /* get ID for port name */ FC_NS_GID_NN = 0x0131, /* get IDs for node name */ FC_NS_GID_FT = 0x0171, /* get IDs by FC4 type */ FC_NS_GPN_FT = 0x0172, /* get port names by FC4 type */ FC_NS_GID_PT = 0x01a1, /* get IDs by port type */ FC_NS_RPN_ID = 0x0212, /* reg port name for ID */ FC_NS_RNN_ID = 0x0213, /* reg node name for ID */ FC_NS_RFT_ID = 0x0217, /* reg FC4 type for ID */ FC_NS_RSPN_ID = 0x0218, /* reg symbolic port name */ FC_NS_RFF_ID = 0x021f, /* reg FC4 Features for ID */ FC_NS_RSNN_NN = 0x0239, /* reg symbolic node name */ }; /* * Port type values. */ enum fc_ns_pt { FC_NS_UNID_PORT = 0x00, /* unidentified */ FC_NS_N_PORT = 0x01, /* N port */ FC_NS_NL_PORT = 0x02, /* NL port */ FC_NS_FNL_PORT = 0x03, /* F/NL port */ FC_NS_NX_PORT = 0x7f, /* Nx port */ FC_NS_F_PORT = 0x81, /* F port */ FC_NS_FL_PORT = 0x82, /* FL port */ FC_NS_E_PORT = 0x84, /* E port */ FC_NS_B_PORT = 0x85, /* B port */ }; /* * Port type object. */ struct fc_ns_pt_obj { __u8 pt_type; }; /* * Port ID object */ struct fc_ns_fid { __u8 fp_flags; /* flags for responses only */ __u8 fp_fid[3]; }; /* * fp_flags in port ID object, for responses only. */ #define FC_NS_FID_LAST 0x80 /* last object */ /* * FC4-types object. */ #define FC_NS_TYPES 256 /* number of possible FC-4 types */ #define FC_NS_BPW 32 /* bits per word in bitmap */ struct fc_ns_fts { __be32 ff_type_map[FC_NS_TYPES / FC_NS_BPW]; /* bitmap of FC-4 types */ }; /* * FC4-features object. */ struct fc_ns_ff { __be32 fd_feat[FC_NS_TYPES * 4 / FC_NS_BPW]; /* 4-bits per FC-type */ }; /* * GID_PT request. */ struct fc_ns_gid_pt { __u8 fn_pt_type; __u8 fn_domain_id_scope; __u8 fn_area_id_scope; __u8 fn_resvd; }; /* * GID_FT or GPN_FT request. */ struct fc_ns_gid_ft { __u8 fn_resvd; __u8 fn_domain_id_scope; __u8 fn_area_id_scope; __u8 fn_fc4_type; }; /* * GPN_FT response. */ struct fc_gpn_ft_resp { __u8 fp_flags; /* see fp_flags definitions above */ __u8 fp_fid[3]; /* port ID */ __be32 fp_resvd; __be64 fp_wwpn; /* port name */ }; /* * GID_PN request */ struct fc_ns_gid_pn { __be64 fn_wwpn; /* port name */ }; /* * GID_PN response or GSPN_ID request */ struct fc_gid_pn_resp { __u8 fp_resvd; __u8 fp_fid[3]; /* port ID */ }; /* * GSPN_ID response */ struct fc_gspn_resp { __u8 fp_name_len; char fp_name[]; }; /* * RFT_ID request - register FC-4 types for ID. */ struct fc_ns_rft_id { struct fc_ns_fid fr_fid; /* port ID object */ struct fc_ns_fts fr_fts; /* FC-4 types object */ }; /* * RPN_ID request - register port name for ID. * RNN_ID request - register node name for ID. */ struct fc_ns_rn_id { struct fc_ns_fid fr_fid; /* port ID object */ __be64 fr_wwn; /* node name or port name */ } __attribute__((__packed__)); /* * RSNN_NN request - register symbolic node name */ struct fc_ns_rsnn { __be64 fr_wwn; /* node name */ __u8 fr_name_len; char fr_name[]; } __attribute__((__packed__)); /* * RSPN_ID request - register symbolic port name */ struct fc_ns_rspn { struct fc_ns_fid fr_fid; /* port ID object */ __u8 fr_name_len; char fr_name[]; } __attribute__((__packed__)); /* * RFF_ID request - register FC-4 Features for ID. */ struct fc_ns_rff_id { struct fc_ns_fid fr_fid; /* port ID object */ __u8 fr_resvd[2]; __u8 fr_feat; /* FC-4 Feature bits */ __u8 fr_type; /* FC-4 type */ } __attribute__((__packed__)); #endif /* _FC_NS_H_ */ >Daniel Vetter <daniel.vetter@ffwll.ch>2017-01-31 13:41:46 +0100 commit92c715fca907686f5298220ece53423e38ba3aed (patch) tree286158fdad04c9b54955350abb95d4f1c0dc860a /sound/usb/usx2y/usbusx2yaudio.c parente6e7b48b295afa5a5ab440de0a94d9ad8b3ce2d0 (diff)
drm/atomic: Fix double free in drm_atomic_state_default_clear
drm_atomic_helper_page_flip and drm_atomic_ioctl set their own events in crtc_state->event. But when it's set the event is freed in 2 places. 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/usb/usx2y/usbusx2yaudio.c')