Skip to content
2 changes: 1 addition & 1 deletion drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1648,7 +1648,7 @@ u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags)

u32 len = hid_report_len(report) + 7;

return kmalloc(len, flags);
return kzalloc(len, flags);
}
EXPORT_SYMBOL_GPL(hid_alloc_report_buf);

Expand Down
4 changes: 3 additions & 1 deletion drivers/hid/intel-ish-hid/ishtp-hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,14 @@ int ishtp_hid_probe(unsigned int cur_hid_dev,
*/
void ishtp_hid_remove(struct ishtp_cl_data *client_data)
{
void *data;
int i;

for (i = 0; i < client_data->num_hid_devices; ++i) {
if (client_data->hid_sensor_hubs[i]) {
kfree(client_data->hid_sensor_hubs[i]->driver_data);
data = client_data->hid_sensor_hubs[i]->driver_data;
hid_destroy_device(client_data->hid_sensor_hubs[i]);
kfree(data);
client_data->hid_sensor_hubs[i] = NULL;
}
}
Expand Down
1 change: 1 addition & 0 deletions drivers/media/usb/uvc/uvc_status.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ int uvc_status_init(struct uvc_device *dev)
dev->int_urb = usb_alloc_urb(0, GFP_KERNEL);
if (dev->int_urb == NULL) {
kfree(dev->status);
dev->status = NULL;
return -ENOMEM;
}

Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,9 @@ int mlxsw_sp_mr_route_add(struct mlxsw_sp_mr_table *mr_table,
rhashtable_remove_fast(&mr_table->route_ht,
&mr_orig_route->ht_node,
mlxsw_sp_mr_route_ht_params);
mutex_lock(&mr_table->route_list_lock);
list_del(&mr_orig_route->node);
mutex_unlock(&mr_table->route_list_lock);
mlxsw_sp_mr_route_destroy(mr_table, mr_orig_route);
}

Expand Down
16 changes: 2 additions & 14 deletions drivers/net/geneve.c
Original file line number Diff line number Diff line change
Expand Up @@ -1918,21 +1918,9 @@ static void geneve_destroy_tunnels(struct net *net, struct list_head *head)
{
struct geneve_net *gn = net_generic(net, geneve_net_id);
struct geneve_dev *geneve, *next;
struct net_device *dev, *aux;

/* gather any geneve devices that were moved into this ns */
for_each_netdev_safe(net, dev, aux)
if (dev->rtnl_link_ops == &geneve_link_ops)
unregister_netdevice_queue(dev, head);

/* now gather any other geneve devices that were created in this ns */
list_for_each_entry_safe(geneve, next, &gn->geneve_list, next) {
/* If geneve->dev is in the same netns, it was already added
* to the list by the previous loop.
*/
if (!net_eq(dev_net(geneve->dev), net))
unregister_netdevice_queue(geneve->dev, head);
}
list_for_each_entry_safe(geneve, next, &gn->geneve_list, next)
geneve_dellink(geneve->dev, head);
}

static void __net_exit geneve_exit_batch_net(struct list_head *net_list)
Expand Down
49 changes: 41 additions & 8 deletions fs/xfs/libxfs/xfs_attr_leaf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1444,6 +1444,7 @@ xfs_attr3_leaf_add_work(
struct xfs_attr_leaf_name_local *name_loc;
struct xfs_attr_leaf_name_remote *name_rmt;
struct xfs_mount *mp;
int old_end, new_end;
int tmp;
int i;

Expand Down Expand Up @@ -1535,17 +1536,49 @@ xfs_attr3_leaf_add_work(
if (be16_to_cpu(entry->nameidx) < ichdr->firstused)
ichdr->firstused = be16_to_cpu(entry->nameidx);

ASSERT(ichdr->firstused >= ichdr->count * sizeof(xfs_attr_leaf_entry_t)
+ xfs_attr3_leaf_hdr_size(leaf));
tmp = (ichdr->count - 1) * sizeof(xfs_attr_leaf_entry_t)
+ xfs_attr3_leaf_hdr_size(leaf);
new_end = ichdr->count * sizeof(struct xfs_attr_leaf_entry) +
xfs_attr3_leaf_hdr_size(leaf);
old_end = new_end - sizeof(struct xfs_attr_leaf_entry);

ASSERT(ichdr->firstused >= new_end);

for (i = 0; i < XFS_ATTR_LEAF_MAPSIZE; i++) {
if (ichdr->freemap[i].base == tmp) {
ichdr->freemap[i].base += sizeof(xfs_attr_leaf_entry_t);
int diff = 0;

if (ichdr->freemap[i].base == old_end) {
/*
* This freemap entry starts at the old end of the
* leaf entry array, so we need to adjust its base
* upward to accomodate the larger array.
*/
diff = sizeof(struct xfs_attr_leaf_entry);
} else if (ichdr->freemap[i].size > 0 &&
ichdr->freemap[i].base < new_end) {
/*
* This freemap entry starts in the space claimed by
* the new leaf entry. Adjust its base upward to
* reflect that.
*/
diff = new_end - ichdr->freemap[i].base;
}

if (diff) {
ichdr->freemap[i].base += diff;
ichdr->freemap[i].size -=
min_t(uint16_t, ichdr->freemap[i].size,
sizeof(xfs_attr_leaf_entry_t));
min_t(uint16_t, ichdr->freemap[i].size, diff);
}

/*
* Don't leave zero-length freemaps with nonzero base lying
* around, because we don't want the code in _remove that
* matches on base address to get confused and create
* overlapping freemaps. If we end up with no freemap entries
* then the next _add will compact the leaf block and
* regenerate the freemaps.
*/
if (ichdr->freemap[i].size == 0 && ichdr->freemap[i].base > 0) {
ichdr->freemap[i].base = 0;
ichdr->holes = 1;
}
}
ichdr->usedbytes += xfs_attr_leaf_entsize(leaf, args->index);
Expand Down
5 changes: 4 additions & 1 deletion fs/xfs/xfs_log_recover.c
Original file line number Diff line number Diff line change
Expand Up @@ -2417,7 +2417,10 @@ xlog_recover_process_data(

ohead = (struct xlog_op_header *)dp;
dp += sizeof(*ohead);
ASSERT(dp <= end);
if (dp > end) {
xfs_warn(log->l_mp, "%s: op header overrun", __func__);
return -EFSCORRUPTED;
}

/* errors will abort recovery */
error = xlog_recover_process_ophdr(log, rhash, rhead, ohead,
Expand Down
Loading