From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD78BC432BE for ; Thu, 29 Jul 2021 11:38:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A2DCE60249 for ; Thu, 29 Jul 2021 11:38:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234171AbhG2Li4 convert rfc822-to-8bit (ORCPT ); Thu, 29 Jul 2021 07:38:56 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:54595 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231576AbhG2Liz (ORCPT ); Thu, 29 Jul 2021 07:38:55 -0400 Received: from smtpclient.apple (p5b3d23f8.dip0.t-ipconnect.de [91.61.35.248]) by mail.holtmann.org (Postfix) with ESMTPSA id 8BF25CED14; Thu, 29 Jul 2021 13:38:50 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: [PATCH v2] Bluetooth: skip invalid hci_sync_conn_complete_evt From: Marcel Holtmann In-Reply-To: <20210728075105.415214-1-desmondcheongzx@gmail.com> Date: Thu, 29 Jul 2021 13:38:50 +0200 Cc: Johan Hedberg , Luiz Augusto von Dentz , "David S. Miller" , Jakub Kicinski , linux-bluetooth , "open list:NETWORKING [GENERAL]" , open list , skhan@linuxfoundation.org, Greg Kroah-Hartman , linux-kernel-mentees@lists.linuxfoundation.org, syzbot+66264bf2fd0476be7e6c@syzkaller.appspotmail.com Content-Transfer-Encoding: 8BIT Message-Id: <72819085-5564-4386-AD94-2901083CDE65@holtmann.org> References: <20210728075105.415214-1-desmondcheongzx@gmail.com> To: Desmond Cheong Zhi Xi X-Mailer: Apple Mail (2.3654.100.0.2.22) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Desmond, > Syzbot reported a corrupted list in kobject_add_internal [1]. This > happens when multiple HCI_EV_SYNC_CONN_COMPLETE event packets with > status 0 are sent for the same HCI connection. This causes us to > register the device more than once which corrupts the kset list. > > As this is forbidden behavior, we add a check for whether we're > trying to process the same HCI_EV_SYNC_CONN_COMPLETE event multiple > times for one connection. If that's the case, the event is invalid, so > we report an error that the device is misbehaving, and ignore the > packet. > > Link: https://syzkaller.appspot.com/bug?extid=66264bf2fd0476be7e6c [1] > Reported-by: syzbot+66264bf2fd0476be7e6c@syzkaller.appspotmail.com > Tested-by: syzbot+66264bf2fd0476be7e6c@syzkaller.appspotmail.com > Signed-off-by: Desmond Cheong Zhi Xi > --- > > v1 -> v2: > - Added more comments to explain the reasoning behind the new check, and > a bt_dev_err message upon detecting the invalid event. As suggested by > Marcel Holtmann. > > net/bluetooth/hci_event.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) I shortened the error message and then applied your patch to bluetooth-next tree. Regards Marcel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9725C43214 for ; Thu, 29 Jul 2021 11:38:56 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3487D60F22 for ; Thu, 29 Jul 2021 11:38:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3487D60F22 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=holtmann.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.linuxfoundation.org Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id ED58C60665; Thu, 29 Jul 2021 11:38:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FBNmLY75bJlq; Thu, 29 Jul 2021 11:38:55 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 417936061F; Thu, 29 Jul 2021 11:38:55 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 25F19C0010; Thu, 29 Jul 2021 11:38:55 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id B426FC000E for ; Thu, 29 Jul 2021 11:38:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 9A92B401F0 for ; Thu, 29 Jul 2021 11:38:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qHwa1Vf3mZtc for ; Thu, 29 Jul 2021 11:38:52 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from mail.holtmann.org (coyote.holtmann.net [212.227.132.17]) by smtp2.osuosl.org (Postfix) with ESMTP id EB6C3401BD for ; Thu, 29 Jul 2021 11:38:51 +0000 (UTC) Received: from smtpclient.apple (p5b3d23f8.dip0.t-ipconnect.de [91.61.35.248]) by mail.holtmann.org (Postfix) with ESMTPSA id 8BF25CED14; Thu, 29 Jul 2021 13:38:50 +0200 (CEST) Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.100.0.2.22\)) Subject: Re: [PATCH v2] Bluetooth: skip invalid hci_sync_conn_complete_evt From: Marcel Holtmann In-Reply-To: <20210728075105.415214-1-desmondcheongzx@gmail.com> Date: Thu, 29 Jul 2021 13:38:50 +0200 Message-Id: <72819085-5564-4386-AD94-2901083CDE65@holtmann.org> References: <20210728075105.415214-1-desmondcheongzx@gmail.com> To: Desmond Cheong Zhi Xi X-Mailer: Apple Mail (2.3654.100.0.2.22) Cc: Johan Hedberg , "open list:NETWORKING \[GENERAL\]" , syzbot+66264bf2fd0476be7e6c@syzkaller.appspotmail.com, open list , linux-bluetooth , Luiz Augusto von Dentz , Jakub Kicinski , linux-kernel-mentees@lists.linuxfoundation.org, "David S. Miller" X-BeenThere: linux-kernel-mentees@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-kernel-mentees-bounces@lists.linuxfoundation.org Sender: "Linux-kernel-mentees" Hi Desmond, > Syzbot reported a corrupted list in kobject_add_internal [1]. This > happens when multiple HCI_EV_SYNC_CONN_COMPLETE event packets with > status 0 are sent for the same HCI connection. This causes us to > register the device more than once which corrupts the kset list. > > As this is forbidden behavior, we add a check for whether we're > trying to process the same HCI_EV_SYNC_CONN_COMPLETE event multiple > times for one connection. If that's the case, the event is invalid, so > we report an error that the device is misbehaving, and ignore the > packet. > > Link: https://syzkaller.appspot.com/bug?extid=66264bf2fd0476be7e6c [1] > Reported-by: syzbot+66264bf2fd0476be7e6c@syzkaller.appspotmail.com > Tested-by: syzbot+66264bf2fd0476be7e6c@syzkaller.appspotmail.com > Signed-off-by: Desmond Cheong Zhi Xi > --- > > v1 -> v2: > - Added more comments to explain the reasoning behind the new check, and > a bt_dev_err message upon detecting the invalid event. As suggested by > Marcel Holtmann. > > net/bluetooth/hci_event.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) I shortened the error message and then applied your patch to bluetooth-next tree. Regards Marcel _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees