lkml.org 
[lkml]   [2008]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: AT91SAM9/CAP9 watchdog driver

    > +static long at91_wdt_ioctl(struct file *file, unsigned int cmd,
    > + unsigned long arg)
    > +{
    > + void __user *argp = (void __user *)arg;
    > + int __user *p = argp;

    No locking.. so you could get two set timeout calls in parallel. Probably
    you need a simple mutex in at91_wdt_settimeout();


    > + res = misc_register(&at91wdt_miscdev);
    > + if (res)
    > + return res;
    > +
    > + /* Set watchdog */
    > + if (at91_wdt_settimeout(wdt_timeout) == -EINVAL) {
    > + pr_info("at91sam9_wdt: timeout must be between 1 and %d.\n",
    > + WDT_MAX_TIME);
    > + return 0;

    At the moment those two are safe. When the open lock_kernel
    goes away it will be possible to get

    misc_register
    open
    ioctl
    wdt_settimout()

    So you may want to swap those two around (and disable the timer if the
    register fails ?), or lock the open against the register routine.

    Otherwise looks good.

    Alan


    \
     
     \ /
      Last update: 2008-06-02 09:15    [W:0.019 / U:37.748 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site