diff options
| author | Johannes Berg <johannes.berg@intel.com> | 2024-07-02 09:24:41 +0200 |
|---|---|---|
| committer | Johannes Berg <johannes.berg@intel.com> | 2024-07-03 12:23:50 +0200 |
| commit | 267ed02c2121b75e0eaaa338240453b576039e4a (patch) | |
| tree | d5a8154378b42e684aa6e56fad05f996caaaebf8 /fs/hostfs/hostfs.h | |
| parent | 53585f9ea40a9466ab9c1151f15984513eb542f7 (diff) | |
hostfs: fix dev_t handling
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.
However, this is (potentially) not the only problem, since
dev_t is a different type on user/kernel side, so we don't
know that the major/minor encoding isn't also different.
Decode/encode it instead to address both problems.
Cc: stable@vger.kernel.org
Fixes: 74ce793bcbde ("hostfs: Fix ephemeral inodes")
Link: https://patch.msgid.link/20240702092440.acc960585dd5.Id0767e12f562a69c6cd3c3262dc3d765db350cf6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'fs/hostfs/hostfs.h')
| -rw-r--r-- | fs/hostfs/hostfs.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/hostfs/hostfs.h b/fs/hostfs/hostfs.h index 0239e3af3945..8b39c15c408c 100644 --- a/fs/hostfs/hostfs.h +++ b/fs/hostfs/hostfs.h @@ -63,9 +63,10 @@ struct hostfs_stat { struct hostfs_timespec atime, mtime, ctime; unsigned int blksize; unsigned long long blocks; - unsigned int maj; - unsigned int min; - dev_t dev; + struct { + unsigned int maj; + unsigned int min; + } rdev, dev; }; extern int stat_file(const char *path, struct hostfs_stat *p, int fd); |
