1. 10 8月, 2022 1 次提交
    • M
      add barriers to buffer_uptodate and set_buffer_uptodate · d4252071
      Mikulas Patocka 提交于
      Let's have a look at this piece of code in __bread_slow:
      
      	get_bh(bh);
      	bh->b_end_io = end_buffer_read_sync;
      	submit_bh(REQ_OP_READ, 0, bh);
      	wait_on_buffer(bh);
      	if (buffer_uptodate(bh))
      		return bh;
      
      Neither wait_on_buffer nor buffer_uptodate contain any memory barrier.
      Consequently, if someone calls sb_bread and then reads the buffer data,
      the read of buffer data may be executed before wait_on_buffer(bh) on
      architectures with weak memory ordering and it may return invalid data.
      
      Fix this bug by adding a memory barrier to set_buffer_uptodate and an
      acquire barrier to buffer_uptodate (in a similar way as
      folio_test_uptodate and folio_mark_uptodate).
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Reviewed-by: NMatthew Wilcox (Oracle) <willy@infradead.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d4252071
  2. 09 8月, 2022 18 次提交
  3. 04 8月, 2022 2 次提交
    • J
      lockd: detect and reject lock arguments that overflow · 6930bcbf
      Jeff Layton 提交于
      lockd doesn't currently vet the start and length in nlm4 requests like
      it should, and can end up generating lock requests with arguments that
      overflow when passed to the filesystem.
      
      The NLM4 protocol uses unsigned 64-bit arguments for both start and
      length, whereas struct file_lock tracks the start and end as loff_t
      values. By the time we get around to calling nlm4svc_retrieve_args,
      we've lost the information that would allow us to determine if there was
      an overflow.
      
      Start tracking the actual start and len for NLM4 requests in the
      nlm_lock. In nlm4svc_retrieve_args, vet these values to ensure they
      won't cause an overflow, and return NLM4_FBIG if they do.
      
      Link: https://bugzilla.linux-nfs.org/show_bug.cgi?id=392Reported-by: NJan Kasiak <j.kasiak@gmail.com>
      Signed-off-by: NJeff Layton <jlayton@kernel.org>
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Cc: <stable@vger.kernel.org> # 5.14+
      6930bcbf
    • H
      tpm: eventlog: Fix section mismatch for DEBUG_SECTION_MISMATCH · bed45936
      Huacai Chen 提交于
      If DEBUG_SECTION_MISMATCH enabled, __calc_tpm2_event_size() will not be
      inlined, this cause section mismatch like this:
      
      WARNING: modpost: vmlinux.o(.text.unlikely+0xe30c): Section mismatch in reference from the variable L0 to the function .init.text:early_ioremap()
      The function L0() references
      the function __init early_memremap().
      This is often because L0 lacks a __init
      annotation or the annotation of early_ioremap is wrong.
      
      Fix it by using __always_inline instead of inline for the called-once
      function __calc_tpm2_event_size().
      
      Fixes: 44038bc5 ("tpm: Abstract crypto agile event size calculations")
      Cc: stable@vger.kernel.org # v5.3
      Reported-by: NWANG Xuerui <git@xen0n.name>
      Signed-off-by: NHuacai Chen <chenhuacai@loongson.cn>
      Signed-off-by: NJarkko Sakkinen <jarkko@kernel.org>
      bed45936
  4. 03 8月, 2022 19 次提交