linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8, v3] ensure symlinks are NUL-terminated
@ 2008-12-16 15:51 Duane Griffin
  2008-12-16 15:51 ` [PATCH] vfs: introduce helper function to safely NUL-terminate symlinks Duane Griffin
  2008-12-16 17:03 ` [PATCH 0/8, v3] ensure symlinks are NUL-terminated Dave Kleikamp
  0 siblings, 2 replies; 21+ messages in thread
From: Duane Griffin @ 2008-12-16 15:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Andrew Morton, Al Viro, Evgeniy Dushistov

These patches fix potential bugs associated with link target handling by
NUL-terminating names read from disk.

This is version 3 of these patches. It fixes the bug, pointed out by Al Viro
and Evgeniy Dushistov, that i_size was not being validated. In order to
facilitate this it introduces a helper function for terminating the link name,
as suggested by Al.

diffstat:
 fs/ext2/inode.c          |    7 +++++--
 fs/ext3/inode.c          |    7 +++++--
 fs/ext4/inode.c          |    7 +++++--
 fs/freevxfs/vxfs_inode.c |    4 +++-
 fs/namei.c               |    7 +++++--
 fs/sysv/inode.c          |    6 +++++-
 fs/ufs/inode.c           |    8 ++++++--
 include/linux/namei.h    |    5 +++++
 8 files changed, 39 insertions(+), 12 deletions(-)

^ permalink raw reply	[flat|nested] 21+ messages in thread
* [PATCH, v4] vfs: introduce helper function to safely NUL-terminate symlinks
@ 2008-12-16 16:53 Duane Griffin
  2008-12-16 16:53 ` [PATCH] " Duane Griffin
  0 siblings, 1 reply; 21+ messages in thread
From: Duane Griffin @ 2008-12-16 16:53 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel, Duane Griffin, Al Viro, Andrew Morton

A number of filesystems were potentially triggering kernel bugs due to
corrupted symlink names on disk. This helper helps safely terminate the
names.

Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Duane Griffin <duaneg@dghda.com>
---

Version 4, this time with size_t instead of unsigned. Thanks Al!

 include/linux/namei.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/linux/namei.h b/include/linux/namei.h
index 99eb803..231ce28 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -94,4 +94,9 @@ static inline char *nd_get_link(struct nameidata *nd)
 	return nd->saved_names[nd->depth];
 }
 
+static inline void nd_terminate_link(void *name, size_t len, size_t maxlen)
+{
+	((char *) name)[min(len, maxlen)] = '\0';
+}
+
 #endif /* _LINUX_NAMEI_H */
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2008-12-27 12:23 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-16 15:51 [PATCH 0/8, v3] ensure symlinks are NUL-terminated Duane Griffin
2008-12-16 15:51 ` [PATCH] vfs: introduce helper function to safely NUL-terminate symlinks Duane Griffin
2008-12-16 15:51   ` [PATCH] vfs: ensure page symlinks are NUL-terminated Duane Griffin
2008-12-16 15:51     ` [PATCH] ext2: ensure fast " Duane Griffin
2008-12-16 15:51       ` [PATCH] ext3: " Duane Griffin
2008-12-16 15:51         ` [PATCH] ext4: " Duane Griffin
2008-12-16 15:51           ` [PATCH] ufs: " Duane Griffin
2008-12-16 15:51             ` [PATCH] sysv: " Duane Griffin
2008-12-16 15:52               ` [PATCH] freevxfs: " Duane Griffin
2008-12-16 19:40             ` [PATCH] ufs: " Evgeniy Dushistov
2008-12-16 23:18               ` Duane Griffin
2008-12-27 12:22                 ` Evgeniy Dushistov
2008-12-16 23:46           ` [PATCH] vfs: introduce helper function to safely NUL-terminate symlinks Andreas Dilger
2008-12-17  0:26             ` Duane Griffin
2008-12-19 15:03               ` Duane Griffin
2008-12-19 19:28                 ` Andrew Morton
2008-12-19 19:43                 ` Al Viro
2008-12-16 16:38   ` Al Viro
2008-12-16 17:03 ` [PATCH 0/8, v3] ensure symlinks are NUL-terminated Dave Kleikamp
2008-12-16 17:26   ` Duane Griffin
  -- strict thread matches above, loose matches on Subject: below --
2008-12-16 16:53 [PATCH, v4] vfs: introduce helper function to safely NUL-terminate symlinks Duane Griffin
2008-12-16 16:53 ` [PATCH] " Duane Griffin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).