Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751792AbdF3XK7 (ORCPT ); Fri, 30 Jun 2017 19:10:59 -0400 Received: from mail-pg0-f52.google.com ([74.125.83.52]:35883 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751189AbdF3XK6 (ORCPT ); Fri, 30 Jun 2017 19:10:58 -0400 MIME-Version: 1.0 From: "David F." Date: Fri, 30 Jun 2017 16:10:56 -0700 Message-ID: Subject: did vfs_read or something related to it get broken? To: linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1054 Lines: 48 Hi, I have a driver that reads data from a file that has worked from kernel 3.x up to 4.9.13. I haven't tried all the other 4.9's or 4.10, or 4.11.6 or earlier, but in 4.11.7 it's now broken and an error is returned. It's based on http://krishnamohanlinux.blogspot.com/2013/12/how-to-write-to-file-from-kernel-module.html Is there a new requirement of some sort or did it get broken? int driver_file_read(struct file *file, unsigned char *data, unsigned int size) { int ret; mm_segment_t oldfs; // get file pointer loff_t pos = file->f_pos; oldfs = get_fs(); set_fs(get_ds()); ret=vfs_read(file, data, size, &pos); set_fs(oldfs); // update file pointer file->f_pos=pos; return (ret); } struct file *driver_file_open(const char *path, int flags, int mode, int *err) { int ec=0; struct file *filp = NULL; filp=filp_open(path, flags, mode); if (IS_ERR(filp)) { ec=PTR_ERR(filp); filp=NULL; } // update callers error code if (err) { *err=ec; } // return pointer to file return (filp); }