Return-path: Received: from wf-out-1314.google.com ([209.85.200.172]:48800 "EHLO wf-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752153AbYJVH6k (ORCPT ); Wed, 22 Oct 2008 03:58:40 -0400 Received: by wf-out-1314.google.com with SMTP id 27so2904920wfd.4 for ; Wed, 22 Oct 2008 00:58:39 -0700 (PDT) Message-ID: (sfid-20081022_095844_498526_CF04C702) Date: Wed, 22 Oct 2008 09:58:39 +0200 From: "Rami Rosen" To: linville@tuxdriver.com, linux-wireless@vger.kernel.org Subject: [PATCH ] mac80211: [RESEND] check return value of dev_alloc_skb() in ieee80211_sta_join_ibss(). Cc: "Johannes Berg" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_23821_29395313.1224662319878" Sender: linux-wireless-owner@vger.kernel.org List-ID: ------=_Part_23821_29395313.1224662319878 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline This patch add a check on the return value of dev_alloc_skb() in ieee80211_sta_join_ibss() in net/mac80211/mlme.c. The patch is to wireless-next-2.6. Signed-off-by: Rami Rosen ------=_Part_23821_29395313.1224662319878 Content-Type: text/plain; name=patch.txt Content-Transfer-Encoding: base64 X-Attachment-Id: f_fmlo9gnp0 Content-Disposition: attachment; filename=patch.txt ZGlmZiAtLWdpdCBhL25ldC9tYWM4MDIxMS9tbG1lLmMgYi9uZXQvbWFjODAyMTEvbWxtZS5jCmlu ZGV4IDQ5Zjg2ZmEuLmM2MTEzNGMgMTAwNjQ0Ci0tLSBhL25ldC9tYWM4MDIxMS9tbG1lLmMKKysr IGIvbmV0L21hYzgwMjExL21sbWUuYwpAQCAtMTM4OCw2ICsxMzg4LDEzIEBAIHN0YXRpYyBpbnQg aWVlZTgwMjExX3N0YV9qb2luX2lic3Moc3RydWN0IGllZWU4MDIxMV9zdWJfaWZfZGF0YSAqc2Rh dGEsCiAJc3RydWN0IGllZWU4MDIxMV9zdXBwb3J0ZWRfYmF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