watchdog: Fix race condition in registration code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.

This patch fixes a real problem on 3.8.x, .3.9.x. Possibly earlier stable 
lines too but I only tested on 3.8 and 3.9.

Upstream patch applies fine to 3.8 and 3.9 stable lines.

Please add to the stable queue. Thanks.

commit 60403f7a4d9368d187f79cba5e4672d01df37574
Author: Guenter Roeck <linux@xxxxxxxxxxxx>
Date:   Fri Apr 5 21:22:43 2013 -0700

    watchdog: Fix race condition in registration code
    
    A race condition exists when registering the first watchdog device.
    Sequence of events:
    
    - watchdog_register_device calls watchdog_dev_register
    - watchdog_dev_register creates the watchdog misc device by calling
      misc_register.
      At that time, the matching character device (/dev/watchdog0) does not 
yet
      exist, and old_wdd is not set either.
    - Userspace gets an event and opens /dev/watchdog
    - watchdog_open is called and sets wdd = old_wdd, which is still NULL,
      and tries to dereference it. This causes the kernel to panic.
    
    Seen with systemd trying to open /dev/watchdog immediately after
    it was created.
    
    Reported-by: Arkadiusz Miskiewicz <arekm@xxxxxxxx>
    Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
    Tested-by: Arkadiusz Miskiewicz <arekm@xxxxxxxx>
    Signed-off-by: Wim Van Sebroeck <wim@xxxxxxxxx>

-- 
Arkadiusz Miśkiewicz, arekm / maven.pl
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]