diff options
author | Navid Emamdoost <navid.emamdoost@gmail.com> | 2019-07-21 08:37:31 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-07-21 20:47:30 +0200 |
commit | bb1320834b8a80c6ac2697ab418d066981ea08ba (patch) | |
tree | ce284a36b9f25ceb45f34f2fe51116e2d98d773e /drivers/net/ethernet | |
parent | net: hns3: typo in the name of a constant (diff) | |
download | linux-bb1320834b8a80c6ac2697ab418d066981ea08ba.tar.xz linux-bb1320834b8a80c6ac2697ab418d066981ea08ba.zip |
allocate_flower_entry: should check for null deref
allocate_flower_entry does not check for allocation success, but tries
to deref the result. I only moved the spin_lock under null check, because
the caller is checking allocation's status at line 652.
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c index 312599c6b35a..e447976bdd3e 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c @@ -67,7 +67,8 @@ static struct ch_tc_pedit_fields pedits[] = { static struct ch_tc_flower_entry *allocate_flower_entry(void) { struct ch_tc_flower_entry *new = kzalloc(sizeof(*new), GFP_KERNEL); - spin_lock_init(&new->lock); + if (new) + spin_lock_init(&new->lock); return new; } |