diff options
author | Hannes Hering <hering2@de.ibm.com> | 2009-05-04 14:06:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-04 14:06:37 -0400 |
commit | 0b2febf38a33d7c40fb7bb4a58c113a1fa33c412 (patch) | |
tree | 95993c55500c30ff17e04f530728d00f40480364 /drivers/net | |
parent | 379b026ecc20c4657d37e40ead789f7f28f1a1c1 (diff) |
ehea: fix invalid pointer access
This patch fixes an invalid pointer access in case the receive queue
holds no pointer to the next skb when the queue is empty.
Signed-off-by: Hannes Hering <hering2@de.ibm.com>
Signed-off-by: Jan-Bernd Themann <themann@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ehea/ehea.h | 2 | ||||
-rw-r--r-- | drivers/net/ehea/ehea_main.c | 31 |
2 files changed, 19 insertions, 14 deletions
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 6e317caf429c..16a41389575a 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <asm/io.h> | 40 | #include <asm/io.h> |
41 | 41 | ||
42 | #define DRV_NAME "ehea" | 42 | #define DRV_NAME "ehea" |
43 | #define DRV_VERSION "EHEA_0100" | 43 | #define DRV_VERSION "EHEA_0101" |
44 | 44 | ||
45 | /* eHEA capability flags */ | 45 | /* eHEA capability flags */ |
46 | #define DLPAR_PORT_ADD_REM 1 | 46 | #define DLPAR_PORT_ADD_REM 1 |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 604c844d0769..b22dab9153f6 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -545,14 +545,17 @@ static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array, | |||
545 | x &= (arr_len - 1); | 545 | x &= (arr_len - 1); |
546 | 546 | ||
547 | pref = skb_array[x]; | 547 | pref = skb_array[x]; |
548 | prefetchw(pref); | 548 | if (pref) { |
549 | prefetchw(pref + EHEA_CACHE_LINE); | 549 | prefetchw(pref); |
550 | 550 | prefetchw(pref + EHEA_CACHE_LINE); | |
551 | pref = (skb_array[x]->data); | 551 | |
552 | prefetch(pref); | 552 | pref = (skb_array[x]->data); |
553 | prefetch(pref + EHEA_CACHE_LINE); | 553 | prefetch(pref); |
554 | prefetch(pref + EHEA_CACHE_LINE * 2); | 554 | prefetch(pref + EHEA_CACHE_LINE); |
555 | prefetch(pref + EHEA_CACHE_LINE * 3); | 555 | prefetch(pref + EHEA_CACHE_LINE * 2); |
556 | prefetch(pref + EHEA_CACHE_LINE * 3); | ||
557 | } | ||
558 | |||
556 | skb = skb_array[skb_index]; | 559 | skb = skb_array[skb_index]; |
557 | skb_array[skb_index] = NULL; | 560 | skb_array[skb_index] = NULL; |
558 | return skb; | 561 | return skb; |
@@ -569,12 +572,14 @@ static inline struct sk_buff *get_skb_by_index_ll(struct sk_buff **skb_array, | |||
569 | x &= (arr_len - 1); | 572 | x &= (arr_len - 1); |
570 | 573 | ||
571 | pref = skb_array[x]; | 574 | pref = skb_array[x]; |
572 | prefetchw(pref); | 575 | if (pref) { |
573 | prefetchw(pref + EHEA_CACHE_LINE); | 576 | prefetchw(pref); |
577 | prefetchw(pref + EHEA_CACHE_LINE); | ||
574 | 578 | ||
575 | pref = (skb_array[x]->data); | 579 | pref = (skb_array[x]->data); |
576 | prefetchw(pref); | 580 | prefetchw(pref); |
577 | prefetchw(pref + EHEA_CACHE_LINE); | 581 | prefetchw(pref + EHEA_CACHE_LINE); |
582 | } | ||
578 | 583 | ||
579 | skb = skb_array[wqe_index]; | 584 | skb = skb_array[wqe_index]; |
580 | skb_array[wqe_index] = NULL; | 585 | skb_array[wqe_index] = NULL; |