From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1949320AbcBTIAP (ORCPT ); Sat, 20 Feb 2016 03:00:15 -0500 Received: from [82.165.8.211] ([82.165.8.211]:54754 "EHLO mail.holtmann.org" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1030429AbcBTIAN (ORCPT ); Sat, 20 Feb 2016 03:00:13 -0500 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Subject: Re: [PATCH] Bluetooth: hci_core: Avoid mixing up req_complete and req_complete_skb From: Marcel Holtmann In-Reply-To: <1455920722-20892-1-git-send-email-dianders@chromium.org> Date: Sat, 20 Feb 2016 00:00:08 -0800 Cc: Johan Hedberg , "Gustavo F. Padovan" , Johan Hedberg , "David S. Miller" , BlueZ development , Network Development , linux-kernel@vger.kernel.org Content-Transfer-Encoding: 7bit Message-Id: References: <1455920722-20892-1-git-send-email-dianders@chromium.org> To: Douglas Anderson X-Mailer: Apple Mail (2.3112) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Douglas, > In commit 44d271377479 ("Bluetooth: Compress the size of struct > hci_ctrl") we squashed down the size of the structure by using a union > with the assumption that all users would use the flag to determine > whether we had a req_complete or a req_complete_skb. > > Unfortunately we had a case in hci_req_cmd_complete() where we weren't > looking at the flag. This can result in a situation where we might be > storing a hci_req_complete_skb_t in a hci_req_complete_t variable, or > vice versa. > > During some testing I found at least one case where the function > hci_req_sync_complete() was called improperly because the kernel thought > that it didn't require an SKB. Looking through the stack in kgdb I > found that it was called by hci_event_packet() and that > hci_event_packet() had both of its locals "req_complete" and > "req_complete_skb" pointing to the same place: both to > hci_req_sync_complete(). > > Let's make sure we always check the flag. > > For more details on debugging done, see . > > Fixes: 44d271377479 ("Bluetooth: Compress the size of struct hci_ctrl") > Signed-off-by: Douglas Anderson > --- > Testing was done on a Chrome OS device on kernel 3.14 w/ > bluetooth-next backports. Since I couldn't reliably reproduce the > problem, I simply confirmed that existing functionality worked. > > net/bluetooth/hci_core.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) patch has been applied to bluetooth-stable tree. Regards Marcel