Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2715882imj; Mon, 11 Feb 2019 07:25:07 -0800 (PST) X-Google-Smtp-Source: AHgI3Iadq3nee6U6ts7bRK9EpF6Y8ScuUElxNuC7R8g8BOA8bgP5Gv9/K8IhcwyPZpwA8x+dCnRS X-Received: by 2002:a62:9305:: with SMTP id b5mr36691440pfe.10.1549898707343; Mon, 11 Feb 2019 07:25:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549898707; cv=none; d=google.com; s=arc-20160816; b=HvwI8dIv9qyf7FyByx5ZShy9X16qA3sPzMMcnYbxXWczouQyM4KTZRtEPTsmyRgW+q NCQnAQnVcmmr2oB0RMtYrHaVhUgVs2TI6+aDUcb5vARMStt6vKibR9/i2zpXPF9nRrF1 pE1SM0CLoLjLhdPSnj7T334V55oAJVLnCLG6TXJpyFkKn/dMzLoT2aIgiQtY5WtBoiO5 Ga7+JPATc6jdNjzpj0e72nNR2lwjv+nWjIzbCH/ZTO9V1JgjX1N+1AtHkSIGWNWMCdJC 2yoTLSaXiCroS2UubgNUSb3xmW3X6i8vfbUHl0fM3f4JcjOEUxM4615Q1gnpyOjtEluR 6DjA== 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:dkim-signature; bh=gNm2hydU3mUyJDnPHTXelS95sI5/7j4PBdwM2CWUs4c=; b=yLwcB/2fmeGcKlKeNC7Z2PjedZdsh8MPg74LCjVQvHaqtBk1+qNGXurTseEq1RXE9b Ol8UREe6mipxsl72ZCIeH//hBGm8WCVbQJrw5NlF7Bdumc+hvUSN4ObpfL/ttz+62wMi 5HBQltD6N8dy5Bc0W76aSLSLO5usgKr2xpWU6BTZgeBIbO1RgLPP+OZuDOJ1jrnipWwF eEYsnm3/5jcYvE2KMSkR9yk/1VCgLfVlCc778hLUoViC9T3PTSedawK6AS7lKyYnjCgy /76FEn1uOfY6sU5dYqO4Nix2D0uTgCPb6NOlvQ40gkDjU4/bNdw6/pUQp9HLAwmgy1c8 wIcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZUtMsGbK; 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 b65si9648922pgc.259.2019.02.11.07.24.50; Mon, 11 Feb 2019 07:25:07 -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; dkim=pass header.i=@kernel.org header.s=default header.b=ZUtMsGbK; 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 S2390044AbfBKPC6 (ORCPT + 99 others); Mon, 11 Feb 2019 10:02:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:51100 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390490AbfBKPCw (ORCPT ); Mon, 11 Feb 2019 10:02:52 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D1001222A6; Mon, 11 Feb 2019 15:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897371; bh=zClhYNYU/GZQoz5hrfZx2hEGl2NnoYrBQYgFUgjDc9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZUtMsGbKFimVIgX+LHvGXvgIJp9aWVgh7x/JF7DNLrxsy10fj+kZbw5UbNOd9ncWL EPucSzT7J6UV0uasNwMTLiTPj9JG3qaqfIvLh3P+SQRipOKuwZi9b8XcuMuGxzY+aS rPtTza13jwDvBS9Y0yJoD5uCQBBeqTOlXJ4iZQqI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+c1e36d30ee3416289cc0@syzkaller.appspotmail.com, Miklos Szeredi Subject: [PATCH 4.14 179/205] fuse: handle zero sized retrieve correctly Date: Mon, 11 Feb 2019 15:19:37 +0100 Message-Id: <20190211141840.083778886@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Miklos Szeredi commit 97e1532ef81acb31c30f9e75bf00306c33a77812 upstream. Dereferencing req->page_descs[0] will Oops if req->max_pages is zero. Reported-by: syzbot+c1e36d30ee3416289cc0@syzkaller.appspotmail.com Tested-by: syzbot+c1e36d30ee3416289cc0@syzkaller.appspotmail.com Fixes: b2430d7567a3 ("fuse: add per-page descriptor to fuse_req") Cc: # v3.9 Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- fs/fuse/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -1691,7 +1691,6 @@ static int fuse_retrieve(struct fuse_con req->in.h.nodeid = outarg->nodeid; req->in.numargs = 2; req->in.argpages = 1; - req->page_descs[0].offset = offset; req->end = fuse_retrieve_end; index = outarg->offset >> PAGE_SHIFT; @@ -1706,6 +1705,7 @@ static int fuse_retrieve(struct fuse_con this_num = min_t(unsigned, num, PAGE_SIZE - offset); req->pages[req->num_pages] = page; + req->page_descs[req->num_pages].offset = offset; req->page_descs[req->num_pages].length = this_num; req->num_pages++;