Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11813851pjo; Thu, 2 Jan 2020 14:44:29 -0800 (PST) X-Google-Smtp-Source: APXvYqzV1a7TjKNO4eXdnx6rf0lRnGnThlA2UhE6A0ukz1U8lyq2ZKlMKhpg21doptBblvh3+cpC X-Received: by 2002:aca:48d6:: with SMTP id v205mr2967937oia.10.1578005069781; Thu, 02 Jan 2020 14:44:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578005069; cv=none; d=google.com; s=arc-20160816; b=L/x0vSZXjKWX+NmKLf83Nd3AdpKV0L8hzv/utBU4K+mD+oIjMz9qRSZMQQ7ZuEoiFr DGLTltRQCUz7L+F4DWj3wzq0PTbbggag2D23XY+7La+lezQNaLRWeF86UWvxlnR8z7vx dBXaqQgTvCc35qCcgeXu2IIaFO4dClqvMls6q6P0CvfpisBeX1SxHcmQ7WVoK+CXn+5K gM8ib+QffPnS3tNekyNyH45+jBxC9aphRoJ8OtgXcZdMQIVfmCHGO0T1WbMK7/7vxoOV befefnSedfmVCW7GN5Cj6kzjgJ40uER53yNFI1RzQvD7WxUKic2D2xFa1bpf9IOb+8zR k/eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zGDbOShdNeQvZuzYgZ6scyEKzmQ2Kj+Uj/lUMIB+xvI=; b=qZBEhVvPOutDvqXAN2q4r+xXjRBtIdLhP8BMGVZ7QtHZsrtcKbJqQ5nBsfRaGVvlh7 dQLLY8Ek4tvP55Ua9nxZgxim4qAbtTBHCrm9lGrlrdrEBsRRu6/vd7JEJvZnXk+YDHve xuYV+QM7k4nMWDx3D5JQdH+NRd6H1+/GOpGCrDpD/V92oE/K8iB3EwTTJIu1yOQl8S6I 45y55jgJGCwbc1Zjln2Eoj6enabjZ6cOWpHaHSvMg/b2NR+Jy9CpWbsYNqRUhFL2TJux qCBJcu9Po8Ny/P2/m3u4bVjCTqC/J9DD6Td/mfRaXO8lm5mQtQzQPt8AR1DWDvG4zLln CMfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vWqbbKYH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o128si26690936oih.66.2020.01.02.14.44.18; Thu, 02 Jan 2020 14:44:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vWqbbKYH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730355AbgABWfJ (ORCPT + 99 others); Thu, 2 Jan 2020 17:35:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:44554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730762AbgABWfH (ORCPT ); Thu, 2 Jan 2020 17:35:07 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 43F0C20866; Thu, 2 Jan 2020 22:35:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578004506; bh=XEerCGWjLvl7u8fH0PxDvP1eQh0bK1GSZAxI0UkKFeQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vWqbbKYH7lBTb6NgXogFdF1tehjaSSvjKgkxml5KYnAAD8H9sbkwCN8KQ8xBq0jkf vk9WUpJRnHOP0csLjSd50v5kygPJ2YecyCEvEi/+gll9U3C3m7kAwFqYTtTx7f4Lsb JdFaOWcjqtKPyBRrwW859TyaI88qYlzdica24w4E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pan Bian , Mark Brown , Sasha Levin Subject: [PATCH 4.4 036/137] spi: img-spfi: fix potential double release Date: Thu, 2 Jan 2020 23:06:49 +0100 Message-Id: <20200102220551.533515340@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220546.618583146@linuxfoundation.org> References: <20200102220546.618583146@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pan Bian [ Upstream commit e9a8ba9769a0e354341bc6cc01b98aadcea1dfe9 ] The channels spfi->tx_ch and spfi->rx_ch are not set to NULL after they are released. As a result, they will be released again, either on the error handling branch in the same function or in the corresponding remove function, i.e. img_spfi_remove(). This patch fixes the bug by setting the two members to NULL. Signed-off-by: Pan Bian Link: https://lore.kernel.org/r/1573007769-20131-1-git-send-email-bianpan2016@163.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-img-spfi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi-img-spfi.c b/drivers/spi/spi-img-spfi.c index 823cbc92d1e7..c46c0738c734 100644 --- a/drivers/spi/spi-img-spfi.c +++ b/drivers/spi/spi-img-spfi.c @@ -673,6 +673,8 @@ static int img_spfi_probe(struct platform_device *pdev) dma_release_channel(spfi->tx_ch); if (spfi->rx_ch) dma_release_channel(spfi->rx_ch); + spfi->tx_ch = NULL; + spfi->rx_ch = NULL; dev_warn(spfi->dev, "Failed to get DMA channels, falling back to PIO mode\n"); } else { master->dma_tx = spfi->tx_ch; -- 2.20.1