There is a race from when a device is created with device_create() and
then the drvdata is set with a call to dev_set_drvdata() in which a
sysfs file could be open, yet the drvdata will be NULL, causing all
sorts of bad things to happen.
This patch fixes the problem by using the new function,
device_create_drvdata().
Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Hans J. Koch <hjk@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/uio/uio.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 55cc7b8..0a12e90 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -649,15 +649,14 @@ int __uio_register_device(struct module *owner,
if (ret)
goto err_get_minor;
- idev->dev = device_create(uio_class->class, parent,
- MKDEV(uio_major, idev->minor),
- "uio%d", idev->minor);
+ idev->dev = device_create_drvdata(uio_class->class, parent,
+ MKDEV(uio_major, idev->minor), idev,
+ "uio%d", idev->minor);
if (IS_ERR(idev->dev)) {
printk(KERN_ERR "UIO: device register failed\n");
ret = PTR_ERR(idev->dev);
goto err_device_create;
}
- dev_set_drvdata(idev->dev, idev);
ret = uio_dev_add_attributes(idev);
if (ret)
--
1.5.5.1
--
| Linus Torvalds | Linux 2.6.27 |
| Alan Cox | [PATCH 00/76] Queued TTY Patches |
| Greg KH | [patch 10/73] VLAN: Lost rtnl_unlock() in vlan_ioctl() |
| Rusty Russell | Re: [Bug #11342] Linux 2.6.27-rc3: kernel BUG at mm/vmalloc.c - bisected |
git: | |
| Jakub Narebski | Re: [PATCH] RFC: git lazy clone proof-of-concept |
| Johannes Schindelin | cogito and remote#branch, was Re: [PATCH] Git homepage: remove all the references ... |
| Junio C Hamano | Re: Comments on recursive merge.. |
| Scott Chacon | [PATCH] add a 'pre-push' hook |
| Marcos Laufer | dmesg IBM x3650 OpenBSD 4.3 |
| L. V. Lammert | Re: OBSD's perspective on SELinux |
| Richard Stallman | Real men don't attack straw men |
| Juan Miscaro | When will OpenBSD support UTF8? |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Alan Cox | Re: [PATCH] alternative to sys_indirect, part 1 |
| Jarek Poplawski | Re: panic 2.6.27-rc3-git2, qdisc_dequeue_head |
| Patrick McHardy | Re: [PATCH 3/3] netdevice: order of synchronization of IFF_PROMISC and IFF_ALLMULTI |
