Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9097256pxu; Mon, 28 Dec 2020 06:34:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEGQIq9b5Yxs2pJGFJWHi+jlnBaqCBEQj0MzQAb1GslhvjSNh1zubsV192mXs3Pa8NdJBK X-Received: by 2002:aa7:c0c2:: with SMTP id j2mr42851755edp.343.1609166058423; Mon, 28 Dec 2020 06:34:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166058; cv=none; d=google.com; s=arc-20160816; b=Bgxld6S1wZAyc+7fjAkQ9seow4op0XXoPCOuROzQuVP8GNNsFM6EWfQN2EyOnZy4Bb XHeV1QsvYMRMo1DFsb63kQFY+X27PpRS0WX70rV1hQGm/q6KrvBSetjxF1huhn0y/15V 63bjQKjCwW+rPpmzTf28DfWT4/+sW1lGKTxanH00ks0fLr3tG5I03l8o+e0YH3AKYAeQ UJ0BdJUFPfUWeVIg8l+x6nF6mpPjJY+BxSDBQurr6VOy7FFFmwFsR/XAuxJhiVUEA4cu pJnc484TM+RCl+cPcvmPqO4I1pyXlt1k5NvpAvsemhIyW3STpbh0AKqiQoS3OEeAE0pR o+Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t7Np3BAnzLa3uBSkv3O5NVBtYTdDNwWe/19rYyuAUfA=; b=H5SAjz+jpxLp9kMXjd2b2N9XqD3hnz+WyY0r36natfTKoGLDrtr3lkxHWAyKXBe5az OHkogd/YkRcGFJCGzdZSQzt+MLGZP6mWQYoTrw4gqGvTgF9uf/NCn0BQriLld8vaavv2 8i01J82XPjwm/fFxB4uRbAgkhZlOH9Fo5wFORrZezh0mPrxww2QH+KBKnca4yXSBRIga UxbM8HgVQXjv5Jkn/p3GtKsAI/w5MFv21nj5jFtSExbyKbzJme2mqRK09oRu2lHXYGTB zSvfXO6ZuzqWPv51oqRSxO27PzHybSxLl5rq+RTABX2WkdlWh17qBmf9hxLyGXl2ZwgE P+uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="b+l/tsQQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c12si18470365ejb.751.2020.12.28.06.33.55; Mon, 28 Dec 2020 06:34:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="b+l/tsQQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2504613AbgL1OcJ (ORCPT + 99 others); Mon, 28 Dec 2020 09:32:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:38964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2504154AbgL1ObH (ORCPT ); Mon, 28 Dec 2020 09:31:07 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0B561207B2; Mon, 28 Dec 2020 14:30:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165852; bh=t1gGUelAwP2A+EmHeUClX4L/LHo/xQfFUa6r+6dbcDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b+l/tsQQHi4zCDsgum4yUppA7cQ0gprs4v5qXFzAuwE91LiJAEGYaIoBJlvoDaqZd aPLf42mr+P7oZV+sdycmoujYBYwPU4t/IKO5Y4VUTteKUKnalcpOxNdIhbeFVws12I HvU4M4Xgba3dexlJrlo7/8wI3lZeMTzKcnXzDnbI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Peter Ujfalusi , Mark Brown Subject: [PATCH 5.10 646/717] spi: davinci: Fix use-after-free on unbind Date: Mon, 28 Dec 2020 13:50:44 +0100 Message-Id: <20201228125051.889692540@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lukas Wunner commit 373afef350a93519b4b8d636b0895da8650b714b upstream. davinci_spi_remove() accesses the driver's private data after it's been freed with spi_master_put(). Fix by moving the spi_master_put() to the end of the function. Fixes: fe5fd2540947 ("spi: davinci: Use dma_request_chan() for requesting DMA channel") Signed-off-by: Lukas Wunner Acked-by: Peter Ujfalusi Cc: # v4.7+ Link: https://lore.kernel.org/r/412f7eb1cf8990e0a3a2153f4c577298deab623e.1607286887.git.lukas@wunner.de Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-davinci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c @@ -1040,13 +1040,13 @@ static int davinci_spi_remove(struct pla spi_bitbang_stop(&dspi->bitbang); clk_disable_unprepare(dspi->clk); - spi_master_put(master); if (dspi->dma_rx) { dma_release_channel(dspi->dma_rx); dma_release_channel(dspi->dma_tx); } + spi_master_put(master); return 0; }