From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 60E10323C for ; Mon, 30 Jan 2023 14:23:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BACEBC433EF; Mon, 30 Jan 2023 14:23:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675088586; bh=zL+jDpKgNJoatZKiw2piRhNuUv0oWA6TVS438OSXSAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WDFlozGVE6r6t+Wv0ad70CLmaQ0P6AUus9HH/PxgBZiotu27y6dEb3Sdbe2NtedmY ebuq0IzE61jPQ5B53xGZg9IBcQ7XUqLzaWu57lVQWQDZZHkFqs9Ztoi3jpK83NHZYn w+pdQg2iHp70JDKcV7n+0N/JsuyaeBziQpBzP/Jk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bartosz Golaszewski , Mark Brown , Sasha Levin Subject: [PATCH 5.10 069/143] spi: spidev: remove debug messages that access spidev->spi without locking Date: Mon, 30 Jan 2023 14:52:06 +0100 Message-Id: <20230130134309.700025726@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230130134306.862721518@linuxfoundation.org> References: <20230130134306.862721518@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Bartosz Golaszewski [ Upstream commit 6b35b173dbc1711f8d272e3f322d2ad697015919 ] The two debug messages in spidev_open() dereference spidev->spi without taking the lock and without checking if it's not null. This can lead to a crash. Drop the messages as they're not needed - the user-space will get informed about ENOMEM with the syscall return value. Signed-off-by: Bartosz Golaszewski Link: https://lore.kernel.org/r/20230106100719.196243-2-brgl@bgdev.pl Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spidev.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index 9c5ec99431d2..aee960a7d7f9 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c @@ -592,7 +592,6 @@ static int spidev_open(struct inode *inode, struct file *filp) if (!spidev->tx_buffer) { spidev->tx_buffer = kmalloc(bufsiz, GFP_KERNEL); if (!spidev->tx_buffer) { - dev_dbg(&spidev->spi->dev, "open/ENOMEM\n"); status = -ENOMEM; goto err_find_dev; } @@ -601,7 +600,6 @@ static int spidev_open(struct inode *inode, struct file *filp) if (!spidev->rx_buffer) { spidev->rx_buffer = kmalloc(bufsiz, GFP_KERNEL); if (!spidev->rx_buffer) { - dev_dbg(&spidev->spi->dev, "open/ENOMEM\n"); status = -ENOMEM; goto err_alloc_rx_buf; } -- 2.39.0