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
5 changes: 4 additions & 1 deletion drivers/target/iscsi/iscsi_target_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -847,8 +847,11 @@ void iscsit_dec_conn_usage_count(struct iscsi_conn *conn)
spin_lock_bh(&conn->conn_usage_lock);
conn->conn_usage_count--;

if (!conn->conn_usage_count && conn->conn_waiting_on_uc)
if (!conn->conn_usage_count && conn->conn_waiting_on_uc) {
spin_unlock_bh(&conn->conn_usage_lock);
complete(&conn->conn_waiting_on_uc_comp);
return;
}

spin_unlock_bh(&conn->conn_usage_lock);
}
Expand Down
12 changes: 12 additions & 0 deletions include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -3271,6 +3271,18 @@ skb_header_pointer(const struct sk_buff *skb, int offset, int len, void *buffer)
skb_headlen(skb), buffer);
}

/* Variant of skb_header_pointer() where @offset is user-controlled
* and potentially negative.
*/
static inline void * __must_check
skb_header_pointer_careful(const struct sk_buff *skb, int offset,
int len, void *buffer)
{
if (unlikely(offset < 0 && -offset > skb_headroom(skb)))
return NULL;
return skb_header_pointer(skb, offset, len, buffer);
}

/**
* skb_needs_linearize - check if we need to linearize a given skb
* depending on the given device features.
Expand Down
13 changes: 6 additions & 7 deletions net/sched/cls_u32.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,8 @@ static int u32_classify(struct sk_buff *skb, const struct tcf_proto *tp,
int toff = off + key->off + (off2 & key->offmask);
__be32 *data, hdata;

if (skb_headroom(skb) + toff > INT_MAX)
goto out;

data = skb_header_pointer(skb, toff, 4, &hdata);
data = skb_header_pointer_careful(skb, toff, 4,
&hdata);
if (!data)
goto out;
if ((*data ^ key->val) & key->mask) {
Expand Down Expand Up @@ -212,8 +210,9 @@ static int u32_classify(struct sk_buff *skb, const struct tcf_proto *tp,
if (ht->divisor) {
__be32 *data, hdata;

data = skb_header_pointer(skb, off + n->sel.hoff, 4,
&hdata);
data = skb_header_pointer_careful(skb,
off + n->sel.hoff,
4, &hdata);
if (!data)
goto out;
sel = ht->divisor & u32_hash_fold(*data, &n->sel,
Expand All @@ -227,7 +226,7 @@ static int u32_classify(struct sk_buff *skb, const struct tcf_proto *tp,
if (n->sel.flags & TC_U32_VAROFFSET) {
__be16 *data, hdata;

data = skb_header_pointer(skb,
data = skb_header_pointer_careful(skb,
off + n->sel.offoff,
2, &hdata);
if (!data)
Expand Down
5 changes: 5 additions & 0 deletions net/sched/sch_teql.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ static int teql_qdisc_init(struct Qdisc *sch, struct nlattr *opt)
if (m->dev == dev)
return -ELOOP;

if (sch->parent != TC_H_ROOT) {
NL_SET_ERR_MSG_MOD(extack, "teql can only be used as root");
Comment thread
roxanan1996 marked this conversation as resolved.
return -EOPNOTSUPP;
}

q->m = m;

skb_queue_head_init(&q->q);
Expand Down
Loading