提交 12bc8dfb 编写于 作者: A Andrea Parri (Microsoft) 提交者: Jakub Kicinski

hv_netvsc: Reset the RSC count if NVSP_STAT_FAIL in netvsc_receive()

Commit 44144185 ("hv_netvsc: Add validation for untrusted Hyper-V
values") added validation to rndis_filter_receive_data() (and
rndis_filter_receive()) which introduced NVSP_STAT_FAIL-scenarios where
the count is not updated/reset.  Fix this omission, and prevent similar
scenarios from occurring in the future.
Reported-by: NJuan Vazquez <juvazq@microsoft.com>
Signed-off-by: NAndrea Parri (Microsoft) <parri.andrea@gmail.com>
Fixes: 44144185 ("hv_netvsc: Add validation for untrusted Hyper-V values")
Reviewed-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
Link: https://lore.kernel.org/r/20210203113602.558916-1-parri.andrea@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
上级 52cbd23a
......@@ -1262,8 +1262,11 @@ static int netvsc_receive(struct net_device *ndev,
ret = rndis_filter_receive(ndev, net_device,
nvchan, data, buflen);
if (unlikely(ret != NVSP_STAT_SUCCESS))
if (unlikely(ret != NVSP_STAT_SUCCESS)) {
/* Drop incomplete packet */
nvchan->rsc.cnt = 0;
status = NVSP_STAT_FAIL;
}
}
enq_receive_complete(ndev, net_device, q_idx,
......
......@@ -509,8 +509,6 @@ static int rndis_filter_receive_data(struct net_device *ndev,
return ret;
drop:
/* Drop incomplete packet */
nvchan->rsc.cnt = 0;
return NVSP_STAT_FAIL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册