Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2500231imm; Mon, 24 Sep 2018 05:31:55 -0700 (PDT) X-Google-Smtp-Source: ACcGV62WTFnMVm7erv5wVi4MeNR3mUhqeYRgZWPn1ompB2tRMx9yHEdDrWbl5Qy8fart/XuBOJeT X-Received: by 2002:a17:902:4d45:: with SMTP id o5-v6mr10592218plh.78.1537792315274; Mon, 24 Sep 2018 05:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792315; cv=none; d=google.com; s=arc-20160816; b=JVVY5Ff2rQ+9PWH+N/YoGJl9NwKG1BPhACO3DJG41NReAXFRX3WEomb2rNR8xVZ6V7 lPIJ0O73uWtuyJaMsWe1L52OyFp7KSGTGIY0hLhELVvbuj0gs063hJI04KQR5npLQEQZ XH2Dp25hsqGkmfqfi+1vtwGzDnW8auzlRQw2DqGOW/k1fht5CQ90+hYA2eIX6FFvKnts O1hNhzc/dciUgABQeYL1jgyXp+ah7hMfhI7WTzecmxfJIb9vdSdhJX/AjiEF1X/Baiha AkrX3BjheXODRVg1IbRy2tPKm5qdMh/eZ6iJ2QNsWcLMrw1cXza2Nt2IWdIqBnitutqf 1zZg== 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; bh=AdZf+TMXmVJjndy9PV3rUNPKmhMUi0lRW6h5sTyqIvQ=; b=ncXKFl5NwgDNOQkpq93IelBp6aLb+8d2t8FduX3N7/ta2gNeZM7/Aawl9dTv47jUXg vFL7x1e+P0Semnuz3QqWB36Sjm7idJZQzFr/XrOcIsbXgAFNkIxpNfCI14h2r39YulMo G6bAPxwMH0WYoPu6donqhPTU7q+gjdHdo6wJYAmKev3E0emNfe4zEdPYJ82sHsOd8jU0 NhNIYdqK1hxP8g8QftzAVTSgKzSBbwQ21DqXTE50NqPNl+91uGxYnRMRRn+7nq2BeMiM u6mxijJWiMuW7PmArFQ2RsLoqqtgqlO/cp03opG9fVtDHTSVPWKaKzBBWTFL1v3Ex3GJ nJ5Q== ARC-Authentication-Results: i=1; mx.google.com; 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 t1-v6si34550509plb.177.2018.09.24.05.31.39; Mon, 24 Sep 2018 05:31:55 -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; 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 S2387888AbeIXSc3 (ORCPT + 99 others); Mon, 24 Sep 2018 14:32:29 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57822 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733162AbeIXSc2 (ORCPT ); Mon, 24 Sep 2018 14:32:28 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 80DE71099; Mon, 24 Sep 2018 12:30:33 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Herrenschmidt , Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 4.18 064/235] powerpc/powernv: opal_put_chars partial write fix Date: Mon, 24 Sep 2018 13:50:50 +0200 Message-Id: <20180924113111.589473383@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Piggin [ Upstream commit bd90284cc6c1c9e8e48c8eadd0c79574fcce0b81 ] The intention here is to consume and discard the remaining buffer upon error. This works if there has not been a previous partial write. If there has been, then total_len is no longer total number of bytes to copy. total_len is always "bytes left to copy", so it should be added to written bytes. This code may not be exercised any more if partial writes will not be hit, but this is a small bugfix before a larger change. Reviewed-by: Benjamin Herrenschmidt Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/platforms/powernv/opal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -388,7 +388,7 @@ int opal_put_chars(uint32_t vtermno, con /* Closed or other error drop */ if (rc != OPAL_SUCCESS && rc != OPAL_BUSY && rc != OPAL_BUSY_EVENT) { - written = total_len; + written += total_len; break; } if (rc == OPAL_SUCCESS) {