diff mbox series

nl80211: Fix reading NL80211_ATTR_MLO_LINK_ID in nl80211_pre_doit

Message ID 1657517683-5724-1-git-send-email-quic_vjakkam@quicinc.com (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show
Series nl80211: Fix reading NL80211_ATTR_MLO_LINK_ID in nl80211_pre_doit | expand

Commit Message

Veerendranath Jakkam July 11, 2022, 5:34 a.m. UTC
nl80211_pre_doit() using nla_get_u16() to read u8 attribute
NL80211_ATTR_MLO_LINK_ID. Fix this by using nla_get_u8() to
read NL80211_ATTR_MLO_LINK_ID attribute.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
---
 net/wireless/nl80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jeff Johnson July 11, 2022, 3:59 p.m. UTC | #1
On 7/10/2022 10:34 PM, Veerendranath Jakkam wrote:
> nl80211_pre_doit() using nla_get_u16() to read u8 attribute

I would be more explicit and say:
nl80211_pre_doit() is incorrectly using ...

> NL80211_ATTR_MLO_LINK_ID. Fix this by using nla_get_u8() to
> read NL80211_ATTR_MLO_LINK_ID attribute.
> 
> Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
> ---
>   net/wireless/nl80211.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index eda2ad0..e20d0fc 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -15835,7 +15835,7 @@ static int nl80211_pre_doit(const struct genl_ops *ops, struct sk_buff *skb,
>   		/* MLO -> require valid link ID */
>   		if (wdev->valid_links &&
>   		    (!link_id ||
> -		     !(wdev->valid_links & BIT(nla_get_u16(link_id))))) {
> +		     !(wdev->valid_links & BIT(nla_get_u8(link_id))))) {
>   			err = -EINVAL;
>   			goto out_unlock;
>   		}
Jeff Johnson July 12, 2022, 12:56 a.m. UTC | #2
On 7/11/2022 8:59 AM, Jeff Johnson wrote:
> On 7/10/2022 10:34 PM, Veerendranath Jakkam wrote:
>> nl80211_pre_doit() using nla_get_u16() to read u8 attribute
> 
> I would be more explicit and say:
> nl80211_pre_doit() is incorrectly using ...

but I see this is already in wireless-next so nevermind :)
diff mbox series

Patch

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index eda2ad0..e20d0fc 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -15835,7 +15835,7 @@  static int nl80211_pre_doit(const struct genl_ops *ops, struct sk_buff *skb,
 		/* MLO -> require valid link ID */
 		if (wdev->valid_links &&
 		    (!link_id ||
-		     !(wdev->valid_links & BIT(nla_get_u16(link_id))))) {
+		     !(wdev->valid_links & BIT(nla_get_u8(link_id))))) {
 			err = -EINVAL;
 			goto out_unlock;
 		}