aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cxgb3/cxgb3_defs.h
diff options
context:
space:
mode:
authorDivy Le Ray <divy@chelsio.com>2007-08-21 23:49:26 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:50:49 -0400
commitc9a6ce500d78932c43361eae28c3de81b3660c77 (patch)
treed0cb68fb610a4085ee4c28164851b7ee142aa851 /drivers/net/cxgb3/cxgb3_defs.h
parente22bb45d772b5e5c850a6223c2a3245f520de641 (diff)
cxgb3 - tighten checks on TID values
Enforce validity checks on connection ids Signed-off-by: Divy Le Ray <divy@chelsio.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/cxgb3/cxgb3_defs.h')
-rw-r--r--drivers/net/cxgb3/cxgb3_defs.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/net/cxgb3/cxgb3_defs.h b/drivers/net/cxgb3/cxgb3_defs.h
index 483a594210a7..45e92164c260 100644
--- a/drivers/net/cxgb3/cxgb3_defs.h
+++ b/drivers/net/cxgb3/cxgb3_defs.h
@@ -79,9 +79,17 @@ static inline struct t3c_tid_entry *lookup_tid(const struct tid_info *t,
79static inline struct t3c_tid_entry *lookup_stid(const struct tid_info *t, 79static inline struct t3c_tid_entry *lookup_stid(const struct tid_info *t,
80 unsigned int tid) 80 unsigned int tid)
81{ 81{
82 union listen_entry *e;
83
82 if (tid < t->stid_base || tid >= t->stid_base + t->nstids) 84 if (tid < t->stid_base || tid >= t->stid_base + t->nstids)
83 return NULL; 85 return NULL;
84 return &(stid2entry(t, tid)->t3c_tid); 86
87 e = stid2entry(t, tid);
88 if ((void *)e->next >= (void *)t->tid_tab &&
89 (void *)e->next < (void *)&t->atid_tab[t->natids])
90 return NULL;
91
92 return &e->t3c_tid;
85} 93}
86 94
87/* 95/*
@@ -90,9 +98,17 @@ static inline struct t3c_tid_entry *lookup_stid(const struct tid_info *t,
90static inline struct t3c_tid_entry *lookup_atid(const struct tid_info *t, 98static inline struct t3c_tid_entry *lookup_atid(const struct tid_info *t,
91 unsigned int tid) 99 unsigned int tid)
92{ 100{
101 union active_open_entry *e;
102
93 if (tid < t->atid_base || tid >= t->atid_base + t->natids) 103 if (tid < t->atid_base || tid >= t->atid_base + t->natids)
94 return NULL; 104 return NULL;
95 return &(atid2entry(t, tid)->t3c_tid); 105
106 e = atid2entry(t, tid);
107 if ((void *)e->next >= (void *)t->tid_tab &&
108 (void *)e->next < (void *)&t->atid_tab[t->natids])
109 return NULL;
110
111 return &e->t3c_tid;
96} 112}
97 113
98int process_rx(struct t3cdev *dev, struct sk_buff **skbs, int n); 114int process_rx(struct t3cdev *dev, struct sk_buff **skbs, int n);