Received: by 10.223.185.116 with SMTP id b49csp2398873wrg; Thu, 15 Feb 2018 11:01:13 -0800 (PST) X-Google-Smtp-Source: AH8x226yO/4AWoGC+qR9ImOojVGvJT78MpHUjSjKskR4Lw68S151aAUv3KkM4SNeQrK0i+gK82jx X-Received: by 2002:a17:902:a50a:: with SMTP id s10-v6mr607422plq.107.1518721273789; Thu, 15 Feb 2018 11:01:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518721273; cv=none; d=google.com; s=arc-20160816; b=EAL7iOm993NReQDO+eU6mz7ERPPtFZY6Hi25QxsB8yImBtGRAjwdRNmfqOW1tN1Bhy LhKtacWqf4m58IPkw0pUztwdQwX8YvF6s8f9yDYdIU2ra5cr9dOvbNQH/KhsEnSnzhh8 3vmO7DLMxdlfENNqIGoUQcczIJC1nppC9SFKVwWosovgDTOuqGkldGhsAi17/nM9AUIF GKSwGMu3QCJLplBsg7XkjdILwRW2WtqssoFFl7APtDpfS76MgJ+bIDY+HcLT49whamzc rJrOOPC6FAW55mMQeFLCtIb+pw/fHN+RBlE2a+XqYRiN2du2XvvHwGItrwgjWCGWpnZ4 kw3Q== 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=BVMuVj7cDK9Z0uSQIWnix7Wp/58INNq/i+n109fwcrI=; b=Xg75q1xdZwRE6ZfoNEDcCcspk5TzbcWNo3sWNentK9EpJC3kDkAzOTWMafj4nzsJfu ikompzl7eOJkOh5Ei8M4prz15tEoZEf/pgSQO/beVgqJJg76KoqkrOmg1ttipHnv36jI IVt2nTOiKWPlRN9JtA7mY+NAGS3TX3fiprpclo8M7lx1MCOkV90lmhGct8yzUn2+mUa/ bKWYLjBL6H6V1xAXpx/KztXp4ntisT7QZriS8JpzSdUnhWpxzmhMx1qM+CureWxtd6N6 XhG/PMchEQwM9Y9SvS6HARcWHDVfHyL1OJhGZ3WFnS+N403O6Tykc0Fiu/ahe38C8wqg xqLg== 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 s86si3352633pfd.327.2018.02.15.11.00.57; Thu, 15 Feb 2018 11:01:13 -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 S1167052AbeBOS7Q (ORCPT + 99 others); Thu, 15 Feb 2018 13:59:16 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:47912 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161425AbeBOPTd (ORCPT ); Thu, 15 Feb 2018 10:19:33 -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 92470FF7; Thu, 15 Feb 2018 15:19:32 +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 3.18 30/45] kernfs: fix regression in kernfs_fop_write caused by wrong type Date: Thu, 15 Feb 2018 16:17:21 +0100 Message-Id: <20180215144122.358790493@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215144115.863307741@linuxfoundation.org> References: <20180215144115.863307741@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 3.18-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 @@ -267,7 +267,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) {