drivers/net/macvtap: fix error check
Subsystems (2)
PATCH 1/1 drivers/net/macvtap: fix error check
'len' is unsigned of type size_t and can't be negative.
--- drivers/net/macvtap.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/macvtap.c +2 -1
@@ -528,8 +528,9 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, vnet_hdr_len = q->vnet_hdr_sz; err = -EINVAL ; -if ((len -= vnet_hdr_len) <0 ) +if (len < vnet_hdr_len) goto err; + len -= vnet_hdr_len; err =memcpy_fromiovecend ((void *)&vnet_hdr, iv,0 ,sizeof (vnet_hdr));
Signature · 1 line
1.7.3.4
Quoted 3 lines · Nicolas Kaiser
'len' is unsigned of type
size_tand can't be negative.Signed-off-by Nicolas Kaiser <[email protected]>
I think it's harmless: the worst thing that can happen is macvtap_alloc_skb() failing with ENOMEM when it gets a large argument, but we could have it in -stable just to be sure.
Arnd
David Miller
maintainerFrom: Arnd Bergmann <[email protected]>
Date: Mon, 7 Mar 2011 10:59:04 +0100
Quoted 11 lines · Nicolas Kaiser
Quoted 3 lines
'len' is unsigned of type
size_tand can't be negative.Signed-off-by Nicolas Kaiser <[email protected]>Acked-by Arnd Bergmann <[email protected]>I think it's harmless: the worst thing that can happen is
macvtap_alloc_skb()failing with ENOMEM when it gets a large argument, but we could have it in -stable just to be sure.
I'm just going to add it to net-2.6
I verified that gcc is not generating this test at all currently, so putting this into -stable is quite pointless.