firewire: Switch cdev code over to use register_chrdev and keep a list of devices.
authorKristian Høgsberg <krh@redhat.com>
Wed, 7 Mar 2007 17:12:44 +0000 (12:12 -0500)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Fri, 9 Mar 2007 21:03:09 +0000 (22:03 +0100)
The old mechanism kept a struct cdev for each fw device, but fops->release
would reference this struct after the device got freed in some cases.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/firewire/fw-device-cdev.c
drivers/firewire/fw-device.c
drivers/firewire/fw-device.h
drivers/firewire/fw-transaction.c

index d9f3bb2..54ef27b 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/poll.h>
 #include <linux/delay.h>
 #include <linux/mm.h>
+#include <linux/idr.h>
 #include <linux/compat.h>
 #include <asm/uaccess.h>
 #include "fw-transaction.h"
@@ -103,7 +104,9 @@ static int fw_device_op_open(struct inode *inode, struct file *file)
        struct client *client;
        unsigned long flags;
 
-       device = container_of(inode->i_cdev, struct fw_device, cdev);
+       device = fw_device_from_devt(inode->i_rdev);
+       if (device == NULL)
+               return -ENODEV;
 
        client = kzalloc(sizeof *client, GFP_KERNEL);
        if (client == NULL)
Simple merge
Simple merge
Simple merge