Skip to content

Commit 9e0ce55

Browse files
committed
Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc leftovers from Al Viro. * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: fix the __user misannotations in asm-generic get_user/put_user fput: Don't reinvent the wheel but use existing llist API namespace.c: Don't reinvent the wheel but use existing llist API
2 parents e253d98 + 1985296 commit 9e0ce55

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

fs/file_table.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,10 @@ static LLIST_HEAD(delayed_fput_list);
233233
static void delayed_fput(struct work_struct *unused)
234234
{
235235
struct llist_node *node = llist_del_all(&delayed_fput_list);
236-
struct llist_node *next;
236+
struct file *f, *t;
237237

238-
for (; node; node = next) {
239-
next = llist_next(node);
240-
__fput(llist_entry(node, struct file, f_u.fu_llist));
241-
}
238+
llist_for_each_entry_safe(f, t, node, f_u.fu_llist)
239+
__fput(f);
242240
}
243241

244242
static void ____fput(struct callback_head *work)
@@ -312,7 +310,7 @@ void put_filp(struct file *file)
312310
}
313311

314312
void __init files_init(void)
315-
{
313+
{
316314
filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0,
317315
SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);
318316
percpu_counter_init(&nr_files, 0, GFP_KERNEL);
@@ -331,4 +329,4 @@ void __init files_maxfiles_init(void)
331329
n = ((totalram_pages - memreserve) * (PAGE_SIZE / 1024)) / 10;
332330

333331
files_stat.max_files = max_t(unsigned long, n, NR_FILE);
334-
}
332+
}

fs/namespace.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,12 +1182,10 @@ static LLIST_HEAD(delayed_mntput_list);
11821182
static void delayed_mntput(struct work_struct *unused)
11831183
{
11841184
struct llist_node *node = llist_del_all(&delayed_mntput_list);
1185-
struct llist_node *next;
1185+
struct mount *m, *t;
11861186

1187-
for (; node; node = next) {
1188-
next = llist_next(node);
1189-
cleanup_mnt(llist_entry(node, struct mount, mnt_llist));
1190-
}
1187+
llist_for_each_entry_safe(m, t, node, mnt_llist)
1188+
cleanup_mnt(m);
11911189
}
11921190
static DECLARE_DELAYED_WORK(delayed_mntput_work, delayed_mntput);
11931191

include/asm-generic/uaccess.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ static inline int __access_ok(unsigned long addr, unsigned long size)
7575

7676
#define put_user(x, ptr) \
7777
({ \
78-
void *__p = (ptr); \
78+
void __user *__p = (ptr); \
7979
might_fault(); \
8080
access_ok(VERIFY_WRITE, __p, sizeof(*ptr)) ? \
81-
__put_user((x), ((__typeof__(*(ptr)) *)__p)) : \
81+
__put_user((x), ((__typeof__(*(ptr)) __user *)__p)) : \
8282
-EFAULT; \
8383
})
8484

@@ -137,10 +137,10 @@ extern int __put_user_bad(void) __attribute__((noreturn));
137137

138138
#define get_user(x, ptr) \
139139
({ \
140-
const void *__p = (ptr); \
140+
const void __user *__p = (ptr); \
141141
might_fault(); \
142142
access_ok(VERIFY_READ, __p, sizeof(*ptr)) ? \
143-
__get_user((x), (__typeof__(*(ptr)) *)__p) : \
143+
__get_user((x), (__typeof__(*(ptr)) __user *)__p) :\
144144
((x) = (__typeof__(*(ptr)))0,-EFAULT); \
145145
})
146146

0 commit comments

Comments
 (0)