Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9085460pxu; Mon, 28 Dec 2020 06:16:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzUqYlbZGAnrWMxIWNeksVxziMRUSsLU6rJvyxm6D0ESzVb1SEbDyfGTtbzwkNuGbpDoTfT X-Received: by 2002:a17:906:fcda:: with SMTP id qx26mr42217246ejb.213.1609165010561; Mon, 28 Dec 2020 06:16:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609165010; cv=none; d=google.com; s=arc-20160816; b=tcUtz+7bsOR4rSWeOO6gYzdmr+KBucvD6ndOSN1e6IEgVbbU2Xi5dHZWZjC1tIpxr2 PgKYYJhIlVDsTLywYgLBd/nbpRXs9s4ZYlEcNpibRgqRneliArrU8B/18L9sm6KYWtjb GdzNVmosemduBwF7AQ6AfKBIcUuwFy5fidHsqneRzkY8UmAPfSo9QT0Yc/M1G4VLdZRK SvCfeUedAx9l1yAvZH8Md2lVpPvbYjP4WcS164aamCogJ3QjN4cgdv4DKRu0om9BuTnY eMeftW4li/WR6EGdew5Ru/r7oNLqagNHwEJtPU176QBZYoDRAx3Ee/kksLEOOV+gnSYV pTag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sns1M76deSy6g/loNSb9AgTbUdmunj/m0Q3DemUuzPo=; b=DnMaYNNoXcKtrtM3vuE7jO3klmY8qVWSoFqbY3X+aodGX9QLoJGQ/rGphY7n0HgFjz T9kHgBIGurmlKx6COtQsNBqgbKDH+6/q8PsfDgdg2LzkmoaEix0S734Zk9oA9zjEXgP+ j9njQZKyCZmqH3bzyLk5ZAiN7jR4n+j/2vGllyCMvsLh/sUHp1fipOC3qYJ4HiQCpDdQ Z9mBisThwoUn2giCwmWWgoDu2wf6txV1wt9VO6+dlfzA8hmJvBw14AfYFLKCQuIuG47K +9ZJcHAzzUuX2ugY2nKkeViSQr7p29Il7MmayFae/ZUZJJmYcGlBn7rkz1U1iMcBSCap m03g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UFvWvzN0; 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=pass (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 m13si22564857edi.155.2020.12.28.06.16.28; Mon, 28 Dec 2020 06:16:50 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=UFvWvzN0; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2440198AbgL1ONg (ORCPT + 99 others); Mon, 28 Dec 2020 09:13:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:47362 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2440209AbgL1ONe (ORCPT ); Mon, 28 Dec 2020 09:13:34 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id EA8BD205CB; Mon, 28 Dec 2020 14:13:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164799; bh=zzuJMY+o0rZHf9ldOzV0e4o8kbV+3YZQxBj4RWsQ82g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UFvWvzN0vke9UUs1TibiJeMn+TVnJaXRg/zMFbQe9Ki0lVWlvft5DZfb3yiLQgSPp nfNq1XVPYkNEG6EZjime8o+eVhdXTV0UqZxCy4mY4qHtEJBP1SROR2zmsm2olUyMkb yrY+X5keTBT66JrZdQL9g/avva3wPLLGBNWJCZkE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.10 302/717] mt76: mt7663s: fix a possible ple quota underflow Date: Mon, 28 Dec 2020 13:45:00 +0100 Message-Id: <20201228125035.496787170@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lorenzo Bianconi [ Upstream commit 1c79a190e94325e01811f653f770a34e816fdd8f ] Properly account current consumed ple quota in mt7663s_tx_pick_quota routine and avoid possible underflow. Fixes: 6ef2d665f64d ("mt76: mt7663s: split mt7663s_tx_update_sched in mt7663s_tx_{pick,update}_quota") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c index 2486cda3243bc..69e38f477b1e4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/sdio_txrx.c @@ -150,7 +150,7 @@ static int mt7663s_tx_pick_quota(struct mt76_sdio *sdio, enum mt76_txq_id qid, return -EBUSY; } else { if (sdio->sched.pse_data_quota < *pse_size + pse_sz || - sdio->sched.ple_data_quota < *ple_size) + sdio->sched.ple_data_quota < *ple_size + 1) return -EBUSY; *ple_size = *ple_size + 1; -- 2.27.0