I have written a kernel module which I'm loading on kernel 4.2.3 . I am trying to read a simple text file in my init_module
which basically loads some configuration data by reading the contents of the text file. This same code works on previous versions of kernel but not on 4.2.3 Below is my code snippet for reference :
struct file* pFile = NULL;
pFile = filp_open(fileName, mode, 0);
if(pFile != NULL){
if(IS_ERR(pFile))
{
printk("<1>error %p for %s**\n", pFile, fileName);
pFile = NULL;
}
else if(pFile->f_op->read == NULL || pFile->f_op->write == NULL)
{
filp_close(pFile, 0);
pFile = NULL;
}
In my case I am getting pFile->f_op->read
function pointer as NULL
. This code works fine for non text files like /proc/kallsyms
which I am able to open & read. Please provide me some pointers as to is this a 4.2.3 kernel specific issue, how can i workaround this in my kernel module code ? Any pointers would be very helpful.