From: Jesse Gross Date: Wed, 29 Dec 2010 22:10:50 +0000 (-0800) Subject: datapath: Add owner to file_operations declaration. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=609af740ae40b37f2c0041dd8d6ed1e6be311fee;p=openvswitch 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 --- 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,