Received: by 10.223.185.116 with SMTP id b49csp5482444wrg; Wed, 7 Mar 2018 12:32:17 -0800 (PST) X-Google-Smtp-Source: AG47ELvPlPGl32Z+bAS08Es7asiSlRjHO8Zg3NFfdS5VfyxF31rxVGOHCksYgwHy+5rfyA6obgmD X-Received: by 10.101.82.10 with SMTP id o10mr7975039pgp.271.1520454737862; Wed, 07 Mar 2018 12:32:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520454737; cv=none; d=google.com; s=arc-20160816; b=E3V+KNETTHbc4uDgew0HX4oawmL3UR3I+FY7bVIM3xBzanlcK+mgIf4YFtbdcBaTBn wYEtoUY5mhH6/jS69Mtx0DTphnEI7lQavnJVwDDggapdo0EVddHt/PkmK3Ybw9kkbn2b Czxhp4bqHJp+1SBmMoNp3Qp0vcQ+UXQk6HNzz7itSMT0u7TWFYaXq70teHMyqjlvkCeO bo/vmKF+RtIHufUOjxTv9KdNmskM6dwsp3Fct29fBceQ80jc6Li/EU2lr+vcOPC8sEqY Mm44/id40D3eQgD0FLsHzxtVNuNfkTqRAvP/nKQ7Nx3/M3wCC/WQsRG4X1jN108ATSnf tkHg== 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=qSmODZiNXCQIDIzkivIqxV1AOxrH3CRUv1t9zpR3j4A=; b=kt5EIaMn2S7vN63mOUKn0Uw/f6LwqtPRGxvMbErlI9KTokpQm0ioRnCQti0Q8noNmt owjEJT7Eqy6lL2uveGUqs652FeJKY5jJ92JH5ShFfT6reyhZ08s9nHQaWQ7vhBgQhPnE Kxb33jzZ4ci9MFTfXhLK6FNEwf6vImbB5xZEkSJgkzS3GlplF5wEXevS6mbcpPwBL0pM LGbOnS39f1lOy8ct+D24usmQUhXkx20Nd9Pzm+uLaVin20uftWvd63zslClIeznSt8ql sClT8pqt0JjthUePZESgX4wn4JYoMljg4MShLXG4mm2FqP7zK9JBq1+Scg+D79l6ODYZ 0rxw== 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 s12si11756896pgq.491.2018.03.07.12.32.03; Wed, 07 Mar 2018 12:32:17 -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 S964953AbeCGUbM (ORCPT + 99 others); Wed, 7 Mar 2018 15:31:12 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:42334 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934873AbeCGTmZ (ORCPT ); Wed, 7 Mar 2018 14:42:25 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 94A59FB3; Wed, 7 Mar 2018 19:42:17 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Monakhov , Bart Van Assche , Ming Lei , Jens Axboe Subject: [PATCH 4.15 031/122] block: pass inclusive lend parameter to truncate_inode_pages_range Date: Wed, 7 Mar 2018 11:37:23 -0800 Message-Id: <20180307191733.748254637@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191729.190879024@linuxfoundation.org> References: <20180307191729.190879024@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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: Ming Lei commit 0bd1ed4860d0f5f836aa8371797689a3779d1bf5 upstream. The 'lend' parameter of truncate_inode_pages_range is required to be inclusive, so follow the rule. This patch fixes one memory corruption triggered by discard. Cc: Cc: Dmitry Monakhov Fixes: 351499a172c0 ("block: Invalidate cache on discard v2") Reviewed-by: Bart Van Assche Signed-off-by: Ming Lei Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/block/ioctl.c +++ b/block/ioctl.c @@ -225,7 +225,7 @@ static int blk_ioctl_discard(struct bloc if (start + len > i_size_read(bdev->bd_inode)) return -EINVAL; - truncate_inode_pages_range(mapping, start, start + len); + truncate_inode_pages_range(mapping, start, start + len - 1); return blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL, flags); }