Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1974033ima; Thu, 25 Oct 2018 07:48:01 -0700 (PDT) X-Google-Smtp-Source: AJdET5eX7pl8M0Yz7BaCw9yOpey+gO3SLVMzjafe6/jHYnVjo0msxI3GEyhP3cihIi1c+FPTpZwv X-Received: by 2002:a17:902:4e25:: with SMTP id f34-v6mr1762293ple.43.1540478881238; Thu, 25 Oct 2018 07:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540478881; cv=none; d=google.com; s=arc-20160816; b=zDGcHFRLbGWduuyqBuHfrhynRW2vRl44jgcgQnmmBgIs6jZDqTmoajOQYoeIQ/JR26 tzklMJrRMCKjinWyBi+KEwKonG3XTpH/OdC/R003RUbarssez/VXBy6QrLEaSwqKuJHT CCQZ3IAQz4/Gp0BMRjsd5hXps1CJzy9rcY7SP5Ux92WX9N4okrHyCCNUGLsAb79cbhjc qdQ/NTChM5gc2JvNQZvv+qMwb4fXSntA4cKqZXiN6cuQ3ehzLEJMbu3FG7MttV1YN1/Z LzBBE6E0+uzNYevL4tZmfy9B/e4ZsNAiUrL7N8C1vH4Tfxowmx8MZ7aifSH2KkgQQdnF tKwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=2PnmLZyXbrgRwrlQUif5L8cFJVcBWRFavJ4JJxuTk8E=; b=tWbRVF6hgmen93pQ6fDxh4Wa4iBH3us3K1vbbStjFQ7uBfDN6eUWN3/5CMRFBZmFym yYk1/CeHVg/oi83a65/ZPLDuG5js7yWlRmYDbMuGpZz5o0V6jmtISebFlmPoxqJMolIW KmLVAvzHvDUKt6OuYiTvy/l7aeqzt/hXVPPlZRB9VIwKtXi+r+lY0j83mxqhvEWj0xoI oK3ooLpq2zlVyrfDMagO+GGO494s+cKe7nsjVsr9KA1pCRQGIl9ZEyulZgfxOla0AQWG J81UzN+hhhQoyH/GrUq8Jy6DYh7gOJuORAm3/Xwru4/MNmAlaFl3WaEAOZ/svF4inrgB 7dug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sIpT5Vtc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y190-v6si8301548pfy.147.2018.10.25.07.47.44; Thu, 25 Oct 2018 07:48:01 -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=sIpT5Vtc; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728025AbeJYXSW (ORCPT + 99 others); Thu, 25 Oct 2018 19:18:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:52474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727781AbeJYWn6 (ORCPT ); Thu, 25 Oct 2018 18:43:58 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 03CB92054F; Thu, 25 Oct 2018 14:11:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540476663; bh=226aN9mZBFXH7rJIjAk2+e+Iv0fmnLYMuL9nyU2tCSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sIpT5Vtc0W4oWSGDLP/qaHaWcXDQ08Sn6E/edst7fAXCrTBBeATXKagThX0no6Omx 1jrqnyl6wSHSVMq17NvsO3ikSN/8vtVl1ZhVItlXU04R3BnkAr3yw2qfJvNAvxzmkK K8abyBgNB3FVJRJbUHT7sxYKigHqieuN23gCJp7g= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Dan Williams , Vishal Verma , Sasha Levin Subject: [PATCH AUTOSEL 4.14 05/46] tools/testing/nvdimm: unit test clear-error commands Date: Thu, 25 Oct 2018 10:10:12 -0400 Message-Id: <20181025141053.213330-5-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141053.213330-1-sashal@kernel.org> References: <20181025141053.213330-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Williams [ Upstream commit fb2a1748355161e050e9f49f1ea9a0ae707a148b ] Validate command parsing in acpi_nfit_ctl for the clear error command. This tests for a crash condition introduced by commit 4b27db7e26cd "acpi, nfit: add support for the _LSI, _LSR, and _LSW label methods". Cc: Vishal Verma Signed-off-by: Dan Williams Signed-off-by: Sasha Levin --- tools/testing/nvdimm/test/nfit.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c index bef419d4266d..3ad0b3a3317b 100644 --- a/tools/testing/nvdimm/test/nfit.c +++ b/tools/testing/nvdimm/test/nfit.c @@ -1589,6 +1589,7 @@ static int nfit_ctl_test(struct device *dev) unsigned long mask, cmd_size, offset; union { struct nd_cmd_get_config_size cfg_size; + struct nd_cmd_clear_error clear_err; struct nd_cmd_ars_status ars_stat; struct nd_cmd_ars_cap ars_cap; char buf[sizeof(struct nd_cmd_ars_status) @@ -1767,6 +1768,23 @@ static int nfit_ctl_test(struct device *dev) return -EIO; } + /* test clear error */ + cmd_size = sizeof(cmds.clear_err); + cmds.clear_err = (struct nd_cmd_clear_error) { + .length = 512, + .cleared = 512, + }; + rc = setup_result(cmds.buf, cmd_size); + if (rc) + return rc; + rc = acpi_nfit_ctl(&acpi_desc->nd_desc, NULL, ND_CMD_CLEAR_ERROR, + cmds.buf, cmd_size, &cmd_rc); + if (rc < 0 || cmd_rc) { + dev_dbg(dev, "%s: failed at: %d rc: %d cmd_rc: %d\n", + __func__, __LINE__, rc, cmd_rc); + return -EIO; + } + return 0; } -- 2.17.1