From patchwork Tue Feb 9 13:59:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jamal X-Patchwork-Id: 44908 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D2CC5B7D18 for ; Wed, 10 Feb 2010 01:02:23 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754413Ab0BIN7n (ORCPT ); Tue, 9 Feb 2010 08:59:43 -0500 Received: from qw-out-2122.google.com ([74.125.92.27]:55126 "EHLO qw-out-2122.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754239Ab0BIN7m (ORCPT ); Tue, 9 Feb 2010 08:59:42 -0500 Received: by qw-out-2122.google.com with SMTP id 9so857423qwb.37 for ; Tue, 09 Feb 2010 05:59:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:subject:from:reply-to :to:cc:content-type:date:message-id:mime-version:x-mailer; bh=6CsEZE5weXWpAnNylEQOhn4wf/RALzFVxNEuT9Iaw2Q=; b=An6wyVX7mKGqbrTwfQHGPlymgcd0AFHtEItLrM1N7O5eiBlYRYfW8/ys3ku7BCE5Tz VwyafcAPlD/dTLAD3zq3AAX3ekLmYHl+s1pAncTKuuzQoun6MT+kb603T8EYm19aGWRc WFeXsGd5Ve/DHpzFzUarvuuJg9Hi4JK/AH2G4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:subject:from:reply-to:to:cc:content-type:date:message-id :mime-version:x-mailer; b=R84jQgMXojyNs80+tyaWccBAjRhhvVFM+LB9V1RlOfR7oF35H9k5ezHDn43tH0ZDX/ 1gWFwoauM3xD8187iR3+KRmbg+hgs3jvInYJCotN6s6A7o06Sl1KSIipk0Fdm6DGvm9A o+BpDe8QwqFnJ8fEu+3DhM8XJ2aN3nIj/D830= Received: by 10.224.42.139 with SMTP id s11mr3131695qae.26.1265723979724; Tue, 09 Feb 2010 05:59:39 -0800 (PST) Received: from ?10.0.0.26? (CPE0030ab124d2f-CM001bd7a7f1a0.cpe.net.cable.rogers.com [99.240.66.42]) by mx.google.com with ESMTPS id 26sm246567qwa.22.2010.02.09.05.59.38 (version=SSLv3 cipher=RC4-MD5); Tue, 09 Feb 2010 05:59:39 -0800 (PST) Subject: [PATCH] xfrm: validate attributes From: jamal Reply-To: hadi@cyberus.ca To: David Miller , Herbert Xu Cc: netdev@vger.kernel.org Date: Tue, 09 Feb 2010 08:59:38 -0500 Message-Id: <1265723978.3688.82.camel@bigi> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org make sure all XFRMAs go through validation in case wrong content is passed cheers, jamal commit 979fef2abd38392e28c851215c59d1128fe0f776 Author: Jamal Hadi Salim Date: Tue Feb 9 08:47:57 2010 -0500 xfrm: validate attributes Some XFRM attributes were not going through basic validation. Signed-off-by: Jamal Hadi Salim diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index d5a7129..943c871 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -2054,6 +2054,10 @@ static const int xfrm_msg_min[XFRM_NR_MSGTYPES] = { #undef XMSGSIZE static const struct nla_policy xfrma_policy[XFRMA_MAX+1] = { + [XFRMA_SA] = { .len = sizeof(struct xfrm_usersa_info)}, + [XFRMA_POLICY] = { .len = sizeof(struct xfrm_userpolicy_info)}, + [XFRMA_LASTUSED] = { .type = NLA_U64}, + [XFRMA_ALG_AUTH_TRUNC] = { .len = sizeof(struct xfrm_algo_auth)}, [XFRMA_ALG_AEAD] = { .len = sizeof(struct xfrm_algo_aead) }, [XFRMA_ALG_AUTH] = { .len = sizeof(struct xfrm_algo) }, [XFRMA_ALG_CRYPT] = { .len = sizeof(struct xfrm_algo) },