Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3807319ybi; Mon, 29 Jul 2019 13:01:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpOtl+1lb3CFLp2rzzuHKhpYO69vyZTtoeT3lkmqXNc6XHviJooDcflLIn8/ia0o2jiauh X-Received: by 2002:a63:6187:: with SMTP id v129mr21061188pgb.153.1564430508579; Mon, 29 Jul 2019 13:01:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564430508; cv=none; d=google.com; s=arc-20160816; b=XlL8VZQCm213Uk3rDS1sFK32uuVcXjpyYW95Y+CUs767pp+CJCtHejp12xvLuWhiAR R3wuCQUD2M1GGTBiDloNvDfHlR5I8y7Iyqzs9t2JYRaXOlvH9gB7DAkpWNO0xa3/EeR+ fhv0CDi+eJ3YCDw0AV90/BTK492jBzNzcwaWtjNmMcG5dviBYteYbraHMSI0wLpVGEzC n7WfKFSruL0O7kfVG5l+qvJ9M3oAqWh0Ur6EijnDh+VbpSOQoW+IRKNDpgoxPCYQy+8d 6OWPUP5NBy2QyaV4CipCyKppglsrVL+DRzmwt1rqqE0GX5tvvrC37clNzqIXlG3Km5Jh XzsQ== 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=gTg4gzD9iGdqJnPwuja8JTOWnC58Txvp8/UbzzFANTg=; b=wQvT6eay8Ddmci651lmVlvYA03sb9eJGynCsuvBgPL1dbRJMloHZe4UHM6/nZ+SoSM fDARpom69oULmA3iVVOLn1z43GSWb3CPxoFJ4nP7zXF4REAlH0HFFoS1lKf4/6Rulz+/ WEsaXRWMIpClwRj0K7EMPpKh/FIc5N6f/l99NZua8oMUEEvNEa5wyHCa/7bFhm5Mq/9z +IHAOyEXIQP6LMc3onhSNyjrM6rPDe1k7DAVTAQcpB1pDq9fGcMrZHlMqGT7JaHikF78 LiUt5vDmwsUQCScFR+BbQsBYQv09/1eWsm8QdwVQFs7H7Lwyts01tnnns1L0LTx9Gx7+ bq2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="DPMZaMW/"; 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 p12si52623722plq.331.2019.07.29.13.01.33; Mon, 29 Jul 2019 13:01:48 -0700 (PDT) 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="DPMZaMW/"; 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 S2404401AbfG2UAT (ORCPT + 99 others); Mon, 29 Jul 2019 16:00:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:44590 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403810AbfG2Twp (ORCPT ); Mon, 29 Jul 2019 15:52:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 3FF092171F; Mon, 29 Jul 2019 19:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429964; bh=qtpQve33xVbuoeZIu8vd+agX2xDVDUpkDAhJEmLgQ8Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DPMZaMW/8GxmAi/Dh4YkcPOoVnKbt8IWWh3FRg3CM1zZHETs3LCe3BG+dA3MfhGDn XTl6RCYErV/Zopn2IW/ajE/YxKDdifL0TRczNxHaWGHIvXzX0YFrRzBOHp+xACGjz5 jxMyj19dHIXxRmYW5SL7mOctFLcHr7ZDcD2pUMoA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Kees Cook , Sami Tolvanen , Nick Desaulniers , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.2 151/215] 9p: pass the correct prototype to read_cache_page Date: Mon, 29 Jul 2019 21:22:27 +0200 Message-Id: <20190729190805.975538186@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190739.971253303@linuxfoundation.org> References: <20190729190739.971253303@linuxfoundation.org> User-Agent: quilt/0.66 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 [ Upstream commit f053cbd4366051d7eb6ba1b8d529d20f719c2963 ] Fix the callback 9p passes to read_cache_page to actually have the proper type expected. Casting around function pointers can easily hide typing bugs, and defeats control flow protection. Link: http://lkml.kernel.org/r/20190520055731.24538-5-hch@lst.de Signed-off-by: Christoph Hellwig Reviewed-by: Kees Cook Cc: Sami Tolvanen Cc: Nick Desaulniers Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- fs/9p/vfs_addr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index bc57ae9e2963..cce9ace651a2 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c @@ -35,8 +35,9 @@ * @page: structure to page * */ -static int v9fs_fid_readpage(struct p9_fid *fid, struct page *page) +static int v9fs_fid_readpage(void *data, struct page *page) { + struct p9_fid *fid = data; struct inode *inode = page->mapping->host; struct bio_vec bvec = {.bv_page = page, .bv_len = PAGE_SIZE}; struct iov_iter to; @@ -107,7 +108,8 @@ static int v9fs_vfs_readpages(struct file *filp, struct address_space *mapping, if (ret == 0) return ret; - ret = read_cache_pages(mapping, pages, (void *)v9fs_vfs_readpage, filp); + ret = read_cache_pages(mapping, pages, v9fs_fid_readpage, + filp->private_data); p9_debug(P9_DEBUG_VFS, " = %d\n", ret); return ret; } -- 2.20.1