From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 0258C1B3C0 for ; Tue, 23 Oct 2018 10:53:20 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2018 01:53:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,415,1534834800"; d="scan'208";a="94260665" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.107]) by orsmga003.jf.intel.com with SMTP; 23 Oct 2018 01:53:17 -0700 Received: by (sSMTP sendmail emulation); Tue, 23 Oct 2018 09:53:16 +0100 Date: Tue, 23 Oct 2018 09:53:16 +0100 From: Bruce Richardson To: Yipeng Wang Cc: dev@dpdk.org, honnappa.nagarahalli@arm.com Message-ID: <20181023085315.GA22220@bricha3-MOBL.ger.corp.intel.com> References: <1540233588-202969-1-git-send-email-yipeng1.wang@intel.com> <1540233588-202969-2-git-send-email-yipeng1.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1540233588-202969-2-git-send-email-yipeng1.wang@intel.com> Organization: Intel Research and Development Ireland Ltd. User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH v8 1/4] hash: fix race condition in iterate X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Oct 2018 08:53:21 -0000 On Mon, Oct 22, 2018 at 11:39:45AM -0700, Yipeng Wang wrote: > In rte_hash_iterate, the reader lock did not protect the > while loop which checks empty entry. This created a race > condition that the entry may become empty when enters > the lock, then a wrong key data value would be read out. > > This commit reads out the position in the while condition, > which makes sure that the position will not be changed > to empty before entering the lock. > > Fixes: f2e3001b53ec ("hash: support read/write concurrency") > Cc: stable@dpdk.org > > Signed-off-by: Yipeng Wang > Reported-by: Honnappa Nagarahalli > Reviewed-by: Honnappa Nagarahalli > Acked-by: Dharmik Thakkar > --- Acked-by: Bruce Richardson