Skip to content

Commit

Permalink
Merge android-4.9-q into canting-4.9-q
Browse files Browse the repository at this point in the history
* 'android-4.9-q' of https://android.googlesource.com/kernel/common:
  Linux 4.9.272
  xen-pciback: redo VF placement in the virtual topology
  arm64: Remove unimplemented syscall log message
  KVM: SVM: Truncate GPR value for DR and CR accesses in !64-bit mode
  bnxt_en: Remove the setting of dev_port.
  btrfs: fixup error handling in fixup_inode_link_counts
  btrfs: fix error handling in btrfs_del_csums
  nfc: fix NULL ptr dereference in llcp_sock_getname() after failed connect
  ocfs2: fix data corruption by fallocate
  pid: take a reference when initializing `cad_pid`
  ext4: fix bug on in ext4_es_cache_extent as ext4_split_extent_at failed
  ALSA: timer: Fix master timer notification
  net: caif: fix memory leak in cfusbl_device_notify
  net: caif: fix memory leak in caif_device_notify
  net: caif: add proper error handling
  net: caif: added cfserl_release function
  Bluetooth: use correct lock to prevent UAF of hdev object
  Bluetooth: fix the erroneous flush_work() order
  ieee802154: fix error return code in ieee802154_llsec_getparams()
  ieee802154: fix error return code in ieee802154_add_iface()
  netfilter: nfnetlink_cthelper: hit EBUSY on updates if size mismatches
  HID: i2c-hid: fix format string mismatch
  HID: pidff: fix error return code in hid_pidff_init()
  ipvs: ignore IP_VS_SVC_F_HASHED flag when adding service
  vfio/platform: fix module_put call in error flow
  vfio/pci: zap_vma_ptes() needs MMU
  vfio/pci: Fix error return code in vfio_ecap_init()
  efi: cper: fix snprintf() use in cper_dimm_err_location()
  efi: Allow EFI_MEMORY_XP and EFI_MEMORY_RO both to be cleared
  net: usb: cdc_ncm: don't spew notifications

Signed-off-by: Khusika Dhamar Gusti <mail@khusika.com>
  • Loading branch information
Khusika Dhamar Gusti committed Jun 10, 2021
2 parents 0af494e + 6c5d14c commit e9ad28b
Show file tree
Hide file tree
Showing 34 changed files with 185 additions and 91 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION = 4
PATCHLEVEL = 9
SUBLEVEL = 271
SUBLEVEL = 272
EXTRAVERSION =
NAME = Roaring Lionus

Expand Down
8 changes: 0 additions & 8 deletions arch/arm64/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,14 +737,6 @@ asmlinkage long do_ni_syscall(struct pt_regs *regs)
}
#endif

if (show_unhandled_signals_ratelimited()) {
pr_info("%s[%d]: syscall %d\n", current->comm,
task_pid_nr(current), (int)regs->syscallno);
dump_instr("", regs);
if (user_mode(regs))
__show_regs(regs);
}

return sys_ni_syscall();
}

Expand Down
8 changes: 4 additions & 4 deletions arch/x86/kvm/svm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3412,7 +3412,7 @@ static int cr_interception(struct vcpu_svm *svm)
err = 0;
if (cr >= 16) { /* mov to cr */
cr -= 16;
val = kvm_register_read(&svm->vcpu, reg);
val = kvm_register_readl(&svm->vcpu, reg);
switch (cr) {
case 0:
if (!check_selective_cr0_intercepted(svm, val))
Expand Down Expand Up @@ -3457,7 +3457,7 @@ static int cr_interception(struct vcpu_svm *svm)
kvm_queue_exception(&svm->vcpu, UD_VECTOR);
return 1;
}
kvm_register_write(&svm->vcpu, reg, val);
kvm_register_writel(&svm->vcpu, reg, val);
}
kvm_complete_insn_gp(&svm->vcpu, err);

Expand Down Expand Up @@ -3489,13 +3489,13 @@ static int dr_interception(struct vcpu_svm *svm)
if (dr >= 16) { /* mov to DRn */
if (!kvm_require_dr(&svm->vcpu, dr - 16))
return 1;
val = kvm_register_read(&svm->vcpu, reg);
val = kvm_register_readl(&svm->vcpu, reg);
kvm_set_dr(&svm->vcpu, dr - 16, val);
} else {
if (!kvm_require_dr(&svm->vcpu, dr))
return 1;
kvm_get_dr(&svm->vcpu, dr, &val);
kvm_register_write(&svm->vcpu, reg, val);
kvm_register_writel(&svm->vcpu, reg, val);
}

skip_emulated_instruction(&svm->vcpu);
Expand Down
4 changes: 1 addition & 3 deletions drivers/firmware/efi/cper.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@ static int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg)
if (!msg || !(mem->validation_bits & CPER_MEM_VALID_MODULE_HANDLE))
return 0;

n = 0;
len = CPER_REC_LEN - 1;
len = CPER_REC_LEN;
dmi_memdev_name(mem->mem_dev_handle, &bank, &device);
if (bank && device)
n = snprintf(msg, len, "DIMM location: %s %s ", bank, device);
Expand All @@ -267,7 +266,6 @@ static int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg)
"DIMM location: not present. DMI handle: 0x%.4x ",
mem->mem_dev_handle);

msg[n] = '\0';
return n;
}

Expand Down
5 changes: 0 additions & 5 deletions drivers/firmware/efi/memattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ static bool entry_is_valid(const efi_memory_desc_t *in, efi_memory_desc_t *out)
return false;
}

if (!(in->attribute & (EFI_MEMORY_RO | EFI_MEMORY_XP))) {
pr_warn("Entry attributes invalid: RO and XP bits both cleared\n");
return false;
}

if (PAGE_SIZE > EFI_PAGE_SIZE &&
(!PAGE_ALIGNED(in->phys_addr) ||
!PAGE_ALIGNED(in->num_pages << EFI_PAGE_SHIFT))) {
Expand Down
4 changes: 2 additions & 2 deletions drivers/hid/i2c-hid/i2c-hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1157,8 +1157,8 @@ static int i2c_hid_probe(struct i2c_client *client,
hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID);
hid->product = le16_to_cpu(ihid->hdesc.wProductID);

snprintf(hid->name, sizeof(hid->name), "%s %04hX:%04hX",
client->name, hid->vendor, hid->product);
snprintf(hid->name, sizeof(hid->name), "%s %04X:%04X",
client->name, (u16)hid->vendor, (u16)hid->product);
strlcpy(hid->phys, dev_name(&client->dev), sizeof(hid->phys));

ihid->quirks = i2c_hid_lookup_quirk(hid->vendor, hid->product);
Expand Down
1 change: 1 addition & 0 deletions drivers/hid/usbhid/hid-pidff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,7 @@ int hid_pidff_init(struct hid_device *hid)

if (pidff->pool[PID_DEVICE_MANAGED_POOL].value &&
pidff->pool[PID_DEVICE_MANAGED_POOL].value[0] == 0) {
error = -EPERM;
hid_notice(hid,
"device does not support device managed pool\n");
goto fail;
Expand Down
1 change: 0 additions & 1 deletion drivers/net/ethernet/broadcom/bnxt/bnxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -4262,7 +4262,6 @@ int bnxt_hwrm_func_qcaps(struct bnxt *bp)

pf->fw_fid = le16_to_cpu(resp->fid);
pf->port_id = le16_to_cpu(resp->port_id);
bp->dev->dev_port = pf->port_id;
memcpy(pf->mac_addr, resp->mac_address, ETH_ALEN);
memcpy(bp->dev->dev_addr, pf->mac_addr, ETH_ALEN);
pf->max_rsscos_ctxs = le16_to_cpu(resp->max_rsscos_ctx);
Expand Down
12 changes: 11 additions & 1 deletion drivers/net/usb/cdc_ncm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,15 @@ cdc_ncm_speed_change(struct usbnet *dev,
uint32_t rx_speed = le32_to_cpu(data->DLBitRRate);
uint32_t tx_speed = le32_to_cpu(data->ULBitRate);

/* if the speed hasn't changed, don't report it.
* RTL8156 shipped before 2021 sends notification about every 32ms.
*/
if (dev->rx_speed == rx_speed && dev->tx_speed == tx_speed)
return;

dev->rx_speed = rx_speed;
dev->tx_speed = tx_speed;

/*
* Currently the USB-NET API does not support reporting the actual
* device speed. Do print it instead.
Expand Down Expand Up @@ -1606,7 +1615,8 @@ static void cdc_ncm_status(struct usbnet *dev, struct urb *urb)
* USB_CDC_NOTIFY_NETWORK_CONNECTION notification shall be
* sent by device after USB_CDC_NOTIFY_SPEED_CHANGE.
*/
usbnet_link_change(dev, !!event->wValue, 0);
if (netif_carrier_ok(dev->net) != !!event->wValue)
usbnet_link_change(dev, !!event->wValue, 0);
break;

case USB_CDC_NOTIFY_SPEED_CHANGE:
Expand Down
1 change: 1 addition & 0 deletions drivers/vfio/pci/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
config VFIO_PCI
tristate "VFIO support for PCI devices"
depends on VFIO && PCI && EVENTFD
depends on MMU
select VFIO_VIRQFD
select IRQ_BYPASS_MANAGER
help
Expand Down
2 changes: 1 addition & 1 deletion drivers/vfio/pci/vfio_pci_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1576,7 +1576,7 @@ static int vfio_ecap_init(struct vfio_pci_device *vdev)
if (len == 0xFF) {
len = vfio_ext_cap_len(vdev, ecap, epos);
if (len < 0)
return ret;
return len;
}
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/vfio/platform/vfio_platform_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ static int vfio_platform_open(void *device_data)
vfio_platform_regions_cleanup(vdev);
err_reg:
mutex_unlock(&driver_lock);
module_put(THIS_MODULE);
module_put(vdev->parent_module);
return ret;
}

Expand Down
14 changes: 8 additions & 6 deletions drivers/xen/xen-pciback/vpci.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev,
struct pci_dev *dev, int devid,
publish_pci_dev_cb publish_cb)
{
int err = 0, slot, func = -1;
int err = 0, slot, func = PCI_FUNC(dev->devfn);
struct pci_dev_entry *t, *dev_entry;
struct vpci_dev_data *vpci_dev = pdev->pci_dev_data;

Expand All @@ -93,23 +93,26 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev,

/*
* Keep multi-function devices together on the virtual PCI bus, except
* virtual functions.
* that we want to keep virtual functions at func 0 on their own. They
* aren't multi-function devices and hence their presence at func 0
* may cause guests to not scan the other functions.
*/
if (!dev->is_virtfn) {
if (!dev->is_virtfn || func) {
for (slot = 0; slot < PCI_SLOT_MAX; slot++) {
if (list_empty(&vpci_dev->dev_list[slot]))
continue;

t = list_entry(list_first(&vpci_dev->dev_list[slot]),
struct pci_dev_entry, list);
if (t->dev->is_virtfn && !PCI_FUNC(t->dev->devfn))
continue;

if (match_slot(dev, t->dev)) {
pr_info("vpci: %s: assign to virtual slot %d func %d\n",
pci_name(dev), slot,
PCI_FUNC(dev->devfn));
func);
list_add_tail(&dev_entry->list,
&vpci_dev->dev_list[slot]);
func = PCI_FUNC(dev->devfn);
goto unlock;
}
}
Expand All @@ -122,7 +125,6 @@ static int __xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev,
pci_name(dev), slot);
list_add_tail(&dev_entry->list,
&vpci_dev->dev_list[slot]);
func = dev->is_virtfn ? 0 : PCI_FUNC(dev->devfn);
goto unlock;
}
}
Expand Down
10 changes: 5 additions & 5 deletions fs/btrfs/file-item.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
u64 end_byte = bytenr + len;
u64 csum_end;
struct extent_buffer *leaf;
int ret;
int ret = 0;
u16 csum_size = btrfs_super_csum_size(root->fs_info->super_copy);
int blocksize_bits = root->fs_info->sb->s_blocksize_bits;

Expand All @@ -626,6 +626,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
path->leave_spinning = 1;
ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
if (ret > 0) {
ret = 0;
if (path->slots[0] == 0)
break;
path->slots[0]--;
Expand Down Expand Up @@ -656,7 +657,7 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
if (key.offset >= bytenr && csum_end <= end_byte) {
ret = btrfs_del_item(trans, root, path);
if (ret)
goto out;
break;
if (key.offset == bytenr)
break;
} else if (key.offset < bytenr && csum_end > end_byte) {
Expand Down Expand Up @@ -700,8 +701,9 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
ret = btrfs_split_item(trans, root, path, &key, offset);
if (ret && ret != -EAGAIN) {
btrfs_abort_transaction(trans, ret);
goto out;
break;
}
ret = 0;

key.offset = end_byte - 1;
} else {
Expand All @@ -711,8 +713,6 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
}
btrfs_release_path(path);
}
ret = 0;
out:
btrfs_free_path(path);
return ret;
}
Expand Down
13 changes: 7 additions & 6 deletions fs/btrfs/tree-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,7 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans,
break;

if (ret == 1) {
ret = 0;
if (path->slots[0] == 0)
break;
path->slots[0]--;
Expand All @@ -1541,17 +1542,19 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans,

ret = btrfs_del_item(trans, root, path);
if (ret)
goto out;
break;

btrfs_release_path(path);
inode = read_one_inode(root, key.offset);
if (!inode)
return -EIO;
if (!inode) {
ret = -EIO;
break;
}

ret = fixup_inode_link_count(trans, root, inode);
iput(inode);
if (ret)
goto out;
break;

/*
* fixup on a directory may create new entries,
Expand All @@ -1560,8 +1563,6 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans,
*/
key.offset = (u64)-1;
}
ret = 0;
out:
btrfs_release_path(path);
return ret;
}
Expand Down
43 changes: 23 additions & 20 deletions fs/ext4/extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -3274,7 +3274,10 @@ static int ext4_split_extent_at(handle_t *handle,
ext4_ext_mark_unwritten(ex2);

err = ext4_ext_insert_extent(handle, inode, ppath, &newex, flags);
if (err == -ENOSPC && (EXT4_EXT_MAY_ZEROOUT & split_flag)) {
if (err != -ENOSPC && err != -EDQUOT)
goto out;

if (EXT4_EXT_MAY_ZEROOUT & split_flag) {
if (split_flag & (EXT4_EXT_DATA_VALID1|EXT4_EXT_DATA_VALID2)) {
if (split_flag & EXT4_EXT_DATA_VALID1) {
err = ext4_ext_zeroout(inode, ex2);
Expand All @@ -3300,30 +3303,30 @@ static int ext4_split_extent_at(handle_t *handle,
ext4_ext_pblock(&orig_ex));
}

if (err)
goto fix_extent_len;
/* update the extent length and mark as initialized */
ex->ee_len = cpu_to_le16(ee_len);
ext4_ext_try_to_merge(handle, inode, path, ex);
err = ext4_ext_dirty(handle, inode, path + path->p_depth);
if (err)
goto fix_extent_len;

/* update extent status tree */
err = ext4_zeroout_es(inode, &zero_ex);

goto out;
} else if (err)
goto fix_extent_len;

out:
ext4_ext_show_leaf(inode, path);
return err;
if (!err) {
/* update the extent length and mark as initialized */
ex->ee_len = cpu_to_le16(ee_len);
ext4_ext_try_to_merge(handle, inode, path, ex);
err = ext4_ext_dirty(handle, inode, path + path->p_depth);
if (!err)
/* update extent status tree */
err = ext4_zeroout_es(inode, &zero_ex);
/* If we failed at this point, we don't know in which
* state the extent tree exactly is so don't try to fix
* length of the original extent as it may do even more
* damage.
*/
goto out;
}
}

fix_extent_len:
ex->ee_len = orig_ex.ee_len;
ext4_ext_dirty(handle, inode, path + path->p_depth);
return err;
out:
ext4_ext_show_leaf(inode, path);
return err;
}

/*
Expand Down
Loading

0 comments on commit e9ad28b

Please sign in to comment.