Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2966073pxa; Tue, 18 Aug 2020 02:56:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9Al2P+UK3zEFvfXWpiGc9nCqdgvFtZExhF6L9NEzXEIBCd7nH4NjjbWSbJCHophB8bMDc X-Received: by 2002:aa7:dd15:: with SMTP id i21mr19146999edv.153.1597744563583; Tue, 18 Aug 2020 02:56:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597744563; cv=none; d=google.com; s=arc-20160816; b=x7hlnG6MTkrzESaINHWHYNrHUzPPZ3cV9JZyjs273rkinhqF9KjXxvGTvlUcI9WH+T azcAiy4KVAWZxSxe7mk2B3/t3Ua7h1+Uezp+1qOgKtpHsoSRtOGXfQriU6akNl5YWXPD tGjpgXALu2tMts/nCzGwAZFgqB5hiO2M2PZwKq4V7TG0A8FwN3QIHZEDciHLe+KbMxnf 53Oi5/ETSWLNr8GJroUsVsfIGqGzuBrnlFUajxIDknuZ7ywfaE/21AsDewKyPg3wBNkR UUcxTWc2hlurzch866adzsnC1HKAf33J97XoBD2P2hxmtSls7ld/aZZ77lrcu2Y0l3yg /a5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=+B8nUd8Bn6tBuadz5ebT80uH7K/1HlqKOB1rpd2wmFg=; b=eIxFQI6LSWyIsOZWIdTPkgrLNPZhQ8Lwbie8w9BskmzdOi+DNZy/xUPmRvvAfKimgT jyM/5EG20VlO4VwwgQqTLxlVa9fx0UbqfAjzP1WV+4+7erfkYSPrG3YfAzL0abGBRZa8 XuqkLf8kFfgLdN0b2cyPnxFO9QbvHowCYGuyCrLY+p5u8FbB9StCSOuktjZIonrEkVvS 5qFOqp6Y9TzNVOLkM0u/oVbLtcUeSQLhBOg0izZIC3uefxOK8/u13Im6ofZJRqj/rEN9 aH3QKC/b+ZqxpY7FXj3bj89zwammdKy9FUT1Nt0ofU8ewhewJXm2uTIeDDXeMuLnQC7r hBRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=G2nzMHix; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cf13si13187797ejb.179.2020.08.18.02.55.40; Tue, 18 Aug 2020 02:56:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=G2nzMHix; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726635AbgHRJw5 (ORCPT + 99 others); Tue, 18 Aug 2020 05:52:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:47940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726484AbgHRJwz (ORCPT ); Tue, 18 Aug 2020 05:52:55 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 B5ED420738; Tue, 18 Aug 2020 09:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597744375; bh=xdS+b75ghYmvRyp5w9RPdxKoug0EJ/G+RiOriB8x2Hk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=G2nzMHixlR6257icH9egqpc70o0BhDsW4O8+t+2Ivyzzp7ScpRlqfPKrVthkuEJst 1tngXqow2SmSDX0R9ZAAOq47rOq0J8lZ5kghwqVli8sXOW8WcX7Ee/KzcO9XXmaoY3 48Q+5RkPW2HFSN5b0NaKLDTTLHUjoTIVMufaB0oU= Date: Tue, 18 Aug 2020 11:53:18 +0200 From: Greg Kroah-Hartman To: Pavel Machek Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, syzbot+96414aa0033c363d8458@syzkaller.appspotmail.com, Lihong Kou , Marcel Holtmann , Sasha Levin Subject: Re: [PATCH 4.19 027/168] Bluetooth: add a mutex lock to avoid UAF in do_enale_set Message-ID: <20200818095318.GA57268@kroah.com> References: <20200817143733.692105228@linuxfoundation.org> <20200817143735.099152549@linuxfoundation.org> <20200818094024.GB10974@amd> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200818094024.GB10974@amd> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 18, 2020 at 11:40:25AM +0200, Pavel Machek wrote: > Hi! > > > From: Lihong Kou > > > > [ Upstream commit f9c70bdc279b191da8d60777c627702c06e4a37d ] > > > > In the case we set or free the global value listen_chan in > > different threads, we can encounter the UAF problems because > > the method is not protected by any lock, add one to avoid > > this bug. > > For this to be safe, bt_6lowpan_exit() needs same handling, no? > > Signed-off-by: Pavel Machek (CIP) > > diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c > index 9a75f9b00b51..2402ef5ac072 100644 > --- a/net/bluetooth/6lowpan.c > +++ b/net/bluetooth/6lowpan.c > @@ -1304,10 +1304,12 @@ static void __exit bt_6lowpan_exit(void) > debugfs_remove(lowpan_enable_debugfs); > debugfs_remove(lowpan_control_debugfs); > > + mutex_lock(&set_lock); > if (listen_chan) { > l2cap_chan_close(listen_chan, 0); > l2cap_chan_put(listen_chan); > } > + mutex_unlock(&set_lock); > > disconnect_devices(); > > > Why you are sending this in this format seems very odd to me, you know better...