From patchwork Wed Mar 17 23:44:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liming Sun X-Patchwork-Id: 1455128 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=qbxZx8tt; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F1JSw0s9lz9sWF; Thu, 18 Mar 2021 18:25:03 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1lMn1c-0000ED-00; Thu, 18 Mar 2021 07:24:55 +0000 Received: from mail-eopbgr770058.outbound.protection.outlook.com ([40.107.77.58] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1lMfqY-0004ev-JY for kernel-team@lists.ubuntu.com; Wed, 17 Mar 2021 23:45:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WY5HAeIL3XV4+D8hIp1ctMb1Mq7TK8MSBFluRS68Z8sbFGQfLumYixUbccfPNu15pZ6mF/zanB8/XPPfq/Gz5bDUHD6zceiq4gldGqIhqmN51QciuYbofsefJKwW5LDAlE8IY4GgXbm24W1EIC8KGrQCoUtL3R37opkZ3UyxQHGrWPqGs7Rpmu+tyQMJ4t53KQM+A+R5ynYoCpJEiRu0k3PjdXlVf4plEfU0Q9sZ7FqFif6MR9vzbI8NOVjGLEL1yJp2gxaXEZKSAGzHlQ/LrgQAtto0Ze3aLS8qABpVyUOL6J0gkRrNjiQJW42ZJwCKl9uDd1YGEAbviBNXJQMvQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UdfB62TSEHDT4P9SK8vhXUDOZ+gG899rrsMybwedhtU=; b=VkANWGfxxTyqMs2Xhk5f4iDNV+5rvxnW4PKTHG2noTjK5dy5hLzfVKz+Z0qZIVE7DE0FVNvocQXjbm8amxD5OAUdsTbf/XJOssx4XIWzyhMhbK+uUch6juzz78yS6fJBqgEMP6RHJ3QYeZEcY30RsMfYW4s/oxdfRw6hTdGGx1TYIfEM0/7L+lUHnf2xdbPRjH8Txf9OTiLFd3C8lME3W69IhtRVqj9MTFWYFbtoxQ4JS0QwtwcfC6zWBdbLn1/ERK69hU1FOg+CSfcJueJtwGghrBhReYsKOX3ARNYYDCI5wPmIOA9iVe+sBFY/mKL/6ap00Ioos7ZPqUOo0Ccybw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) smtp.rcpttodomain=lists.ubuntu.com smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UdfB62TSEHDT4P9SK8vhXUDOZ+gG899rrsMybwedhtU=; b=qbxZx8ttZ2YIu+IGDOXk/lA5TlxKBw5bFmjncQOzEimW0DXz3IfGjwjIC7Ve0z80Avc9gdlmgQEkQABQKfx9BOjqJOelgfsKGT6ZOJJSLv41rll5Y8vVZZyDleF04SXhO11hbylAB8TdgAYWORjjnN1caDzjjNLtn0xAJo0LorJ1GKqtpSqxcbglv+8r+j7cz3bgWSTPZ8e6OjiytcHEEzGaepy66xsYmjDsqDNz6ESdeSQdBf015kHwZ9j7O1v5MyHhpIbMZM+m7O+0/kZA0XfNSNWRzYds3KmpZlQxS65anbW0Ww5IWpXpPcsCWa5bLpXQ8Fqmh8IJpBm49ilOYQ== Received: from BN8PR07CA0018.namprd07.prod.outlook.com (2603:10b6:408:ac::31) by BYAPR12MB2760.namprd12.prod.outlook.com (2603:10b6:a03:72::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32; Wed, 17 Mar 2021 23:45:00 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ac:cafe::4f) by BN8PR07CA0018.outlook.office365.com (2603:10b6:408:ac::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Wed, 17 Mar 2021 23:44:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) smtp.mailfrom=nvidia.com; lists.ubuntu.com; dkim=none (message not signed) header.d=none;lists.ubuntu.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.35 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.35; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.35) by BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.3955.18 via Frontend Transport; Wed, 17 Mar 2021 23:44:59 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 17 Mar 2021 23:44:58 +0000 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 17 Mar 2021 23:44:58 +0000 Received: from vdi.nvidia.com (172.20.145.6) by mail.nvidia.com (172.20.187.15) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 17 Mar 2021 23:44:58 +0000 From: Liming Sun To: Subject: [PATCH v1 1/1] [SRU][F:linux-bluefield][PATCH 1/1] UBUNTU: SAUCE: Fix the rshim logging buffer full/wraparound issue Date: Wed, 17 Mar 2021 19:44:43 -0400 Message-ID: X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4be9014d-3dca-4dc3-12a9-08d8e99ead64 X-MS-TrafficTypeDiagnostic: BYAPR12MB2760: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:341; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BdpsWwyQVZcaW2hncuwFLCLwCH/PRzdhUSJz/1gJM1uAiGvYuINqebZBD1CHi9nCxIq0fV285u/+rpRK9AINvGgSCKVzhSB0848xlhUb4B7pHrR1DPtzbC8Ep6to94WsY3mrTWVJaSkW9Mrj4+/WgGKjw4OC0i8t3hhuX65lxPsLx9DWsWcoLZ/WPTQ9qiqOKYLRFK+AHOM4Dh9ByNltRYwykQ6aoZLd50iu4YiPWWnSHbOCXj1+vkRSn89KXVVdbp4SiiTs4EvcVc5WsETAHSrUfr259UJiDv3SEci26bJEUYimugeeEUKG5DMg5NGJIzIfQDIWEXqwoE6XecXENC/bytAolwbTwFmIhzArmcSHyGjPnPSqLufRfdF7tCmvn9UapDyXFDkdZ6+mOFWpZyfNO8uc7TkrO0HlJFo+UxcaW0XdzzpCse0ZhsFO4i1bntT/+jtigitszr0Lv5HmRY1uB5HNpQ44c6aLZVQS1sTK/5tk2O8lx4Ia9wjn24+vg6yKY/clk0wCK4OHECKj4WuQWiO4giTVtVJlseILCcP8+iKRxWTsT+mHvNhcQC2sgsEYM1WnfqAv3OjNmcbhgAizLrYCFK/zwB7Nl8wVeLQGJu7MeLrsMbQaZGfFZRfGpQmDrW7JtOb0/vz75q7rbOJJCvxjX55cbPVqAgexlrFR2WLBOQNOAedhRyoVZ3wmBoc8e0kc6OUqipByeZl0xVHE3WtdhQ5CBGtUWsgF8gKY/H6ngyhtHpdQZk6bvav31atZO2WUMaH64at3trALow== X-Forefront-Antispam-Report: CIP:216.228.112.35; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid02.nvidia.com; CAT:NONE; SFS:(4636009)(396003)(136003)(376002)(39860400002)(346002)(46966006)(36840700001)(2906002)(36860700001)(336012)(4326008)(7636003)(426003)(36756003)(70586007)(82310400003)(34020700004)(8676002)(6666004)(86362001)(107886003)(966005)(186003)(36906005)(316002)(6916009)(478600001)(2616005)(8936002)(26005)(82740400003)(83380400001)(47076005)(5660300002)(7696005)(356005)(70206006); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2021 23:44:59.4457 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4be9014d-3dca-4dc3-12a9-08d8e99ead64 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.35]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2760 X-Mailman-Approved-At: Thu, 18 Mar 2021 07:24:55 +0000 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Sun Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" Buglink: https://bugs.launchpad.net/bugs/1919847 This commit fixes the full/wraparound issue of the rshim logging buffer. When checking the total length of the message, it should count in the header (one 8-Byte word) as well. Signed-off-by: Liming Sun --- drivers/platform/mellanox/mlx-bootctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/platform/mellanox/mlx-bootctl.c b/drivers/platform/mellanox/mlx-bootctl.c index 1bc0c7b..7ec7c9a 100644 --- a/drivers/platform/mellanox/mlx-bootctl.c +++ b/drivers/platform/mellanox/mlx-bootctl.c @@ -510,9 +510,9 @@ static ssize_t rsh_log_store(struct device_driver *drv, const char *buf, /* Calculate how many words are available. */ num = (size + sizeof(u64) - 1) / sizeof(u64); idx = readq(rsh_scratch_buf_ctl); - if (idx + num >= RSH_SCRATCH_BUF_CTL_IDX_MAX) - num = RSH_SCRATCH_BUF_CTL_IDX_MAX - idx; - if (!num) + if (idx + num + 1 >= RSH_SCRATCH_BUF_CTL_IDX_MAX) + num = RSH_SCRATCH_BUF_CTL_IDX_MAX - idx - 1; + if (num <= 0) goto done; /* Write Header. */