[PATCH] hostfs: fix 32-bit crash

Johannes Berg johannes at sipsolutions.net
Mon Jul 1 15:47:18 PDT 2024


From: Johannes Berg <johannes.berg at intel.com>

dev_t is a kernel type and may have different definitions
in kernel and userspace. On 32-bit x86 this currently makes
the stat structure being 4 bytes longer in the user code,
causing stack corruption. Just use 'unsigned int' so the
same size is used.

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 fs/hostfs/hostfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/hostfs/hostfs.h b/fs/hostfs/hostfs.h
index 0239e3af3945..89217d1a2189 100644
--- a/fs/hostfs/hostfs.h
+++ b/fs/hostfs/hostfs.h
@@ -65,7 +65,7 @@ struct hostfs_stat {
 	unsigned long long blocks;
 	unsigned int maj;
 	unsigned int min;
-	dev_t dev;
+	unsigned int dev;
 };
 
 extern int stat_file(const char *path, struct hostfs_stat *p, int fd);
-- 
2.45.2




More information about the linux-um mailing list