From 609af740ae40b37f2c0041dd8d6ed1e6be311fee Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Wed, 29 Dec 2010 14:10:50 -0800 Subject: [PATCH] datapath: Add owner to file_operations declaration. It's currently possible for operations on our character device to be still running when we unload the module. This will result in an oops when the executing code is suddenly freed. The chrdev code has a way to avoid this by taking a reference on the module every time the device is opened, which means that we can't be unloaded as long as there is an open file descriptor and therefore the possibility of an operation. However, our file_operations structure doesn't include an owner member, which prevents this mechanism from working. This adds one. Signed-off-by: Jesse Gross Acked-by: Ben Pfaff --- datapath/datapath.c | 1 + 1 file changed, 1 insertion(+) diff --git a/datapath/datapath.c b/datapath/datapath.c index 1bf05206..67f6730c 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1989,6 +1989,7 @@ static unsigned int openvswitch_poll(struct file *file, poll_table *wait) } static struct file_operations openvswitch_fops = { + .owner = THIS_MODULE, .read = openvswitch_read, .poll = openvswitch_poll, .unlocked_ioctl = openvswitch_ioctl, -- 2.30.2