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=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_RED 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 D5037C47082 for ; Wed, 26 May 2021 15:50:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B7A7261028 for ; Wed, 26 May 2021 15:50:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233352AbhEZPvx (ORCPT ); Wed, 26 May 2021 11:51:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:36496 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235370AbhEZPvU (ORCPT ); Wed, 26 May 2021 11:51:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BF93161184; Wed, 26 May 2021 15:49:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622044178; bh=uyJM6RmL4VFOIpdrgSUrinaAJ058EDjZ1XMhpJ0RipY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dUE8zMqAXEPdRvMBVtCaDDomtwIkS8UIos2Vn2ggDOzI/gUAhah5INMyy7aya8QqM HCbdOp6JRcQKBvw1x4BnScLAESoZEsHBW5n3VBfgBneBehi14KtfrEBo1clXAhCt7C CpvUh1hf2Lz1Xfu2tKbSZwg0+L96lQxa14FY+up8= Date: Wed, 26 May 2021 17:49:35 +0200 From: Greg Kroah-Hartman To: Marcel Holtmann Cc: Johan Hedberg , Luiz Augusto von Dentz , linma , "David S. Miller" , Jakub Kicinski , linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Hao Xiong , stable Subject: Re: [PATCH] Bluetooth: fix the erroneous flush_work() order Message-ID: References: <20210525114215.141988-1-gregkh@linuxfoundation.org> <87CD8C35-C7D2-4CF7-B9F9-266B3498DB94@holtmann.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87CD8C35-C7D2-4CF7-B9F9-266B3498DB94@holtmann.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 26, 2021 at 05:05:50PM +0200, Marcel Holtmann wrote: > Hi Greg, > > > From: linma > > this needs a real name, but I could fix that on git am as well. "Lin Ma" > > In the cleanup routine for failed initialization of HCI device, > > the flush_work(&hdev->rx_work) need to be finished before the > > flush_work(&hdev->cmd_work). Otherwise, the hci_rx_work() can > > possibly invoke new cmd_work and cause a bug, like double free, > > in late processings. > > > > This was assigned CVE-2021-3564. > > > > This patch reorder the flush_work() to fix this bug. > > > > Cc: Marcel Holtmann > > Cc: Johan Hedberg > > Cc: Luiz Augusto von Dentz > > Cc: "David S. Miller" > > Cc: Jakub Kicinski > > Cc: linux-bluetooth@vger.kernel.org > > Cc: netdev@vger.kernel.org > > Cc: linux-kernel@vger.kernel.org > > Signed-off-by: Lin Ma > > Signed-off-by: Hao Xiong > > Cc: stable > > Signed-off-by: Greg Kroah-Hartman > > --- > > net/bluetooth/hci_core.c | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c > > index fd12f1652bdf..88aa32f44e68 100644 > > --- a/net/bluetooth/hci_core.c > > +++ b/net/bluetooth/hci_core.c > > @@ -1610,8 +1610,13 @@ static int hci_dev_do_open(struct hci_dev *hdev) > > } else { > > /* Init failed, cleanup */ > > flush_work(&hdev->tx_work); > > - flush_work(&hdev->cmd_work); > > + /* > > + * Since hci_rx_work() is possible to awake new cmd_work > > + * it should be flushed first to avoid unexpected call of > > + * hci_cmd_work() > > + */ > > So everything in net/ uses the comment coding style enforced with --strict. See v2 please. thanks, greg k-h