Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1509765ybb; Sat, 11 Apr 2020 05:17:13 -0700 (PDT) X-Google-Smtp-Source: APiQypJNSHbYwTkFtMjoXoUOfDvhJQhoILjfeyr4D6/oO3vBaEUohgMbFzrDDMT6V3fvigP19Nzd X-Received: by 2002:a0c:fe4a:: with SMTP id u10mr1894685qvs.165.1586607432837; Sat, 11 Apr 2020 05:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586607432; cv=none; d=google.com; s=arc-20160816; b=zWgsw8zHEPf9k1X7mrH5bp+51DxC4LoL6QbdmHUdQw0Dbxo9FYdklyDPRHqK7ZhziO ZV/fv5DFKhRLZtVgXkwvwU4ysBf9n6d/Ua3ZCyuJ6ESuzIyKQMEL8+VKAID2lbKHTeKZ LubGuB0ePgysVpo+D1lqTaXg4SuB4lcaKVbvQV3vRKzIMF41+DC/W8q7ZHp/Um78HVTU WmlMIrOO7ZiCFNHAVB1uxseDHdKVCplOUSYhtiImWx/tf8V6JxEylpaG/o/bkOmv1yeA bp4id5n5cI1j5pWQ2p3ak86p8MT/HIxO3jkHlc6Maxjen8tPYyUMRRyiFgnb5NMNNWkB lpiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=MwX/IFvfBS1oN2aPw5vANZYNFnBbL4VOsVhkoury/y4=; b=HHYjowuwbk8kUjmn/N1/LstIgihIQt0318Cntm/dLqAL0xNN8UfgBOwFdMIx46hXwZ /76E1/TpSICzvWWIGQIm10qa7fn7ucl/YCKFAZGRe8JcK4Qe0E4OgFcz3wOUgyOLvI+T 8MSNDfXtqpUyqOY4pJ+H+MSJfsIHJmiMUu80RjVLivZ1HsdV9JRPdsMrKQV7Ala/Pu0E w8aMZbDnFLky3/wt9PtqzCvox+Pvi0reBt2ezsG5JgKgFkhewYrxBXtUr2hJelc1vU6L S6luVQy3pIisuVkbxw4TPq6sgIYZhjd8mHFCKg/7MtAglP3nnEBEbnoisMO7CtxEG6Mz 8Vbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LMlUKTXe; 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 z4si2966728qkd.58.2020.04.11.05.16.59; Sat, 11 Apr 2020 05:17:12 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=LMlUKTXe; 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 S1728243AbgDKMQZ (ORCPT + 99 others); Sat, 11 Apr 2020 08:16:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:50408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727528AbgDKMQN (ORCPT ); Sat, 11 Apr 2020 08:16:13 -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 DCE8E2084D; Sat, 11 Apr 2020 12:16:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586607373; bh=Jttk726tXOUzFy4Zy+whTq1rsrkJW0mjXnvp9/CaKi0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LMlUKTXeqEWBGod6wgAvObK0U/AdDz0ZL0tD3LepP55ikEQxwVwnRJ3Q3JrEBV0Tt TzdVus5bNOFZYOiqQ/xRJklH6SVPSA2hOZ8yjS2lduLQw9/iiFz7+eDRl3DzMTPaUc 6cD+yB9wD+PG9rPJPJv61O3vJXLOyNANsV4JF4/8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+4496e82090657320efc6@syzkaller.appspotmail.com, Qiujun Huang , Hillf Danton , Marcel Holtmann Subject: [PATCH 4.19 46/54] Bluetooth: RFCOMM: fix ODEBUG bug in rfcomm_dev_ioctl Date: Sat, 11 Apr 2020 14:09:28 +0200 Message-Id: <20200411115513.335400701@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200411115508.284500414@linuxfoundation.org> References: <20200411115508.284500414@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qiujun Huang commit 71811cac8532b2387b3414f7cd8fe9e497482864 upstream. Needn't call 'rfcomm_dlc_put' here, because 'rfcomm_dlc_exists' didn't increase dlc->refcnt. Reported-by: syzbot+4496e82090657320efc6@syzkaller.appspotmail.com Signed-off-by: Qiujun Huang Suggested-by: Hillf Danton Signed-off-by: Marcel Holtmann Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/rfcomm/tty.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c @@ -413,10 +413,8 @@ static int __rfcomm_create_dev(struct so dlc = rfcomm_dlc_exists(&req.src, &req.dst, req.channel); if (IS_ERR(dlc)) return PTR_ERR(dlc); - else if (dlc) { - rfcomm_dlc_put(dlc); + if (dlc) return -EBUSY; - } dlc = rfcomm_dlc_alloc(GFP_KERNEL); if (!dlc) return -ENOMEM;