diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2011-05-24 13:50:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-24 13:50:52 -0400 |
commit | 1f37070d3ff325827c6213e51b57f21fd5ac9d05 (patch) | |
tree | ac0d1bc0a5e2cdaaeedb72b2ba049141ea16121c /include/net/dst.h | |
parent | 5d8bee676fc9fc9389302baa9ba47bc2ed885f64 (diff) |
dst: catch uninitialized metrics
Catch cases where dst_metric_set() and other functions are called
but _metrics is NULL.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/dst.h')
-rw-r--r-- | include/net/dst.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/net/dst.h b/include/net/dst.h index 07a0402c52e6..7d15d238b6ec 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -111,6 +111,8 @@ static inline u32 *dst_metrics_write_ptr(struct dst_entry *dst) | |||
111 | { | 111 | { |
112 | unsigned long p = dst->_metrics; | 112 | unsigned long p = dst->_metrics; |
113 | 113 | ||
114 | BUG_ON(!p); | ||
115 | |||
114 | if (p & DST_METRICS_READ_ONLY) | 116 | if (p & DST_METRICS_READ_ONLY) |
115 | return dst->ops->cow_metrics(dst, p); | 117 | return dst->ops->cow_metrics(dst, p); |
116 | return __DST_METRICS_PTR(p); | 118 | return __DST_METRICS_PTR(p); |