Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754689AbcK1Lhw (ORCPT ); Mon, 28 Nov 2016 06:37:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58238 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754332AbcK1Lhn (ORCPT ); Mon, 28 Nov 2016 06:37:43 -0500 Date: Mon, 28 Nov 2016 12:37:33 +0100 From: Jiri Benc To: Haishuang Yan Cc: "David S. Miller" , Hannes Frederic Sowa , Pravin B Shelar , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] vxlan: fix a potential issue when create a new vxlan fdb entry. Message-ID: <20161128123733.592c7876@griffin> In-Reply-To: <1480316543-23298-1-git-send-email-yanhaishuang@cmss.chinamobile.com> References: <1480316543-23298-1-git-send-email-yanhaishuang@cmss.chinamobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 28 Nov 2016 11:37:37 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 727 Lines: 24 On Mon, 28 Nov 2016 15:02:23 +0800, Haishuang Yan wrote: > vxlan_fdb_append may return error, so add the proper check, > otherwise it will cause memory leak. > > Signed-off-by: Haishuang Yan > --- > drivers/net/vxlan.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c > index 21e92be..3b7b237 100644 > --- a/drivers/net/vxlan.c > +++ b/drivers/net/vxlan.c > @@ -611,6 +611,7 @@ static int vxlan_fdb_create(struct vxlan_dev *vxlan, > struct vxlan_rdst *rd = NULL; > struct vxlan_fdb *f; > int notify = 0; > + int rc = 0; The initialization to 0 should not be needed. Looks good otherwise. Thanks, Jiri