Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 362 → Rev 361

/pcivme-3.2/driver/fops.c
67,7 → 67,11
 
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/mutex.h>
#if HAVE_UNLOCKED_IOCTL
#include <linux/mutex.h>
#else
#include <linux/smp_lock.h>
#endif
 
 
#include "fops.h"
726,9 → 730,9
 
// check for accessible user buffer
if (_IOC_DIR(cmd) & _IOC_READ)
err = !access_ok( (void *)arg, _IOC_SIZE(cmd));
err = !access_ok(VERIFY_WRITE, (void *)arg, _IOC_SIZE(cmd));
if (_IOC_DIR(cmd) & _IOC_WRITE)
err = !access_ok( (void *)arg, _IOC_SIZE(cmd));
err = !access_ok(VERIFY_READ, (void *)arg, _IOC_SIZE(cmd));
if (err)
return -EFAULT;
 
808,14 → 812,22
long retval=0;
 
 
#if HAVE_UNLOCKED_IOCTL
struct mutex fs_mutex;
mutex_init(&fs_mutex);
mutex_lock(&fs_mutex);
#else
lock_kernel();
#endif
 
PRINTK(KERN_DEBUG "%s : pcivme_unlocked_ioctl(0x%08x), size = %d\n", DEVICE_NAME, cmd, _IOC_SIZE(cmd));
retval = pcivme_ioctl(NULL, pFile, cmd,arg);
 
#if HAVE_UNLOCKED_IOCTL
mutex_unlock(&fs_mutex);
#else
unlock_kernel();
#endif
 
return retval;
}
945,7 → 957,7
return -EFAULT;
 
// check for free access to user buffer
if (!access_ok( pcBuffer, count))
if (!access_ok(VERIFY_WRITE, pcBuffer, count))
return -EFAULT;
 
// do I still have the same modifier?
987,7 → 999,7
return -EFAULT;
 
// check for free access to user buffer
if (!access_ok( pcBuffer, count))
if (!access_ok(VERIFY_READ, pcBuffer, count))
return -EFAULT;
 
// do I still have the same modifier?