Commit fa85a6c2 authored by Haiyang Zhang's avatar Haiyang Zhang Committed by David S. Miller

hyperv: Add a check for ring_size value

It prevents ring_size being set to a too small value.
Reported-by: default avatarJason Wang <jasowang@redhat.com>
Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4331debc
......@@ -47,7 +47,7 @@ struct net_device_context {
struct work_struct work;
};
#define RING_SIZE_MIN 64
static int ring_size = 128;
module_param(ring_size, int, S_IRUGO);
MODULE_PARM_DESC(ring_size, "Ring buffer size (# of pages)");
......@@ -518,6 +518,11 @@ static void __exit netvsc_drv_exit(void)
static int __init netvsc_drv_init(void)
{
if (ring_size < RING_SIZE_MIN) {
ring_size = RING_SIZE_MIN;
pr_info("Increased ring_size to %d (min allowed)\n",
ring_size);
}
return vmbus_driver_register(&netvsc_drv);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment