Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp3892420ima; Mon, 4 Feb 2019 06:58:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN4QcOVBwHJtqZDEyED1/oWUbJdOZdz4UJcQxGGTwgA1fG8pJX0Im2GHBRQeCKDKsuOjpwFC X-Received: by 2002:a17:902:be11:: with SMTP id r17mr52356948pls.308.1549292280494; Mon, 04 Feb 2019 06:58:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549292280; cv=none; d=google.com; s=arc-20160816; b=F628AoVA8QYvWW3N53fIQaENGCtnqfOz+h71ou8ousrPeyWqo4gbsbQWW3OBJTbhUh l7nN4CUDdImnHzvVkhOwj/z7S9OUXu935ShRQcEAboJnof73vR4jz7DmlXVc3owvp0i8 ROhNdMKiTk8eirI/ndZB1XCbclT6kqo7FyjmfoD9Jmlmy1AlnKzz7rseeeezUFhp/JmX +Pl7osDIToXYR8U18HI/GvRi2Y13KTMxC1CWzCb6bkc802/P/JCk2uYTfeNNl3bKmy29 4Tzl8ge1dPzKD/pe55wM2dlj79yDB9KsoCnD0g2qDYwafwYrGqA0wcp370aw9waqHSbj NbeA== 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=tpi32nit3Ts4NaKlziAc/A2FzB0ZfBSUxNiJ45LE0Jw=; b=cGt7EYkZB9fl7ouXsevXFB+k/hX69i0kXsnPXzvrHGAxT89LGP5SRQZC825aFT3DVh gGOFaO1VxJfoxeglc9iIA0jBrz/QqB1Fiki3hw5yVS4ZbDhQCyJ/joS0oxyvszvCAhiR a1A1ooa+oX3tAs1PfTndcAAKD2s79ZZsPYJO5C2D25Owgt8Aapimm7KqQghIOnAHam31 okKX5Bs7H1EDKe8nt1dqS1xAqfEXQnDGvMghdmmMw/WQ+XKHr3GjAUdhHGUpDtftiNiv 8TQvRFT6eTwtkw5TFMN9f3eO+g89XRmx6jJB7BJiIId2Eu75IWtm6uD/M3526ueNMJl9 OtHQ== 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 o10si227547pgg.373.2019.02.04.06.57.44; Mon, 04 Feb 2019 06:58:00 -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 S1730912AbfBDOxV (ORCPT + 99 others); Mon, 4 Feb 2019 09:53:21 -0500 Received: from coyote.holtmann.net ([212.227.132.17]:39391 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727626AbfBDOxU (ORCPT ); Mon, 4 Feb 2019 09:53:20 -0500 Received: from marcel-macpro.fritz.box (p4FF9FD60.dip0.t-ipconnect.de [79.249.253.96]) by mail.holtmann.org (Postfix) with ESMTPSA id A2062CF173; Mon, 4 Feb 2019 16:01:06 +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: Fix decrementing reference count twice in releasing socket From: Marcel Holtmann In-Reply-To: <20190203005634.GA19908@myunghoj-Precision-5530> Date: Mon, 4 Feb 2019 15:53:16 +0100 Cc: Johan Hedberg , "David S. Miller" , linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: 7bit Message-Id: <131B7D29-1085-4DDC-8DC9-A2ABE533BEC4@holtmann.org> References: <20190203005634.GA19908@myunghoj-Precision-5530> To: Myungho Jung 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 Myungho, > When releasing socket, it is possible to enter hci_sock_release() and > hci_sock_dev_event(HCI_DEV_UNREG) at the same time in different thread. > The reference count of hdev should be decremented only once from one of > them but if storing hdev to local variable in hci_sock_release() before > detached from socket and setting to NULL in hci_sock_dev_event(), > hci_dev_put(hdev) is unexpectedly called twice. This is resolved by > referencing hdev from socket after bt_sock_unlink() in > hci_sock_release(). > > Reported-by: syzbot+fdc00003f4efff43bc5b@syzkaller.appspotmail.com > Signed-off-by: Myungho Jung > --- > net/bluetooth/hci_sock.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) patch has been applied to bluetooth-next tree. Regards Marcel