Skip to content

Commit 995d03a

Browse files
committed
Merge branch 'akpm' (patches from Andrew)
Merge misc fixes from Andrew Morton: "15 fixes" [ This does not merge the "fortify: use WARN instead of BUG for now" patch, which needs a bit of extra work to build cleanly with all configurations. Arnd is on it. - Linus ] * emailed patches from Andrew Morton <akpm@linux-foundation.org>: ocfs2: don't clear SGID when inheriting ACLs mm: allow page_cache_get_speculative in interrupt context userfaultfd: non-cooperative: flush event_wqh at release time ipc: add missing container_of()s for randstruct cpuset: fix a deadlock due to incomplete patching of cpusets_enabled() userfaultfd_zeropage: return -ENOSPC in case mm has gone mm: take memory hotplug lock within numa_zonelist_order_handler() mm/page_io.c: fix oops during block io poll in swapin path zram: do not free pool->size_class kthread: fix documentation build warning kasan: avoid -Wmaybe-uninitialized warning userfaultfd: non-cooperative: notify about unmap of destination during mremap mm, mprotect: flush TLB if potentially racing with a parallel reclaim leaving stale TLB entries pid: kill pidhash_size in pidhash_init() mm/hugetlb.c: __get_user_pages ignores certain follow_hugetlb_page errors
2 parents 8d3fe85 + 19ec8e4 commit 995d03a

File tree

22 files changed

+109
-33
lines changed

22 files changed

+109
-33
lines changed

fs/ocfs2/acl.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -240,18 +240,6 @@ int ocfs2_set_acl(handle_t *handle,
240240
switch (type) {
241241
case ACL_TYPE_ACCESS:
242242
name_index = OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS;
243-
if (acl) {
244-
umode_t mode;
245-
246-
ret = posix_acl_update_mode(inode, &mode, &acl);
247-
if (ret)
248-
return ret;
249-
250-
ret = ocfs2_acl_set_mode(inode, di_bh,
251-
handle, mode);
252-
if (ret)
253-
return ret;
254-
}
255243
break;
256244
case ACL_TYPE_DEFAULT:
257245
name_index = OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT;
@@ -289,7 +277,19 @@ int ocfs2_iop_set_acl(struct inode *inode, struct posix_acl *acl, int type)
289277
had_lock = ocfs2_inode_lock_tracker(inode, &bh, 1, &oh);
290278
if (had_lock < 0)
291279
return had_lock;
280+
if (type == ACL_TYPE_ACCESS && acl) {
281+
umode_t mode;
282+
283+
status = posix_acl_update_mode(inode, &mode, &acl);
284+
if (status)
285+
goto unlock;
286+
287+
status = ocfs2_acl_set_mode(inode, bh, NULL, mode);
288+
if (status)
289+
goto unlock;
290+
}
292291
status = ocfs2_set_acl(NULL, inode, bh, type, acl, NULL, NULL);
292+
unlock:
293293
ocfs2_inode_unlock_tracker(inode, 1, &oh, had_lock);
294294
brelse(bh);
295295
return status;

fs/userfaultfd.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,9 @@ static int userfaultfd_release(struct inode *inode, struct file *file)
854854
__wake_up_locked_key(&ctx->fault_wqh, TASK_NORMAL, &range);
855855
spin_unlock(&ctx->fault_pending_wqh.lock);
856856

857+
/* Flush pending events that may still wait on event_wqh */
858+
wake_up_all(&ctx->event_wqh);
859+
857860
wake_up_poll(&ctx->fd_wqh, POLLHUP);
858861
userfaultfd_ctx_put(ctx);
859862
return 0;
@@ -1643,6 +1646,8 @@ static int userfaultfd_zeropage(struct userfaultfd_ctx *ctx,
16431646
ret = mfill_zeropage(ctx->mm, uffdio_zeropage.range.start,
16441647
uffdio_zeropage.range.len);
16451648
mmput(ctx->mm);
1649+
} else {
1650+
return -ENOSPC;
16461651
}
16471652
if (unlikely(put_user(ret, &user_uffdio_zeropage->zeropage)))
16481653
return -EFAULT;

include/linux/cpuset.h

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@
1818

1919
#ifdef CONFIG_CPUSETS
2020

21+
/*
22+
* Static branch rewrites can happen in an arbitrary order for a given
23+
* key. In code paths where we need to loop with read_mems_allowed_begin() and
24+
* read_mems_allowed_retry() to get a consistent view of mems_allowed, we need
25+
* to ensure that begin() always gets rewritten before retry() in the
26+
* disabled -> enabled transition. If not, then if local irqs are disabled
27+
* around the loop, we can deadlock since retry() would always be
28+
* comparing the latest value of the mems_allowed seqcount against 0 as
29+
* begin() still would see cpusets_enabled() as false. The enabled -> disabled
30+
* transition should happen in reverse order for the same reasons (want to stop
31+
* looking at real value of mems_allowed.sequence in retry() first).
32+
*/
33+
extern struct static_key_false cpusets_pre_enable_key;
2134
extern struct static_key_false cpusets_enabled_key;
2235
static inline bool cpusets_enabled(void)
2336
{
@@ -32,12 +45,14 @@ static inline int nr_cpusets(void)
3245

3346
static inline void cpuset_inc(void)
3447
{
48+
static_branch_inc(&cpusets_pre_enable_key);
3549
static_branch_inc(&cpusets_enabled_key);
3650
}
3751

3852
static inline void cpuset_dec(void)
3953
{
4054
static_branch_dec(&cpusets_enabled_key);
55+
static_branch_dec(&cpusets_pre_enable_key);
4156
}
4257

4358
extern int cpuset_init(void);
@@ -115,7 +130,7 @@ extern void cpuset_print_current_mems_allowed(void);
115130
*/
116131
static inline unsigned int read_mems_allowed_begin(void)
117132
{
118-
if (!cpusets_enabled())
133+
if (!static_branch_unlikely(&cpusets_pre_enable_key))
119134
return 0;
120135

121136
return read_seqcount_begin(&current->mems_allowed_seq);
@@ -129,7 +144,7 @@ static inline unsigned int read_mems_allowed_begin(void)
129144
*/
130145
static inline bool read_mems_allowed_retry(unsigned int seq)
131146
{
132-
if (!cpusets_enabled())
147+
if (!static_branch_unlikely(&cpusets_enabled_key))
133148
return false;
134149

135150
return read_seqcount_retry(&current->mems_allowed_seq, seq);

include/linux/kthread.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct task_struct *kthread_create_on_node(int (*threadfn)(void *data),
1515
* @threadfn: the function to run in the thread
1616
* @data: data pointer for @threadfn()
1717
* @namefmt: printf-style format string for the thread name
18-
* @...: arguments for @namefmt.
18+
* @arg...: arguments for @namefmt.
1919
*
2020
* This macro will create a kthread on the current node, leaving it in
2121
* the stopped state. This is just a helper for kthread_create_on_node();

include/linux/mm_types.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,10 @@ struct mm_struct {
494494
* PROT_NONE or PROT_NUMA mapped page.
495495
*/
496496
bool tlb_flush_pending;
497+
#endif
498+
#ifdef CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH
499+
/* See flush_tlb_batched_pending() */
500+
bool tlb_flush_batched;
497501
#endif
498502
struct uprobes_state uprobes_state;
499503
#ifdef CONFIG_HUGETLB_PAGE

include/linux/pagemap.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,6 @@ void release_pages(struct page **pages, int nr, bool cold);
163163
*/
164164
static inline int page_cache_get_speculative(struct page *page)
165165
{
166-
VM_BUG_ON(in_interrupt());
167-
168166
#ifdef CONFIG_TINY_RCU
169167
# ifdef CONFIG_PREEMPT_COUNT
170168
VM_BUG_ON(!in_atomic() && !irqs_disabled());

ipc/msg.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,8 @@ void msg_exit_ns(struct ipc_namespace *ns)
10341034
static int sysvipc_msg_proc_show(struct seq_file *s, void *it)
10351035
{
10361036
struct user_namespace *user_ns = seq_user_ns(s);
1037-
struct msg_queue *msq = it;
1037+
struct kern_ipc_perm *ipcp = it;
1038+
struct msg_queue *msq = container_of(ipcp, struct msg_queue, q_perm);
10381039

10391040
seq_printf(s,
10401041
"%10d %10d %4o %10lu %10lu %5u %5u %5u %5u %5u %5u %10lu %10lu %10lu\n",

ipc/sem.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2179,7 +2179,8 @@ void exit_sem(struct task_struct *tsk)
21792179
static int sysvipc_sem_proc_show(struct seq_file *s, void *it)
21802180
{
21812181
struct user_namespace *user_ns = seq_user_ns(s);
2182-
struct sem_array *sma = it;
2182+
struct kern_ipc_perm *ipcp = it;
2183+
struct sem_array *sma = container_of(ipcp, struct sem_array, sem_perm);
21832184
time_t sem_otime;
21842185

21852186
/*

ipc/shm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1380,9 +1380,11 @@ SYSCALL_DEFINE1(shmdt, char __user *, shmaddr)
13801380
static int sysvipc_shm_proc_show(struct seq_file *s, void *it)
13811381
{
13821382
struct user_namespace *user_ns = seq_user_ns(s);
1383-
struct shmid_kernel *shp = it;
1383+
struct kern_ipc_perm *ipcp = it;
1384+
struct shmid_kernel *shp;
13841385
unsigned long rss = 0, swp = 0;
13851386

1387+
shp = container_of(ipcp, struct shmid_kernel, shm_perm);
13861388
shm_add_rss_swap(shp, &rss, &swp);
13871389

13881390
#if BITS_PER_LONG <= 32

kernel/cgroup/cpuset.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
#include <linux/cgroup.h>
6464
#include <linux/wait.h>
6565

66+
DEFINE_STATIC_KEY_FALSE(cpusets_pre_enable_key);
6667
DEFINE_STATIC_KEY_FALSE(cpusets_enabled_key);
6768

6869
/* See "Frequency meter" comments, below. */

0 commit comments

Comments
 (0)