Received: by 10.223.185.116 with SMTP id b49csp395347wrg; Fri, 16 Feb 2018 00:27:06 -0800 (PST) X-Google-Smtp-Source: AH8x226djzqPwIbi+KYrOCJ3J+IQQIHQQRun+Kwuf3eCHFQ+UNs3r0KhdDLTsQeVkZ5gfnAeGJFV X-Received: by 10.98.208.3 with SMTP id p3mr5373986pfg.8.1518769626755; Fri, 16 Feb 2018 00:27:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518769626; cv=none; d=google.com; s=arc-20160816; b=o/H/eBzvXpvrg/i0MX6ElG8PFG0fNw7g/xlQDo78R+tFkSB2yRYMJiNsVYdx7jvtb6 acIK2WUPcnAABh/ZmxvFQ5t/acsL1tSg9dCsGs8+neoortZVG0Feb9tPT7geXLPFv9xI k8Apiwp5H6OL937dvajdzopJW/oXsUGzAw7hJkCbhdtYga2L6WLFYKJVAt1I5BXxyPl2 mx4fhJ789s1bRZZI8hW5kasepnB2Z0ADWDPlFUp+Q2tuFunUdmXGJBM87unLMgJAqnV3 5uNGqYrVmwSrosAGTmjNwY6TeKzR612kilEZDzHGBa0yk4LKkUHl+sWWScp07/RNCyCu ekZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=OdxgEVWn751qvsFvLhPu3sscrwpz8d0isO+U11BCxW0=; b=vHXsZPR6uEna2RTPeUiTLsky11FkHqKQJAHJTqgd2dVG7XAd5TNZJJAGi12aJ9GNkb lSTrljaTnQLqDu3STymV0SoFIK6/wM/hWpMKiK7TNX7teMz977FeNuYvPP2LRpBAbeuQ 3q+lxqQPi5eFGoysudRrtWy9trdpwlRy2OvPYhX+lnjqjpG7a+dQEw2QmWjDwwEUGXK8 PmHe6GoGDVp+kr+3tpvkeU3lRW4hHVALyuxpmcl9ax9JBDajckUJ4O0X4S+4NCHgtkTQ Lzust74AQpoHh9D9JUkYPQVE2WZBvl6089s2mKs6yrOmjWS9BN7k2rBgcNVUUkIO5/qt NSMQ== 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 z11-v6si1337294plo.811.2018.02.16.00.26.52; Fri, 16 Feb 2018 00:27:06 -0800 (PST) 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 S1425844AbeBOQZG (ORCPT + 99 others); Thu, 15 Feb 2018 11:25:06 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:33962 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033257AbeBOPnV (ORCPT ); Thu, 15 Feb 2018 10:43:21 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 63C2E1182; Thu, 15 Feb 2018 15:43:20 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tejun Heo , Ivan Vecera , Al Viro Subject: [PATCH 4.15 104/202] kernfs: fix regression in kernfs_fop_write caused by wrong type Date: Thu, 15 Feb 2018 16:16:44 +0100 Message-Id: <20180215151718.713009147@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ivan Vecera commit ba87977a49913129962af8ac35b0e13e0fa4382d upstream. Commit b7ce40cff0b9 ("kernfs: cache atomic_write_len in kernfs_open_file") changes type of local variable 'len' from ssize_t to size_t. This change caused that the *ppos value is updated also when the previous write callback failed. Mentioned snippet: ... len = ops->write(...); <- return value can be negative ... if (len > 0) <- true here in this case *ppos += len; ... Fixes: b7ce40cff0b9 ("kernfs: cache atomic_write_len in kernfs_open_file") Acked-by: Tejun Heo Signed-off-by: Ivan Vecera Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman --- fs/kernfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/kernfs/file.c +++ b/fs/kernfs/file.c @@ -275,7 +275,7 @@ static ssize_t kernfs_fop_write(struct f { struct kernfs_open_file *of = kernfs_of(file); const struct kernfs_ops *ops; - size_t len; + ssize_t len; char *buf; if (of->atomic_write_len) {