mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-27 12:32:50 +00:00
mac80211: Free mpath object when rhashtable insertion fails
commit 4ff3a9d14c upstream.
When rhashtable insertion fails the mesh table code doesn't free
the now-orphan mesh path object. This patch fixes that.
Cc: stable@vger.kernel.org
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5f9d7b24e6
commit
62bb080fa3
@@ -448,17 +448,15 @@ struct mesh_path *mesh_path_add(struct ieee80211_sub_if_data *sdata,
|
||||
|
||||
} while (unlikely(ret == -EEXIST && !mpath));
|
||||
|
||||
if (ret && ret != -EEXIST)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
/* At this point either new_mpath was added, or we found a
|
||||
* matching entry already in the table; in the latter case
|
||||
* free the unnecessary new entry.
|
||||
*/
|
||||
if (ret == -EEXIST) {
|
||||
if (ret) {
|
||||
kfree(new_mpath);
|
||||
|
||||
if (ret != -EEXIST)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
new_mpath = mpath;
|
||||
}
|
||||
|
||||
sdata->u.mesh.mesh_paths_generation++;
|
||||
return new_mpath;
|
||||
}
|
||||
@@ -488,6 +486,9 @@ int mpp_path_add(struct ieee80211_sub_if_data *sdata,
|
||||
&new_mpath->rhash,
|
||||
mesh_rht_params);
|
||||
|
||||
if (ret)
|
||||
kfree(new_mpath);
|
||||
|
||||
sdata->u.mesh.mpp_paths_generation++;
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user