Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2747882imj; Mon, 11 Feb 2019 07:54:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IYCF6oHJXOkU/z9mS4GmIh7ZzLd8W7o+M6sFr5VFpoKMx/I5qYE2aeIQ2nVtIFYnq/HE4RC X-Received: by 2002:a17:902:6909:: with SMTP id j9mr37232335plk.196.1549900491439; Mon, 11 Feb 2019 07:54:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549900491; cv=none; d=google.com; s=arc-20160816; b=YrKj88sYZx80pJclJpKE+eWN39iwBNejtZ6CnZqTue5KKrZuyfRrxXARDkgP7B14v8 Jd+L2HhuaN6CFFjef7lOb4C3h80oP2PFlqUbiqzChMgo9uWQI2+zyBcdLH46ioa3GrGw FuRWONRQ78Wcx9QrikpHO9hyeZnRu8PmjOESHaZKQaBkFtg2ZCgruO6f2gw8S0gI2gUT dI7Nc2fus8ME1cuosKEbPhc9pnL3yMLVXsZFhLvVN9MKvjjsz7SQS/pA9sPqPHz2yVm3 myeR41IiysEFgJewg12RxyafUjXh8xnSkkQ0xSzscdywh4xHPLQVnZxid9aHl/+zq7WS WHWw== 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=W0QQv76D+7uyl5aM6FKz1P9x3K8BEkoiZCKNuuADQm8=; b=E5S+W//9/vNehJ5j/+lDrP4C8zve2CmulVu73aRH2K8k41lphPPSc1yqNqrfRlQZJ7 fRGI9G47Ov+cC0DJDAGvFagc80DX7Ns3+txaohoALoDQNUDJGl4JL5i/09Yf5EQSh5lJ /8iRdmhHlgCXq/5OlHynlff9exfgfGyzvZ5VA/J3nJVRIXCCGEVTJr5qrCV7hVvTySzb YfiwRm72I5Q8H6uIqFRq2ru6lmyth3m7h3DEHhKRs/aCgjdFCtjl+wfKXw5OR0HwQ8Gl m3RLWeh4u1iOUwK5DjOhhz+3wQgJorHfj/2KQ1b3imxjsmNPRIX9M0/2qLISvbuYKSkR 1zeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="0d2/d1W8"; 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 b4si9548196pgq.43.2019.02.11.07.54.34; Mon, 11 Feb 2019 07:54:51 -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="0d2/d1W8"; 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 S1731712AbfBKPxn (ORCPT + 99 others); Mon, 11 Feb 2019 10:53:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:45486 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731236AbfBKOgZ (ORCPT ); Mon, 11 Feb 2019 09:36:25 -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 710B420700; Mon, 11 Feb 2019 14:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895784; bh=JeuBIwNRYaeRrhrbmgxpqv2VqdDPAeqOUysVJ6GWBtY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0d2/d1W8wItUZlQkvQhNlyMPWie82NZwoiFLX1/pLQh7J3+ftbZ+OohsA2GnX8Jst TDyHoBOHTJhr9nvJ8Gmy/KpaxEdGb+E2IG43QOLLt30fR58XwHXoIRJOjw7VT8+NEJ sIut2A9z9Ut7tqMxjEgVcmQccwWGFDFz7oqYiTmw= 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.20 322/352] fuse: handle zero sized retrieve correctly Date: Mon, 11 Feb 2019 15:19:09 +0100 Message-Id: <20190211141907.332307834@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@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.20-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 @@ -1742,7 +1742,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; @@ -1757,6 +1756,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++;