Skip to content

Commit 122b7e3

Browse files
committed
Merge tag 'char-misc-4.20-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver fixes from Greg KH: "Here are three tiny last-minute driver fixes for 4.20-rc8 that resolve some reported issues, and one MAINTAINERS file update. All of them are related to the hyper-v subsystem, it seems people are actually testing and using it now, which is nice to see :) The fixes are: - uio_hv_generic: fix for opening multiple times - Remove PCI dependancy on hyperv drivers - return proper error code for an unopened channel. And Sasha has signed up to help out with the hyperv maintainership. All of these have been in linux-next for a while with no reported issues" * tag 'char-misc-4.20-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: Drivers: hv: vmbus: Return -EINVAL for the sys files for unopened channels x86, hyperv: remove PCI dependency MAINTAINERS: Patch monkey for the Hyper-V code uio_hv_generic: set callbacks on open
2 parents bfd7bd5 + 55449af commit 122b7e3

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

MAINTAINERS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6906,8 +6906,10 @@ Hyper-V CORE AND DRIVERS
69066906
M: "K. Y. Srinivasan" <kys@microsoft.com>
69076907
M: Haiyang Zhang <haiyangz@microsoft.com>
69086908
M: Stephen Hemminger <sthemmin@microsoft.com>
6909+
M: Sasha Levin <sashal@kernel.org>
6910+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git
69096911
L: devel@linuxdriverproject.org
6910-
S: Maintained
6912+
S: Supported
69116913
F: Documentation/networking/netvsc.txt
69126914
F: arch/x86/include/asm/mshyperv.h
69136915
F: arch/x86/include/asm/trace/hyperv.h

drivers/hv/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ menu "Microsoft Hyper-V guest support"
44

55
config HYPERV
66
tristate "Microsoft Hyper-V client drivers"
7-
depends on X86 && ACPI && PCI && X86_LOCAL_APIC && HYPERVISOR_GUEST
7+
depends on X86 && ACPI && X86_LOCAL_APIC && HYPERVISOR_GUEST
88
select PARAVIRT
99
help
1010
Select this option to run Linux as a Hyper-V client operating

drivers/hv/vmbus_drv.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,8 @@ static ssize_t out_intr_mask_show(struct device *dev,
316316

317317
if (!hv_dev->channel)
318318
return -ENODEV;
319+
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
320+
return -EINVAL;
319321
hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound);
320322
return sprintf(buf, "%d\n", outbound.current_interrupt_mask);
321323
}
@@ -329,6 +331,8 @@ static ssize_t out_read_index_show(struct device *dev,
329331

330332
if (!hv_dev->channel)
331333
return -ENODEV;
334+
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
335+
return -EINVAL;
332336
hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound);
333337
return sprintf(buf, "%d\n", outbound.current_read_index);
334338
}
@@ -343,6 +347,8 @@ static ssize_t out_write_index_show(struct device *dev,
343347

344348
if (!hv_dev->channel)
345349
return -ENODEV;
350+
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
351+
return -EINVAL;
346352
hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound);
347353
return sprintf(buf, "%d\n", outbound.current_write_index);
348354
}
@@ -357,6 +363,8 @@ static ssize_t out_read_bytes_avail_show(struct device *dev,
357363

358364
if (!hv_dev->channel)
359365
return -ENODEV;
366+
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
367+
return -EINVAL;
360368
hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound);
361369
return sprintf(buf, "%d\n", outbound.bytes_avail_toread);
362370
}
@@ -371,6 +379,8 @@ static ssize_t out_write_bytes_avail_show(struct device *dev,
371379

372380
if (!hv_dev->channel)
373381
return -ENODEV;
382+
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
383+
return -EINVAL;
374384
hv_ringbuffer_get_debuginfo(&hv_dev->channel->outbound, &outbound);
375385
return sprintf(buf, "%d\n", outbound.bytes_avail_towrite);
376386
}
@@ -384,6 +394,8 @@ static ssize_t in_intr_mask_show(struct device *dev,
384394

385395
if (!hv_dev->channel)
386396
return -ENODEV;
397+
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
398+
return -EINVAL;
387399
hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound);
388400
return sprintf(buf, "%d\n", inbound.current_interrupt_mask);
389401
}
@@ -397,6 +409,8 @@ static ssize_t in_read_index_show(struct device *dev,
397409

398410
if (!hv_dev->channel)
399411
return -ENODEV;
412+
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
413+
return -EINVAL;
400414
hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound);
401415
return sprintf(buf, "%d\n", inbound.current_read_index);
402416
}
@@ -410,6 +424,8 @@ static ssize_t in_write_index_show(struct device *dev,
410424

411425
if (!hv_dev->channel)
412426
return -ENODEV;
427+
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
428+
return -EINVAL;
413429
hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound);
414430
return sprintf(buf, "%d\n", inbound.current_write_index);
415431
}
@@ -424,6 +440,8 @@ static ssize_t in_read_bytes_avail_show(struct device *dev,
424440

425441
if (!hv_dev->channel)
426442
return -ENODEV;
443+
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
444+
return -EINVAL;
427445
hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound);
428446
return sprintf(buf, "%d\n", inbound.bytes_avail_toread);
429447
}
@@ -438,6 +456,8 @@ static ssize_t in_write_bytes_avail_show(struct device *dev,
438456

439457
if (!hv_dev->channel)
440458
return -ENODEV;
459+
if (hv_dev->channel->state != CHANNEL_OPENED_STATE)
460+
return -EINVAL;
441461
hv_ringbuffer_get_debuginfo(&hv_dev->channel->inbound, &inbound);
442462
return sprintf(buf, "%d\n", inbound.bytes_avail_towrite);
443463
}

drivers/uio/uio_hv_generic.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,11 @@ hv_uio_open(struct uio_info *info, struct inode *inode)
204204
if (atomic_inc_return(&pdata->refcnt) != 1)
205205
return 0;
206206

207+
vmbus_set_chn_rescind_callback(dev->channel, hv_uio_rescind);
208+
vmbus_set_sc_create_callback(dev->channel, hv_uio_new_channel);
209+
207210
ret = vmbus_connect_ring(dev->channel,
208211
hv_uio_channel_cb, dev->channel);
209-
210212
if (ret == 0)
211213
dev->channel->inbound.ring_buffer->interrupt_mask = 1;
212214
else
@@ -334,9 +336,6 @@ hv_uio_probe(struct hv_device *dev,
334336
goto fail_close;
335337
}
336338

337-
vmbus_set_chn_rescind_callback(channel, hv_uio_rescind);
338-
vmbus_set_sc_create_callback(channel, hv_uio_new_channel);
339-
340339
ret = sysfs_create_bin_file(&channel->kobj, &ring_buffer_bin_attr);
341340
if (ret)
342341
dev_notice(&dev->device,

0 commit comments

Comments
 (0)