Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions arch/x86/coco/tdx/tdx.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <asm/insn.h>
#include <asm/insn-eval.h>
#include <asm/pgtable.h>
#include <asm/traps.h>

/* MMIO direction */
#define EPT_READ 0
Expand Down Expand Up @@ -430,6 +431,11 @@ static int handle_mmio(struct pt_regs *regs, struct ve_info *ve)
return -EINVAL;
}

if (!fault_in_kernel_space(ve->gla)) {
WARN_ONCE(1, "Access to userspace address is not supported");
return -EINVAL;
}

/*
* Reject EPT violation #VEs that split pages.
*
Expand Down
9 changes: 7 additions & 2 deletions fs/nfsd/nfs4xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -5441,9 +5441,14 @@ nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
int len = xdr->buf->len - post_err_offset;

so->so_replay.rp_status = op->status;
so->so_replay.rp_buflen = len;
read_bytes_from_xdr_buf(xdr->buf, post_err_offset,
if (len <= NFSD4_REPLAY_ISIZE) {
so->so_replay.rp_buflen = len;
read_bytes_from_xdr_buf(xdr->buf,
post_err_offset,
so->so_replay.rp_buf, len);
} else {
so->so_replay.rp_buflen = 0;
}
}
status:
*p = op->status;
Expand Down
17 changes: 12 additions & 5 deletions fs/nfsd/state.h
Original file line number Diff line number Diff line change
Expand Up @@ -430,11 +430,18 @@ struct nfs4_client_reclaim {
struct xdr_netobj cr_princhash;
};

/* A reasonable value for REPLAY_ISIZE was estimated as follows:
* The OPEN response, typically the largest, requires
* 4(status) + 8(stateid) + 20(changeinfo) + 4(rflags) + 8(verifier) +
* 4(deleg. type) + 8(deleg. stateid) + 4(deleg. recall flag) +
* 20(deleg. space limit) + ~32(deleg. ace) = 112 bytes
/*
* REPLAY_ISIZE is sized for an OPEN response with delegation:
* 4(status) + 8(stateid) + 20(changeinfo) + 4(rflags) +
* 8(verifier) + 4(deleg. type) + 8(deleg. stateid) +
* 4(deleg. recall flag) + 20(deleg. space limit) +
* ~32(deleg. ace) = 112 bytes
*
* Some responses can exceed this. A LOCK denial includes the conflicting
* lock owner, which can be up to 1024 bytes (NFS4_OPAQUE_LIMIT). Responses
* larger than REPLAY_ISIZE are not cached in rp_ibuf; only rp_status is
* saved. Enlarging this constant increases the size of every
* nfs4_stateowner.
*/

#define NFSD4_REPLAY_ISIZE 112
Expand Down
27 changes: 14 additions & 13 deletions net/core/page_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ u64 *page_pool_ethtool_stats_get(u64 *data, void *stats)
EXPORT_SYMBOL(page_pool_ethtool_stats_get);

#else
#define alloc_stat_inc(pool, __stat)
#define recycle_stat_inc(pool, __stat)
#define recycle_stat_add(pool, __stat, val)
#define alloc_stat_inc(...) do { } while (0)
#define recycle_stat_inc(...) do { } while (0)
#define recycle_stat_add(...) do { } while (0)
#endif

static bool page_pool_producer_lock(struct page_pool *pool)
Expand Down Expand Up @@ -553,19 +553,16 @@ static void page_pool_return_page(struct page_pool *pool, struct page *page)

static bool page_pool_recycle_in_ring(struct page_pool *pool, struct page *page)
{
int ret;
/* BH protection not needed if current is softirq */
if (in_softirq())
ret = ptr_ring_produce(&pool->ring, page);
else
ret = ptr_ring_produce_bh(&pool->ring, page);
bool in_softirq, ret;

if (!ret) {
/* BH protection not needed if current is softirq */
in_softirq = page_pool_producer_lock(pool);
ret = !__ptr_ring_produce(&pool->ring, page);
if (ret)
recycle_stat_inc(pool, ring);
return true;
}
page_pool_producer_unlock(pool, in_softirq);

return false;
return ret;
}

/* Only allow direct recycling in special circumstances, into the
Expand Down Expand Up @@ -854,10 +851,14 @@ static void page_pool_scrub(struct page_pool *pool)

static int page_pool_release(struct page_pool *pool)
{
bool in_softirq;
int inflight;

page_pool_scrub(pool);
inflight = page_pool_inflight(pool);
/* Acquire producer lock to make sure producers have exited. */
in_softirq = page_pool_producer_lock(pool);
page_pool_producer_unlock(pool, in_softirq);
if (!inflight)
page_pool_free(pool);

Expand Down
Loading