Received: by 10.223.185.116 with SMTP id b49csp2161702wrg; Thu, 15 Feb 2018 07:27:56 -0800 (PST) X-Google-Smtp-Source: AH8x225hxE3f5NjEGKbD/zpcHPuwEkzyjEL1uYn9Dq6b++yCqnCW7SU5LH9LxFnGx4Lna7Lr8AT0 X-Received: by 10.99.136.195 with SMTP id l186mr2562899pgd.427.1518708476331; Thu, 15 Feb 2018 07:27:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518708476; cv=none; d=google.com; s=arc-20160816; b=0QRShMpqksakXjtBrqmQW405yyU4k28U3e7bTO0b2EamGDFTM0oZQg1siYttXsv4Cj 4nUU8+jPA1gjvVeKymJOKHUWBIoYtf6LNKxLSN5guDgwgFdSuWCdUgFITuI4TiZR/qKy i6zvrLJTRCsVzkefp9PhD2q9gxIY1hTC78D7YaD3fmGKm9mN0b7lLHz+CAXhPMzF67oP H/Xa+uI2V8ssk4FuoEn26k+AJuzw1NEOiHplcUg477Z8m+iIiUXLT24wZpbQUxUbVWjy NucEcCqM9+yZO/WhcbdTMoSF9lGVMjmy8meJSDv01zw6o5H8jseAXrziWqtgiRaC/qOC KIKg== 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=iiPOn78lI/CzcMEBgEIOgfaiX24aXWjU6EIyPcv+Eqk=; b=an+7f/Em0k7NW63EaLgDbJYJQMiPVqarYlQvSuiW4VMhWt6nNuAeT94znb95OdQGwJ 6ABZyosxzP88TLQQXpuuldpMs5yrgfAopTMuRRUZqkEB+teh7SDMDhwD2NdffcB/NaH3 dougRScHVG3i2KZSdCKrKG1PfbFDTFQ4Aw2OS+e3/6NQaguWXNEWepLQwQg+E0uJ27tg 8A+pn00g6S/F9QypA67j+0CqVRF9oQTB3Xkqovl4WBHGVcms6Zkz2u9C0tk8di2YiiI1 XVcbOprHwwQrlnlK2k+PscS7CNytnZmD4IOLUpdpxgOww3FEI+Jyz35sddnK5DUahSXc 0RHw== 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 q11-v6si1349358pll.379.2018.02.15.07.27.41; Thu, 15 Feb 2018 07:27:56 -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 S1163412AbeBOP0d (ORCPT + 99 others); Thu, 15 Feb 2018 10:26:33 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:52990 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163369AbeBOP0b (ORCPT ); Thu, 15 Feb 2018 10:26:31 -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 6FDB7D4B; Thu, 15 Feb 2018 15:26:30 +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.9 27/88] kernfs: fix regression in kernfs_fop_write caused by wrong type Date: Thu, 15 Feb 2018 16:16:54 +0100 Message-Id: <20180215151226.418654572@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151222.437136975@linuxfoundation.org> References: <20180215151222.437136975@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.9-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) {