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=-28.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 ADFA7C433DB for ; Wed, 3 Mar 2021 14:21:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 58C7964E87 for ; Wed, 3 Mar 2021 14:21:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350856AbhCCOST (ORCPT ); Wed, 3 Mar 2021 09:18:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1842939AbhCCKWn (ORCPT ); Wed, 3 Mar 2021 05:22:43 -0500 Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02D70C061797 for ; Wed, 3 Mar 2021 00:21:54 -0800 (PST) Received: by mail-qt1-x831.google.com with SMTP id h9so7027872qtq.7 for ; Wed, 03 Mar 2021 00:21:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=u4NW6pVd55BVysXdGT9j2mN9N0jqN4OssY4y20JP5Tk=; b=fkd/r7Nk6TKGUmo21/5ScKGNyY1XZVKDnKh3WzZ5MGyaqRpNGTDS0zz71/2IGFs7+A j2RNv6QW821we60GeAaBAzInbkCNC7BnQd6E56vS0I+S47CHqX9vxSyMZQfZNgRHDSTi cVL3jknZrlyBDjsDrmeV/kYmXS++qxWtJD0VuiTK0Mu8gS4hUyczmBHYNDzKgB1pMgzW beLPBoxPckYpBHn7/BecxYr6EHkRNFdSatH5YHmRM0CQslemaboAxMbefrFm7ZfOxbvY MYoyzRW/PEaoJJ1yjlpHZ5dqyclt1JsNj/VCSBRQjyYTFvaiiIbH6CbrpKrGcJqkLGUy NINw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=u4NW6pVd55BVysXdGT9j2mN9N0jqN4OssY4y20JP5Tk=; b=YNBad35t1niUHY6xHslJ1W6Qq5tTlybIJ2vBaAIJJOyvpiqBTvbl0RGnwlIg/pOytn fVAML2LwBQSghaJk6XTLzrn1ih6DKti18jtjZeZVN3PAn/moM3Ye1bBlFaZZGhTuUfzi EztYG9CZmuHj7qBN0fxsYzFwoIdsilU6jRuHupY3ARDgJL2OOK16pKdeWYJUd+WmG2wi BSZi5uR5sTDrcMPt0nxU4CvfqbaI3EUgMn1P1xI3wxTV8rO4YH75iK/OFDfnWdIYQY5h SgFUe9ynDeWiO0xvcPe2VWb2z6F0NEggfrUpSldG/WYNjmRxakEZPeF3DhC5nMTZss0N owIQ== X-Gm-Message-State: AOAM531xE+7JrLUy3q9+sqofTkvgE7AABb8+P4/avyfCCQyY71MKbswE 2HEGy3LUf3hH4opthdVA0OtZQ8hov8neuQfSMRe4aA== X-Google-Smtp-Source: ABdhPJzr/7vquNM3mrxZ3jm9E4gx993nP272v7aKwR6SRzfJgdcxWsvvzwwDgwU0bG514ImSii708d0CzyhXNZVQE+I= X-Received: by 2002:a05:622a:c9:: with SMTP id p9mr21103012qtw.337.1614759712453; Wed, 03 Mar 2021 00:21:52 -0800 (PST) MIME-Version: 1.0 References: <20200808040440.255578-1-yepeilin.cs@gmail.com> In-Reply-To: <20200808040440.255578-1-yepeilin.cs@gmail.com> From: Dmitry Vyukov Date: Wed, 3 Mar 2021 09:21:41 +0100 Message-ID: Subject: Re: [Linux-kernel-mentees] [PATCH net] Bluetooth: Fix NULL pointer dereference in amp_read_loc_assoc_final_data() To: Peilin Ye Cc: Marcel Holtmann , Johan Hedberg , Andrei Emeltchenko , Greg Kroah-Hartman , "David S. Miller" , Jakub Kicinski , linux-kernel-mentees@lists.linuxfoundation.org, syzkaller-bugs , linux-bluetooth , netdev , LKML , gtiwari@redhat.com, syzbot+f4fb0eaafdb51c32a153@syzkaller.appspotmail.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 8, 2020 at 6:06 AM Peilin Ye wrote: > > Prevent amp_read_loc_assoc_final_data() from dereferencing `mgr` as NULL. > > Reported-and-tested-by: syzbot+f4fb0eaafdb51c32a153@syzkaller.appspotmail.com > Fixes: 9495b2ee757f ("Bluetooth: AMP: Process Chan Selected event") > Signed-off-by: Peilin Ye > --- > net/bluetooth/amp.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c > index 9c711f0dfae3..be2d469d6369 100644 > --- a/net/bluetooth/amp.c > +++ b/net/bluetooth/amp.c > @@ -297,6 +297,9 @@ void amp_read_loc_assoc_final_data(struct hci_dev *hdev, > struct hci_request req; > int err; > > + if (!mgr) > + return; > + > cp.phy_handle = hcon->handle; > cp.len_so_far = cpu_to_le16(0); > cp.max_len = cpu_to_le16(hdev->amp_assoc_size); Not sure what happened here, but the merged patch somehow has a different author and no Reported-by tag: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e8bd76ede155fd54d8c41d045dda43cd3174d506 so let's tell syzbot what fixed it manually: #syz fix: Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data 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=-17.5 required=3.0 tests=BAYES_00,DATE_IN_PAST_12_24, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,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 C6C6BC433E0 for ; Wed, 3 Mar 2021 23:42:57 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (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 4F65B60C41 for ; Wed, 3 Mar 2021 23:42:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4F65B60C41 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=lists.linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-kernel-mentees-bounces@lists.linuxfoundation.org Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 1060F40196; Wed, 3 Mar 2021 23:42:57 +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 0WXVkxddzJ81; Wed, 3 Mar 2021 23:42:56 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTP id DC45340185; Wed, 3 Mar 2021 23:42:55 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B9D39C000A; Wed, 3 Mar 2021 23:42:55 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2E9B7C0001 for ; Wed, 3 Mar 2021 23:42:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 07DA984342 for ; Wed, 3 Mar 2021 23:42:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=google.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DlIJZwUYmccK for ; Wed, 3 Mar 2021 23:42:52 +0000 (UTC) X-Greylist: delayed 12:27:29 by SQLgrey-1.8.0 Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by smtp1.osuosl.org (Postfix) with ESMTPS id 259C48433E for ; Wed, 3 Mar 2021 23:42:51 +0000 (UTC) Received: by mail-qk1-x72b.google.com with SMTP id l4so11218173qkl.0 for ; Wed, 03 Mar 2021 15:42:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=u4NW6pVd55BVysXdGT9j2mN9N0jqN4OssY4y20JP5Tk=; b=fkd/r7Nk6TKGUmo21/5ScKGNyY1XZVKDnKh3WzZ5MGyaqRpNGTDS0zz71/2IGFs7+A j2RNv6QW821we60GeAaBAzInbkCNC7BnQd6E56vS0I+S47CHqX9vxSyMZQfZNgRHDSTi cVL3jknZrlyBDjsDrmeV/kYmXS++qxWtJD0VuiTK0Mu8gS4hUyczmBHYNDzKgB1pMgzW beLPBoxPckYpBHn7/BecxYr6EHkRNFdSatH5YHmRM0CQslemaboAxMbefrFm7ZfOxbvY MYoyzRW/PEaoJJ1yjlpHZ5dqyclt1JsNj/VCSBRQjyYTFvaiiIbH6CbrpKrGcJqkLGUy NINw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=u4NW6pVd55BVysXdGT9j2mN9N0jqN4OssY4y20JP5Tk=; b=eTZyLJ3j+YCUvOMruYpQTZxhr6RwIXQi6AJ8CeU+kkPrv/NR1FhzF8qQ3OK2+rkgbI tM70b0c63EvpBxec1c7D64C7y/SK3WyUT867vg+AeXYvJgZaZSy8xH7KAYCmTY2LLfH5 lga+BRa3Fxl9Y5k5JGIUhxA2U37NrGOWovlnzZYYVxTWCdWc4KSAzhi3nsn9RlsE29/n K7PCQEkDfd3MttvLLbiKIgbapl0okLOq7IvcUqo/AP9iB/m34JGpMlO7ksIGwfTyJY+M y+vLQBKycWx7eewbp/lnBIzsRh5pETZR0LqQtM9Cnif8KWQY+ev+NU1QxajEYsKt3HDF t30g== X-Gm-Message-State: AOAM531V9BShnM8atobZru8etkz1l5r0E4TzRkUq8zmT8QCdWXpfYA6G mE5A8nWD1ysFLCvKlj+5uthB6uGhllqhlTlLlvzZJae/G27eMA== X-Google-Smtp-Source: ABdhPJzr/7vquNM3mrxZ3jm9E4gx993nP272v7aKwR6SRzfJgdcxWsvvzwwDgwU0bG514ImSii708d0CzyhXNZVQE+I= X-Received: by 2002:a05:622a:c9:: with SMTP id p9mr21103012qtw.337.1614759712453; Wed, 03 Mar 2021 00:21:52 -0800 (PST) MIME-Version: 1.0 References: <20200808040440.255578-1-yepeilin.cs@gmail.com> In-Reply-To: <20200808040440.255578-1-yepeilin.cs@gmail.com> Date: Wed, 3 Mar 2021 09:21:41 +0100 Message-ID: Subject: Re: [Linux-kernel-mentees] [PATCH net] Bluetooth: Fix NULL pointer dereference in amp_read_loc_assoc_final_data() To: Peilin Ye Cc: Johan Hedberg , Andrei Emeltchenko , gtiwari@redhat.com, Marcel Holtmann , syzkaller-bugs , LKML , linux-bluetooth , syzbot+f4fb0eaafdb51c32a153@syzkaller.appspotmail.com, netdev , 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: , From: Dmitry Vyukov via Linux-kernel-mentees Reply-To: Dmitry Vyukov Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-kernel-mentees-bounces@lists.linuxfoundation.org Sender: "Linux-kernel-mentees" On Sat, Aug 8, 2020 at 6:06 AM Peilin Ye wrote: > > Prevent amp_read_loc_assoc_final_data() from dereferencing `mgr` as NULL. > > Reported-and-tested-by: syzbot+f4fb0eaafdb51c32a153@syzkaller.appspotmail.com > Fixes: 9495b2ee757f ("Bluetooth: AMP: Process Chan Selected event") > Signed-off-by: Peilin Ye > --- > net/bluetooth/amp.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c > index 9c711f0dfae3..be2d469d6369 100644 > --- a/net/bluetooth/amp.c > +++ b/net/bluetooth/amp.c > @@ -297,6 +297,9 @@ void amp_read_loc_assoc_final_data(struct hci_dev *hdev, > struct hci_request req; > int err; > > + if (!mgr) > + return; > + > cp.phy_handle = hcon->handle; > cp.len_so_far = cpu_to_le16(0); > cp.max_len = cpu_to_le16(hdev->amp_assoc_size); Not sure what happened here, but the merged patch somehow has a different author and no Reported-by tag: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e8bd76ede155fd54d8c41d045dda43cd3174d506 so let's tell syzbot what fixed it manually: #syz fix: Bluetooth: Fix null pointer dereference in amp_read_loc_assoc_final_data _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees