From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tomas Henzl Subject: Re: [PATCH v6 20/37] cxlflash: Fix to prevent workq from accessing freed memory Date: Fri, 23 Oct 2015 15:41:35 +0200 Message-ID: <562A390F.7040909@redhat.com> References: <1445458134-63197-1-git-send-email-mrochs@linux.vnet.ibm.com> <1445458457-31539-1-git-send-email-mrochs@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.redhat.com ([209.132.183.28]:60443 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751851AbbJWNlj (ORCPT ); Fri, 23 Oct 2015 09:41:39 -0400 In-Reply-To: <1445458457-31539-1-git-send-email-mrochs@linux.vnet.ibm.com> Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: "Matthew R. Ochs" , linux-scsi@vger.kernel.org, James Bottomley , "Nicholas A. Bellinger" , Brian King , Ian Munsie , Daniel Axtens , Andrew Donnellan , David Laight Cc: Michael Neuling , "Manoj N. Kumar" , linuxppc-dev@lists.ozlabs.org On 21.10.2015 22:14, Matthew R. Ochs wrote: > The workq can process work in parallel with a remove event, leading > to a condition where the workq handler can access freed memory. > > To remedy, the workq should be terminated prior to freeing memory. Move > the termination call earlier in remove and use cancel_work_sync() instead > of flush_work() as there is not a need to process any scheduled work when > shutting down. > > Signed-off-by: Matthew R. Ochs > Signed-off-by: Manoj N. Kumar > Reviewed-by: Brian King Reviewed-by: Tomas Henzl Tomas