Return-path: Received: from mail-pa0-f47.google.com ([209.85.220.47]:49431 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933143AbaDIQdZ (ORCPT ); Wed, 9 Apr 2014 12:33:25 -0400 Received: by mail-pa0-f47.google.com with SMTP id lj1so2727213pab.34 for ; Wed, 09 Apr 2014 09:33:25 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <1393376982-28276-1-git-send-email-mcgrof@do-not-panic.com> <1393376982-28276-3-git-send-email-mcgrof@do-not-panic.com> <1393852248.10039.5.camel@jlt4.sipsolutions.net> From: Arik Nemtsov Date: Wed, 9 Apr 2014 19:33:09 +0300 Message-ID: (sfid-20140409_183329_636759_5C0F6292) Subject: Re: [PATCH 2/3] cfg80211: fix processing world regdomain when non modular To: Colleen T Cc: "Luis R. Rodriguez" , Janusz Dziedzic , Johannes Berg , linux-wireless , Sander Eikelenboom Content-Type: multipart/mixed; boundary=001a1134ab3cdc444604f69ea802 Sender: linux-wireless-owner@vger.kernel.org List-ID: --001a1134ab3cdc444604f69ea802 Content-Type: text/plain; charset=ISO-8859-1 Hey Collen, Luis, On Sun, Mar 16, 2014 at 9:04 PM, Colleen T wrote: > On Sat, Mar 15, 2014 at 9:42 PM, Luis R. Rodriguez > wrote: >> On Sat, Mar 15, 2014 at 8:59 AM, Janusz Dziedzic >> wrote: >>> 2014-03-15 2:03 GMT+01:00 Luis R. Rodriguez : >>>> On Fri, Mar 14, 2014 at 3:12 PM, Colleen T wrote: >>>>> I'm on mac80211-next/master, sha is >>>>> 5a970df8990d173e7e4092952f2e3da1de69b27d >>>> >>>> I tried to reproduce by just merging the fixes in question onto Linus' >>>> tree and using radios=3 but no go. Can you provide the full kernel >>>> log, I'm particularly interested in what happened before. The >>>> COUNTRY=US on debian, which I believe you're on, should just trigger a >>>> regulatory domain setting to US upon initialization. Depending on how >>>> Debian does it this could either trigger as a module parameter or as a >>>> userspace event *after* the world regdom get set. > > I'm attaching a full kernel log that shows the warning being > triggered. You are correct, I'm on debian. In the attached case I > ran: > $ modprobe mac80211_hwsim radios=4 > I pulled the fixes onto Linus' tree and I end up with the same result. > Seems I might have found the culprit - reg_todo is called while the request to CRDA is in flight and the patch in question causes the already-in-process user-request to be handled again. Since it's the same regdomain as the last request (it's the last request itself), we get this: treatment = __reg_process_hint_user(user_request); if (treatment == REG_REQ_IGNORE || treatment == REG_REQ_ALREADY_SET) { kfree(user_request); <------ return treatment; } Can you try adding the attached patch? It just replaced relevant kfree-s with a function that avoids freeing the last request. Also, in the current scheme of things, CRDA might be called twice for the same request in some corner cases, but that's not a problem, since reg_is_valid_request() will block the second set_regdom(). Regards, Arik --001a1134ab3cdc444604f69ea802 Content-Type: text/x-patch; charset=US-ASCII; name="0001-cfg80211-avoid-freeing-last_request-while-in-flight.patch" Content-Disposition: attachment; filename="0001-cfg80211-avoid-freeing-last_request-while-in-flight.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_htsu3mjc1 RnJvbSBjMDVjNGU1ZWVmYzU2YTFkZDFkNzRkNzMyNmE1OTlkZWI0NGM2ODQ0IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBBcmlrIE5lbXRzb3YgPGFyaWtAd2l6ZXJ5LmNvbT4KRGF0ZTog V2VkLCA5IEFwciAyMDE0IDE5OjI0OjE2ICswMzAwClN1YmplY3Q6IFtQQVRDSF0gY2ZnODAyMTE6 IGF2b2lkIGZyZWVpbmcgbGFzdF9yZXF1ZXN0IHdoaWxlIGluIGZsaWdodAoKQXZvaWQgZnJlZWlu ZyB0aGUgbGFzdCByZXF1ZXN0IHdoaWxlIGl0IGlzIGJlaW5nIHByb2Nlc3NlZC4gVGhpcyBjYW4K aGFwcGVuIGluIHNvbWUgY2FzZXMgaWYgcmVnX3dvcmsgaXMga2lja2VkIGZvciBzb21lIHJlYXNv biB3aGlsZSB0aGUKY3VycmVudGx5IHBlbmRpbmcgcmVxdWVzdCBpcyBpbiBmbGlnaHQ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