users/willy/linux.git
3 years agomm: Remove slab from struct page struct-slab
Matthew Wilcox (Oracle) [Thu, 30 Sep 2021 03:10:53 +0000 (23:10 -0400)]
mm: Remove slab from struct page

All members of struct slab can now be removed from struct page.
This shrinks the definition of struct page by 30 LOC, making
it easier to understand.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agoiommu: Use put_pages_list
Matthew Wilcox (Oracle) [Thu, 30 Sep 2021 02:49:59 +0000 (22:49 -0400)]
iommu: Use put_pages_list

page->freelist is for the use of slab.  We already have the ability
to free a list of pages in the core mm, but it requires the use of a
list_head and for the pages to be chained together through page->lru.
Switch the iommu code over to using free_pages_list().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agobootmem: Use page->index instead of page->freelist
Matthew Wilcox (Oracle) [Wed, 22 Sep 2021 19:01:37 +0000 (15:01 -0400)]
bootmem: Use page->index instead of page->freelist

page->freelist is for the use of slab.  Using page->index is the same
set of bits as page->freelist, and by using an integer instead of a
pointer, we can avoid casts.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agozsmalloc: Stop using slab fields in struct page
Matthew Wilcox (Oracle) [Wed, 22 Sep 2021 18:58:38 +0000 (14:58 -0400)]
zsmalloc: Stop using slab fields in struct page

The ->freelist and ->units members of struct page are for the use of slab
only.  I'm not particularly familiar with zsmalloc, so generate the same
code by using page->index to store 'page' (page->index and page->freelist
are at the same offset in struct page).  This should be cleaned up
properly at some point by somebody who is familiar with zsmalloc.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/kasan: Convert to struct slab
Matthew Wilcox (Oracle) [Sun, 3 Oct 2021 00:27:54 +0000 (20:27 -0400)]
mm/kasan: Convert to struct slab

This should all be split up and done better.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomemcg: Convert object cgroups from struct page to struct slab
Matthew Wilcox (Oracle) [Wed, 29 Sep 2021 16:05:14 +0000 (12:05 -0400)]
memcg: Convert object cgroups from struct page to struct slab

Now that slab and slub are converted to use struct slab throughout,
convert the memcg infrastructure that they use.

There is a comment in here that I would appreciate being cleared up
before this patch is merged.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm: Convert slub to use struct slab
Matthew Wilcox (Oracle) [Wed, 29 Sep 2021 19:58:22 +0000 (15:58 -0400)]
mm: Convert slub to use struct slab

Remaining bits & pieces.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm: Convert slob to use struct slab
Matthew Wilcox (Oracle) [Mon, 4 Oct 2021 11:26:50 +0000 (07:26 -0400)]
mm: Convert slob to use struct slab

Use struct slab throughout the slob allocator.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm: Convert slab to use struct slab
Matthew Wilcox (Oracle) [Wed, 29 Sep 2021 19:58:22 +0000 (15:58 -0400)]
mm: Convert slab to use struct slab

Use struct slab throughout the slab allocator.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Remove pfmemalloc_match_unsafe()
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 03:22:58 +0000 (23:22 -0400)]
mm/slub: Remove pfmemalloc_match_unsafe()

slab_test_pfmemalloc() doesn't need to check PageSlab() (unlike
PageSlabPfmemalloc()), so we don't need a pfmemalloc_match_unsafe()
variant any more.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert pfmemalloc_match() to take a struct slab
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 03:21:25 +0000 (23:21 -0400)]
mm/slub: Convert pfmemalloc_match() to take a struct slab

Improves type safety and removes calls to slab_page().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert setup_page_debug() to setup_slab_debug()
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 03:18:37 +0000 (23:18 -0400)]
mm/slub: Convert setup_page_debug() to setup_slab_debug()

Removes a call to slab_page()

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert slab_lock() and slab_unlock() to struct slab
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 03:10:36 +0000 (23:10 -0400)]
mm/slub: Convert slab_lock() and slab_unlock() to struct slab

Improve type safety to the point where we can get rid of the assertions
that this is not a tail page.  Remove a lot of calls to slab_page().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert get_map() and __fill_map() to struct slab
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 03:06:11 +0000 (23:06 -0400)]
mm/slub: Convert get_map() and __fill_map() to struct slab

Improve type safety and remove calls to slab_page().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert cmpxchg_double_slab to struct slab
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 03:03:05 +0000 (23:03 -0400)]
mm/slub: Convert cmpxchg_double_slab to struct slab

Improve type safety for both cmpxchg_double_slab() and
__cmpxchg_double_slab().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert trace() to take a struct slab
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 02:57:19 +0000 (22:57 -0400)]
mm/slub: Convert trace() to take a struct slab

Improves type safety and removes calls to slab_page().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert print_page_info() to print_slab_info()
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 02:54:30 +0000 (22:54 -0400)]
mm/slub: Convert print_page_info() to print_slab_info()

Improve the type safety and remove calls to slab_page().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert slab_err() to take a struct slab
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 02:52:03 +0000 (22:52 -0400)]
mm/slub: Convert slab_err() to take a struct slab

Push slab_page() down.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert print_trailer() to struct slab
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 02:45:02 +0000 (22:45 -0400)]
mm/slub: Convert print_trailer() to struct slab

This is mostly pushing slab_page() calls down.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert object_err() to take a struct slab
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 02:33:39 +0000 (22:33 -0400)]
mm/slub: Convert object_err() to take a struct slab

Improves type safety and removes a lot of calls to slab_page().
Also make object_err() static.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert check_valid_pointer() to struct slab
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 02:26:48 +0000 (22:26 -0400)]
mm/slub: Convert check_valid_pointer() to struct slab

Improves type safety and removes a lot of calls to slab_page().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert check_slab() to struct slab
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 02:22:33 +0000 (22:22 -0400)]
mm/slub: Convert check_slab() to struct slab

Also convert slab_pad_check() to struct slab.  Improves type safety
and pushes down a few calls to slab_page().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert on_freelist() to struct slab
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 02:11:42 +0000 (22:11 -0400)]
mm/slub: Convert on_freelist() to struct slab

Improves type safety as well as pushing down calls to slab_page().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert check_object() to struct slab
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 01:57:41 +0000 (21:57 -0400)]
mm/slub: Convert check_object() to struct slab

Also convert check_bytes_and_report() and check_pad_bytes().
This is almost exclusively pushing slab_page() calls down.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert alloc_debug_processing() to struct slab
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 01:41:36 +0000 (21:41 -0400)]
mm/slub: Convert alloc_debug_processing() to struct slab

Push the slab conversion all the way down to alloc_consistency_checks(),
but actually use the fact that it's a slab in alloc_debug_processing().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert free_consistency_checks() to take a struct slab
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 01:25:44 +0000 (21:25 -0400)]
mm/slub: Convert free_consistency_checks() to take a struct slab

Provides a little more type safety, but mostly this is just pushing
slab_page() calls down.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert full slab management to struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 22:09:46 +0000 (18:09 -0400)]
mm/slub: Convert full slab management to struct slab

Pass struct slab to add_full() and remove_full().  Improves type
safety.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert freelist_corrupted() to struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 22:06:50 +0000 (18:06 -0400)]
mm/slub: Convert freelist_corrupted() to struct slab

Move slab_page() call down a level.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Remove struct page argument from setup_object()
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 22:03:05 +0000 (18:03 -0400)]
mm/slub: Remove struct page argument from setup_object()

Neither setup_object() nor setup_object_debug() used their struct page
argument, so delete it instead of converting to struct slab.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Remove struct page argument to next_freelist_entry()
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 22:00:07 +0000 (18:00 -0400)]
mm/slub: Remove struct page argument to next_freelist_entry()

This argument was unused.  Fix up some comments and rename a parameter.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert shuffle_freelist to struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 21:54:24 +0000 (17:54 -0400)]
mm/slub: Convert shuffle_freelist to struct slab

Improve type safety.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert slab freeing to struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 21:45:54 +0000 (17:45 -0400)]
mm/slub: Convert slab freeing to struct slab

Improve type safety by passing a slab pointer through discard_slab()
to free_slab() and __free_slab().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert partial slab management to struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 21:36:34 +0000 (17:36 -0400)]
mm/slub: Convert partial slab management to struct slab

Convert __add_partial(), add_partial() and remove_partial().
Improves type safety and removes calls to slab_page().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert acquire_slab() to take a struct page
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 21:32:11 +0000 (17:32 -0400)]
mm/slub: Convert acquire_slab() to take a struct page

Improves type safety.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert deactivate_slab() to take a struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 21:29:09 +0000 (17:29 -0400)]
mm/slub: Convert deactivate_slab() to take a struct slab

Improves type safety and removes calls to slab_page().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert __unfreeze_partials to take a struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 21:22:40 +0000 (17:22 -0400)]
mm/slub: Convert __unfreeze_partials to take a struct slab

Improves type safety while removing a few calls to slab_page().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert slab flushing to struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 19:47:19 +0000 (15:47 -0400)]
mm/slub: Convert slab flushing to struct slab

Moves a few calls to slab_page() around.  Gets us a step closer to
allowing deactivate_slab() to take a slab instead of a page.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert node_match() to take a struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 19:44:45 +0000 (15:44 -0400)]
mm/slub: Convert node_match() to take a struct slab

Removes a few calls to slab_page()

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert get_freelist() to take a struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 19:42:58 +0000 (15:42 -0400)]
mm/slub: Convert get_freelist() to take a struct slab

Adds a little bit of type safety.  Convert the one caller.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert slab_alloc_node() to use a struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 19:28:57 +0000 (15:28 -0400)]
mm/slub: Convert slab_alloc_node() to use a struct slab

Adds a little type safety.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert list_slab_objects() to take a struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 19:19:53 +0000 (15:19 -0400)]
mm/slub: Convert list_slab_objects() to take a struct slab

Convert the one caller to pass a slab instead.  Adds a little type safety.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert free_partial() to use struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 19:17:27 +0000 (15:17 -0400)]
mm/slub: Convert free_partial() to use struct slab

Add a little type safety.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert __kmem_cache_do_shrink() to struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 19:14:32 +0000 (15:14 -0400)]
mm/slub: Convert __kmem_cache_do_shrink() to struct slab

Adds a little type safety.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert bootstrap() to struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 19:12:24 +0000 (15:12 -0400)]
mm/slub: Convert bootstrap() to struct slab

Adds a little type safety.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert count_partial() to struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 19:10:36 +0000 (15:10 -0400)]
mm/slub: Convert count_partial() to struct slab

Convert all its helper functions at the same time.  Adds a little
typesafety.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert validate_slab() to take a struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 19:07:45 +0000 (15:07 -0400)]
mm/slub: Convert validate_slab() to take a struct slab

Also convert validate_slab_node to use a struct slab.  Adds a little
typesafety.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert show_slab_objects() to struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 19:04:54 +0000 (15:04 -0400)]
mm/slub: Convert show_slab_objects() to struct slab

Adds a little bit of type safety.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert kmem_cache_cpu to struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 19:00:00 +0000 (15:00 -0400)]
mm/slub: Convert kmem_cache_cpu to struct slab

To avoid converting from page to slab, we have to convert all these
functions at once.  Adds a little type-safety.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert early_kmem_cache_node_alloc() to use struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 18:40:23 +0000 (14:40 -0400)]
mm/slub: Convert early_kmem_cache_node_alloc() to use struct slab

Add a little type safety.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert new_slab() to return a struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 18:34:28 +0000 (14:34 -0400)]
mm/slub: Convert new_slab() to return a struct slab

We can cast directly from struct page to struct slab in alloc_slab_page()
because the page pointer returned from the page allocator is guaranteed
to be a head page.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert __slab_free() to take a struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 18:06:58 +0000 (14:06 -0400)]
mm/slub: Convert __slab_free() to take a struct slab

Provide a little more typesafety and also convert free_debug_processing()
to take a struct slab.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert kfree() to use a struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 17:50:08 +0000 (13:50 -0400)]
mm/slub: Convert kfree() to use a struct slab

With kfree() using a struct slab, we can also convert slab_free()
and do_slab_free() to use a slab instead of a page.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert detached_freelist to use a struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 15:59:10 +0000 (11:59 -0400)]
mm/slub: Convert detached_freelist to use a struct slab

This gives us a little bit of extra typesafety as we know that
nobody called virt_to_page() instead of virt_to_head_page().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm/slub: Convert process_slab() to take a struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 15:33:52 +0000 (11:33 -0400)]
mm/slub: Convert process_slab() to take a struct slab

Add some type safety by passing a struct slab instead of a struct page.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm: Convert check_heap_object() to use struct slab
Matthew Wilcox (Oracle) [Mon, 4 Oct 2021 12:30:33 +0000 (08:30 -0400)]
mm: Convert check_heap_object() to use struct slab

Ensure that we're not seeing a tail page inside __check_heap_object()
by converting to a slab instead of a page.  Take the opportunity to
mark the slab as const since we're not modifying it.  Also move the
declaration of __check_heap_object() to mm/slab.h so it's not
available to the wider kernel.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm: Use struct slab in kmem_obj_info()
Matthew Wilcox (Oracle) [Sat, 2 Oct 2021 18:03:44 +0000 (14:03 -0400)]
mm: Use struct slab in kmem_obj_info()

All three implementations of slab support kmem_obj_info() which reports
details of an object allocated from the slab allocator.  By using the
slab type instead of the page type, we make it obvious that this can
only be called for slabs.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm: Convert __ksize() to struct slab
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 03:04:21 +0000 (23:04 -0400)]
mm: Convert __ksize() to struct slab

slub and slob both use struct page here; convert them to struct slab.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm: Convert virt_to_cache() to use struct slab
Matthew Wilcox (Oracle) [Thu, 30 Sep 2021 03:09:23 +0000 (23:09 -0400)]
mm: Convert virt_to_cache() to use struct slab

This function is entirely self-contained, so can be converted from
page to slab.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm: Add account_slab() and unaccount_slab()
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 14:11:16 +0000 (10:11 -0400)]
mm: Add account_slab() and unaccount_slab()

These functions simply call their page equivalents for now.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm: Split slab into its own type
Matthew Wilcox (Oracle) [Wed, 29 Sep 2021 15:26:26 +0000 (11:26 -0400)]
mm: Split slab into its own type

Make struct slab independent of struct page.  It still uses the
underlying memory in struct page for storing slab-specific data,
but slab and slub can now be weaned off using struct page directly.
Some of the wrapper functions (slab_address() and slab_order())
still need to cast to struct page, but this is a significant
disentanglement.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm: Add pgflags_nid()
Matthew Wilcox (Oracle) [Wed, 29 Sep 2021 14:26:21 +0000 (10:26 -0400)]
mm: Add pgflags_nid()

Convert page_to_nid() into a wrapper around pgflags_nid().  This is
in preparation for splitting struct page into separate types.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm: Convert page_to_section() to pgflags_section()
Matthew Wilcox (Oracle) [Wed, 29 Sep 2021 14:20:00 +0000 (10:20 -0400)]
mm: Convert page_to_section() to pgflags_section()

Pass the page->flags to this function instead of the struct page.
This is in preparation for splitting struct page into separate types.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agokasan: Fix tag for large allocations when using CONFIG_SLAB
Matthew Wilcox (Oracle) [Fri, 1 Oct 2021 02:31:48 +0000 (22:31 -0400)]
kasan: Fix tag for large allocations when using CONFIG_SLAB

If an object is allocated on a tail page of a multi-page slab, kasan
will get the wrong tag because page->s_mem is NULL for tail pages.
I'm not quite sure what the user-visible effect of this might be.

Fixes: 7f94ffbc4c6a ("kasan: add hooks implementation for tag-based mode")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agobuilddeb: Support signing kernels with a Machine Owner Key
Matthew Wilcox (Oracle) [Fri, 30 Apr 2021 12:54:45 +0000 (08:54 -0400)]
builddeb: Support signing kernels with a Machine Owner Key

If the config file specifies a signing key, use it to sign
the kernel so that machines with SecureBoot enabled can boot.
See https://wiki.debian.org/SecureBoot

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agomm: Remove bogus VM_BUG_ON
Matthew Wilcox (Oracle) [Wed, 18 Aug 2021 14:43:41 +0000 (10:43 -0400)]
mm: Remove bogus VM_BUG_ON

It is not safe to check page->index without holding the page lock.
It can be changed if the page is moved between the swap cache and the
page cache for a shmem file, for example.  There is a VM_BUG_ON below
which checks page->index is correct after taking the page lock.

Cc: stable@vger.kernel.org
Fixes: 5c211ba29deb ("mm: add and use find_lock_entries")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
3 years agoMerge tag 'hwmon-for-v5.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 3 Oct 2021 00:51:01 +0000 (17:51 -0700)]
Merge tag 'hwmon-for-v5.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fixes from Guenter Roeck:

 - Fixed various potential NULL pointer accesses in w8379* drivers

 - Improved error handling, fault reporting, and fixed rounding in
   thmp421 driver

 - Fixed error handling in ltc2947 driver

 - Added missing attribute to pmbus/mp2975 driver

 - Fixed attribute values in pbus/ibm-cffps, occ, and mlxreg-fan
   drivers

 - Removed unused residual code from k10temp driver

* tag 'hwmon-for-v5.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (w83793) Fix NULL pointer dereference by removing unnecessary structure field
  hwmon: (w83792d) Fix NULL pointer dereference by removing unnecessary structure field
  hwmon: (w83791d) Fix NULL pointer dereference by removing unnecessary structure field
  hwmon: (pmbus/mp2975) Add missed POUT attribute for page 1 mp2975 controller
  hwmon: (pmbus/ibm-cffps) max_power_out swap changes
  hwmon: (occ) Fix P10 VRM temp sensors
  hwmon: (ltc2947) Properly handle errors when looking for the external clock
  hwmon: (tmp421) fix rounding for negative values
  hwmon: (tmp421) report /PVLD condition as fault
  hwmon: (tmp421) handle I2C errors
  hwmon: (mlxreg-fan) Return non-zero value when fan current state is enforced from sysfs
  hwmon: (k10temp) Remove residues of current and voltage

3 years agoMerge tag '5.15-rc3-ksmbd-fixes' of git://git.samba.org/ksmbd
Linus Torvalds [Sun, 3 Oct 2021 00:43:54 +0000 (17:43 -0700)]
Merge tag '5.15-rc3-ksmbd-fixes' of git://git.samba.org/ksmbd

Pull ksmbd server fixes from Steve French:
 "Eleven fixes for the ksmbd kernel server, mostly security related:

   - an important fix for disabling weak NTLMv1 authentication

   - seven security (improved buffer overflow checks) fixes

   - fix for wrong infolevel struct used in some getattr/setattr paths

   - two small documentation fixes"

* tag '5.15-rc3-ksmbd-fixes' of git://git.samba.org/ksmbd:
  ksmbd: missing check for NULL in convert_to_nt_pathname()
  ksmbd: fix transform header validation
  ksmbd: add buffer validation for SMB2_CREATE_CONTEXT
  ksmbd: add validation in smb2 negotiate
  ksmbd: add request buffer validation in smb2_set_info
  ksmbd: use correct basic info level in set_file_basic_info()
  ksmbd: remove NTLMv1 authentication
  ksmbd: fix documentation for 2 functions
  MAINTAINERS: rename cifs_common to smbfs_common in cifs and ksmbd entry
  ksmbd: fix invalid request buffer access in compound
  ksmbd: remove RFC1002 check in smb2 request

3 years agoMerge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Sat, 2 Oct 2021 19:56:03 +0000 (12:56 -0700)]
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "Five fairly minor fixes and spelling updates, all in drivers. Even
  though the ufs fix is in tracing, it's a potentially exploitable use
  beyond end of array bug"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: csiostor: Add module softdep on cxgb4
  scsi: qla2xxx: Fix excessive messages during device logout
  scsi: virtio_scsi: Fix spelling mistake "Unsupport" -> "Unsupported"
  scsi: ses: Fix unsigned comparison with less than zero
  scsi: ufs: Fix illegal offset in UPIU event trace

3 years agoMerge tag 'block-5.15-2021-10-01' of git://git.kernel.dk/linux-block
Linus Torvalds [Sat, 2 Oct 2021 18:00:36 +0000 (11:00 -0700)]
Merge tag 'block-5.15-2021-10-01' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:
 "A few block fixes for this release:

   - Revert a BFQ commit that causes breakage for people. Unfortunately
     it was auto-selected for stable as well, so now 5.14.7 suffers from
     it too. Hopefully stable will pick up this revert quickly too, so
     we can remove the issue on that end as well.

   - Add a quirk for Apple NVMe controllers, which due to their
     non-compliance broke due to the introduction of command sequences
     (Keith)

   - Use shifts in nbd, fixing a __divdi3 issue (Nick)"

* tag 'block-5.15-2021-10-01' of git://git.kernel.dk/linux-block:
  nbd: use shifts rather than multiplies
  Revert "block, bfq: honor already-setup queue merges"
  nvme: add command id quirk for apple controllers

3 years agoMerge tag 'io_uring-5.15-2021-10-01' of git://git.kernel.dk/linux-block
Linus Torvalds [Sat, 2 Oct 2021 17:26:19 +0000 (10:26 -0700)]
Merge tag 'io_uring-5.15-2021-10-01' of git://git.kernel.dk/linux-block

Pull io_uring fixes from Jens Axboe:
 "Two fixes in here:

   - The signal issue that was discussed start of this week (me).

   - Kill dead fasync support in io_uring. Looks like it was broken
     since io_uring was initially merged, and given that nobody has ever
     complained about it, let's just kill it (Pavel)"

* tag 'io_uring-5.15-2021-10-01' of git://git.kernel.dk/linux-block:
  io_uring: kill fasync
  io-wq: exclusively gate signal based exit on get_signal() return

3 years agoMerge tag 'libnvdimm-fixes-5.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sat, 2 Oct 2021 17:08:35 +0000 (10:08 -0700)]
Merge tag 'libnvdimm-fixes-5.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm

Pull libnvdimm fixes from Dan Williams:
 "A fix for a regression added this cycle in the pmem driver, and for a
  long standing bug for failed NUMA node lookups on ARM64.

  This has appeared in -next for several days with no reported issues.

  Summary:

   - Fix a regression that caused the sysfs ABI for pmem block devices
     to not be registered. This fails the nvdimm unit tests and dax
     xfstests.

   - Fix numa node lookups for dax-kmem memory (device-dax memory
     assigned to the page allocator) on ARM64"

* tag 'libnvdimm-fixes-5.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
  nvdimm/pmem: fix creating the dax group
  ACPI: NFIT: Use fallback node id when numa info in NFIT table is incorrect

3 years agocachefiles: Fix oops in trace_cachefiles_mark_buried due to NULL object
Dave Wysochanski [Fri, 1 Oct 2021 14:37:31 +0000 (15:37 +0100)]
cachefiles: Fix oops in trace_cachefiles_mark_buried due to NULL object

In cachefiles_mark_object_buried, the dentry in question may not have an
owner, and thus our cachefiles_object pointer may be NULL when calling
the tracepoint, in which case we will also not have a valid debug_id to
print in the tracepoint.

Check for NULL object in the tracepoint and if so, just set debug_id to
MAX_UINT as was done in 2908f5e101e3 ("fscache: Add a cookie debug ID
and use that in traces").

This fixes the following oops:

    FS-Cache: Cache "mycache" added (type cachefiles)
    CacheFiles: File cache on vdc registered
    ...
    Workqueue: fscache_object fscache_object_work_func [fscache]
    RIP: 0010:trace_event_raw_event_cachefiles_mark_buried+0x4e/0xa0 [cachefiles]
    ....
    Call Trace:
     cachefiles_mark_object_buried+0xa5/0xb0 [cachefiles]
     cachefiles_bury_object+0x270/0x430 [cachefiles]
     cachefiles_walk_to_object+0x195/0x9c0 [cachefiles]
     cachefiles_lookup_object+0x5a/0xc0 [cachefiles]
     fscache_look_up_object+0xd7/0x160 [fscache]
     fscache_object_work_func+0xb2/0x340 [fscache]
     process_one_work+0x1f1/0x390
     worker_thread+0x53/0x3e0
     kthread+0x127/0x150

Fixes: 2908f5e101e3 ("fscache: Add a cookie debug ID and use that in traces")
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-cachefs@redhat.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3 years agodrm/i915: fix blank screen booting crashes
Hugh Dickins [Sat, 2 Oct 2021 10:17:29 +0000 (03:17 -0700)]
drm/i915: fix blank screen booting crashes

5.15-rc1 crashes with blank screen when booting up on two ThinkPads
using i915.  Bisections converge convincingly, but arrive at different
and suprising "culprits", none of them the actual culprit.

netconsole (with init_netconsole() hacked to call i915_init() when
logging has started, instead of by module_init()) tells the story:

kernel BUG at drivers/gpu/drm/i915/i915_sw_fence.c:245!
with RSI: ffffffff814d408b pointing to sw_fence_dummy_notify().
I've been building with CONFIG_CC_OPTIMIZE_FOR_SIZE=y, and that
function needs to be 4-byte aligned.

Fixes: 62eaf0ae217d ("drm/i915/guc: Support request cancellation")
Signed-off-by: Hugh Dickins <hughd@google.com>
Tested-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3 years agohwmon: (w83793) Fix NULL pointer dereference by removing unnecessary structure field
Nadezda Lutovinova [Tue, 21 Sep 2021 15:51:53 +0000 (18:51 +0300)]
hwmon: (w83793) Fix NULL pointer dereference by removing unnecessary structure field

If driver read tmp value sufficient for
(tmp & 0x08) && (!(tmp & 0x80)) && ((tmp & 0x7) == ((tmp >> 4) & 0x7))
from device then Null pointer dereference occurs.
(It is possible if tmp = 0b0xyz1xyz, where same literals mean same numbers)
Also lm75[] does not serve a purpose anymore after switching to
devm_i2c_new_dummy_device() in w83791d_detect_subclients().

The patch fixes possible NULL pointer dereference by removing lm75[].

Found by Linux Driver Verification project (linuxtesting.org).

Cc: stable@vger.kernel.org
Signed-off-by: Nadezda Lutovinova <lutovinova@ispras.ru>
Link: https://lore.kernel.org/r/20210921155153.28098-3-lutovinova@ispras.ru
[groeck: Dropped unnecessary continuation lines, fixed multi-line alignments]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
3 years agohwmon: (w83792d) Fix NULL pointer dereference by removing unnecessary structure field
Nadezda Lutovinova [Tue, 21 Sep 2021 15:51:52 +0000 (18:51 +0300)]
hwmon: (w83792d) Fix NULL pointer dereference by removing unnecessary structure field

If driver read val value sufficient for
(val & 0x08) && (!(val & 0x80)) && ((val & 0x7) == ((val >> 4) & 0x7))
from device then Null pointer dereference occurs.
(It is possible if tmp = 0b0xyz1xyz, where same literals mean same numbers)
Also lm75[] does not serve a purpose anymore after switching to
devm_i2c_new_dummy_device() in w83791d_detect_subclients().

The patch fixes possible NULL pointer dereference by removing lm75[].

Found by Linux Driver Verification project (linuxtesting.org).

Cc: stable@vger.kernel.org
Signed-off-by: Nadezda Lutovinova <lutovinova@ispras.ru>
Link: https://lore.kernel.org/r/20210921155153.28098-2-lutovinova@ispras.ru
[groeck: Dropped unnecessary continuation lines, fixed multipline alignment]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
3 years agohwmon: (w83791d) Fix NULL pointer dereference by removing unnecessary structure field
Nadezda Lutovinova [Tue, 21 Sep 2021 15:51:51 +0000 (18:51 +0300)]
hwmon: (w83791d) Fix NULL pointer dereference by removing unnecessary structure field

If driver read val value sufficient for
(val & 0x08) && (!(val & 0x80)) && ((val & 0x7) == ((val >> 4) & 0x7))
from device then Null pointer dereference occurs.
(It is possible if tmp = 0b0xyz1xyz, where same literals mean same numbers)
Also lm75[] does not serve a purpose anymore after switching to
devm_i2c_new_dummy_device() in w83791d_detect_subclients().

The patch fixes possible NULL pointer dereference by removing lm75[].

Found by Linux Driver Verification project (linuxtesting.org).

Cc: stable@vger.kernel.org
Signed-off-by: Nadezda Lutovinova <lutovinova@ispras.ru>
Link: https://lore.kernel.org/r/20210921155153.28098-1-lutovinova@ispras.ru
[groeck: Dropped unnecessary continuation lines, fixed multi-line alignment]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
3 years agohwmon: (pmbus/mp2975) Add missed POUT attribute for page 1 mp2975 controller
Vadim Pasternak [Mon, 27 Sep 2021 07:07:40 +0000 (10:07 +0300)]
hwmon: (pmbus/mp2975) Add missed POUT attribute for page 1 mp2975 controller

Add missed attribute for reading POUT from page 1.
It is supported by device, but has been missed in initial commit.

Fixes: 2c6fcbb21149 ("hwmon: (pmbus) Add support for MPS Multi-phase mp2975 controller")
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20210927070740.2149290-1-vadimp@nvidia.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
3 years agohwmon: (pmbus/ibm-cffps) max_power_out swap changes
Brandon Wyman [Tue, 28 Sep 2021 20:50:51 +0000 (20:50 +0000)]
hwmon: (pmbus/ibm-cffps) max_power_out swap changes

The bytes for max_power_out from the ibm-cffps devices differ in byte
order for some power supplies.

The Witherspoon power supply returns the bytes in MSB/LSB order.

The Rainier power supply returns the bytes in LSB/MSB order.

The Witherspoon power supply uses version cffps1. The Rainier power
supply should use version cffps2. If version is cffps1, swap the bytes
before output to max_power_out.

Tested:
    Witherspoon before: 3148. Witherspoon after: 3148.
    Rainier before: 53255. Rainier after: 2000.

Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Reviewed-by: Eddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/20210928205051.1222815-1-bjwyman@gmail.com
[groeck: Replaced yoda programming]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
3 years agohwmon: (occ) Fix P10 VRM temp sensors
Eddie James [Wed, 29 Sep 2021 15:36:04 +0000 (10:36 -0500)]
hwmon: (occ) Fix P10 VRM temp sensors

The P10 (temp sensor version 0x10) doesn't do the same VRM status
reporting that was used on P9. It just reports the temperature, so
drop the check for VRM fru type in the sysfs show function, and don't
set the name to "alarm".

Fixes: db4919ec86 ("hwmon: (occ) Add new temperature sensor type")
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Link: https://lore.kernel.org/r/20210929153604.14968-1-eajames@linux.ibm.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
3 years agoMerge tag 's390-5.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Linus Torvalds [Fri, 1 Oct 2021 21:45:23 +0000 (14:45 -0700)]
Merge tag 's390-5.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Pull s390 fix from Vasily Gorbik:
 "One fix for 5.15-rc4: Avoid CIO excessive path-verification requests,
  which might cause unwanted delays"

* tag 's390-5.15-4' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
  s390/cio: avoid excessive path-verification requests

3 years agothermal: Update information in MAINTAINERS
Rafael J. Wysocki [Fri, 1 Oct 2021 17:14:28 +0000 (19:14 +0200)]
thermal: Update information in MAINTAINERS

Because Rui is now going to focus on work that is not related to the
maintenance of the thermal subsystem in the kernel, Rafael will start
to help Daniel with handling the development process as a new member
of the thermal maintainers team.  Rui will continue to review patches
in that area.

The thermal development process flow will change so that the material
from the thermal git tree will be merged into the thermal branch of
the linux-pm.git tree before going into the mainline.

Update the information in MAINTAINERS accordingly.

Signed-off-by: Rafael J. Wysocki <rafael@kernel.org>
Acked-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3 years agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Linus Torvalds [Fri, 1 Oct 2021 18:08:07 +0000 (11:08 -0700)]
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull more kvm fixes from Paolo Bonzini:
 "Small x86 fixes"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: selftests: Ensure all migrations are performed when test is affined
  KVM: x86: Swap order of CPUID entry "index" vs. "significant flag" checks
  ptp: Fix ptp_kvm_getcrosststamp issue for x86 ptp_kvm
  x86/kvmclock: Move this_cpu_pvti into kvmclock.h
  selftests: KVM: Don't clobber XMM register when read
  KVM: VMX: Fix a TSX_CTRL_CPUID_CLEAR field mask issue

3 years agoMerge tag 'drm-fixes-2021-10-01' of git://anongit.freedesktop.org/drm/drm
Linus Torvalds [Fri, 1 Oct 2021 17:27:44 +0000 (10:27 -0700)]
Merge tag 'drm-fixes-2021-10-01' of git://anongit.freedesktop.org/drm/drm

Pull drm fixes from Daniel Vetter:
 "Dave is out on a long w/e, should be back next week.

  Nothing nefarious, just a bunch of driver fixes: amdgpu, i915, tegra,
  and one exynos driver fix"

* tag 'drm-fixes-2021-10-01' of git://anongit.freedesktop.org/drm/drm:
  drm/amdgpu: force exit gfxoff on sdma resume for rmb s0ix
  drm/amdgpu: check tiling flags when creating FB on GFX8-
  drm/amd/display: Pass PCI deviceid into DC
  drm/amd/display: initialize backlight_ramping_override to false
  drm/amdgpu: correct initial cp_hqd_quantum for gfx9
  drm/amd/display: Fix Display Flicker on embedded panels
  drm/amdgpu: fix gart.bo pin_count leak
  drm/i915: Remove warning from the rps worker
  drm/i915/request: fix early tracepoints
  drm/i915/guc, docs: Fix pdfdocs build error by removing nested grid
  gpu: host1x: Plug potential memory leak
  gpu/host1x: fence: Make spinlock static
  drm/tegra: uapi: Fix wrong mapping end address in case of disabled IOMMU
  drm/tegra: dc: Remove unused variables
  drm/exynos: Make use of the helper function devm_platform_ioremap_resource()
  drm/i915/gvt: fix the usage of ww lock in gvt scheduler.

3 years agoio_uring: kill fasync
Pavel Begunkov [Fri, 1 Oct 2021 09:39:33 +0000 (10:39 +0100)]
io_uring: kill fasync

We have never supported fasync properly, it would only fire when there
is something polling io_uring making it useless. The original support came
in through the initial io_uring merge for 5.1. Since it's broken and
nobody has reported it, get rid of the fasync bits.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/2f7ca3d344d406d34fa6713824198915c41cea86.1633080236.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
3 years agoMerge tag 'iommu-fixes-v5.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Fri, 1 Oct 2021 17:14:29 +0000 (10:14 -0700)]
Merge tag 'iommu-fixes-v5.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu

Pull iommu fixes from Joerg Roedel:

 - Two fixes for the new Apple DART driver to fix a kernel panic and a
   stale data usage issue

 - Intel VT-d fix for how PCI device ids are printed

* tag 'iommu-fixes-v5.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
  iommu/dart: Clear sid2group entry when a group is freed
  iommu/vt-d: Drop "0x" prefix from PCI bus & device addresses
  iommu/dart: Remove iommu_flush_ops

3 years agoMerge tag 'exynos-drm-fixes-for-v5.15-rc4' of git://git.kernel.org/pub/scm/linux...
Daniel Vetter [Fri, 1 Oct 2021 16:14:38 +0000 (18:14 +0200)]
Merge tag 'exynos-drm-fixes-for-v5.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-fixes

One cleanup
- Use devm_platform_ioremap_resource() helper function instead of old
one.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
From: Inki Dae <inki.dae@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210928074158.2942-1-inki.dae@samsung.com
3 years agoMerge tag 'amd-drm-fixes-5.15-2021-09-29' of https://gitlab.freedesktop.org/agd5f...
Daniel Vetter [Fri, 1 Oct 2021 14:59:21 +0000 (16:59 +0200)]
Merge tag 'amd-drm-fixes-5.15-2021-09-29' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes

amd-drm-fixes-5.15-2021-09-29:

amdgpu:
- gart pin count fix
- eDP flicker fix
- GFX9 MQD fix
- Display fixes
- Tiling flags fix for pre-GFX9
- SDMA resume fix for S0ix

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
From: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210930023013.5207-1-alexander.deucher@amd.com
3 years agoMerge tag 'drm-intel-fixes-2021-09-30' of git://anongit.freedesktop.org/drm/drm-intel...
Daniel Vetter [Fri, 1 Oct 2021 14:47:18 +0000 (16:47 +0200)]
Merge tag 'drm-intel-fixes-2021-09-30' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes

drm/i915 fixes for v5.15-rc4:
- Fix GVT scheduler ww lock usage
- Fix pdfdocs documentation build
- Fix request early tracepoints
- Fix an invalid warning from rps worker

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
From: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/87lf3ev44z.fsf@intel.com
3 years agoksmbd: missing check for NULL in convert_to_nt_pathname()
Dan Carpenter [Thu, 30 Sep 2021 12:24:56 +0000 (15:24 +0300)]
ksmbd: missing check for NULL in convert_to_nt_pathname()

The kmalloc() does not have a NULL check.  This code can be re-written
slightly cleaner to just use the kstrdup().

Fixes: 265fd1991c1d ("ksmbd: use LOOKUP_BENEATH to prevent the out of share access")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Acked-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
3 years agoMerge tag 'net-5.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Linus Torvalds [Thu, 30 Sep 2021 21:28:05 +0000 (14:28 -0700)]
Merge tag 'net-5.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Jakub Kicinski:
 "Networking fixes, including fixes from mac80211, netfilter and bpf.

  Current release - regressions:

   - bpf, cgroup: assign cgroup in cgroup_sk_alloc when called from
     interrupt

   - mdio: revert mechanical patches which broke handling of optional
     resources

   - dev_addr_list: prevent address duplication

  Previous releases - regressions:

   - sctp: break out if skb_header_pointer returns NULL in sctp_rcv_ootb
     (NULL deref)

   - Revert "mac80211: do not use low data rates for data frames with no
     ack flag", fixing broadcast transmissions

   - mac80211: fix use-after-free in CCMP/GCMP RX

   - netfilter: include zone id in tuple hash again, minimize collisions

   - netfilter: nf_tables: unlink table before deleting it (race -> UAF)

   - netfilter: log: work around missing softdep backend module

   - mptcp: don't return sockets in foreign netns

   - sched: flower: protect fl_walk() with rcu (race -> UAF)

   - ixgbe: fix NULL pointer dereference in ixgbe_xdp_setup

   - smsc95xx: fix stalled rx after link change

   - enetc: fix the incorrect clearing of IF_MODE bits

   - ipv4: fix rtnexthop len when RTA_FLOW is present

   - dsa: mv88e6xxx: 6161: use correct MAX MTU config method for this
     SKU

   - e100: fix length calculation & buffer overrun in ethtool::get_regs

  Previous releases - always broken:

   - mac80211: fix using stale frag_tail skb pointer in A-MSDU tx

   - mac80211: drop frames from invalid MAC address in ad-hoc mode

   - af_unix: fix races in sk_peer_pid and sk_peer_cred accesses (race
     -> UAF)

   - bpf, x86: Fix bpf mapping of atomic fetch implementation

   - bpf: handle return value of BPF_PROG_TYPE_STRUCT_OPS prog

   - netfilter: ip6_tables: zero-initialize fragment offset

   - mhi: fix error path in mhi_net_newlink

   - af_unix: return errno instead of NULL in unix_create1() when over
     the fs.file-max limit

  Misc:

   - bpf: exempt CAP_BPF from checks against bpf_jit_limit

   - netfilter: conntrack: make max chain length random, prevent
     guessing buckets by attackers

   - netfilter: nf_nat_masquerade: make async masq_inet6_event handling
     generic, defer conntrack walk to work queue (prevent hogging RTNL
     lock)"

* tag 'net-5.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (77 commits)
  af_unix: fix races in sk_peer_pid and sk_peer_cred accesses
  net: stmmac: fix EEE init issue when paired with EEE capable PHYs
  net: dev_addr_list: handle first address in __hw_addr_add_ex
  net: sched: flower: protect fl_walk() with rcu
  net: introduce and use lock_sock_fast_nested()
  net: phy: bcm7xxx: Fixed indirect MMD operations
  net: hns3: disable firmware compatible features when uninstall PF
  net: hns3: fix always enable rx vlan filter problem after selftest
  net: hns3: PF enable promisc for VF when mac table is overflow
  net: hns3: fix show wrong state when add existing uc mac address
  net: hns3: fix mixed flag HCLGE_FLAG_MQPRIO_ENABLE and HCLGE_FLAG_DCB_ENABLE
  net: hns3: don't rollback when destroy mqprio fail
  net: hns3: remove tc enable checking
  net: hns3: do not allow call hns3_nic_net_open repeatedly
  ixgbe: Fix NULL pointer dereference in ixgbe_xdp_setup
  net: bridge: mcast: Associate the seqcount with its protecting lock.
  net: mdio-ipq4019: Fix the error for an optional regs resource
  net: hns3: fix hclge_dbg_dump_tm_pg() stack usage
  net: mdio: mscc-miim: Fix the mdio controller
  af_unix: Return errno instead of NULL in unix_create1().
  ...

3 years agoMerge tag 'gpio-fixes-for-v5.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Thu, 30 Sep 2021 19:11:35 +0000 (12:11 -0700)]
Merge tag 'gpio-fixes-for-v5.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio fixes from Bartosz Golaszewski:
 "A single fix for the gpio-pca953x driver and two commits updating the
  MAINTAINERS entries for Mun Yew Tham (GPIO specific) and myself
  (treewide after a change in professional situation).

  Summary:

   - don't ignore I2C errors in gpio-pca953x

   - update MAINTAINERS entries for Mun Yew Tham and myself"

* tag 'gpio-fixes-for-v5.15-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
  MAINTAINERS: Update Mun Yew Tham as Altera Pio Driver maintainer
  MAINTAINERS: update my email address
  gpio: pca953x: do not ignore i2c errors

3 years agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Linus Torvalds [Thu, 30 Sep 2021 19:00:46 +0000 (12:00 -0700)]
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma

Pull rdma fixes from Jason Gunthorpe:
 "Not much too exciting here, although two syzkaller bugs that seem to
  have 9 lives may have finally been squashed.

  Several core bugs and a batch of driver bug fixes:

   - Fix compilation problems in qib and hfi1

   - Do not corrupt the joined multicast group state when using
     SEND_ONLY

   - Several CMA bugs, a reference leak for listening and two syzkaller
     crashers

   - Various bug fixes for irdma

   - Fix a Sleeping while atomic bug in usnic

   - Properly sanitize kernel pointers in dmesg

   - Two bugs in the 64b CQE support for hns"

* tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
  RDMA/hns: Add the check of the CQE size of the user space
  RDMA/hns: Fix the size setting error when copying CQE in clean_cq()
  RDMA/hfi1: Fix kernel pointer leak
  RDMA/usnic: Lock VF with mutex instead of spinlock
  RDMA/hns: Work around broken constant propagation in gcc 8
  RDMA/cma: Ensure rdma_addr_cancel() happens before issuing more requests
  RDMA/cma: Do not change route.addr.src_addr.ss_family
  RDMA/irdma: Report correct WC error when there are MW bind errors
  RDMA/irdma: Report correct WC error when transport retry counter is exceeded
  RDMA/irdma: Validate number of CQ entries on create CQ
  RDMA/irdma: Skip CQP ring during a reset
  MAINTAINERS: Update Broadcom RDMA maintainers
  RDMA/cma: Fix listener leak in rdma_cma_listen_on_all() failure
  IB/cma: Do not send IGMP leaves for sendonly Multicast groups
  IB/qib: Fix clang confusion of NULL pointer comparison

3 years agoksmbd: fix transform header validation
Namjae Jeon [Wed, 29 Sep 2021 10:52:51 +0000 (19:52 +0900)]
ksmbd: fix transform header validation

Validate that the transform and smb request headers are present
before checking OriginalMessageSize and SessionId fields.

Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Cc: Ralph Böhme <slow@samba.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Tom Talpey <tom@talpey.com>
Acked-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
3 years agoksmbd: add buffer validation for SMB2_CREATE_CONTEXT
Hyunchul Lee [Fri, 24 Sep 2021 13:22:22 +0000 (22:22 +0900)]
ksmbd: add buffer validation for SMB2_CREATE_CONTEXT

Add buffer validation for SMB2_CREATE_CONTEXT.

Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
3 years agoksmbd: add validation in smb2 negotiate
Namjae Jeon [Wed, 29 Sep 2021 06:44:32 +0000 (15:44 +0900)]
ksmbd: add validation in smb2 negotiate

This patch add validation to check request buffer check in smb2
negotiate and fix null pointer deferencing oops in smb3_preauth_hash_rsp()
that found from manual test.

Cc: Tom Talpey <tom@talpey.com>
Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Cc: Ralph Böhme <slow@samba.org>
Cc: Hyunchul Lee <hyc.lee@gmail.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
3 years agoksmbd: add request buffer validation in smb2_set_info
Namjae Jeon [Wed, 29 Sep 2021 06:41:48 +0000 (15:41 +0900)]
ksmbd: add request buffer validation in smb2_set_info

Add buffer validation in smb2_set_info, and remove unused variable
in set_file_basic_info. and smb2_set_info infolevel functions take
structure pointer argument.

Cc: Tom Talpey <tom@talpey.com>
Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Cc: Ralph Böhme <slow@samba.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Acked-by: Hyunchul Lee <hyc.lee@gmail.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
3 years agoksmbd: use correct basic info level in set_file_basic_info()
Namjae Jeon [Wed, 29 Sep 2021 06:37:18 +0000 (15:37 +0900)]
ksmbd: use correct basic info level in set_file_basic_info()

Use correct basic info level in set/get_file_basic_info().

Reviewed-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
3 years agoaf_unix: fix races in sk_peer_pid and sk_peer_cred accesses
Eric Dumazet [Wed, 29 Sep 2021 22:57:50 +0000 (15:57 -0700)]
af_unix: fix races in sk_peer_pid and sk_peer_cred accesses

Jann Horn reported that SO_PEERCRED and SO_PEERGROUPS implementations
are racy, as af_unix can concurrently change sk_peer_pid and sk_peer_cred.

In order to fix this issue, this patch adds a new spinlock that needs
to be used whenever these fields are read or written.

Jann also pointed out that l2cap_sock_get_peer_pid_cb() is currently
reading sk->sk_peer_pid which makes no sense, as this field
is only possibly set by AF_UNIX sockets.
We will have to clean this in a separate patch.
This could be done by reverting b48596d1dc25 "Bluetooth: L2CAP: Add get_peer_pid callback"
or implementing what was truly expected.

Fixes: 109f6e39fa07 ("af_unix: Allow SO_PEERCRED to work across namespaces.")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Jann Horn <jannh@google.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Cc: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: stmmac: fix EEE init issue when paired with EEE capable PHYs
Wong Vee Khee [Thu, 30 Sep 2021 06:44:36 +0000 (14:44 +0800)]
net: stmmac: fix EEE init issue when paired with EEE capable PHYs

When STMMAC is paired with Energy-Efficient Ethernet(EEE) capable PHY,
and the PHY is advertising EEE by default, we need to enable EEE on the
xPCS side too, instead of having user to manually trigger the enabling
config via ethtool.

Fixed this by adding xpcs_config_eee() call in stmmac_eee_init().

Fixes: 7617af3d1a5e ("net: pcs: Introducing support for DWC xpcs Energy Efficient Ethernet")
Cc: Michael Sit Wei Hong <michael.wei.hong.sit@intel.com>
Signed-off-by: Wong Vee Khee <vee.khee.wong@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
3 years agonet: dev_addr_list: handle first address in __hw_addr_add_ex
Jakub Kicinski [Wed, 29 Sep 2021 15:32:24 +0000 (08:32 -0700)]
net: dev_addr_list: handle first address in __hw_addr_add_ex

struct dev_addr_list is used for device addresses, unicast addresses
and multicast addresses. The first of those needs special handling
of the main address - netdev->dev_addr points directly the data
of the entry and drivers write to it freely, so we can't maintain
it in the rbtree (for now, at least, to be fixed in net-next).

Current work around sprinkles special handling of the first
address on the list throughout the code but it missed the case
where address is being added. First address will not be visible
during subsequent adds.

Syzbot found a warning where unicast addresses are modified
without holding the rtnl lock, tl;dr is that team generates
the same modification multiple times, not necessarily when
right locks are held.

In the repro we have:

  macvlan -> team -> veth

macvlan adds a unicast address to the team. Team then pushes
that address down to its memebers (veths). Next something unrelated
makes team sync member addrs again, and because of the bug
the addr entries get duplicated in the veths. macvlan gets
removed, removes its addr from team which removes only one
of the duplicated addresses from veths. This removal is done
under rtnl. Next syzbot uses iptables to add a multicast addr
to team (which does not hold rtnl lock). Team syncs veth addrs,
but because veths' unicast list still has the duplicate it will
also get sync, even though this update is intended for mc addresses.
Again, uc address updates need rtnl lock, boom.

Reported-by: syzbot+7a2ab2cdc14d134de553@syzkaller.appspotmail.com
Fixes: 406f42fa0d3c ("net-next: When a bond have a massive amount of VLANs with IPv6 addresses, performance of changing link state, attaching a VRF, changing an IPv6 address, etc. go down dramtically.")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>