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 3031D1FB9 for ; Fri, 3 Feb 2023 10:28:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C8ACC433D2; Fri, 3 Feb 2023 10:28:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675420120; bh=gXpkYAU/2A+yyxmMoyJnsPI3rX8wly/Jk/ju6sgCVTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BuHfPlt5nNWMwHEdOXzhcDR6t3qEzcFbSElHoGRj71Z6qo46kAtXzxCDXbGP76vm2 q9ydzmfkt8evFTHoL+toQxncJ2cGic82RcgA+QEdomAqm4qU2FItUSC3NULfAKfx5w q6CFKVFAi/5+R2RRDHwGWxaFjRAL/8D3trrUidrY= 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.4 059/134] spi: spidev: remove debug messages that access spidev->spi without locking Date: Fri, 3 Feb 2023 11:12:44 +0100 Message-Id: <20230203101026.537922570@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230203101023.832083974@linuxfoundation.org> References: <20230203101023.832083974@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 2478ae471f4e..6d6fc7de9cf3 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c @@ -588,7 +588,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; } @@ -597,7 +596,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