Commit 538316d2 authored by Andrew Morton's avatar Andrew Morton Committed by Dave Jones

[PATCH] fix devfs oops

The recent (untested?) "cleanup" removed a null-pointer test.
parent 5054ed20
...@@ -1802,8 +1802,11 @@ int devfs_generate_path (devfs_handle_t de, char *path, int buflen) ...@@ -1802,8 +1802,11 @@ int devfs_generate_path (devfs_handle_t de, char *path, int buflen)
static struct file_operations *devfs_get_ops (devfs_handle_t de) static struct file_operations *devfs_get_ops (devfs_handle_t de)
{ {
struct file_operations *ops = de->u.cdev.ops; struct file_operations *ops = de->u.cdev.ops;
struct module *owner = ops->owner; struct module *owner;
if (!ops)
return NULL;
owner = ops->owner;
read_lock (&de->parent->u.dir.lock); /* Prevent module from unloading */ read_lock (&de->parent->u.dir.lock); /* Prevent module from unloading */
if ( (de->next == de) || !try_module_get (owner) ) if ( (de->next == de) || !try_module_get (owner) )
{ /* Entry is already unhooked or module is unloading */ { /* Entry is already unhooked or module is unloading */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment