x25: Prevent crashing when parsing bad X.25 facilities
commit9cff69da3eb80877cf7efd51c777707e7561537f
authorDan Rosenberg <drosenberg@vsecurity.com>
Fri, 12 Nov 2010 20:44:42 +0000 (12 12:44 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 21 Mar 2011 19:44:17 +0000 (21 12:44 -0700)
tree3a01470486fab1ac0c2357590ad7506b6df6ee47
parentb534a83f55a6c4ca6ad9e54148df9b94e1c46010
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