Skip to content

Commit

Permalink
dst: catch uninitialized metrics
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed May 24, 2011
1 parent 5d8bee6 commit 1f37070
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/net/dst.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ static inline u32 *dst_metrics_write_ptr(struct dst_entry *dst)
{
unsigned long p = dst->_metrics;

BUG_ON(!p);

if (p & DST_METRICS_READ_ONLY)
return dst->ops->cow_metrics(dst, p);
return __DST_METRICS_PTR(p);
Expand Down

0 comments on commit 1f37070

Please sign in to comment.