x25: Prevent crashing when parsing bad X.25 facilities
authorDan Rosenberg <drosenberg@vsecurity.com>
Fri, 12 Nov 2010 20:44:42 +0000 (12:44 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 9 Dec 2010 21:24:21 +0000 (13:24 -0800)
commit1ee97ce543460d963911ca8d0b8461ba7b48846d
tree838fdf59af322352c6a5a5ea036fb07ddb0722a4
parentbe609a1fca672655bf831d296685f33ba330e007
x25: Prevent crashing when parsing bad X.25 facilities

commit 5ef41308f94dcbb3b7afc56cdef1c2ba53fa5d2f upstream.

Now with improved comma support.

On parsing malformed X.25 facilities, decrementing the remaining length
may cause it to underflow.  Since the length is an unsigned integer,
this will result in the loop continuing until the kernel crashes.

This patch adds checks to ensure decrementing the remaining length does
not cause it to wrap around.

Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/x25/x25_facilities.c