]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: cqm: check nlmsg_alloc() return
authorAmit Khatri <amit.khatri@samsung.com>
Thu, 13 Aug 2015 10:20:48 +0000 (10:20 +0000)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 13 Aug 2015 13:16:31 +0000 (15:16 +0200)
If nlmsg_alloc() fails, don't crash but return an error.

Signed-off-by: Amit Khatri <amit.khatri@samsung.com>
Signed-off-by: Rahul Jain <rahul.jain@samsung.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
cqm.c

diff --git a/cqm.c b/cqm.c
index dddd36e8689c2eaf55a18cbc41a816c15aeea58e..093b744baba501c3bba645720eca1a826462d4b9 100644 (file)
--- a/cqm.c
+++ b/cqm.c
@@ -34,6 +34,8 @@ static int iw_cqm_rssi(struct nl80211_state *state,
 
        /* connection quality monitor attributes */
        cqm = nlmsg_alloc();
+       if (!cqm)
+               return -ENOMEM;
 
        NLA_PUT_U32(cqm, NL80211_ATTR_CQM_RSSI_THOLD, thold);
        NLA_PUT_U32(cqm, NL80211_ATTR_CQM_RSSI_HYST, hyst);