* [PATCH RESEND] wifi: iwlwifi: mvm: fix an error code in iwl_mvm_alloc_sta_after_restart()
@ 2024-08-02 4:27 Ma Ke
2024-08-02 5:09 ` Dan Carpenter
0 siblings, 1 reply; 7+ messages in thread
From: Ma Ke @ 2024-08-02 4:27 UTC (permalink / raw)
To: miriam.rachel.korenblit, kvalo, johannes.berg, gregory.greenman,
benjamin.berg, daniel.gabay, make24, dan.carpenter
Cc: linux-wireless, linux-kernel
This error path should return -EINVAL instead of success.
Fixes: 57974a55d995 ("wifi: iwlwifi: mvm: refactor iwl_mvm_mac_sta_state_common()")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
---
drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
index d5a204e52076..477239a1ed83 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
@@ -644,12 +644,12 @@ static int iwl_mvm_alloc_sta_after_restart(struct iwl_mvm *mvm,
lockdep_is_held(&mvm->mutex));
if (!link_conf)
- continue;
+ return -EINVAL;
mvm_link = mvmvif->link[link_conf->link_id];
if (!mvm_link || !mvm_link_sta)
- continue;
+ return -EINVAL;
sta_id = mvm_link_sta->sta_id;
ret = iwl_mvm_mld_cfg_sta(mvm, sta, vif, link_sta,
--
2.25.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH RESEND] wifi: iwlwifi: mvm: fix an error code in iwl_mvm_alloc_sta_after_restart() 2024-08-02 4:27 [PATCH RESEND] wifi: iwlwifi: mvm: fix an error code in iwl_mvm_alloc_sta_after_restart() Ma Ke @ 2024-08-02 5:09 ` Dan Carpenter 2024-08-23 3:04 ` Ma Ke 0 siblings, 1 reply; 7+ messages in thread From: Dan Carpenter @ 2024-08-02 5:09 UTC (permalink / raw) To: Ma Ke Cc: miriam.rachel.korenblit, kvalo, johannes.berg, gregory.greenman, benjamin.berg, daniel.gabay, linux-wireless, linux-kernel The Subject says RESEND but doesn't explain why you are resending. You probably meant v2, but again it needs an explanation. On Fri, Aug 02, 2024 at 12:27:40PM +0800, Ma Ke wrote: > This error path should return -EINVAL instead of success. Why do you feel that way? Have you tested it? What is the user visible effect of this bug? I slightly feel hypocritical because I have send lots of commit messages with exactly this commit message. The difference is that I only send really easy patches where it's obvious what the intent was. A normal kernel developer wouldn't need to leave their email client or view any outside information to see that my patch is correct. If a patch is not dead easy, I normally just report it. (Sometimes I report dead easy bugs as well because I am lazy and maybe it's the end of my work day or whatever). This patch on the other hand is more subtle and it's not clear why the continue statements changed into returns. regards, dan carpenter ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RESEND] wifi: iwlwifi: mvm: fix an error code in iwl_mvm_alloc_sta_after_restart() 2024-08-02 5:09 ` Dan Carpenter @ 2024-08-23 3:04 ` Ma Ke 2024-08-23 5:56 ` Kalle Valo 2024-08-23 9:03 ` Dan Carpenter 0 siblings, 2 replies; 7+ messages in thread From: Ma Ke @ 2024-08-23 3:04 UTC (permalink / raw) To: dan.carpenter Cc: benjamin.berg, daniel.gabay, gregory.greenman, johannes.berg, kvalo, linux-kernel, linux-wireless, make24, miriam.rachel.korenblit [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 1764 bytes --] Dan Carpenter<dan.carpenter@linaro.org> wrote: > The Subject says RESEND but doesn't explain why you are resending. > You probably meant v2, but again it needs an explanation. > > On Fri, Aug 02, 2024 at 12:27:40PM +0800, Ma Ke wrote: > > This error path should return -EINVAL instead of success. > > Why do you feel that way? Have you tested it? What is the user visible > effect of this bug? > > I slightly feel hypocritical because I have send lots of commit messages > with exactly this commit message. The difference is that I only send > really easy patches where it's obvious what the intent was. A normal > kernel developer wouldn't need to leave their email client or view any > outside information to see that my patch is correct. If a patch is not > dead easy, I normally just report it. (Sometimes I report dead easy > bugs as well because I am lazy and maybe it's the end of my work day > or whatever). > > This patch on the other hand is more subtle and it's not clear why the > continue statements changed into returns. > > regards, > dan carpenter Thank you for your response to the vulnerability I submitted. Yes, we believe there is a similar issue. As described in [1], it gets pointers which are handled under the protection mechanism. If the path is error, it should return -EINVAL directly instead of success. The discovery of this problem was confirmed through manual review of the code and compilation testing. And by the way, I resent the patch because I hadn’t received a reply for a long time, so I resent it. [1] https://lore.kernel.org/all/MW5PR11MB58102E1897D7437CD8E1DF27A3DDA@MW5PR11MB5810.namprd11.prod.outlook.com/ -- Regards, Ma Ke ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RESEND] wifi: iwlwifi: mvm: fix an error code in iwl_mvm_alloc_sta_after_restart() 2024-08-23 3:04 ` Ma Ke @ 2024-08-23 5:56 ` Kalle Valo 2024-08-23 9:03 ` Dan Carpenter 1 sibling, 0 replies; 7+ messages in thread From: Kalle Valo @ 2024-08-23 5:56 UTC (permalink / raw) To: Ma Ke Cc: dan.carpenter, benjamin.berg, daniel.gabay, gregory.greenman, johannes.berg, linux-kernel, linux-wireless, miriam.rachel.korenblit Ma Ke <make24@iscas.ac.cn> writes: > Dan Carpenter<dan.carpenter@linaro.org> wrote:. >> The Subject says RESEND but doesn't explain why you are resending.. >> You probably meant v2, but again it needs an explanation.. >> . >> On Fri, Aug 02, 2024 at 12:27:40PM +0800, Ma Ke wrote:. >> > This error path should return -EINVAL instead of success.. >> . >> Why do you feel that way? Have you tested it? What is the user visible. >> effect of this bug?. >> . >> I slightly feel hypocritical because I have send lots of commit messages. >> with exactly this commit message. The difference is that I only send. >> really easy patches where it's obvious what the intent was. A normal. >> kernel developer wouldn't need to leave their email client or view any. >> outside information to see that my patch is correct. If a patch is not. >> dead easy, I normally just report it. (Sometimes I report dead easy. >> bugs as well because I am lazy and maybe it's the end of my work day. >> or whatever).. >> . >> This patch on the other hand is more subtle and it's not clear why the. >> continue statements changed into returns.. >> . >> regards,. >> dan carpenter. > Thank you for your response to the vulnerability I submitted. Yes, we . > believe there is a similar issue. As described in [1], it gets pointers . > which are handled under the protection mechanism. If the path is error, it . > should return -EINVAL directly instead of success. The commit message should explain _why_ it should return an error. Currently there's no explanation neither in the commit message or in your email. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches https://docs.kernel.org/process/submitting-patches.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RESEND] wifi: iwlwifi: mvm: fix an error code in iwl_mvm_alloc_sta_after_restart() 2024-08-23 3:04 ` Ma Ke 2024-08-23 5:56 ` Kalle Valo @ 2024-08-23 9:03 ` Dan Carpenter 2024-08-23 9:14 ` Dan Carpenter 2024-08-23 9:29 ` Berg, Benjamin 1 sibling, 2 replies; 7+ messages in thread From: Dan Carpenter @ 2024-08-23 9:03 UTC (permalink / raw) To: Ma Ke Cc: benjamin.berg, daniel.gabay, gregory.greenman, johannes.berg, kvalo, linux-kernel, linux-wireless, miriam.rachel.korenblit On Fri, Aug 23, 2024 at 11:04:23AM +0800, Ma Ke wrote: > Dan Carpenter<dan.carpenter@linaro.org> wrote: > > The Subject says RESEND but doesn't explain why you are resending. > > You probably meant v2, but again it needs an explanation. > > > > On Fri, Aug 02, 2024 at 12:27:40PM +0800, Ma Ke wrote: > > > This error path should return -EINVAL instead of success. > > > > Why do you feel that way? Have you tested it? What is the user visible > > effect of this bug? > > > > I slightly feel hypocritical because I have send lots of commit messages > > with exactly this commit message. The difference is that I only send > > really easy patches where it's obvious what the intent was. A normal > > kernel developer wouldn't need to leave their email client or view any > > outside information to see that my patch is correct. If a patch is not > > dead easy, I normally just report it. (Sometimes I report dead easy > > bugs as well because I am lazy and maybe it's the end of my work day > > or whatever). > > > > This patch on the other hand is more subtle and it's not clear why the > > continue statements changed into returns. > > > > regards, > > dan carpenter > Thank you for your response to the vulnerability I submitted. Yes, we > believe there is a similar issue. As described in [1], it gets pointers > which are handled under the protection mechanism. If the path is error, it > should return -EINVAL directly instead of success. The discovery of this > problem was confirmed through manual review of the code and compilation > testing. And by the way, I resent the patch because I hadn’t received a > reply for a long time, so I resent it. > > [1] https://lore.kernel.org/all/MW5PR11MB58102E1897D7437CD8E1DF27A3DDA@MW5PR11MB5810.namprd11.prod.outlook.com/ > Oh, huh. If I understand it correctly, you're copying the logic from my patch. 71b5e40651d8 ("wifi: iwlwifi: mvm: fix an error code in iwl_mvm_mld_add_sta()") That was a different situation: 1) The code was already doing a return instead of a continue, it's just that the error code wasn't set. 2) I mentioned in my email that I wasn't sure of the logic, but just copy and pasting from similar code. 3) Plus my code is on a WARN_ON() path so it's almost certainly dead code. That means my patch was very safe. Meanwhile Gregory's code looks deliberate. If it's causing an issue at runtime definitely we need to fix that. Or if we can find a bug in it then sure. But don't assume my code is better than his, because it's likely not the case. regards, dan carpenter ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RESEND] wifi: iwlwifi: mvm: fix an error code in iwl_mvm_alloc_sta_after_restart() 2024-08-23 9:03 ` Dan Carpenter @ 2024-08-23 9:14 ` Dan Carpenter 2024-08-23 9:29 ` Berg, Benjamin 1 sibling, 0 replies; 7+ messages in thread From: Dan Carpenter @ 2024-08-23 9:14 UTC (permalink / raw) To: Ma Ke Cc: benjamin.berg, daniel.gabay, johannes.berg, kvalo, linux-kernel, linux-wireless, miriam.rachel.korenblit It would have been nice to know what Gregory's thoughts were about this code but he left Intel in Jan. regards, dan carpenter ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RESEND] wifi: iwlwifi: mvm: fix an error code in iwl_mvm_alloc_sta_after_restart() 2024-08-23 9:03 ` Dan Carpenter 2024-08-23 9:14 ` Dan Carpenter @ 2024-08-23 9:29 ` Berg, Benjamin 1 sibling, 0 replies; 7+ messages in thread From: Berg, Benjamin @ 2024-08-23 9:29 UTC (permalink / raw) To: make24@iscas.ac.cn, dan.carpenter@linaro.org Cc: Gabay, Daniel, kvalo@kernel.org, gregory.greenman@intel.com, Berg, Johannes, linux-kernel@vger.kernel.org, Korenblit, Miriam Rachel, linux-wireless@vger.kernel.org On Fri, 2024-08-23 at 12:03 +0300, Dan Carpenter wrote: > On Fri, Aug 23, 2024 at 11:04:23AM +0800, Ma Ke wrote: > > Dan Carpenter<dan.carpenter@linaro.org> wrote: > > > The Subject says RESEND but doesn't explain why you are resending. > > > You probably meant v2, but again it needs an explanation. > > > > > > On Fri, Aug 02, 2024 at 12:27:40PM +0800, Ma Ke wrote: > > > > This error path should return -EINVAL instead of success. > > > > > > Why do you feel that way? Have you tested it? What is the user visible > > > effect of this bug? > > > > > > I slightly feel hypocritical because I have send lots of commit messages > > > with exactly this commit message. The difference is that I only send > > > really easy patches where it's obvious what the intent was. A normal > > > kernel developer wouldn't need to leave their email client or view any > > > outside information to see that my patch is correct. If a patch is not > > > dead easy, I normally just report it. (Sometimes I report dead easy > > > bugs as well because I am lazy and maybe it's the end of my work day > > > or whatever). > > > > > > This patch on the other hand is more subtle and it's not clear why the > > > continue statements changed into returns. > > > > > > regards, > > > dan carpenter > > Thank you for your response to the vulnerability I submitted. Yes, we > > believe there is a similar issue. As described in [1], it gets pointers > > which are handled under the protection mechanism. If the path is error, it > > should return -EINVAL directly instead of success. The discovery of this > > problem was confirmed through manual review of the code and compilation > > testing. And by the way, I resent the patch because I hadn’t received a > > reply for a long time, so I resent it. > > > > [1] https://lore.kernel.org/all/MW5PR11MB58102E1897D7437CD8E1DF27A3DDA@MW5PR11MB5810.namprd11.prod.outlook.com/ > > > > Oh, huh. If I understand it correctly, you're copying the logic from my patch. > > 71b5e40651d8 ("wifi: iwlwifi: mvm: fix an error code in iwl_mvm_mld_add_sta()") > > That was a different situation: > 1) The code was already doing a return instead of a continue, it's just that > the error code wasn't set. > 2) I mentioned in my email that I wasn't sure of the logic, but just copy and > pasting from similar code. > 3) Plus my code is on a WARN_ON() path so it's almost certainly dead code. That > means my patch was very safe. > > Meanwhile Gregory's code looks deliberate. If it's causing an issue at runtime > definitely we need to fix that. Or if we can find a bug in it then sure. But > don't assume my code is better than his, because it's likely not the case. I think the code is correct as-is. Especially as this function is in the recovery flow after an error, and, if I remember correctly, the driver state may be somewhat inconsistent with mac80211 here. An argument about the (in)correctness of this code should consider both how mac80211 handles restarts and what state the driver might be in after a firmware assert at an inopportune moment. Benjamin Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-08-23 9:29 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-08-02 4:27 [PATCH RESEND] wifi: iwlwifi: mvm: fix an error code in iwl_mvm_alloc_sta_after_restart() Ma Ke 2024-08-02 5:09 ` Dan Carpenter 2024-08-23 3:04 ` Ma Ke 2024-08-23 5:56 ` Kalle Valo 2024-08-23 9:03 ` Dan Carpenter 2024-08-23 9:14 ` Dan Carpenter 2024-08-23 9:29 ` Berg, Benjamin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).