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>
This commit is contained in:
Hannes Hering 2009-05-04 11:06:37 -07:00 committed by David S. Miller
parent 379b026ecc
commit 0b2febf38a
2 changed files with 18 additions and 13 deletions

View file

@ -40,7 +40,7 @@
#include <asm/io.h>
#define DRV_NAME "ehea"
#define DRV_VERSION "EHEA_0100"
#define DRV_VERSION "EHEA_0101"
/* eHEA capability flags */
#define DLPAR_PORT_ADD_REM 1

View file

@ -545,6 +545,7 @@ static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array,
x &= (arr_len - 1);
pref = skb_array[x];
if (pref) {
prefetchw(pref);
prefetchw(pref + EHEA_CACHE_LINE);
@ -553,6 +554,8 @@ static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array,
prefetch(pref + EHEA_CACHE_LINE);
prefetch(pref + EHEA_CACHE_LINE * 2);
prefetch(pref + EHEA_CACHE_LINE * 3);
}
skb = skb_array[skb_index];
skb_array[skb_index] = NULL;
return skb;
@ -569,12 +572,14 @@ static inline struct sk_buff *get_skb_by_index_ll(struct sk_buff **skb_array,
x &= (arr_len - 1);
pref = skb_array[x];
if (pref) {
prefetchw(pref);
prefetchw(pref + EHEA_CACHE_LINE);
pref = (skb_array[x]->data);
prefetchw(pref);
prefetchw(pref + EHEA_CACHE_LINE);
}
skb = skb_array[wqe_index];
skb_array[wqe_index] = NULL;