Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3821643ybi; Mon, 29 Jul 2019 13:17:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTjom5s2qjEpvGj3OycW03eygqnT0iXONrd2Oy2dvxXWk+BkBMdNtKBJ5+4Dd/NrkqxTny X-Received: by 2002:a65:44cb:: with SMTP id g11mr59912551pgs.288.1564431435456; Mon, 29 Jul 2019 13:17:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564431435; cv=none; d=google.com; s=arc-20160816; b=SWQI4xm6uNEg7g+tZ6T/vnrOw6ouiGBbIHBoarJlnsOeus1D1dYLN45WPHaqmrUNpE 4XgVyIUY3O+WWNCsJlpnwtbzD/O5xTSggEYlvYsWTSR40Gu3o6brjosvNmbD9nf/c0B4 xrpKNSMwSl/oMBYJ17whhBImdFzwIaALT5U+4LiOcOAqiRLG5iN8CnNOAbEgsQz1yXFh N7e9v3LKNhYRUZDgk9+UFM/jkYhOqbgnm8sCSBf2f3TXovMx2pwUXvVMnzZS+bW96iBt R58AOitG3FMozRTk5+W+5eHDC/0J5J7k2OS1if3Z5jVuOhxxEUb+O9KTuyKFdRxOB0IB JP9w== 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=w+X670P+QZKTkn9Fq3Yy648+/G2TvCAOjFjWkCrqA1E=; b=dWY2mrej66Za25EZohQJll3d1YfGw8yxU5xl7Z3tRSUvb8vQrVvud/+q+noKWH9keZ Fq09GjsbgkS3nnvrItw+NHVy/fe8kjeIPmc9SoR+Z1EqCpzH3RieI41BqTaxdS0snJd1 /vCdma9VJ6IqQ6bUs1629rV6PfwRXa7hlX4EnAvaS3RR4FvVe4NMF3UBLKp2ApNVrGBP e49jLnUGvJ8jIT1qa/A0EUZ1dSff2tGs/MTV8/PXaRNsXgAzSFJu82JTCOkfSAO2y+W6 7otCLQSlD1qWGmTjfRjcRGk9SRhSEKGh7b7TFm/PEzUaqLgkaVMLdRbLUAbWB6NfcNXj sx8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AlyfkWeS; 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 a9si28638964pfn.104.2019.07.29.13.17.00; Mon, 29 Jul 2019 13:17:15 -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=AlyfkWeS; 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 S1727620AbfG2TZZ (ORCPT + 99 others); Mon, 29 Jul 2019 15:25:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:37636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388281AbfG2TZV (ORCPT ); Mon, 29 Jul 2019 15:25:21 -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 0B1B920C01; Mon, 29 Jul 2019 19:25:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428320; bh=Tu2SmrOsQqUe9ACAyBEFF/lSAeSN+5gPhxezGHmRkwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AlyfkWeStX+XCQuHAenWfRWAXcKIc9lltneRO5Ai8XGaWSD6byFIfarKqGGmYXkwH P9wWTJ5n0gJwYqSp5mXpc7pc7cU4LhXXjfn4/44kwXxzxGpcNHw7BLQU8cpETtciV6 ufpiesH9HBj9PT8Whi/4zAngSG7chTganyeYIbUM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Borislav Petkov , Tony Luck , linux-edac , Sasha Levin Subject: [PATCH 4.14 038/293] RAS/CEC: Fix pfn insertion Date: Mon, 29 Jul 2019 21:18:49 +0200 Message-Id: <20190729190825.269610232@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 [ Upstream commit 6d8e294bf5f0e85c34e8b14b064e2965f53f38b0 ] When inserting random PFNs for debugging the CEC through (debugfs)/ras/cec/pfn, depending on the return value of pfn_set(), multiple values get inserted per a single write. That is because simple_attr_write() interprets a retval of 0 as success and claims the whole input. However, pfn_set() returns the cec_add_elem() value, which, if > 0 and smaller than the whole input length, makes glibc continue issuing the write syscall until there's input left: pfn_set simple_attr_write debugfs_attr_write full_proxy_write vfs_write ksys_write do_syscall_64 entry_SYSCALL_64_after_hwframe leading to those repeated calls. Return 0 to fix that. Signed-off-by: Borislav Petkov Cc: Tony Luck Cc: linux-edac Signed-off-by: Sasha Levin --- drivers/ras/cec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c index c7205cdcc11a..97cf40a522be 100644 --- a/drivers/ras/cec.c +++ b/drivers/ras/cec.c @@ -373,7 +373,9 @@ static int pfn_set(void *data, u64 val) { *(u64 *)data = val; - return cec_add_elem(val); + cec_add_elem(val); + + return 0; } DEFINE_DEBUGFS_ATTRIBUTE(pfn_ops, u64_get, pfn_set, "0x%llx\n"); -- 2.20.1