From: Matthew Daley Date: Fri, 14 Oct 2011 18:45:05 +0000 (+0000) Subject: x25: Prevent skb overreads when checking call user data X-Git-Tag: v3.0.8~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ea7f3aa5d3fbec2e09edb8c03bc764f9514d3d2;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git x25: Prevent skb overreads when checking call user data commit 7f81e25befdfb3272345a2e775f520e1d515fa20 upstream. x25_find_listener does not check that the amount of call user data given in the skb is big enough in per-socket comparisons, hence buffer overreads may occur. Fix this by adding a check. Signed-off-by: Matthew Daley Cc: Eric Dumazet Cc: Andrew Hendry Acked-by: Andrew Hendry Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 4680b1e..373e14f 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -295,7 +295,8 @@ static struct sock *x25_find_listener(struct x25_address *addr, * Found a listening socket, now check the incoming * call user data vs this sockets call user data */ - if(skb->len > 0 && x25_sk(s)->cudmatchlength > 0) { + if (x25_sk(s)->cudmatchlength > 0 && + skb->len >= x25_sk(s)->cudmatchlength) { if((memcmp(x25_sk(s)->calluserdata.cuddata, skb->data, x25_sk(s)->cudmatchlength)) == 0) {