aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/hyperv
diff options
context:
space:
mode:
authorHaiyang Zhang <haiyangz@microsoft.com>2012-07-25 04:08:41 -0400
committerDavid S. Miller <davem@davemloft.net>2012-07-25 18:31:30 -0400
commitfa85a6c29a493e8a574bf62a6349b38b591bf885 (patch)
tree4022b7c94ff929f0f91d6eb6dffcf3feffa301ba /drivers/net/hyperv
parent4331debc51ee1ce319f4a389484e0e8e05de2aca (diff)
hyperv: Add a check for ring_size value
It prevents ring_size being set to a too small value. Reported-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hyperv')
-rw-r--r--drivers/net/hyperv/netvsc_drv.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 8e23c084c4a7..8c5a1c43c81d 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -47,7 +47,7 @@ struct net_device_context {
47 struct work_struct work; 47 struct work_struct work;
48}; 48};
49 49
50 50#define RING_SIZE_MIN 64
51static int ring_size = 128; 51static int ring_size = 128;
52module_param(ring_size, int, S_IRUGO); 52module_param(ring_size, int, S_IRUGO);
53MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)"); 53MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)");
@@ -518,6 +518,11 @@ static void __exit netvsc_drv_exit(void)
518 518
519static int __init netvsc_drv_init(void) 519static int __init netvsc_drv_init(void)
520{ 520{
521 if (ring_size < RING_SIZE_MIN) {
522 ring_size = RING_SIZE_MIN;
523 pr_info("Increased ring_size to %d (min allowed)\n",
524 ring_size);
525 }
521 return vmbus_driver_register(&netvsc_drv); 526 return vmbus_driver_register(&netvsc_drv);
522} 527}
523 528