From: Kristian Høgsberg Date: Wed, 7 Mar 2007 17:12:44 +0000 (-0500) Subject: firewire: Switch cdev code over to use register_chrdev and keep a list of devices. X-Git-Tag: v2.6.22-rc1~111^2~64 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3aca3dabbcf00f2088d472f27755c29acaa992e;p=pandora-kernel.git firewire: Switch cdev code over to use register_chrdev and keep a list of devices. 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 Signed-off-by: Stefan Richter --- diff --git a/drivers/firewire/fw-device-cdev.c b/drivers/firewire/fw-device-cdev.c index d9f3bb2be1c2..54ef27b2adb5 100644 --- a/drivers/firewire/fw-device-cdev.c +++ b/drivers/firewire/fw-device-cdev.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #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) Reading git-diff-tree failed