Patch "net: ieee802154: handle iftypes as u32" has been added to the 4.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: ieee802154: handle iftypes as u32

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-ieee802154-handle-iftypes-as-u32.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7957205ab19528d4496d9298c477bfda2a4ab42b
Author: Alexander Aring <aahringo@xxxxxxxxxx>
Date:   Thu Nov 11 22:09:16 2021 -0500

    net: ieee802154: handle iftypes as u32
    
    [ Upstream commit 451dc48c806a7ce9fbec5e7a24ccf4b2c936e834 ]
    
    This patch fixes an issue that an u32 netlink value is handled as a
    signed enum value which doesn't fit into the range of u32 netlink type.
    If it's handled as -1 value some BIT() evaluation ends in a
    shift-out-of-bounds issue. To solve the issue we set the to u32 max which
    is s32 "-1" value to keep backwards compatibility and let the followed enum
    values start counting at 0. This brings the compiler to never handle the
    enum as signed and a check if the value is above NL802154_IFTYPE_MAX should
    filter -1 out.
    
    Fixes: f3ea5e44231a ("ieee802154: add new interface command")
    Signed-off-by: Alexander Aring <aahringo@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20211112030916.685793-1-aahringo@xxxxxxxxxx
    Signed-off-by: Stefan Schmidt <stefan@xxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/net/nl802154.h b/include/net/nl802154.h
index 32cb3e591e07b..53f140fc1983c 100644
--- a/include/net/nl802154.h
+++ b/include/net/nl802154.h
@@ -19,6 +19,8 @@
  *
  */
 
+#include <linux/types.h>
+
 #define NL802154_GENL_NAME "nl802154"
 
 enum nl802154_commands {
@@ -143,10 +145,9 @@ enum nl802154_attrs {
 };
 
 enum nl802154_iftype {
-	/* for backwards compatibility TODO */
-	NL802154_IFTYPE_UNSPEC = -1,
+	NL802154_IFTYPE_UNSPEC = (~(__u32)0),
 
-	NL802154_IFTYPE_NODE,
+	NL802154_IFTYPE_NODE = 0,
 	NL802154_IFTYPE_MONITOR,
 	NL802154_IFTYPE_COORD,
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux