From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751730AbeAQAgX convert rfc822-to-8bit (ORCPT + 1 other); Tue, 16 Jan 2018 19:36:23 -0500 Received: from mga14.intel.com ([192.55.52.115]:18477 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750908AbeAQAgW (ORCPT ); Tue, 16 Jan 2018 19:36:22 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,369,1511856000"; d="scan'208";a="27034242" From: "Dilger, Andreas" To: Greg Kroah-Hartman CC: "Eremin, Dmitry" , "devel@driverdev.osuosl.org" , "Drokin, Oleg" , "James Simmons" , Dan Carpenter , Linux Kernel Mailing List , "Lustre Development List" Subject: Re: [PATCH] staging: lustre: Fix avoid intensive reconnecting for ko2iblnd patch Thread-Topic: [PATCH] staging: lustre: Fix avoid intensive reconnecting for ko2iblnd patch Thread-Index: AQHTjtk6RRk3n6X/RkyvsWQGd5pBv6N3HkiAgAAgCACAAIB7gA== Date: Wed, 17 Jan 2018 00:36:19 +0000 Message-ID: <6D19AB36-CDDF-4743-AF46-ADF31E26B4F4@intel.com> References: <1516114161-27679-1-git-send-email-Dmitry.Eremin@intel.com> <9FC73D3DBECE0941BD2ED069D26863425CE75F26@irsmsx110.ger.corp.intel.com> <20180116165628.GB7066@kroah.com> In-Reply-To: <20180116165628.GB7066@kroah.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.255.86.173] Content-Type: text/plain; charset="us-ascii" Content-ID: <2C61B4AAE1019E4892F75C658AB7472F@intel.com> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: > On Jan 16, 2018, at 09:56, Greg Kroah-Hartman wrote: > > On Tue, Jan 16, 2018 at 03:01:49PM +0000, Eremin, Dmitry wrote: >> In the original commit 4d99b2581effe115376402e710fbcb1c3c073769 > > Please use the documented way to write this: > 4d99b2581eff ("staging: lustre: avoid intensive reconnecting for ko2iblnd") > >> was missed one hunk. Added it now to avoid issue with use after free. > > And I do not understand this commit message at all. > >> Signed-off-by: Dmitry Eremin >> --- >> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c >> index 2ebc484..a15a625 100644 >> --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c >> +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c >> @@ -890,7 +890,8 @@ void kiblnd_destroy_conn(struct kib_conn *conn, bool free_conn) >> atomic_dec(&net->ibn_nconns); >> } >> >> - kfree(conn); >> + if (free_conn) >> + kfree(conn); > > This looks really odd, don't you think? I'm not sure what the objection is here? There is an argument to this this function named "free_conn" which determines if the structure should be freed, or if the network connection is just being torn down and reconnected. Cheers, Andreas -- Andreas Dilger Lustre Principal Architect Intel Corporation