@@ -1818,15 +1818,15 @@ __cfg80211_bss_update(struct cfg80211_registered_device *rdev,
1818
1818
bool signal_valid , unsigned long ts )
1819
1819
{
1820
1820
struct cfg80211_internal_bss * found = NULL ;
1821
+ struct cfg80211_bss_ies * ies ;
1821
1822
1822
1823
if (WARN_ON (!tmp -> pub .channel ))
1823
- return NULL ;
1824
+ goto free_ies ;
1824
1825
1825
1826
tmp -> ts = ts ;
1826
1827
1827
- if (WARN_ON (!rcu_access_pointer (tmp -> pub .ies ))) {
1828
- return NULL ;
1829
- }
1828
+ if (WARN_ON (!rcu_access_pointer (tmp -> pub .ies )))
1829
+ goto free_ies ;
1830
1830
1831
1831
found = rb_find_bss (rdev , tmp , BSS_CMP_REGULAR );
1832
1832
@@ -1836,7 +1836,6 @@ __cfg80211_bss_update(struct cfg80211_registered_device *rdev,
1836
1836
} else {
1837
1837
struct cfg80211_internal_bss * new ;
1838
1838
struct cfg80211_internal_bss * hidden ;
1839
- struct cfg80211_bss_ies * ies ;
1840
1839
1841
1840
/*
1842
1841
* create a copy -- the "res" variable that is passed in
@@ -1845,15 +1844,8 @@ __cfg80211_bss_update(struct cfg80211_registered_device *rdev,
1845
1844
*/
1846
1845
new = kzalloc (sizeof (* new ) + rdev -> wiphy .bss_priv_size ,
1847
1846
GFP_ATOMIC );
1848
- if (!new ) {
1849
- ies = (void * )rcu_dereference (tmp -> pub .beacon_ies );
1850
- if (ies )
1851
- kfree_rcu (ies , rcu_head );
1852
- ies = (void * )rcu_dereference (tmp -> pub .proberesp_ies );
1853
- if (ies )
1854
- kfree_rcu (ies , rcu_head );
1855
- return NULL ;
1856
- }
1847
+ if (!new )
1848
+ goto free_ies ;
1857
1849
memcpy (new , tmp , sizeof (* new ));
1858
1850
new -> refcount = 1 ;
1859
1851
INIT_LIST_HEAD (& new -> hidden_list );
@@ -1913,6 +1905,16 @@ __cfg80211_bss_update(struct cfg80211_registered_device *rdev,
1913
1905
bss_ref_get (rdev , found );
1914
1906
1915
1907
return found ;
1908
+
1909
+ free_ies :
1910
+ ies = (void * )rcu_dereference (tmp -> pub .beacon_ies );
1911
+ if (ies )
1912
+ kfree_rcu (ies , rcu_head );
1913
+ ies = (void * )rcu_dereference (tmp -> pub .proberesp_ies );
1914
+ if (ies )
1915
+ kfree_rcu (ies , rcu_head );
1916
+
1917
+ return NULL ;
1916
1918
}
1917
1919
1918
1920
struct cfg80211_internal_bss *
0 commit comments