Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1172069yba; Thu, 9 May 2019 11:57:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyS0yJTYFO81uzOwUQkEo9K2xG0kw3P8rP7VoHrXFrwPcuExQ6jK0s/JrbYZjEfnCWOI5Pf X-Received: by 2002:a62:62c3:: with SMTP id w186mr7421091pfb.73.1557428278303; Thu, 09 May 2019 11:57:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557428278; cv=none; d=google.com; s=arc-20160816; b=FkMj7Jorx82old9RZz3UbkEwvEQXDeG+pGthbkL1bMhoOPDjTKvuhKSkpiyc8fEggA HTP4zgZSnLbpBsYQWd2ffFI++aHV05iY7+8N2/DZ8ZYfmU5XGZRCpmEw/EBWXeVsEwKE EV0246CLplf99va9gli/OfnXGEPIu5gLmPIb9/8WpfTJ0Z658ZMqeLhqvMdBvWogvm9s LhJMqT9EoqRR9UiR6lLvEtZr/OOBsqrl7SUmj9wkSgL8JHYdXlna1xFFI+JZDkbLOZK6 e2kX1zEDJC3pwHBrUtKAxCu7kXCKUH/awRwr2jxwGVaglzCEScMauG4kw7rwwkb3djf5 B98w== 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=CwnyvQAwlRbChtqq9ktZDPjgKQzRo74/rMGt/w9oFeA=; b=H6P8QJd2VzyQjc0BnFNgto+5uIjP5FDF3oIQItcWsqMc8Cv2weHpGLhLZKYzsgOe/z qeICGDkasuJ7sSq8EsCNaFcrcUgpNkJoLgQ6N1frE9r6MqX2PZkmHVIyjN6QMQ6xMWXT D6vjZ4zI+7iMoosgWA7EvQfgZtGIYTdWw7nepx68bZP7nHhEkyBjqqlOBz0Y7rzu29vl cXP72P3+Js9cLCeojLd3/fRvMJpo4jsPLDGwsS+P7sC2Mn7spGZ3pgMvSStXhfmRbtAI kVGR4f5OltHTE51YfZyvdN5nM9jO6UxjqSbaD1OehcIVzmsDHwIaPWDXZdU4WWNxfjGE YuYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=htVXjRPd; 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 o64si3983641pfa.274.2019.05.09.11.57.42; Thu, 09 May 2019 11:57:58 -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=htVXjRPd; 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 S1729137AbfEIS4c (ORCPT + 99 others); Thu, 9 May 2019 14:56:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:49968 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728655AbfEISy5 (ORCPT ); Thu, 9 May 2019 14:54:57 -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 B6409204FD; Thu, 9 May 2019 18:54:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557428097; bh=wRPFeyce9M4vuMa0CFMDtgaGsnXeBo/NOGwadyRg36E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=htVXjRPdqMkG87c4KRn+A7yw66ktSVaO8XtZVPi+f8tlBnmes+O424Qpq4Vh+Au/V 7Q5MooLBcRsP/chF5INkWC5nVVpixBbRZMd58qa5SCTAoIZmytM/tFBlSD2WUkb5uM i91yJYvwb/pCndqr3KS/Hi7urxgXKVfsnmeeplMM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luiz Augusto von Dentz , Marcel Holtmann Subject: [PATCH 5.1 24/30] Bluetooth: Fix not initializing L2CAP tx_credits Date: Thu, 9 May 2019 20:42:56 +0200 Message-Id: <20190509181256.147670995@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190509181250.417203112@linuxfoundation.org> References: <20190509181250.417203112@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: Luiz Augusto von Dentz commit ba8f5289f706aed94cc95b15cc5b89e22062f61f upstream. l2cap_le_flowctl_init was reseting the tx_credits which works only for outgoing connection since that set the tx_credits on the response, for incoming connections that was not the case which leaves the channel without any credits causing it to be suspended. Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Marcel Holtmann Cc: stable@vger.kernel.org # 4.20+ Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/l2cap_core.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -510,12 +510,12 @@ void l2cap_chan_set_defaults(struct l2ca } EXPORT_SYMBOL_GPL(l2cap_chan_set_defaults); -static void l2cap_le_flowctl_init(struct l2cap_chan *chan) +static void l2cap_le_flowctl_init(struct l2cap_chan *chan, u16 tx_credits) { chan->sdu = NULL; chan->sdu_last_frag = NULL; chan->sdu_len = 0; - chan->tx_credits = 0; + chan->tx_credits = tx_credits; /* Derive MPS from connection MTU to stop HCI fragmentation */ chan->mps = min_t(u16, chan->imtu, chan->conn->mtu - L2CAP_HDR_SIZE); /* Give enough credits for a full packet */ @@ -1281,7 +1281,7 @@ static void l2cap_le_connect(struct l2ca if (test_and_set_bit(FLAG_LE_CONN_REQ_SENT, &chan->flags)) return; - l2cap_le_flowctl_init(chan); + l2cap_le_flowctl_init(chan, 0); req.psm = chan->psm; req.scid = cpu_to_le16(chan->scid); @@ -5532,11 +5532,10 @@ static int l2cap_le_connect_req(struct l chan->dcid = scid; chan->omtu = mtu; chan->remote_mps = mps; - chan->tx_credits = __le16_to_cpu(req->credits); __l2cap_chan_add(conn, chan); - l2cap_le_flowctl_init(chan); + l2cap_le_flowctl_init(chan, __le16_to_cpu(req->credits)); dcid = chan->scid; credits = chan->rx_credits;