Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756841AbZJBBrg (ORCPT ); Thu, 1 Oct 2009 21:47:36 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756323AbZJBBdg (ORCPT ); Thu, 1 Oct 2009 21:33:36 -0400 Received: from kroah.org ([198.145.64.141]:33246 "EHLO coco.kroah.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756311AbZJBBd2 (ORCPT ); Thu, 1 Oct 2009 21:33:28 -0400 X-Mailbox-Line: From gregkh@mini.kroah.org Thu Oct 1 18:24:17 2009 Message-Id: <20091002012417.642843903@mini.kroah.org> User-Agent: quilt/0.48-1 Date: Thu, 01 Oct 2009 18:16:59 -0700 From: Greg KH To: linux-kernel@vger.kernel.org, stable@kernel.org, davem@davemloft.net Cc: stable-review@kernel.org, torvalds@linux-foundation.org, akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk, jakub@redhat.com, mingo@elte.hu, Arjan van de Ven Subject: [071/136] net ax25: Fix signed comparison in the sockopt handler References: <20091002011548.335611824@mini.kroah.org> Content-Disposition: inline; filename=net-ax25-fix-signed-comparison-in-the-sockopt-handler.patch In-Reply-To: <20091002012911.GA18542@kroah.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1605 Lines: 47 2.6.31-stable review patch. If anyone has any objections, please let us know. ------------------ From: Arjan van de Ven fixed upstream in commit b7058842c940ad2c08dd829b21e5c92ebe3b8758 in a different way The ax25 code tried to use if (optlen < sizeof(int)) return -EINVAL; as a security check against optlen being negative (or zero) in the set socket option. Unfortunately, "sizeof(int)" is an unsigned property, with the result that the whole comparison is done in unsigned, letting negative values slip through. This patch changes this to if (optlen < (int)sizeof(int)) return -EINVAL; so that the comparison is done as signed, and negative values get properly caught. Signed-off-by: Arjan van de Ven Cc: David S. Miller Cc: Ingo Molnar Cc: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- net/ax25/af_ax25.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -538,7 +538,7 @@ static int ax25_setsockopt(struct socket if (level != SOL_AX25) return -ENOPROTOOPT; - if (optlen < sizeof(int)) + if (optlen < (int)sizeof(int)) return -EINVAL; if (get_user(opt, (int __user *)optval)) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/