Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753975AbbL2U22 (ORCPT ); Tue, 29 Dec 2015 15:28:28 -0500 Received: from shards.monkeyblade.net ([149.20.54.216]:59980 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753704AbbL2U2X (ORCPT ); Tue, 29 Dec 2015 15:28:23 -0500 Date: Tue, 29 Dec 2015 15:28:22 -0500 (EST) Message-Id: <20151229.152822.353618428420139342.davem@davemloft.net> To: joe@ovn.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, pshelar@nicira.com Subject: Re: [PATCH net] openvswitch: Fix template leak in error cases. From: David Miller In-Reply-To: <1450910367-61953-1-git-send-email-joe@ovn.org> References: <1450910367-61953-1-git-send-email-joe@ovn.org> X-Mailer: Mew version 6.6 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Tue, 29 Dec 2015 12:28:23 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1274 Lines: 28 From: Joe Stringer Date: Wed, 23 Dec 2015 14:39:27 -0800 > Commit 5b48bb8506c5 ("openvswitch: Fix helper reference leak") fixed a > reference leak on helper objects, but inadvertently introduced a leak on > the ct template. > > Previously, ct_info.ct->general.use was initialized to 0 by > nf_ct_tmpl_alloc() and only incremented when ovs_ct_copy_action() > returned successful. If an error occurred while adding the helper or > adding the action to the actions buffer, the __ovs_ct_free_action() > cleanup would use nf_ct_put() to free the entry; However, this relies on > atomic_dec_and_test(ct_info.ct->general.use). This reference must be > incremented first, or nf_ct_put() will never free it. > > Fix the issue by acquiring a reference to the template immediately after > allocation. > > Fixes: cae3a2627520 ("openvswitch: Allow attaching helpers to ct action") > Fixes: 5b48bb8506c5 ("openvswitch: Fix helper reference leak") > Signed-off-by: Joe Stringer Looks good, applied, thanks Joe. -- 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/