From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id B5CAE1A04D3 for ; Fri, 2 Oct 2015 22:43:32 +1000 (AEST) Subject: Re: [PATCH v5 01/34] cxlflash: Fix to avoid invalid port_sel value To: "Matthew R. Ochs" , linux-scsi@vger.kernel.org, James Bottomley , "Nicholas A. Bellinger" , Brian King , Ian Munsie , Daniel Axtens , Andrew Donnellan , David Laight References: <1443714773-9176-1-git-send-email-mrochs@linux.vnet.ibm.com> <1443714878-11649-1-git-send-email-mrochs@linux.vnet.ibm.com> Cc: Michael Neuling , linuxppc-dev@lists.ozlabs.org, Manoj Kumar , "Manoj N. Kumar" From: Tomas Henzl Message-ID: <560E7BEE.3000001@redhat.com> Date: Fri, 2 Oct 2015 14:43:26 +0200 MIME-Version: 1.0 In-Reply-To: <1443714878-11649-1-git-send-email-mrochs@linux.vnet.ibm.com> Content-Type: text/plain; charset=windows-1252 List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 1.10.2015 17:54, Matthew R. Ochs wrote: > From: Manoj Kumar > > If two concurrent MANAGE_LUN ioctls are issued with the same > WWID parameter, it would result in an incorrect value of port_sel. > > This is because port_sel is modified without any locks being > held. If the first caller stalls after the return from > find_and_create_lun(), the value of port_sel will be set > incorrectly to indicate a single port, though in this case > it should have been set to both ports. > > To fix, use the global mutex to serialize the lookup of the > WWID and the subsequent modification of port_sel. > > Signed-off-by: Matthew R. Ochs > Signed-off-by: Manoj N. Kumar > Reviewed-by: Brian King Reviewed-by: Tomas Henzl Tomas