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
8 changes: 6 additions & 2 deletions drivers/infiniband/core/user_mad.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,8 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
struct ib_ah *ah;
struct ib_rmpp_mad *rmpp_mad;
__be64 *tid;
int ret, data_len, hdr_len, copy_offset, rmpp_active;
int ret, hdr_len, copy_offset, rmpp_active;
size_t data_len;
u8 base_version;

if (count < hdr_size(file) + IB_MGMT_RMPP_HDR)
Expand Down Expand Up @@ -545,7 +546,10 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
}

base_version = ((struct ib_mad_hdr *)&packet->mad.data)->base_version;
data_len = count - hdr_size(file) - hdr_len;
if (check_sub_overflow(count, (size_t)(hdr_size(file) + hdr_len), &data_len)) {
ret = -EINVAL;
goto err_ah;
}
packet->msg = ib_create_send_mad(agent,
be32_to_cpu(packet->mad.hdr.qpn),
packet->mad.hdr.pkey_index, rmpp_active,
Expand Down
4 changes: 4 additions & 0 deletions drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr,
brcmf_err("invalid interface index: %u\n", ifevent->ifidx);
return;
}
if (ifevent->bsscfgidx >= BRCMF_MAX_IFS) {
brcmf_err("invalid bsscfg index: %u\n", ifevent->bsscfgidx);
return;
}

ifp = drvr->iflist[ifevent->bsscfgidx];

Expand Down
36 changes: 28 additions & 8 deletions fs/xfs/libxfs/xfs_attr_leaf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,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 @@ -1422,17 +1423,36 @@ 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);
}
}
ichdr->usedbytes += xfs_attr_leaf_entsize(leaf, args->index);
Expand Down
2 changes: 1 addition & 1 deletion net/netfilter/xt_tcpmss.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ tcpmss_mt(const struct sk_buff *skb, struct xt_action_param *par)
return (mssval >= info->mss_min &&
mssval <= info->mss_max) ^ info->invert;
}
if (op[i] < 2)
if (op[i] < 2 || i == optlen - 1)
i++;
else
i += op[i+1] ? : 1;
Expand Down