Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6d71cbc
tpm, tpm_tis: Decorate tpm_tis_gen_interrupt() with request_locality()
semihalf-majczak-lukasz Feb 16, 2021
15726df
tpm, tpm_tis: Decorate tpm_get_timeouts() with request_locality()
jarkkojs Feb 19, 2021
909a8d2
btrfs: raid56: simplify tracking of Q stripe presence
kdave Feb 19, 2020
0c740d2
btrfs: fix raid6 qstripe kmap
weiny2 Jan 28, 2021
8674c1a
btrfs: validate qgroup inherit for SNAP_CREATE_V2 ioctl
Feb 17, 2021
91bc329
btrfs: free correct amount of space in btrfs_delayed_inode_reserve_me…
lorddoskias Feb 22, 2021
a87911c
btrfs: unlock extents in btrfs_zero_range in case of quota reservatio…
lorddoskias Feb 23, 2021
e49bacc
btrfs: fix warning when creating a directory with smack enabled
fdmanana Feb 26, 2021
52a6436
PM: runtime: Update device status before letting suppliers suspend
rafaeljw Feb 25, 2021
1a41829
dm bufio: subtract the number of initial sectors in dm_bufio_get_devi…
Feb 23, 2021
b367201
dm verity: fix FEC for RS roots unaligned to block size
mbroz Feb 23, 2021
9e15b43
drm/amdgpu: fix parameter error of RREG32_PCIE() in amdgpu_regs_pcie
Mar 2, 2021
1f8884d
arm64: ptrace: Fix seccomp of traced syscall -1 (NO_SYSCALL)
TimothyEBaldwin Jan 16, 2021
0781709
crypto - shash: reduce minimum alignment of shash_desc structure
ardbiesheuvel Jan 13, 2021
6827415
usbip: tools: fix build error for multiple definition
borneoa Jun 18, 2020
26a1af3
ALSA: ctxfi: cthw20k2: fix mask on conf to allow 4 bits
Feb 27, 2021
809ef26
RDMA/rxe: Fix missing kconfig dependency on CRYPTO
julianbraha Feb 19, 2021
86b3b62
IB/mlx5: Add missing error code
Feb 22, 2021
9a20e57
ALSA: hda: intel-nhlt: verify config type
plbossart Mar 2, 2021
77a81b1
ftrace: Have recordmcount use w8 to read relp->r_info in arm64_is_fak…
Feb 22, 2021
1fba84f
rsxx: Return -EFAULT if copy_to_user() fails
Mar 3, 2021
d859388
r8169: fix resuming from suspend on RTL8105e if machine runs on battery
hkallweit Feb 14, 2021
84d5d3c
Linux 5.4.104
gregkh Mar 9, 2021
0886746
Merge tag 'v5.4.104' into 5.4-2.3.x-imx
zandrey Mar 9, 2021
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
VERSION = 5
PATCHLEVEL = 4
SUBLEVEL = 103
SUBLEVEL = 104
EXTRAVERSION =
NAME = Kleptomaniac Octopus

Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1844,7 +1844,7 @@ int syscall_trace_enter(struct pt_regs *regs)

if (flags & (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE)) {
tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
if (!in_syscall(regs) || (flags & _TIF_SYSCALL_EMU))
if (flags & _TIF_SYSCALL_EMU)
return -1;
}

Expand Down
62 changes: 37 additions & 25 deletions drivers/base/power/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,22 +325,22 @@ static void rpm_put_suppliers(struct device *dev)
static int __rpm_callback(int (*cb)(struct device *), struct device *dev)
__releases(&dev->power.lock) __acquires(&dev->power.lock)
{
int retval, idx;
bool use_links = dev->power.links_count > 0;
bool get = false;
int retval, idx;
bool put;

if (dev->power.irq_safe) {
spin_unlock(&dev->power.lock);
} else if (!use_links) {
spin_unlock_irq(&dev->power.lock);
} else {
get = dev->power.runtime_status == RPM_RESUMING;

spin_unlock_irq(&dev->power.lock);

/*
* Resume suppliers if necessary.
*
* The device's runtime PM status cannot change until this
* routine returns, so it is safe to read the status outside of
* the lock.
*/
if (use_links && dev->power.runtime_status == RPM_RESUMING) {
/* Resume suppliers if necessary. */
if (get) {
idx = device_links_read_lock();

retval = rpm_get_suppliers(dev);
Expand All @@ -355,24 +355,36 @@ static int __rpm_callback(int (*cb)(struct device *), struct device *dev)

if (dev->power.irq_safe) {
spin_lock(&dev->power.lock);
} else {
/*
* If the device is suspending and the callback has returned
* success, drop the usage counters of the suppliers that have
* been reference counted on its resume.
*
* Do that if resume fails too.
*/
if (use_links
&& ((dev->power.runtime_status == RPM_SUSPENDING && !retval)
|| (dev->power.runtime_status == RPM_RESUMING && retval))) {
idx = device_links_read_lock();
return retval;
}

fail:
rpm_put_suppliers(dev);
spin_lock_irq(&dev->power.lock);

device_links_read_unlock(idx);
}
if (!use_links)
return retval;

/*
* If the device is suspending and the callback has returned success,
* drop the usage counters of the suppliers that have been reference
* counted on its resume.
*
* Do that if the resume fails too.
*/
put = dev->power.runtime_status == RPM_SUSPENDING && !retval;
if (put)
__update_runtime_status(dev, RPM_SUSPENDED);
else
put = get && retval;

if (put) {
spin_unlock_irq(&dev->power.lock);

idx = device_links_read_lock();

fail:
rpm_put_suppliers(dev);

device_links_read_unlock(idx);

spin_lock_irq(&dev->power.lock);
}
Expand Down
8 changes: 5 additions & 3 deletions drivers/block/rsxx/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,17 @@ static ssize_t rsxx_cram_read(struct file *fp, char __user *ubuf,
{
struct rsxx_cardinfo *card = file_inode(fp)->i_private;
char *buf;
ssize_t st;
int st;

buf = kzalloc(cnt, GFP_KERNEL);
if (!buf)
return -ENOMEM;

st = rsxx_creg_read(card, CREG_ADD_CRAM + (u32)*ppos, cnt, buf, 1);
if (!st)
st = copy_to_user(ubuf, buf, cnt);
if (!st) {
if (copy_to_user(ubuf, buf, cnt))
st = -EFAULT;
}
kfree(buf);
if (st)
return st;
Expand Down
30 changes: 25 additions & 5 deletions drivers/char/tpm/tpm_tis_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,12 +618,22 @@ static int tpm_tis_gen_interrupt(struct tpm_chip *chip)
const char *desc = "attempting to generate an interrupt";
u32 cap2;
cap_t cap;
int ret;

/* TPM 2.0 */
if (chip->flags & TPM_CHIP_FLAG_TPM2)
return tpm2_get_tpm_pt(chip, 0x100, &cap2, desc);
else
return tpm1_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, desc,
0);

/* TPM 1.2 */
ret = request_locality(chip, 0);
if (ret < 0)
return ret;

ret = tpm1_getcap(chip, TPM_CAP_PROP_TIS_TIMEOUT, &cap, desc, 0);

release_locality(chip, 0);

return ret;
}

/* Register the IRQ and issue a command that will cause an interrupt. If an
Expand Down Expand Up @@ -929,11 +939,21 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
init_waitqueue_head(&priv->read_queue);
init_waitqueue_head(&priv->int_queue);
if (irq != -1) {
/* Before doing irq testing issue a command to the TPM in polling mode
/*
* Before doing irq testing issue a command to the TPM in polling mode
* to make sure it works. May as well use that command to set the
* proper timeouts for the driver.
*/
if (tpm_get_timeouts(chip)) {

rc = request_locality(chip, 0);
if (rc < 0)
goto out_err;

rc = tpm_get_timeouts(chip);

release_locality(chip, 0);

if (rc) {
dev_err(dev, "Could not get TPM timeouts and durations\n");
rc = -ENODEV;
goto out_err;
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ static ssize_t amdgpu_debugfs_regs_pcie_read(struct file *f, char __user *buf,
while (size) {
uint32_t value;

value = RREG32_PCIE(*pos >> 2);
value = RREG32_PCIE(*pos);
r = put_user(value, (uint32_t *)buf);
if (r)
return r;
Expand Down Expand Up @@ -283,7 +283,7 @@ static ssize_t amdgpu_debugfs_regs_pcie_write(struct file *f, const char __user
if (r)
return r;

WREG32_PCIE(*pos >> 2, value);
WREG32_PCIE(*pos, value);

result += 4;
buf += 4;
Expand Down
4 changes: 3 additions & 1 deletion drivers/infiniband/hw/mlx5/devx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2022,8 +2022,10 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_SUBSCRIBE_EVENT)(

num_alloc_xa_entries++;
event_sub = kzalloc(sizeof(*event_sub), GFP_KERNEL);
if (!event_sub)
if (!event_sub) {
err = -ENOMEM;
goto err;
}

list_add_tail(&event_sub->event_list, &sub_list);
if (use_eventfd) {
Expand Down
1 change: 1 addition & 0 deletions drivers/infiniband/sw/rxe/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ config RDMA_RXE
depends on INET && PCI && INFINIBAND
depends on INFINIBAND_VIRT_DMA
select NET_UDP_TUNNEL
select CRYPTO
select CRYPTO_CRC32
select DMA_VIRT_OPS
---help---
Expand Down
4 changes: 4 additions & 0 deletions drivers/md/dm-bufio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1438,6 +1438,10 @@ EXPORT_SYMBOL_GPL(dm_bufio_get_block_size);
sector_t dm_bufio_get_device_size(struct dm_bufio_client *c)
{
sector_t s = i_size_read(c->bdev->bd_inode) >> SECTOR_SHIFT;
if (s >= c->start)
s -= c->start;
else
s = 0;
if (likely(c->sectors_per_block_bits >= 0))
s >>= c->sectors_per_block_bits;
else
Expand Down
23 changes: 12 additions & 11 deletions drivers/md/dm-verity-fec.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,18 @@ static int fec_decode_rs8(struct dm_verity *v, struct dm_verity_fec_io *fio,
static u8 *fec_read_parity(struct dm_verity *v, u64 rsb, int index,
unsigned *offset, struct dm_buffer **buf)
{
u64 position, block;
u64 position, block, rem;
u8 *res;

position = (index + rsb) * v->fec->roots;
block = position >> v->data_dev_block_bits;
*offset = (unsigned)(position - (block << v->data_dev_block_bits));
block = div64_u64_rem(position, v->fec->roots << SECTOR_SHIFT, &rem);
*offset = (unsigned)rem;

res = dm_bufio_read(v->fec->bufio, v->fec->start + block, buf);
res = dm_bufio_read(v->fec->bufio, block, buf);
if (IS_ERR(res)) {
DMERR("%s: FEC %llu: parity read failed (block %llu): %ld",
v->data_dev->name, (unsigned long long)rsb,
(unsigned long long)(v->fec->start + block),
PTR_ERR(res));
(unsigned long long)block, PTR_ERR(res));
*buf = NULL;
}

Expand Down Expand Up @@ -155,7 +154,7 @@ static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_fec_io *fio,

/* read the next block when we run out of parity bytes */
offset += v->fec->roots;
if (offset >= 1 << v->data_dev_block_bits) {
if (offset >= v->fec->roots << SECTOR_SHIFT) {
dm_bufio_release(buf);

par = fec_read_parity(v, rsb, block_offset, &offset, &buf);
Expand Down Expand Up @@ -674,7 +673,7 @@ int verity_fec_ctr(struct dm_verity *v)
{
struct dm_verity_fec *f = v->fec;
struct dm_target *ti = v->ti;
u64 hash_blocks;
u64 hash_blocks, fec_blocks;
int ret;

if (!verity_fec_is_enabled(v)) {
Expand Down Expand Up @@ -744,15 +743,17 @@ int verity_fec_ctr(struct dm_verity *v)
}

f->bufio = dm_bufio_client_create(f->dev->bdev,
1 << v->data_dev_block_bits,
f->roots << SECTOR_SHIFT,
1, 0, NULL, NULL);
if (IS_ERR(f->bufio)) {
ti->error = "Cannot initialize FEC bufio client";
return PTR_ERR(f->bufio);
}

if (dm_bufio_get_device_size(f->bufio) <
((f->start + f->rounds * f->roots) >> v->data_dev_block_bits)) {
dm_bufio_set_sector_offset(f->bufio, f->start << (v->data_dev_block_bits - SECTOR_SHIFT));

fec_blocks = div64_u64(f->rounds * f->roots, v->fec->roots << SECTOR_SHIFT);
if (dm_bufio_get_device_size(f->bufio) < fec_blocks) {
ti->error = "FEC device is too small";
return -E2BIG;
}
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/realtek/r8169_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3959,6 +3959,7 @@ static void rtl_pll_power_down(struct rtl8169_private *tp)

switch (tp->mac_version) {
case RTL_GIGA_MAC_VER_25 ... RTL_GIGA_MAC_VER_26:
case RTL_GIGA_MAC_VER_29 ... RTL_GIGA_MAC_VER_30:
case RTL_GIGA_MAC_VER_32 ... RTL_GIGA_MAC_VER_33:
case RTL_GIGA_MAC_VER_37:
case RTL_GIGA_MAC_VER_39:
Expand Down Expand Up @@ -3989,6 +3990,7 @@ static void rtl_pll_power_up(struct rtl8169_private *tp)
{
switch (tp->mac_version) {
case RTL_GIGA_MAC_VER_25 ... RTL_GIGA_MAC_VER_26:
case RTL_GIGA_MAC_VER_29 ... RTL_GIGA_MAC_VER_30:
case RTL_GIGA_MAC_VER_32 ... RTL_GIGA_MAC_VER_33:
case RTL_GIGA_MAC_VER_37:
case RTL_GIGA_MAC_VER_39:
Expand Down
2 changes: 1 addition & 1 deletion fs/btrfs/delayed-inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ static int btrfs_delayed_inode_reserve_metadata(
btrfs_ino(inode),
num_bytes, 1);
} else {
btrfs_qgroup_free_meta_prealloc(root, fs_info->nodesize);
btrfs_qgroup_free_meta_prealloc(root, num_bytes);
}
return ret;
}
Expand Down
5 changes: 4 additions & 1 deletion fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -3151,8 +3151,11 @@ static int btrfs_zero_range(struct inode *inode,
goto out;
ret = btrfs_qgroup_reserve_data(inode, &data_reserved,
alloc_start, bytes_to_reserve);
if (ret)
if (ret) {
unlock_extent_cached(&BTRFS_I(inode)->io_tree, lockstart,
lockend, &cached_state);
goto out;
}
ret = btrfs_prealloc_file_range(inode, mode, alloc_start,
alloc_end - alloc_start,
i_blocksize(inode),
Expand Down
19 changes: 18 additions & 1 deletion fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1907,7 +1907,10 @@ static noinline int btrfs_ioctl_snap_create_v2(struct file *file,
if (vol_args->flags & BTRFS_SUBVOL_RDONLY)
readonly = true;
if (vol_args->flags & BTRFS_SUBVOL_QGROUP_INHERIT) {
if (vol_args->size > PAGE_SIZE) {
u64 nums;

if (vol_args->size < sizeof(*inherit) ||
vol_args->size > PAGE_SIZE) {
ret = -EINVAL;
goto free_args;
}
Expand All @@ -1916,6 +1919,20 @@ static noinline int btrfs_ioctl_snap_create_v2(struct file *file,
ret = PTR_ERR(inherit);
goto free_args;
}

if (inherit->num_qgroups > PAGE_SIZE ||
inherit->num_ref_copies > PAGE_SIZE ||
inherit->num_excl_copies > PAGE_SIZE) {
ret = -EINVAL;
goto free_inherit;
}

nums = inherit->num_qgroups + 2 * inherit->num_ref_copies +
2 * inherit->num_excl_copies;
if (vol_args->size != struct_size(inherit, qgroups, nums)) {
ret = -EINVAL;
goto free_inherit;
}
}

ret = btrfs_ioctl_snap_create_transid(file, vol_args->name,
Expand Down
Loading