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=-10.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,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 6F374C433E2 for ; Thu, 10 Sep 2020 05:07:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2803F207EA for ; Thu, 10 Sep 2020 05:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599714430; bh=Lbn9xs8qkCiA5rfVxd87HIU11Jf2P/zukvdmNIBKwyI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=f6on7NWEPaVWWgDJ5RZbfqi9t0WgCAqKIrRfFgKYPYsKJ7jl+P8Hzk/6vpTnlSNb9 s2i8y5xpuDf1yiu5X2xaqCsETI0IsC/4cMtcOishY7JhCqU4jyXtHl2REgLiB6rA04 R6qQu2VjxHlegx5pLoo7QYCHCZlhO/elw6clGumI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726080AbgIJFHD (ORCPT ); Thu, 10 Sep 2020 01:07:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:34680 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725855AbgIJFHC (ORCPT ); Thu, 10 Sep 2020 01:07:02 -0400 Received: from sol.localdomain (172-10-235-113.lightspeed.sntcca.sbcglobal.net [172.10.235.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D4780207EA; Thu, 10 Sep 2020 05:07:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599714421; bh=Lbn9xs8qkCiA5rfVxd87HIU11Jf2P/zukvdmNIBKwyI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=o1BMPBgqOfPecIA0rAE70qWdPtpP8hT+87oOV2DoyELHE4VoyuGG5Vo6u54f5uUfa EX1Rk+GohPhVUaTxSJZoreGFkuRW2w9da2ZKQggM6YptawuzWTjNjYCr8ByBTz9DHf FQyaSUL31uH7WE9aZ1wQ6HmaKBEO3pKfyjYUJUlg= Date: Wed, 9 Sep 2020 22:06:59 -0700 From: Eric Biggers To: Anmol Karn Cc: marcel@holtmann.org, johan.hedberg@gmail.com, linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, netdev@vger.kernel.org, linux-bluetooth@vger.kernel.org, kuba@kernel.org, davem@davemloft.net, syzbot+0bef568258653cff272f@syzkaller.appspotmail.com Subject: Re: [PATCH] net: bluetooth: Fix null pointer dereference in hci_event_packet() Message-ID: <20200910050659.GD828@sol.localdomain> References: <20200910043424.19894-1-anmol.karan123@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200910043424.19894-1-anmol.karan123@gmail.com> Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Thu, Sep 10, 2020 at 10:04:24AM +0530, Anmol Karn wrote: > Prevent hci_phy_link_complete_evt() from dereferencing 'hcon->amp_mgr' > as NULL. Fix it by adding pointer check for it. > > Reported-and-tested-by: syzbot+0bef568258653cff272f@syzkaller.appspotmail.com > Link: https://syzkaller.appspot.com/bug?extid=0bef568258653cff272f > Signed-off-by: Anmol Karn > --- > net/bluetooth/hci_event.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c > index 4b7fc430793c..871e16804433 100644 > --- a/net/bluetooth/hci_event.c > +++ b/net/bluetooth/hci_event.c > @@ -4936,6 +4936,11 @@ static void hci_phy_link_complete_evt(struct hci_dev *hdev, > return; > } > > + if (IS_ERR_OR_NULL(hcon->amp_mgr)) { > + hci_dev_unlock(hdev); > + return; > + } > + In patches that fix a NULL pointer dereference, please include a brief explanation of why the pointer can be NULL, including what it means semantically; and why the proposed change is the best fix for the problem. Also, why IS_ERR_OR_NULL()? - Eric 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=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 CA35CC43461 for ; Thu, 10 Sep 2020 05:07:05 +0000 (UTC) Received: from silver.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 366EC207EA for ; Thu, 10 Sep 2020 05:07:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="o1BMPBgq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 366EC207EA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.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 silver.osuosl.org (Postfix) with ESMTP id 97501204F8; Thu, 10 Sep 2020 05:07:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KoVXfRQMlGkS; Thu, 10 Sep 2020 05:07:03 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id AD942204C6; Thu, 10 Sep 2020 05:07:03 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 93197C0859; Thu, 10 Sep 2020 05:07:03 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4AB44C0051 for ; Thu, 10 Sep 2020 05:07:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 33D13875D1 for ; Thu, 10 Sep 2020 05:07:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id u5x1upU5sbTI for ; Thu, 10 Sep 2020 05:07:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by hemlock.osuosl.org (Postfix) with ESMTPS id B32A3875CF for ; Thu, 10 Sep 2020 05:07:01 +0000 (UTC) Received: from sol.localdomain (172-10-235-113.lightspeed.sntcca.sbcglobal.net [172.10.235.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D4780207EA; Thu, 10 Sep 2020 05:07:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599714421; bh=Lbn9xs8qkCiA5rfVxd87HIU11Jf2P/zukvdmNIBKwyI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=o1BMPBgqOfPecIA0rAE70qWdPtpP8hT+87oOV2DoyELHE4VoyuGG5Vo6u54f5uUfa EX1Rk+GohPhVUaTxSJZoreGFkuRW2w9da2ZKQggM6YptawuzWTjNjYCr8ByBTz9DHf FQyaSUL31uH7WE9aZ1wQ6HmaKBEO3pKfyjYUJUlg= Date: Wed, 9 Sep 2020 22:06:59 -0700 From: Eric Biggers To: Anmol Karn Message-ID: <20200910050659.GD828@sol.localdomain> References: <20200910043424.19894-1-anmol.karan123@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200910043424.19894-1-anmol.karan123@gmail.com> Cc: syzbot+0bef568258653cff272f@syzkaller.appspotmail.com, johan.hedberg@gmail.com, netdev@vger.kernel.org, marcel@holtmann.org, syzkaller-bugs@googlegroups.com, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, kuba@kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, davem@davemloft.net Subject: Re: [Linux-kernel-mentees] [PATCH] net: bluetooth: Fix null pointer dereference in hci_event_packet() 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" On Thu, Sep 10, 2020 at 10:04:24AM +0530, Anmol Karn wrote: > Prevent hci_phy_link_complete_evt() from dereferencing 'hcon->amp_mgr' > as NULL. Fix it by adding pointer check for it. > > Reported-and-tested-by: syzbot+0bef568258653cff272f@syzkaller.appspotmail.com > Link: https://syzkaller.appspot.com/bug?extid=0bef568258653cff272f > Signed-off-by: Anmol Karn > --- > net/bluetooth/hci_event.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c > index 4b7fc430793c..871e16804433 100644 > --- a/net/bluetooth/hci_event.c > +++ b/net/bluetooth/hci_event.c > @@ -4936,6 +4936,11 @@ static void hci_phy_link_complete_evt(struct hci_dev *hdev, > return; > } > > + if (IS_ERR_OR_NULL(hcon->amp_mgr)) { > + hci_dev_unlock(hdev); > + return; > + } > + In patches that fix a NULL pointer dereference, please include a brief explanation of why the pointer can be NULL, including what it means semantically; and why the proposed change is the best fix for the problem. Also, why IS_ERR_OR_NULL()? - Eric _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees