Return-Path: Date: Wed, 15 Aug 2012 01:07:32 -0300 From: Gustavo Padovan To: Andre Guedes Cc: linux-bluetooth@vger.kernel.org Subject: Re: [PATCH] Bluetooth: Fix use-after-free bug in SMP Message-ID: <20120815040732.GB3344@joana> References: <1343864055-23154-1-git-send-email-andre.guedes@openbossa.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1343864055-23154-1-git-send-email-andre.guedes@openbossa.org> Sender: linux-bluetooth-owner@vger.kernel.org List-ID: Hi Andre, * Andre Guedes [2012-08-01 20:34:15 -0300]: > If SMP fails, we should always cancel security_timer delayed work. > Otherwise, security_timer function may run after l2cap_conn object > has been freed. > > This patch fixes the following warning reported by ODEBUG: > > WARNING: at lib/debugobjects.c:261 debug_print_object+0x7c/0x8d() > Hardware name: Bochs > ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x27 > Modules linked in: btusb bluetooth > Pid: 440, comm: kworker/u:2 Not tainted 3.5.0-rc1+ #4 > Call Trace: > [] ? free_obj_work+0x4a/0x7f > [] warn_slowpath_common+0x7e/0x97 > [] warn_slowpath_fmt+0x41/0x43 > [] debug_print_object+0x7c/0x8d > [] ? __queue_work+0x241/0x241 > [] debug_check_no_obj_freed+0x92/0x159 > [] slab_free_hook+0x6f/0x77 > [] ? l2cap_conn_del+0x148/0x157 [bluetooth] > [] kfree+0x59/0xac > [] l2cap_conn_del+0x148/0x157 [bluetooth] > [] l2cap_recv_frame+0xa77/0xfa4 [bluetooth] > [] ? trace_hardirqs_on_caller+0x112/0x1ad > [] l2cap_recv_acldata+0xe2/0x264 [bluetooth] > [] hci_rx_work+0x235/0x33c [bluetooth] > [] ? process_one_work+0x126/0x2fe > [] process_one_work+0x185/0x2fe > [] ? process_one_work+0x126/0x2fe > [] ? lock_acquired+0x1b5/0x1cf > [] ? le_scan_work+0x11d/0x11d [bluetooth] > [] ? spin_lock_irq+0x9/0xb > [] worker_thread+0xcf/0x175 > [] ? rescuer_thread+0x175/0x175 > [] kthread+0x95/0x9d > [] kernel_threadi_helper+0x4/0x10 > [] ? retint_restore_args+0x13/0x13 > [] ? flush_kthread_worker+0xdb/0xdb > [] ? gs_change+0x13/0x13 > > This bug can be reproduced using hctool lecc or l2test tools and > bluetoothd not running. > > Signed-off-by: Andre Guedes > --- > net/bluetooth/smp.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) Patch has been applied to bluetooth.git. Thanks. Gustavo