lkml.org 
[lkml]   [2015]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH net-next] BNX2: fix a Null Pointer for stats_blk
From
From: Weidong Wang <wangweidong1@huawei.com>
Date: Tue, 22 Sep 2015 20:42:40 +0800

> @@ -880,6 +882,7 @@ bnx2_alloc_mem(struct bnx2 *bp)
> }
> }
>
> + spin_lock(&bp->stats64_lock);
> bp->stats_blk = status_blk + status_blk_size;
>
> bp->stats_blk_mapping = bp->status_blk_mapping + status_blk_size;
> @@ -894,20 +897,23 @@ bnx2_alloc_mem(struct bnx2 *bp)
> &bp->ctx_blk_mapping[i],
> GFP_KERNEL);
> if (bp->ctx_blk[i] == NULL)
> - goto alloc_mem_err;
> + goto free_stats64_lock;
> }
> }
>
> err = bnx2_alloc_rx_mem(bp);
> if (err)
> - goto alloc_mem_err;
> + goto free_stats64_lock;

You're holding a spinlock while doing GFP_KERNEL allocations.

Second of all, taking a spinlock in get_stats64() defeats the whole
intention of making statistics acquisition as fast and as SMP scalable
as possible.


\
 
 \ /
  Last update: 2015-09-24 01:01    [W:0.188 / U:0.856 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site