From patchwork Thu May 6 11:52:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Teras X-Patchwork-Id: 51826 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 6EFE0B6F11 for ; Thu, 6 May 2010 21:52:49 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757604Ab0EFLwo (ORCPT ); Thu, 6 May 2010 07:52:44 -0400 Received: from mail-ew0-f220.google.com ([209.85.219.220]:40691 "EHLO mail-ew0-f220.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757477Ab0EFLwn (ORCPT ); Thu, 6 May 2010 07:52:43 -0400 Received: by ewy20 with SMTP id 20so1640563ewy.1 for ; Thu, 06 May 2010 04:52:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:from:to:cc:subject :date:message-id:x-mailer; bh=rpYWpdfajtDRCt65Ojhj8xhAoYT+oOSGVFLQDWjm1r8=; b=P5kQlyKxFaZJR2i8Xzc76QeAckVLp/qibNB+QTtbUiskc20RAS3FfuC06z+hN6DzAs +zgXaSDTxfZ/UdWPmbRNMc1zILKJ6dxuzs+4rGmAjFam8K0stcZooXFbjUd2BGmQHppA /3bEKvvMrXwfYv4rwNH1GVLwqmNnJAQW3Q9a4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer; b=Zk9ZSMAnRakzL5XuFOw9jbh7o3Dn93BRwR85QB6V1+xNbybwA6ih8vS6GmaAC0PUFX 0DeEYys03Z32K2CfvnpTwMzG7ur+Rcq6cz6NFengVhkabD6p/uFW91Jktz/Yla1spgnd dYPG6OEIvRf82q2i7utYZLNyMFCq2QbZ5589E= Received: by 10.213.55.209 with SMTP id v17mr3394491ebg.98.1273146762624; Thu, 06 May 2010 04:52:42 -0700 (PDT) Received: from localhost.localdomain (letku109.adsl.netsonic.fi [194.29.195.109]) by mx.google.com with ESMTPS id 15sm495296ewy.8.2010.05.06.04.52.40 (version=SSLv3 cipher=RC4-MD5); Thu, 06 May 2010 04:52:41 -0700 (PDT) From: Timo Teras To: netdev@vger.kernel.org Cc: Timo Teras Subject: [PATCH] xfrm: fix policy unreferencing on larval drop Date: Thu, 6 May 2010 14:52:14 +0300 Message-Id: <1273146734-8022-1-git-send-email-timo.teras@iki.fi> X-Mailer: git-send-email 1.6.3.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org I mistakenly had the error path to use num_pols to decide how many policies we need to drop (cruft from earlier patch set version which did not handle socket policies right). This is wrong since normally we do not keep explicit references (instead we hold reference to the cache entry which holds references to policies). drop_pols is set to num_pols if we are holding the references, so use that. Otherwise we eventually BUG_ON inside xfrm_policy_destroy due to premature policy deletion. Signed-off-by: Timo Teras --- net/xfrm/xfrm_policy.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 31f4ba4..f4ea3a0 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c @@ -1805,7 +1805,7 @@ restart: /* EREMOTE tells the caller to generate * a one-shot blackhole route. */ dst_release(dst); - xfrm_pols_put(pols, num_pols); + xfrm_pols_put(pols, drop_pols); XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTNOSTATES); return -EREMOTE; }