diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-03-23 23:27:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-24 18:24:30 -0400 |
commit | fb8585fc3f9b39153e0bdaf03f00a02dde9c03c6 (patch) | |
tree | 7097afe2b7adc07f38457549a1e89701153ecae9 /drivers/s390/net/ctcm_fsms.c | |
parent | 3a05d1404d91efd63f0654a4bf59b8803c32efdd (diff) |
ctcm: avoid wraparound in length of incoming data
Since the receive code should tolerate any incoming garbage, it
should be protected against a potential wraparound when manipulating
length values within incoming data.
block_len is unsigned, so a too large subtraction will cause a
wraparound.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Ursula Braun <ursula.braun@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390/net/ctcm_fsms.c')
-rw-r--r-- | drivers/s390/net/ctcm_fsms.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/s390/net/ctcm_fsms.c b/drivers/s390/net/ctcm_fsms.c index f29c7086fc19..4ded9ac2c5ef 100644 --- a/drivers/s390/net/ctcm_fsms.c +++ b/drivers/s390/net/ctcm_fsms.c | |||
@@ -410,9 +410,8 @@ static void chx_rx(fsm_instance *fi, int event, void *arg) | |||
410 | priv->stats.rx_length_errors++; | 410 | priv->stats.rx_length_errors++; |
411 | goto again; | 411 | goto again; |
412 | } | 412 | } |
413 | block_len -= 2; | 413 | if (block_len > 2) { |
414 | if (block_len > 0) { | 414 | *((__u16 *)skb->data) = block_len - 2; |
415 | *((__u16 *)skb->data) = block_len; | ||
416 | ctcm_unpack_skb(ch, skb); | 415 | ctcm_unpack_skb(ch, skb); |
417 | } | 416 | } |
418 | again: | 417 | again: |