lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue,  8 Mar 2022 09:56:11 +0800
From:   Yunhao Tian <t123yh.xyz@...il.com>
To:     Noralf Trønnes <noralf@...nnes.org>
Cc:     Yunhao Tian <t123yh.xyz@...il.com>,
        Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Maxime Ripard <mripard@...nel.org>,
        Thomas Zimmermann <tzimmermann@...e.de>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: [PATCH] drm/mipi-dbi: Fix max_chunk calculation in spi_transfer

In __spi_validate, there's a validation that no partial transfers
are accepted (xfer->len % w_size must be zero). When
max_chunk is not a multiple of bpw (e.g.max_chunk = 65535,
bpw = 16), the transfer will be rejected.

This patch clamps max_chunk to the word size, preventing
the transfer from being rejected.

Signed-off-by: Yunhao Tian <t123yh.xyz@...il.com>
---
 drivers/gpu/drm/drm_mipi_dbi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index 71b646c4131f..440dc9fec6cc 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -1182,6 +1182,15 @@ int mipi_dbi_spi_transfer(struct spi_device *spi, u32 speed_hz,
 	struct spi_message m;
 	size_t chunk;
 	int ret;
+	int w_size;
+
+	if (bpw <= 8)
+		w_size = 1;
+	else if (bpw <= 16)
+		w_size = 2;
+	else
+		w_size = 4;
+	max_chunk -= (max_chunk % w_size);
 
 	spi_message_init_with_transfers(&m, &tr, 1);
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ