Message ID | 20240701-wilc_fix_ies_data-v1-1-7486cbacf98a@bootlin.com |
---|---|
State | New |
Headers | show |
Series | [wireless] wifi: wilc1000: fix ies_len type in connect path | expand |
On 7/1/24 09:23, Alexis Lothoré wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > From: Jozef Hopko <jozef.hopko@altana.com> > > Commit 205c50306acf ("wifi: wilc1000: fix RCU usage in connect path") > made sure that the IEs data was manipulated under the relevant RCU section. > Unfortunately, while doing so, the commit brought a faulty implicit cast > from int to u8 on the ies_len variable, making the parsing fail to be > performed correctly if the IEs block is larger than 255 bytes. This failure > can be observed with Access Points appending a lot of IEs TLVs in their > beacon frames (reproduced with a Pixel phone acting as an Access Point, > which brough 273 bytes of IE data in my testing environment). > > Fix IEs parsing by removing this undesired implicit cast. > > Fixes: 205c50306acf ("wifi: wilc1000: fix RCU usage in connect path") > Signed-off-by: Jozef Hopko <jozef.hopko@altana.com> > Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Thanks Jozef Hopko & Alexis. Acked-by: Ajay Singh <ajay.kathat@microchip.com> > --- > The issue has been initially detected by Jozef Hopko, and the resulting > patch is also from him. He asked me to upstream it on his behalf. I have > successfuly reproduced the same issue and confirmed that the patch indeed > fixes the connection to the AP I used. The only update I did is about > adding details about the issue in commit message and fixing whitespaces. > The issue has been disclosed to me directly through private mail, so I have > no relevant Reported-By/Closes tag to provide. I am not sure however why I > do not manage to make sparse detect this faulty cast. > --- > drivers/net/wireless/microchip/wilc1000/hif.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/microchip/wilc1000/hif.c b/drivers/net/wireless/microchip/wilc1000/hif.c > index d67293142ffb..3c48e1a57b24 100644 > --- a/drivers/net/wireless/microchip/wilc1000/hif.c > +++ b/drivers/net/wireless/microchip/wilc1000/hif.c > @@ -382,7 +382,8 @@ wilc_parse_join_bss_param(struct cfg80211_bss *bss, > struct ieee80211_p2p_noa_attr noa_attr; > const struct cfg80211_bss_ies *ies; > struct wilc_join_bss_param *param; > - u8 rates_len = 0, ies_len; > + u8 rates_len = 0; > + int ies_len; > int ret; > > param = kzalloc(sizeof(*param), GFP_KERNEL); > > --- > base-commit: 21cfb73516c112f0cf0d3ebd3e4bdfbadc819576 > change-id: 20240701-wilc_fix_ies_data-22226322ee7c > > Best regards, > -- > Alexis Lothoré, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com >
Alexis Lothoré <alexis.lothore@bootlin.com> wrote: > From: Jozef Hopko <jozef.hopko@altana.com> > > Commit 205c50306acf ("wifi: wilc1000: fix RCU usage in connect path") > made sure that the IEs data was manipulated under the relevant RCU section. > Unfortunately, while doing so, the commit brought a faulty implicit cast > from int to u8 on the ies_len variable, making the parsing fail to be > performed correctly if the IEs block is larger than 255 bytes. This failure > can be observed with Access Points appending a lot of IEs TLVs in their > beacon frames (reproduced with a Pixel phone acting as an Access Point, > which brough 273 bytes of IE data in my testing environment). > > Fix IEs parsing by removing this undesired implicit cast. > > Fixes: 205c50306acf ("wifi: wilc1000: fix RCU usage in connect path") > Signed-off-by: Jozef Hopko <jozef.hopko@altana.com> > Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> > Acked-by: Ajay Singh <ajay.kathat@microchip.com> Patch applied to wireless.git, thanks. 39ab8fff6230 wifi: wilc1000: fix ies_len type in connect path
diff --git a/drivers/net/wireless/microchip/wilc1000/hif.c b/drivers/net/wireless/microchip/wilc1000/hif.c index d67293142ffb..3c48e1a57b24 100644 --- a/drivers/net/wireless/microchip/wilc1000/hif.c +++ b/drivers/net/wireless/microchip/wilc1000/hif.c @@ -382,7 +382,8 @@ wilc_parse_join_bss_param(struct cfg80211_bss *bss, struct ieee80211_p2p_noa_attr noa_attr; const struct cfg80211_bss_ies *ies; struct wilc_join_bss_param *param; - u8 rates_len = 0, ies_len; + u8 rates_len = 0; + int ies_len; int ret; param = kzalloc(sizeof(*param), GFP_KERNEL);