Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2411765imj; Mon, 18 Feb 2019 05:38:48 -0800 (PST) X-Google-Smtp-Source: AHgI3IaJIZ7MznoDTv8RWGxQ0lmkALWdQQmFVkjBdoGllrChFY9ASzz1/SjKLsWnQ164fDaY6nFu X-Received: by 2002:a62:4bd5:: with SMTP id d82mr23807993pfj.85.1550497128392; Mon, 18 Feb 2019 05:38:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550497128; cv=none; d=google.com; s=arc-20160816; b=n0p4b+7vqZhU9r85M7RHdYOGoeXAaPemZhCNtc2LoiMl4+fcxdTMtCmrLLLA6ObNrP D19KqgnYiXGXyOBRB54qygzHwKZHGF+FKzcOlR0VUQNZwFcvui6xQXFZKy62QWzmIJKe Dqdgo2eWMjNbscleDUOHRIrvMjQBGG7n9mAAW10kw8Uy2wFxLWwtxDmKOUVVkxxq2FAZ Ux3+NO1cTVeP3b2gazJzY6/WiiwqJyzF2fDdIqQGCor2hdXOmjOm4ZpOi6gjivKF1Iio RCuRNEVbQD7BOa5DJj0/76MH3waNmsUMMN4iDECtJ2jWpQvBmhCAkB0yChMZWCMd/vmZ xxcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=VSz/PTqGD1j3OopbA/YjqNveyGZLP6LYVh5OuAwQN28=; b=eOy1AEGhNhRXkWiLBA5GMg77fhbKWgFsSWjHiDQmf9zad1OzmWDICXXITD2mdgaoSD jVfsOvzPxAiNZ+piOQT41qxUayf15KUTaZf5bYPGfwQv9H7FKqFO/F8VepL4geKEHNkp bw28vK9/uquNRrVjKw8hngIbRvq0RhIpmPQDmkW3xY7g3MqQxY16yYyz+dg0LSuvQRt7 a0JwtOZZpupmKjq57A/DvqMfcSJBP+sJQD72QqyUsBf5a/e/0F3zaTd7EL+1OC1vpidV btIeqbWG1Qn/Sts43a952KrAjTmAap3OG9ACrzdqDySXFePAn997NashNSLv+741PNf5 yugQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e9si12962798pgk.173.2019.02.18.05.38.32; Mon, 18 Feb 2019 05:38:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729781AbfBRMzd (ORCPT + 99 others); Mon, 18 Feb 2019 07:55:33 -0500 Received: from coyote.holtmann.net ([212.227.132.17]:51072 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726302AbfBRMzc (ORCPT ); Mon, 18 Feb 2019 07:55:32 -0500 Received: from marcel-macpro.fritz.box (p4FF9F361.dip0.t-ipconnect.de [79.249.243.97]) by mail.holtmann.org (Postfix) with ESMTPSA id 5602BCF2C7; Mon, 18 Feb 2019 14:03:24 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: Re: [PATCH] Bluetooth: hci_ldisc: Initialize hci_dev before open() From: Marcel Holtmann In-Reply-To: <20190206175416.4627-1-jcline@redhat.com> Date: Mon, 18 Feb 2019 13:55:30 +0100 Cc: Johan Hedberg , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+257790c15bcdef6fe00c@syzkaller.appspotmail.com Content-Transfer-Encoding: 7bit Message-Id: <37BAD6CD-1A0C-4DF2-95E0-2D75D7A75DB8@holtmann.org> References: <20190206175416.4627-1-jcline@redhat.com> To: Jeremy Cline X-Mailer: Apple Mail (2.3445.102.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jeremy, > The hci_dev struct hdev is referenced in work queues and timers started > by open() in some protocols. This creates a race between the > initialization function and the work or timer which can result hdev > being dereferenced while it is still null. > > The syzbot report contains a reliable reproducer which causes a null > pointer dereference of hdev in hci_uart_write_work() by making the > memory allocation for hdev fail. > > To fix this, ensure hdev is valid from before calling a protocol's > open() until after calling a protocol's close(). > > Reported-by: syzbot+257790c15bcdef6fe00c@syzkaller.appspotmail.com > Signed-off-by: Jeremy Cline > --- > drivers/bluetooth/hci_ldisc.c | 21 ++++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) patch has been applied to bluetooth-next tree. Regards Marcel