Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Drivers: hv: fcopy: set .owner reference for file operations

Get an additional reference otherwise a crash is observed when hv_utils module is being unloaded while
fcopy daemon is still running. .owner gives us an additional reference when
someone holds a descriptor for the device.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: Alex Ng <alexng@microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Vitaly Kuznetsov and committed by
Greg Kroah-Hartman
3f0dccf8 4c93cccc

+2 -4
+2 -4
drivers/hv/hv_fcopy.c
··· 360 360 } 361 361 362 362 /* XXX: there are still some tricky corner cases, e.g., 363 - * 1) In a SMP guest, when fcopy_release() runs between 363 + * In an SMP guest, when fcopy_release() runs between 364 364 * schedule_delayed_work() and fcopy_send_data(), there is 365 365 * still a chance an obsolete message will be queued. 366 - * 367 - * 2) When the fcopy daemon is running, if we unload the driver, 368 - * we'll notice a kernel oops when we kill the daemon later. 369 366 */ 370 367 static int fcopy_release(struct inode *inode, struct file *f) 371 368 { ··· 382 385 383 386 384 387 static const struct file_operations fcopy_fops = { 388 + .owner = THIS_MODULE, 385 389 .read = fcopy_read, 386 390 .write = fcopy_write, 387 391 .release = fcopy_release,