From patchwork Fri Aug 18 12:16:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lamparter X-Patchwork-Id: 803206 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xYhsZ5zc3z9t0j for ; Fri, 18 Aug 2017 22:17:06 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752013AbdHRMRD (ORCPT ); Fri, 18 Aug 2017 08:17:03 -0400 Received: from eidolon.nox.tf ([185.142.180.128]:57540 "EHLO eidolon.nox.tf" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751091AbdHRMRC (ORCPT ); Fri, 18 Aug 2017 08:17:02 -0400 Received: from equinox by eidolon.nox.tf with local (Exim 4.89) (envelope-from ) id 1digCu-002ATl-6s; Fri, 18 Aug 2017 14:16:57 +0200 From: David Lamparter To: netdev@vger.kernel.org Cc: David Lamparter , Jakub Kicinski , Sridhar Samudrala , Simon Horman , "David S . Miller" Subject: [PATCH net-next] net: check type when freeing metadata dst Date: Fri, 18 Aug 2017 14:16:51 +0200 Message-Id: <20170818121651.516877-1-equinox@diac24.net> X-Mailer: git-send-email 2.13.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org There is a new metadata dst type field added in "net: store port/representator id in metadata_dst", but metadata_dst_free() wasn't updated to check it before freeing the METADATA_IP_TUNNEL specific dst cache entry. This is not currently causing problems since it's far enough back in the struct to be zeroed for the only other type currently in existance (METADATA_HW_PORT_MUX), but nevertheless it's not correct. Fixes: 3fcece12bc1b6dcdf0986f2cd9e8f63b1f9b6aa0 Signed-off-by: David Lamparter Cc: Jakub Kicinski Cc: Sridhar Samudrala Cc: Simon Horman Cc: David S. Miller --- net/core/dst.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/core/dst.c b/net/core/dst.c index 00aa972ad1a1..7954d1710d97 100644 --- a/net/core/dst.c +++ b/net/core/dst.c @@ -299,7 +299,8 @@ EXPORT_SYMBOL_GPL(metadata_dst_alloc); void metadata_dst_free(struct metadata_dst *md_dst) { #ifdef CONFIG_DST_CACHE - dst_cache_destroy(&md_dst->u.tun_info.dst_cache); + if (md_dst->type == METADATA_IP_TUNNEL) + dst_cache_destroy(&md_dst->u.tun_info.dst_cache); #endif kfree(md_dst); }