diff options
author | Andrea Parri (Microsoft) <[email protected]> | 2020-11-18 16:33:10 +0100 |
---|---|---|
committer | Wei Liu <[email protected]> | 2020-11-24 16:22:10 +0000 |
commit | 206ad34d52a2f1205c84d08c12fc116aad0eb407 (patch) | |
tree | 8f5c34c75298a5132f8ca86d1133391d2d0ba2b3 | |
parent | 14c685d9eb361768bb5ca452b999e43498f15746 (diff) |
hv_netvsc: Validate number of allocated sub-channels
Lack of validation could lead to out-of-bound reads and information
leaks (cf. usage of nvdev->chan_table[]). Check that the number of
allocated sub-channels fits into the expected range.
Suggested-by: Saruhan Karademir <[email protected]>
Signed-off-by: Andrea Parri (Microsoft) <[email protected]>
Reviewed-by: Haiyang Zhang <[email protected]>
Acked-by: Jakub Kicinski <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Wei Liu <[email protected]>
-rw-r--r-- | drivers/net/hyperv/rndis_filter.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 6ae43319ece6..9a51fa3003a8 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -1224,6 +1224,11 @@ int rndis_set_subchannel(struct net_device *ndev, return -EIO; } + /* Check that number of allocated sub channel is within the expected range */ + if (init_packet->msg.v5_msg.subchn_comp.num_subchannels > nvdev->num_chn - 1) { + netdev_err(ndev, "invalid number of allocated sub channel\n"); + return -EINVAL; + } nvdev->num_chn = 1 + init_packet->msg.v5_msg.subchn_comp.num_subchannels; |