]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.15
authorSasha Levin <sashal@kernel.org>
Mon, 1 Jan 2024 18:11:05 +0000 (13:11 -0500)
committerSasha Levin <sashal@kernel.org>
Mon, 1 Jan 2024 18:11:05 +0000 (13:11 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
21 files changed:
queue-5.15/arm-dts-fix-occasional-boot-hang-for-am3-usb.patch [new file with mode: 0644]
queue-5.15/bluetooth-af_bluetooth-fix-use-after-free-in-bt_sock.patch [new file with mode: 0644]
queue-5.15/device-property-add-const-qualifier-to-device_get_ma.patch [new file with mode: 0644]
queue-5.15/ethernet-constify-references-to-netdev-dev_addr-in-d.patch [new file with mode: 0644]
queue-5.15/iio-imu-adis16475-add-spi_device_id-table.patch [new file with mode: 0644]
queue-5.15/ksmbd-avoid-duplicate-opinfo_put-call-on-error-of-sm.patch [new file with mode: 0644]
queue-5.15/ksmbd-downgrade-rwh-lease-caching-state-to-rh-for-di.patch [new file with mode: 0644]
queue-5.15/ksmbd-fix-wrong-allocation-size-update-in-smb2_open.patch [new file with mode: 0644]
queue-5.15/ksmbd-have-a-dependency-on-cifs-arc4.patch [new file with mode: 0644]
queue-5.15/ksmbd-lazy-v2-lease-break-on-smb2_write.patch [new file with mode: 0644]
queue-5.15/ksmbd-send-v2-lease-break-notification-for-directory.patch [new file with mode: 0644]
queue-5.15/ksmbd-set-epoch-in-create-context-v2-lease.patch [new file with mode: 0644]
queue-5.15/ksmbd-set-v2-lease-capability.patch [new file with mode: 0644]
queue-5.15/net-usb-ax88179_178a-avoid-failed-operations-when-de.patch [new file with mode: 0644]
queue-5.15/net-usb-ax88179_178a-clean-up-pm-calls.patch [new file with mode: 0644]
queue-5.15/net-usb-ax88179_178a-wol-optimizations.patch [new file with mode: 0644]
queue-5.15/series
queue-5.15/smb-client-fix-oob-in-smb2_query_info_init.patch [new file with mode: 0644]
queue-5.15/smb-client-fix-oob-in-smbcalcsize.patch [new file with mode: 0644]
queue-5.15/spi-introduce-spi_get_device_match_data-helper.patch [new file with mode: 0644]
queue-5.15/usb-fotg210-hcd-delete-an-incorrect-bounds-test.patch [new file with mode: 0644]

diff --git a/queue-5.15/arm-dts-fix-occasional-boot-hang-for-am3-usb.patch b/queue-5.15/arm-dts-fix-occasional-boot-hang-for-am3-usb.patch
new file mode 100644 (file)
index 0000000..ebd90d3
--- /dev/null
@@ -0,0 +1,40 @@
+From 18350583d90236986d6d10187387e6808066b67e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 12 Dec 2023 15:50:35 +0200
+Subject: ARM: dts: Fix occasional boot hang for am3 usb
+
+From: Tony Lindgren <tony@atomide.com>
+
+[ Upstream commit 9b6a51aab5f5f9f71d2fa16e8b4d530e1643dfcb ]
+
+With subtle timings changes, we can now sometimes get an external abort on
+non-linefetch error booting am3 devices at sysc_reset(). This is because
+of a missing reset delay needed for the usb target module.
+
+Looks like we never enabled the delay earlier for am3, although a similar
+issue was seen earlier with a similar usb setup for dm814x as described in
+commit ebf244148092 ("ARM: OMAP2+: Use srst_udelay for USB on dm814x").
+
+Cc: stable@vger.kernel.org
+Fixes: 0782e8572ce4 ("ARM: dts: Probe am335x musb with ti-sysc")
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm/boot/dts/am33xx.dtsi | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
+index f53695ecbb782..7daf6ae2cd9af 100644
+--- a/arch/arm/boot/dts/am33xx.dtsi
++++ b/arch/arm/boot/dts/am33xx.dtsi
+@@ -349,6 +349,7 @@ usb: target-module@47400000 {
+                                       <SYSC_IDLE_NO>,
+                                       <SYSC_IDLE_SMART>,
+                                       <SYSC_IDLE_SMART_WKUP>;
++                      ti,sysc-delay-us = <2>;
+                       clocks = <&l3s_clkctrl AM3_L3S_USB_OTG_HS_CLKCTRL 0>;
+                       clock-names = "fck";
+                       #address-cells = <1>;
+-- 
+2.43.0
+
diff --git a/queue-5.15/bluetooth-af_bluetooth-fix-use-after-free-in-bt_sock.patch b/queue-5.15/bluetooth-af_bluetooth-fix-use-after-free-in-bt_sock.patch
new file mode 100644 (file)
index 0000000..732fbf6
--- /dev/null
@@ -0,0 +1,60 @@
+From 12ee089744e303f08f17798b5fb1d02a529fdd43 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 9 Dec 2023 05:55:18 -0500
+Subject: Bluetooth: af_bluetooth: Fix Use-After-Free in bt_sock_recvmsg
+
+From: Hyunwoo Kim <v4bel@theori.io>
+
+[ Upstream commit 2e07e8348ea454615e268222ae3fc240421be768 ]
+
+This can cause a race with bt_sock_ioctl() because
+bt_sock_recvmsg() gets the skb from sk->sk_receive_queue
+and then frees it without holding lock_sock.
+A use-after-free for a skb occurs with the following flow.
+```
+bt_sock_recvmsg() -> skb_recv_datagram() -> skb_free_datagram()
+bt_sock_ioctl() -> skb_peek()
+```
+Add lock_sock to bt_sock_recvmsg() to fix this issue.
+
+Cc: stable@vger.kernel.org
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Signed-off-by: Hyunwoo Kim <v4bel@theori.io>
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/bluetooth/af_bluetooth.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
+index ce744b14d1a98..b7498e890f0b0 100644
+--- a/net/bluetooth/af_bluetooth.c
++++ b/net/bluetooth/af_bluetooth.c
+@@ -263,11 +263,14 @@ int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
+       if (flags & MSG_OOB)
+               return -EOPNOTSUPP;
++      lock_sock(sk);
++
+       skb = skb_recv_datagram(sk, flags, noblock, &err);
+       if (!skb) {
+               if (sk->sk_shutdown & RCV_SHUTDOWN)
+-                      return 0;
++                      err = 0;
++              release_sock(sk);
+               return err;
+       }
+@@ -293,6 +296,8 @@ int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
+       skb_free_datagram(sk, skb);
++      release_sock(sk);
++
+       if (flags & MSG_TRUNC)
+               copied = skblen;
+-- 
+2.43.0
+
diff --git a/queue-5.15/device-property-add-const-qualifier-to-device_get_ma.patch b/queue-5.15/device-property-add-const-qualifier-to-device_get_ma.patch
new file mode 100644 (file)
index 0000000..a13f2ad
--- /dev/null
@@ -0,0 +1,74 @@
+From cc7fca5f73eb214a9b66f2a5b9f9500d9f2904e6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 22 Sep 2022 16:54:10 +0300
+Subject: device property: Add const qualifier to device_get_match_data()
+ parameter
+
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+[ Upstream commit aade55c86033bee868a93e4bf3843c9c99e84526 ]
+
+Add const qualifier to the device_get_match_data() parameter.
+Some of the future users may utilize this function without
+forcing the type.
+
+All the same, dev_fwnode() may be used with a const qualifier.
+
+Reported-by: kernel test robot <lkp@intel.com>
+Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Link: https://lore.kernel.org/r/20220922135410.49694-1-andriy.shevchenko@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/base/property.c  | 4 ++--
+ include/linux/property.h | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/base/property.c b/drivers/base/property.c
+index 17a648d643566..2ed844650328c 100644
+--- a/drivers/base/property.c
++++ b/drivers/base/property.c
+@@ -18,7 +18,7 @@
+ #include <linux/etherdevice.h>
+ #include <linux/phy.h>
+-struct fwnode_handle *dev_fwnode(struct device *dev)
++struct fwnode_handle *dev_fwnode(const struct device *dev)
+ {
+       return IS_ENABLED(CONFIG_OF) && dev->of_node ?
+               of_fwnode_handle(dev->of_node) : dev->fwnode;
+@@ -1281,7 +1281,7 @@ int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
+ }
+ EXPORT_SYMBOL(fwnode_graph_parse_endpoint);
+-const void *device_get_match_data(struct device *dev)
++const void *device_get_match_data(const struct device *dev)
+ {
+       return fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data, dev);
+ }
+diff --git a/include/linux/property.h b/include/linux/property.h
+index 357513a977e5d..1bd1e4ada7e3a 100644
+--- a/include/linux/property.h
++++ b/include/linux/property.h
+@@ -31,7 +31,7 @@ enum dev_dma_attr {
+       DEV_DMA_COHERENT,
+ };
+-struct fwnode_handle *dev_fwnode(struct device *dev);
++struct fwnode_handle *dev_fwnode(const struct device *dev);
+ bool device_property_present(struct device *dev, const char *propname);
+ int device_property_read_u8_array(struct device *dev, const char *propname,
+@@ -385,7 +385,7 @@ bool device_dma_supported(struct device *dev);
+ enum dev_dma_attr device_get_dma_attr(struct device *dev);
+-const void *device_get_match_data(struct device *dev);
++const void *device_get_match_data(const struct device *dev);
+ int device_get_phy_mode(struct device *dev);
+-- 
+2.43.0
+
diff --git a/queue-5.15/ethernet-constify-references-to-netdev-dev_addr-in-d.patch b/queue-5.15/ethernet-constify-references-to-netdev-dev_addr-in-d.patch
new file mode 100644 (file)
index 0000000..6516e8b
--- /dev/null
@@ -0,0 +1,2388 @@
+From c6a4e6d710f8d5ef8f9d453fcf3e464e53adf828 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 14 Oct 2021 07:24:31 -0700
+Subject: ethernet: constify references to netdev->dev_addr in drivers
+
+From: Jakub Kicinski <kuba@kernel.org>
+
+[ Upstream commit 766607570becbd26cab6d66a544dd8d0d964df5a ]
+
+This big patch sprinkles const on local variables and
+function arguments which may refer to netdev->dev_addr.
+
+Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
+of VLANs...") introduced a rbtree for faster Ethernet address look
+up. To maintain netdev->dev_addr in this tree we need to make all
+the writes to it got through appropriate helpers.
+
+Some of the changes here are not strictly required - const
+is sometimes cast off but pointer is not used for writing.
+It seems like it's still better to add the const in case
+the code changes later or relevant -W flags get enabled
+for the build.
+
+No functional changes.
+
+Link: https://lore.kernel.org/r/20211014142432.449314-1-kuba@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Stable-dep-of: aef05e349bfd ("net: usb: ax88179_178a: avoid failed operations when device is disconnected")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/actions/owl-emac.c              |  2 +-
+ drivers/net/ethernet/adaptec/starfire.c              | 10 +++++-----
+ drivers/net/ethernet/alacritech/slicoss.c            |  2 +-
+ drivers/net/ethernet/alteon/acenic.c                 |  4 ++--
+ drivers/net/ethernet/altera/altera_tse_main.c        |  2 +-
+ drivers/net/ethernet/amd/nmclan_cs.c                 |  3 ++-
+ drivers/net/ethernet/amd/xgbe/xgbe-dev.c             |  2 +-
+ drivers/net/ethernet/amd/xgbe/xgbe.h                 |  2 +-
+ drivers/net/ethernet/apm/xgene-v2/mac.c              |  2 +-
+ drivers/net/ethernet/apm/xgene/xgene_enet_hw.c       |  2 +-
+ drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c    |  2 +-
+ drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c    |  2 +-
+ drivers/net/ethernet/apple/bmac.c                    |  8 ++++----
+ drivers/net/ethernet/aquantia/atlantic/aq_hw.h       |  6 +++---
+ drivers/net/ethernet/aquantia/atlantic/aq_macsec.c   |  2 +-
+ .../ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c    |  4 ++--
+ .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c    |  4 ++--
+ .../ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h    |  2 +-
+ .../ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c |  4 ++--
+ .../aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c     |  4 ++--
+ .../net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c |  2 +-
+ drivers/net/ethernet/broadcom/b44.c                  |  6 ++++--
+ drivers/net/ethernet/broadcom/bcmsysport.c           |  2 +-
+ drivers/net/ethernet/broadcom/bgmac.c                |  2 +-
+ drivers/net/ethernet/broadcom/bnx2.c                 |  2 +-
+ drivers/net/ethernet/broadcom/bnx2x/bnx2x.h          |  2 +-
+ drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c     |  4 ++--
+ drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h    |  3 ++-
+ drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c     |  2 +-
+ drivers/net/ethernet/broadcom/bnxt/bnxt.c            |  2 +-
+ drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c      |  4 ++--
+ drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h      |  2 +-
+ drivers/net/ethernet/broadcom/genet/bcmgenet.c       |  4 ++--
+ drivers/net/ethernet/calxeda/xgmac.c                 |  2 +-
+ drivers/net/ethernet/chelsio/cxgb/gmac.h             |  2 +-
+ drivers/net/ethernet/chelsio/cxgb/pm3393.c           |  2 +-
+ drivers/net/ethernet/chelsio/cxgb/vsc7326.c          |  2 +-
+ drivers/net/ethernet/chelsio/cxgb3/common.h          |  2 +-
+ drivers/net/ethernet/chelsio/cxgb3/xgmac.c           |  2 +-
+ drivers/net/ethernet/cisco/enic/enic_pp.c            |  2 +-
+ drivers/net/ethernet/dlink/dl2k.c                    |  2 +-
+ drivers/net/ethernet/dnet.c                          |  6 +++---
+ drivers/net/ethernet/emulex/benet/be_cmds.c          |  2 +-
+ drivers/net/ethernet/emulex/benet/be_cmds.h          |  2 +-
+ drivers/net/ethernet/emulex/benet/be_main.c          |  2 +-
+ drivers/net/ethernet/ethoc.c                         |  2 +-
+ drivers/net/ethernet/fealnx.c                        |  2 +-
+ drivers/net/ethernet/freescale/dpaa/dpaa_eth.c       |  4 ++--
+ drivers/net/ethernet/freescale/fman/fman_dtsec.c     |  8 ++++----
+ drivers/net/ethernet/freescale/fman/fman_dtsec.h     |  2 +-
+ drivers/net/ethernet/freescale/fman/fman_memac.c     |  8 ++++----
+ drivers/net/ethernet/freescale/fman/fman_memac.h     |  2 +-
+ drivers/net/ethernet/freescale/fman/fman_tgec.c      |  8 ++++----
+ drivers/net/ethernet/freescale/fman/fman_tgec.h      |  2 +-
+ drivers/net/ethernet/freescale/fman/mac.h            |  2 +-
+ drivers/net/ethernet/hisilicon/hisi_femac.c          |  2 +-
+ drivers/net/ethernet/hisilicon/hix5hd2_gmac.c        |  2 +-
+ drivers/net/ethernet/hisilicon/hns/hnae.h            |  2 +-
+ drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c    |  2 +-
+ drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c   |  2 +-
+ drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c    |  2 +-
+ drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h    |  5 +++--
+ drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c  |  2 +-
+ drivers/net/ethernet/hisilicon/hns3/hnae3.h          |  2 +-
+ .../net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c  |  2 +-
+ .../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c    |  2 +-
+ drivers/net/ethernet/i825xx/sun3_82586.c             |  2 +-
+ drivers/net/ethernet/intel/i40e/i40e.h               |  2 +-
+ drivers/net/ethernet/intel/ixgb/ixgb_hw.c            |  2 +-
+ drivers/net/ethernet/intel/ixgb/ixgb_hw.h            |  2 +-
+ drivers/net/ethernet/marvell/mv643xx_eth.c           |  2 +-
+ drivers/net/ethernet/marvell/mvneta.c                |  4 ++--
+ drivers/net/ethernet/marvell/pxa168_eth.c            |  6 +++---
+ drivers/net/ethernet/mediatek/mtk_star_emac.c        |  2 +-
+ drivers/net/ethernet/mellanox/mlx5/core/en_fs.c      |  4 ++--
+ .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c    |  2 +-
+ drivers/net/ethernet/micrel/ks8842.c                 |  2 +-
+ drivers/net/ethernet/micrel/ksz884x.c                |  4 ++--
+ drivers/net/ethernet/myricom/myri10ge/myri10ge.c     |  3 ++-
+ drivers/net/ethernet/neterion/s2io.c                 |  2 +-
+ drivers/net/ethernet/neterion/s2io.h                 |  2 +-
+ .../net/ethernet/netronome/nfp/flower/tunnel_conf.c  |  6 +++---
+ drivers/net/ethernet/nxp/lpc_eth.c                   |  2 +-
+ drivers/net/ethernet/qlogic/qed/qed_dev.c            |  2 +-
+ drivers/net/ethernet/qlogic/qed/qed_dev_api.h        |  2 +-
+ drivers/net/ethernet/qlogic/qed/qed_l2.c             |  2 +-
+ drivers/net/ethernet/qlogic/qed/qed_main.c           |  2 +-
+ drivers/net/ethernet/qlogic/qed/qed_mcp.c            |  2 +-
+ drivers/net/ethernet/qlogic/qed/qed_mcp.h            |  2 +-
+ drivers/net/ethernet/qlogic/qed/qed_rdma.c           |  2 +-
+ drivers/net/ethernet/qlogic/qed/qed_vf.c             |  2 +-
+ drivers/net/ethernet/qlogic/qed/qed_vf.h             |  4 ++--
+ drivers/net/ethernet/qlogic/qede/qede_filter.c       |  2 +-
+ drivers/net/ethernet/qualcomm/emac/emac-mac.c        |  2 +-
+ drivers/net/ethernet/rdc/r6040.c                     | 12 ++++++------
+ drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h    |  2 +-
+ drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c      |  3 ++-
+ drivers/net/ethernet/sfc/ef10.c                      |  4 ++--
+ drivers/net/ethernet/sfc/ef10_sriov.c                |  2 +-
+ drivers/net/ethernet/sfc/ef10_sriov.h                |  6 +++---
+ drivers/net/ethernet/sfc/net_driver.h                |  2 +-
+ drivers/net/ethernet/sfc/siena_sriov.c               |  2 +-
+ drivers/net/ethernet/sfc/siena_sriov.h               |  2 +-
+ drivers/net/ethernet/sis/sis900.c                    |  2 +-
+ drivers/net/ethernet/smsc/smsc911x.c                 |  2 +-
+ drivers/net/ethernet/smsc/smsc9420.c                 |  2 +-
+ drivers/net/ethernet/stmicro/stmmac/common.h         |  4 ++--
+ drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c    |  2 +-
+ drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c |  2 +-
+ drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c  |  2 +-
+ drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c    |  2 +-
+ drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c     |  2 +-
+ drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c      |  2 +-
+ drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c  |  3 ++-
+ drivers/net/ethernet/stmicro/stmmac/hwif.h           |  3 ++-
+ .../net/ethernet/stmicro/stmmac/stmmac_selftests.c   |  4 ++--
+ drivers/net/ethernet/sun/sunbmac.c                   |  2 +-
+ drivers/net/ethernet/sun/sunqe.c                     |  2 +-
+ drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c        |  2 +-
+ drivers/net/ethernet/synopsys/dwc-xlgmac.h           |  2 +-
+ drivers/net/ethernet/ti/tlan.c                       |  4 ++--
+ drivers/net/ethernet/toshiba/tc35815.c               |  3 ++-
+ drivers/net/ethernet/xilinx/xilinx_emaclite.c        |  7 ++++---
+ drivers/net/ethernet/xircom/xirc2ps_cs.c             |  2 +-
+ drivers/net/phy/mscc/mscc_main.c                     |  2 +-
+ drivers/net/usb/aqc111.c                             |  2 +-
+ drivers/net/usb/ax88179_178a.c                       |  8 ++++----
+ drivers/net/usb/catc.c                               |  2 +-
+ drivers/net/usb/dm9601.c                             |  3 ++-
+ drivers/net/usb/mcs7830.c                            |  3 ++-
+ drivers/net/usb/sr9700.c                             |  3 ++-
+ include/linux/qed/qed_eth_if.h                       |  2 +-
+ include/linux/qed/qed_if.h                           |  2 +-
+ include/linux/qed/qed_rdma_if.h                      |  3 ++-
+ 134 files changed, 204 insertions(+), 189 deletions(-)
+
+diff --git a/drivers/net/ethernet/actions/owl-emac.c b/drivers/net/ethernet/actions/owl-emac.c
+index c4ecf4fcadf84..add3480c6c56b 100644
+--- a/drivers/net/ethernet/actions/owl-emac.c
++++ b/drivers/net/ethernet/actions/owl-emac.c
+@@ -342,7 +342,7 @@ static u32 owl_emac_dma_cmd_stop(struct owl_emac_priv *priv)
+ static void owl_emac_set_hw_mac_addr(struct net_device *netdev)
+ {
+       struct owl_emac_priv *priv = netdev_priv(netdev);
+-      u8 *mac_addr = netdev->dev_addr;
++      const u8 *mac_addr = netdev->dev_addr;
+       u32 addr_high, addr_low;
+       addr_high = mac_addr[0] << 8 | mac_addr[1];
+diff --git a/drivers/net/ethernet/adaptec/starfire.c b/drivers/net/ethernet/adaptec/starfire.c
+index e0f6cc910bd24..16b6b83f670bc 100644
+--- a/drivers/net/ethernet/adaptec/starfire.c
++++ b/drivers/net/ethernet/adaptec/starfire.c
+@@ -955,7 +955,7 @@ static int netdev_open(struct net_device *dev)
+       writew(0, ioaddr + PerfFilterTable + 4);
+       writew(0, ioaddr + PerfFilterTable + 8);
+       for (i = 1; i < 16; i++) {
+-              __be16 *eaddrs = (__be16 *)dev->dev_addr;
++              const __be16 *eaddrs = (const __be16 *)dev->dev_addr;
+               void __iomem *setup_frm = ioaddr + PerfFilterTable + i * 16;
+               writew(be16_to_cpu(eaddrs[2]), setup_frm); setup_frm += 4;
+               writew(be16_to_cpu(eaddrs[1]), setup_frm); setup_frm += 4;
+@@ -1787,14 +1787,14 @@ static void set_rx_mode(struct net_device *dev)
+       } else if (netdev_mc_count(dev) <= 14) {
+               /* Use the 16 element perfect filter, skip first two entries. */
+               void __iomem *filter_addr = ioaddr + PerfFilterTable + 2 * 16;
+-              __be16 *eaddrs;
++              const __be16 *eaddrs;
+               netdev_for_each_mc_addr(ha, dev) {
+                       eaddrs = (__be16 *) ha->addr;
+                       writew(be16_to_cpu(eaddrs[2]), filter_addr); filter_addr += 4;
+                       writew(be16_to_cpu(eaddrs[1]), filter_addr); filter_addr += 4;
+                       writew(be16_to_cpu(eaddrs[0]), filter_addr); filter_addr += 8;
+               }
+-              eaddrs = (__be16 *)dev->dev_addr;
++              eaddrs = (const __be16 *)dev->dev_addr;
+               i = netdev_mc_count(dev) + 2;
+               while (i++ < 16) {
+                       writew(be16_to_cpu(eaddrs[0]), filter_addr); filter_addr += 4;
+@@ -1805,7 +1805,7 @@ static void set_rx_mode(struct net_device *dev)
+       } else {
+               /* Must use a multicast hash table. */
+               void __iomem *filter_addr;
+-              __be16 *eaddrs;
++              const __be16 *eaddrs;
+               __le16 mc_filter[32] __attribute__ ((aligned(sizeof(long))));   /* Multicast hash filter */
+               memset(mc_filter, 0, sizeof(mc_filter));
+@@ -1819,7 +1819,7 @@ static void set_rx_mode(struct net_device *dev)
+               }
+               /* Clear the perfect filter list, skip first two entries. */
+               filter_addr = ioaddr + PerfFilterTable + 2 * 16;
+-              eaddrs = (__be16 *)dev->dev_addr;
++              eaddrs = (const __be16 *)dev->dev_addr;
+               for (i = 2; i < 16; i++) {
+                       writew(be16_to_cpu(eaddrs[0]), filter_addr); filter_addr += 4;
+                       writew(be16_to_cpu(eaddrs[1]), filter_addr); filter_addr += 4;
+diff --git a/drivers/net/ethernet/alacritech/slicoss.c b/drivers/net/ethernet/alacritech/slicoss.c
+index 82f4f26081021..1fc9a1cd3ef8f 100644
+--- a/drivers/net/ethernet/alacritech/slicoss.c
++++ b/drivers/net/ethernet/alacritech/slicoss.c
+@@ -1008,7 +1008,7 @@ static void slic_set_link_autoneg(struct slic_device *sdev)
+ static void slic_set_mac_address(struct slic_device *sdev)
+ {
+-      u8 *addr = sdev->netdev->dev_addr;
++      const u8 *addr = sdev->netdev->dev_addr;
+       u32 val;
+       val = addr[5] | addr[4] << 8 | addr[3] << 16 | addr[2] << 24;
+diff --git a/drivers/net/ethernet/alteon/acenic.c b/drivers/net/ethernet/alteon/acenic.c
+index 9dc12b13061f8..afa383355265f 100644
+--- a/drivers/net/ethernet/alteon/acenic.c
++++ b/drivers/net/ethernet/alteon/acenic.c
+@@ -2712,7 +2712,7 @@ static int ace_set_mac_addr(struct net_device *dev, void *p)
+       struct ace_private *ap = netdev_priv(dev);
+       struct ace_regs __iomem *regs = ap->regs;
+       struct sockaddr *addr=p;
+-      u8 *da;
++      const u8 *da;
+       struct cmd cmd;
+       if(netif_running(dev))
+@@ -2720,7 +2720,7 @@ static int ace_set_mac_addr(struct net_device *dev, void *p)
+       memcpy(dev->dev_addr, addr->sa_data,dev->addr_len);
+-      da = (u8 *)dev->dev_addr;
++      da = (const u8 *)dev->dev_addr;
+       writel(da[0] << 8 | da[1], &regs->MacAddrHi);
+       writel((da[2] << 24) | (da[3] << 16) | (da[4] << 8) | da[5],
+diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
+index 9e721436f06fa..36bf3ce545c9b 100644
+--- a/drivers/net/ethernet/altera/altera_tse_main.c
++++ b/drivers/net/ethernet/altera/altera_tse_main.c
+@@ -853,7 +853,7 @@ static int init_phy(struct net_device *dev)
+       return 0;
+ }
+-static void tse_update_mac_addr(struct altera_tse_private *priv, u8 *addr)
++static void tse_update_mac_addr(struct altera_tse_private *priv, const u8 *addr)
+ {
+       u32 msb;
+       u32 lsb;
+diff --git a/drivers/net/ethernet/amd/nmclan_cs.c b/drivers/net/ethernet/amd/nmclan_cs.c
+index 8bd063e54ac38..0f961d7e7196a 100644
+--- a/drivers/net/ethernet/amd/nmclan_cs.c
++++ b/drivers/net/ethernet/amd/nmclan_cs.c
+@@ -529,7 +529,8 @@ static void mace_write(mace_private *lp, unsigned int ioaddr, int reg,
+ mace_init
+       Resets the MACE chip.
+ ---------------------------------------------------------------------------- */
+-static int mace_init(mace_private *lp, unsigned int ioaddr, char *enet_addr)
++static int mace_init(mace_private *lp, unsigned int ioaddr,
++                   const char *enet_addr)
+ {
+   int i;
+   int ct = 0;
+diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
+index decc1c09a031b..4030d619e84f5 100644
+--- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
++++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
+@@ -1087,7 +1087,7 @@ static int xgbe_add_mac_addresses(struct xgbe_prv_data *pdata)
+       return 0;
+ }
+-static int xgbe_set_mac_address(struct xgbe_prv_data *pdata, u8 *addr)
++static int xgbe_set_mac_address(struct xgbe_prv_data *pdata, const u8 *addr)
+ {
+       unsigned int mac_addr_hi, mac_addr_lo;
+diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h
+index e0b8f3c4cc0b2..497c4ec6089a7 100644
+--- a/drivers/net/ethernet/amd/xgbe/xgbe.h
++++ b/drivers/net/ethernet/amd/xgbe/xgbe.h
+@@ -730,7 +730,7 @@ struct xgbe_ext_stats {
+ struct xgbe_hw_if {
+       int (*tx_complete)(struct xgbe_ring_desc *);
+-      int (*set_mac_address)(struct xgbe_prv_data *, u8 *addr);
++      int (*set_mac_address)(struct xgbe_prv_data *, const u8 *addr);
+       int (*config_rx_mode)(struct xgbe_prv_data *);
+       int (*enable_rx_csum)(struct xgbe_prv_data *);
+diff --git a/drivers/net/ethernet/apm/xgene-v2/mac.c b/drivers/net/ethernet/apm/xgene-v2/mac.c
+index 2da979e4fad14..6423e22e05b24 100644
+--- a/drivers/net/ethernet/apm/xgene-v2/mac.c
++++ b/drivers/net/ethernet/apm/xgene-v2/mac.c
+@@ -65,7 +65,7 @@ void xge_mac_set_speed(struct xge_pdata *pdata)
+ void xge_mac_set_station_addr(struct xge_pdata *pdata)
+ {
+-      u8 *dev_addr = pdata->ndev->dev_addr;
++      const u8 *dev_addr = pdata->ndev->dev_addr;
+       u32 addr0, addr1;
+       addr0 = (dev_addr[3] << 24) | (dev_addr[2] << 16) |
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+index 5f657879134ed..e641dbbea1e27 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+@@ -378,8 +378,8 @@ u32 xgene_enet_rd_stat(struct xgene_enet_pdata *pdata, u32 rd_addr)
+ static void xgene_gmac_set_mac_addr(struct xgene_enet_pdata *pdata)
+ {
++      const u8 *dev_addr = pdata->ndev->dev_addr;
+       u32 addr0, addr1;
+-      u8 *dev_addr = pdata->ndev->dev_addr;
+       addr0 = (dev_addr[3] << 24) | (dev_addr[2] << 16) |
+               (dev_addr[1] << 8) | dev_addr[0];
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
+index f482ced2cadd9..72b5e8eb0ec7d 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
+@@ -165,8 +165,8 @@ static void xgene_sgmac_reset(struct xgene_enet_pdata *p)
+ static void xgene_sgmac_set_mac_addr(struct xgene_enet_pdata *p)
+ {
++      const u8 *dev_addr = p->ndev->dev_addr;
+       u32 addr0, addr1;
+-      u8 *dev_addr = p->ndev->dev_addr;
+       addr0 = (dev_addr[3] << 24) | (dev_addr[2] << 16) |
+               (dev_addr[1] << 8) | dev_addr[0];
+diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
+index 304b5d43f2369..86607b79c09f7 100644
+--- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
++++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
+@@ -207,8 +207,8 @@ static void xgene_pcs_reset(struct xgene_enet_pdata *pdata)
+ static void xgene_xgmac_set_mac_addr(struct xgene_enet_pdata *pdata)
+ {
++      const u8 *dev_addr = pdata->ndev->dev_addr;
+       u32 addr0, addr1;
+-      u8 *dev_addr = pdata->ndev->dev_addr;
+       addr0 = (dev_addr[3] << 24) | (dev_addr[2] << 16) |
+               (dev_addr[1] << 8) | dev_addr[0];
+diff --git a/drivers/net/ethernet/apple/bmac.c b/drivers/net/ethernet/apple/bmac.c
+index 7a966361d83f7..4c513f7a36a8b 100644
+--- a/drivers/net/ethernet/apple/bmac.c
++++ b/drivers/net/ethernet/apple/bmac.c
+@@ -308,7 +308,7 @@ bmac_init_registers(struct net_device *dev)
+ {
+       struct bmac_data *bp = netdev_priv(dev);
+       volatile unsigned short regValue;
+-      unsigned short *pWord16;
++      const unsigned short *pWord16;
+       int i;
+       /* XXDEBUG(("bmac: enter init_registers\n")); */
+@@ -371,7 +371,7 @@ bmac_init_registers(struct net_device *dev)
+       bmwrite(dev, BHASH1, bp->hash_table_mask[2]);   /* bits 47 - 32 */
+       bmwrite(dev, BHASH0, bp->hash_table_mask[3]);   /* bits 63 - 48 */
+-      pWord16 = (unsigned short *)dev->dev_addr;
++      pWord16 = (const unsigned short *)dev->dev_addr;
+       bmwrite(dev, MADD0, *pWord16++);
+       bmwrite(dev, MADD1, *pWord16++);
+       bmwrite(dev, MADD2, *pWord16);
+@@ -522,7 +522,7 @@ static int bmac_set_address(struct net_device *dev, void *addr)
+ {
+       struct bmac_data *bp = netdev_priv(dev);
+       unsigned char *p = addr;
+-      unsigned short *pWord16;
++      const unsigned short *pWord16;
+       unsigned long flags;
+       int i;
+@@ -533,7 +533,7 @@ static int bmac_set_address(struct net_device *dev, void *addr)
+               dev->dev_addr[i] = p[i];
+       }
+       /* load up the hardware address */
+-      pWord16  = (unsigned short *)dev->dev_addr;
++      pWord16  = (const unsigned short *)dev->dev_addr;
+       bmwrite(dev, MADD0, *pWord16++);
+       bmwrite(dev, MADD1, *pWord16++);
+       bmwrite(dev, MADD2, *pWord16);
+diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
+index 7442850ca95f0..dbd2846601358 100644
+--- a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
++++ b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
+@@ -219,7 +219,7 @@ struct aq_hw_ops {
+       int (*hw_ring_tx_head_update)(struct aq_hw_s *self,
+                                     struct aq_ring_s *aq_ring);
+-      int (*hw_set_mac_address)(struct aq_hw_s *self, u8 *mac_addr);
++      int (*hw_set_mac_address)(struct aq_hw_s *self, const u8 *mac_addr);
+       int (*hw_soft_reset)(struct aq_hw_s *self);
+@@ -228,7 +228,7 @@ struct aq_hw_ops {
+       int (*hw_reset)(struct aq_hw_s *self);
+-      int (*hw_init)(struct aq_hw_s *self, u8 *mac_addr);
++      int (*hw_init)(struct aq_hw_s *self, const u8 *mac_addr);
+       int (*hw_start)(struct aq_hw_s *self);
+@@ -375,7 +375,7 @@ struct aq_fw_ops {
+       int (*set_phyloopback)(struct aq_hw_s *self, u32 mode, bool enable);
+       int (*set_power)(struct aq_hw_s *self, unsigned int power_state,
+-                       u8 *mac);
++                       const u8 *mac);
+       int (*send_fw_request)(struct aq_hw_s *self,
+                              const struct hw_fw_request_iface *fw_req,
+diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c
+index ee823a18294cd..958b7f8c77d91 100644
+--- a/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c
++++ b/drivers/net/ethernet/aquantia/atlantic/aq_macsec.c
+@@ -35,7 +35,7 @@ static int aq_apply_macsec_cfg(struct aq_nic_s *nic);
+ static int aq_apply_secy_cfg(struct aq_nic_s *nic,
+                            const struct macsec_secy *secy);
+-static void aq_ether_addr_to_mac(u32 mac[2], unsigned char *emac)
++static void aq_ether_addr_to_mac(u32 mac[2], const unsigned char *emac)
+ {
+       u32 tmp[2] = { 0 };
+diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
+index 611875ef2cd15..4625ccb794997 100644
+--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
++++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
+@@ -322,7 +322,7 @@ static int hw_atl_a0_hw_init_rx_path(struct aq_hw_s *self)
+       return aq_hw_err_from_flags(self);
+ }
+-static int hw_atl_a0_hw_mac_addr_set(struct aq_hw_s *self, u8 *mac_addr)
++static int hw_atl_a0_hw_mac_addr_set(struct aq_hw_s *self, const u8 *mac_addr)
+ {
+       unsigned int h = 0U;
+       unsigned int l = 0U;
+@@ -348,7 +348,7 @@ static int hw_atl_a0_hw_mac_addr_set(struct aq_hw_s *self, u8 *mac_addr)
+       return err;
+ }
+-static int hw_atl_a0_hw_init(struct aq_hw_s *self, u8 *mac_addr)
++static int hw_atl_a0_hw_init(struct aq_hw_s *self, const u8 *mac_addr)
+ {
+       static u32 aq_hw_atl_igcr_table_[4][2] = {
+               [AQ_HW_IRQ_INVALID] = { 0x20000000U, 0x20000000U },
+diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
+index 45c17c585d743..15ede7285fb5d 100644
+--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
++++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
+@@ -533,7 +533,7 @@ static int hw_atl_b0_hw_init_rx_path(struct aq_hw_s *self)
+       return aq_hw_err_from_flags(self);
+ }
+-int hw_atl_b0_hw_mac_addr_set(struct aq_hw_s *self, u8 *mac_addr)
++int hw_atl_b0_hw_mac_addr_set(struct aq_hw_s *self, const u8 *mac_addr)
+ {
+       unsigned int h = 0U;
+       unsigned int l = 0U;
+@@ -558,7 +558,7 @@ int hw_atl_b0_hw_mac_addr_set(struct aq_hw_s *self, u8 *mac_addr)
+       return err;
+ }
+-static int hw_atl_b0_hw_init(struct aq_hw_s *self, u8 *mac_addr)
++static int hw_atl_b0_hw_init(struct aq_hw_s *self, const u8 *mac_addr)
+ {
+       static u32 aq_hw_atl_igcr_table_[4][2] = {
+               [AQ_HW_IRQ_INVALID] = { 0x20000000U, 0x20000000U },
+diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h
+index d8db972113ec1..5298846dd9f77 100644
+--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h
++++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h
+@@ -58,7 +58,7 @@ int hw_atl_b0_hw_ring_rx_stop(struct aq_hw_s *self, struct aq_ring_s *ring);
+ void hw_atl_b0_hw_init_rx_rss_ctrl1(struct aq_hw_s *self);
+-int hw_atl_b0_hw_mac_addr_set(struct aq_hw_s *self, u8 *mac_addr);
++int hw_atl_b0_hw_mac_addr_set(struct aq_hw_s *self, const u8 *mac_addr);
+ int hw_atl_b0_set_fc(struct aq_hw_s *self, u32 fc, u32 tc);
+ int hw_atl_b0_set_loopback(struct aq_hw_s *self, u32 mode, bool enable);
+diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
+index 65b9e5846be45..7e88d7234b145 100644
+--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
++++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
+@@ -965,7 +965,7 @@ u32 hw_atl_utils_get_fw_version(struct aq_hw_s *self)
+ }
+ static int aq_fw1x_set_wake_magic(struct aq_hw_s *self, bool wol_enabled,
+-                                u8 *mac)
++                                const u8 *mac)
+ {
+       struct hw_atl_utils_fw_rpc *prpc = NULL;
+       unsigned int rpc_size = 0U;
+@@ -1008,7 +1008,7 @@ static int aq_fw1x_set_wake_magic(struct aq_hw_s *self, bool wol_enabled,
+ }
+ static int aq_fw1x_set_power(struct aq_hw_s *self, unsigned int power_state,
+-                           u8 *mac)
++                           const u8 *mac)
+ {
+       struct hw_atl_utils_fw_rpc *prpc = NULL;
+       unsigned int rpc_size = 0U;
+diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
+index 05086f0040fd9..4d4cfbc91e19c 100644
+--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
++++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
+@@ -355,7 +355,7 @@ static int aq_fw2x_get_phy_temp(struct aq_hw_s *self, int *temp)
+       return 0;
+ }
+-static int aq_fw2x_set_wol(struct aq_hw_s *self, u8 *mac)
++static int aq_fw2x_set_wol(struct aq_hw_s *self, const u8 *mac)
+ {
+       struct hw_atl_utils_fw_rpc *rpc = NULL;
+       struct offload_info *info = NULL;
+@@ -401,7 +401,7 @@ static int aq_fw2x_set_wol(struct aq_hw_s *self, u8 *mac)
+ }
+ static int aq_fw2x_set_power(struct aq_hw_s *self, unsigned int power_state,
+-                           u8 *mac)
++                           const u8 *mac)
+ {
+       int err = 0;
+diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c
+index c76ccdc77ba60..5dfc751572edc 100644
+--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c
++++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c
+@@ -530,7 +530,7 @@ static int hw_atl2_hw_init_rx_path(struct aq_hw_s *self)
+       return aq_hw_err_from_flags(self);
+ }
+-static int hw_atl2_hw_init(struct aq_hw_s *self, u8 *mac_addr)
++static int hw_atl2_hw_init(struct aq_hw_s *self, const u8 *mac_addr)
+ {
+       static u32 aq_hw_atl2_igcr_table_[4][2] = {
+               [AQ_HW_IRQ_INVALID] = { 0x20000000U, 0x20000000U },
+diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
+index fa784953c6018..485d32dda56fd 100644
+--- a/drivers/net/ethernet/broadcom/b44.c
++++ b/drivers/net/ethernet/broadcom/b44.c
+@@ -218,7 +218,8 @@ static inline void __b44_cam_read(struct b44 *bp, unsigned char *data, int index
+       data[1] = (val >> 0) & 0xFF;
+ }
+-static inline void __b44_cam_write(struct b44 *bp, unsigned char *data, int index)
++static inline void __b44_cam_write(struct b44 *bp,
++                                 const unsigned char *data, int index)
+ {
+       u32 val;
+@@ -1507,7 +1508,8 @@ static void bwfilter_table(struct b44 *bp, u8 *pp, u32 bytes, u32 table_offset)
+       }
+ }
+-static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset)
++static int b44_magic_pattern(const u8 *macaddr, u8 *ppattern, u8 *pmask,
++                           int offset)
+ {
+       int magicsync = 6;
+       int k, j, len = offset;
+diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
+index 25466d73b432a..93c965bcdb6cf 100644
+--- a/drivers/net/ethernet/broadcom/bcmsysport.c
++++ b/drivers/net/ethernet/broadcom/bcmsysport.c
+@@ -1820,7 +1820,7 @@ static inline void umac_reset(struct bcm_sysport_priv *priv)
+ }
+ static void umac_set_hw_addr(struct bcm_sysport_priv *priv,
+-                           unsigned char *addr)
++                           const unsigned char *addr)
+ {
+       u32 mac0 = (addr[0] << 24) | (addr[1] << 16) | (addr[2] << 8) |
+                   addr[3];
+diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
+index c691635cf4ebe..3b42674b9df6d 100644
+--- a/drivers/net/ethernet/broadcom/bgmac.c
++++ b/drivers/net/ethernet/broadcom/bgmac.c
+@@ -768,7 +768,7 @@ static void bgmac_umac_cmd_maskset(struct bgmac *bgmac, u32 mask, u32 set,
+       udelay(2);
+ }
+-static void bgmac_write_mac_address(struct bgmac *bgmac, u8 *addr)
++static void bgmac_write_mac_address(struct bgmac *bgmac, const u8 *addr)
+ {
+       u32 tmp;
+diff --git a/drivers/net/ethernet/broadcom/bnx2.c b/drivers/net/ethernet/broadcom/bnx2.c
+index 9d70d908c0646..cf4535f8b3443 100644
+--- a/drivers/net/ethernet/broadcom/bnx2.c
++++ b/drivers/net/ethernet/broadcom/bnx2.c
+@@ -2704,7 +2704,7 @@ bnx2_alloc_bad_rbuf(struct bnx2 *bp)
+ }
+ static void
+-bnx2_set_mac_addr(struct bnx2 *bp, u8 *mac_addr, u32 pos)
++bnx2_set_mac_addr(struct bnx2 *bp, const u8 *mac_addr, u32 pos)
+ {
+       u32 val;
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+index 9e79bcfb365fa..2209d99b34047 100644
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
+@@ -2002,7 +2002,7 @@ int bnx2x_idle_chk(struct bnx2x *bp);
+  * operation has been successfully scheduled and a negative - if a requested
+  * operations has failed.
+  */
+-int bnx2x_set_mac_one(struct bnx2x *bp, u8 *mac,
++int bnx2x_set_mac_one(struct bnx2x *bp, const u8 *mac,
+                     struct bnx2x_vlan_mac_obj *obj, bool set,
+                     int mac_type, unsigned long *ramrod_flags);
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+index 9c26c46771f5e..ed20a5945885b 100644
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+@@ -8428,7 +8428,7 @@ int bnx2x_alloc_mem(struct bnx2x *bp)
+  * Init service functions
+  */
+-int bnx2x_set_mac_one(struct bnx2x *bp, u8 *mac,
++int bnx2x_set_mac_one(struct bnx2x *bp, const u8 *mac,
+                     struct bnx2x_vlan_mac_obj *obj, bool set,
+                     int mac_type, unsigned long *ramrod_flags)
+ {
+@@ -9157,7 +9157,7 @@ u32 bnx2x_send_unload_req(struct bnx2x *bp, int unload_mode)
+       else if (bp->wol) {
+               u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0;
+-              u8 *mac_addr = bp->dev->dev_addr;
++              const u8 *mac_addr = bp->dev->dev_addr;
+               struct pci_dev *pdev = bp->pdev;
+               u32 val;
+               u16 pmc;
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
+index 966d5722c5e2f..8c2cf55197878 100644
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
+@@ -508,7 +508,8 @@ int bnx2x_vfpf_init(struct bnx2x *bp);
+ void bnx2x_vfpf_close_vf(struct bnx2x *bp);
+ int bnx2x_vfpf_setup_q(struct bnx2x *bp, struct bnx2x_fastpath *fp,
+                      bool is_leading);
+-int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr, u8 vf_qid, bool set);
++int bnx2x_vfpf_config_mac(struct bnx2x *bp, const u8 *addr, u8 vf_qid,
++                        bool set);
+ int bnx2x_vfpf_config_rss(struct bnx2x *bp,
+                         struct bnx2x_config_rss_params *params);
+ int bnx2x_vfpf_set_mcast(struct net_device *dev);
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
+index ea0e9394f8986..05d861679a02e 100644
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
+@@ -722,7 +722,7 @@ static int bnx2x_vfpf_teardown_queue(struct bnx2x *bp, int qidx)
+ }
+ /* request pf to add a mac for the vf */
+-int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr, u8 vf_qid, bool set)
++int bnx2x_vfpf_config_mac(struct bnx2x *bp, const u8 *addr, u8 vf_qid, bool set)
+ {
+       struct vfpf_set_q_filters_tlv *req = &bp->vf2pf_mbox->req.set_q_filters;
+       struct pfvf_general_resp_tlv *resp = &bp->vf2pf_mbox->resp.general_resp;
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+index 4cb22e4060520..42fa218295295 100644
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+@@ -4882,7 +4882,7 @@ static int bnxt_hwrm_cfa_ntuple_filter_alloc(struct bnxt *bp,
+ #endif
+ static int bnxt_hwrm_set_vnic_filter(struct bnxt *bp, u16 vnic_id, u16 idx,
+-                                   u8 *mac_addr)
++                                   const u8 *mac_addr)
+ {
+       struct hwrm_cfa_l2_filter_alloc_output *resp;
+       struct hwrm_cfa_l2_filter_alloc_input *req;
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
+index 78763f5027d10..7de7101d5389b 100644
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c
+@@ -1151,7 +1151,7 @@ void bnxt_hwrm_exec_fwd_req(struct bnxt *bp)
+       }
+ }
+-int bnxt_approve_mac(struct bnxt *bp, u8 *mac, bool strict)
++int bnxt_approve_mac(struct bnxt *bp, const u8 *mac, bool strict)
+ {
+       struct hwrm_func_vf_cfg_input *req;
+       int rc = 0;
+@@ -1246,7 +1246,7 @@ void bnxt_update_vf_mac(struct bnxt *bp)
+ {
+ }
+-int bnxt_approve_mac(struct bnxt *bp, u8 *mac, bool strict)
++int bnxt_approve_mac(struct bnxt *bp, const u8 *mac, bool strict)
+ {
+       return 0;
+ }
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h
+index 995535e4c11be..9a4bacba477b1 100644
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.h
+@@ -41,5 +41,5 @@ int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs, bool reset);
+ void bnxt_sriov_disable(struct bnxt *);
+ void bnxt_hwrm_exec_fwd_req(struct bnxt *);
+ void bnxt_update_vf_mac(struct bnxt *);
+-int bnxt_approve_mac(struct bnxt *, u8 *, bool);
++int bnxt_approve_mac(struct bnxt *, const u8 *, bool);
+ #endif
+diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+index e036a244b78bf..f6a553e5df25f 100644
+--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+@@ -3239,7 +3239,7 @@ static void bcmgenet_umac_reset(struct bcmgenet_priv *priv)
+ }
+ static void bcmgenet_set_hw_addr(struct bcmgenet_priv *priv,
+-                               unsigned char *addr)
++                               const unsigned char *addr)
+ {
+       bcmgenet_umac_writel(priv, get_unaligned_be32(&addr[0]), UMAC_MAC0);
+       bcmgenet_umac_writel(priv, get_unaligned_be16(&addr[4]), UMAC_MAC1);
+@@ -3537,7 +3537,7 @@ static void bcmgenet_timeout(struct net_device *dev, unsigned int txqueue)
+ #define MAX_MDF_FILTER        17
+ static inline void bcmgenet_set_mdf_addr(struct bcmgenet_priv *priv,
+-                                       unsigned char *addr,
++                                       const unsigned char *addr,
+                                        int *i)
+ {
+       bcmgenet_umac_writel(priv, addr[0] << 8 | addr[1],
+diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
+index b6a066404f4bf..9695c261d18f9 100644
+--- a/drivers/net/ethernet/calxeda/xgmac.c
++++ b/drivers/net/ethernet/calxeda/xgmac.c
+@@ -607,7 +607,7 @@ static inline void xgmac_mac_disable(void __iomem *ioaddr)
+       writel(value, ioaddr + XGMAC_CONTROL);
+ }
+-static void xgmac_set_mac_addr(void __iomem *ioaddr, unsigned char *addr,
++static void xgmac_set_mac_addr(void __iomem *ioaddr, const unsigned char *addr,
+                              int num)
+ {
+       u32 data;
+diff --git a/drivers/net/ethernet/chelsio/cxgb/gmac.h b/drivers/net/ethernet/chelsio/cxgb/gmac.h
+index dfa77491a910d..5913eaf442b5c 100644
+--- a/drivers/net/ethernet/chelsio/cxgb/gmac.h
++++ b/drivers/net/ethernet/chelsio/cxgb/gmac.h
+@@ -117,7 +117,7 @@ struct cmac_ops {
+       const struct cmac_statistics *(*statistics_update)(struct cmac *, int);
+       int (*macaddress_get)(struct cmac *, u8 mac_addr[6]);
+-      int (*macaddress_set)(struct cmac *, u8 mac_addr[6]);
++      int (*macaddress_set)(struct cmac *, const u8 mac_addr[6]);
+ };
+ typedef struct _cmac_instance cmac_instance;
+diff --git a/drivers/net/ethernet/chelsio/cxgb/pm3393.c b/drivers/net/ethernet/chelsio/cxgb/pm3393.c
+index c27908e66f5ed..0bb37e4680c78 100644
+--- a/drivers/net/ethernet/chelsio/cxgb/pm3393.c
++++ b/drivers/net/ethernet/chelsio/cxgb/pm3393.c
+@@ -496,7 +496,7 @@ static int pm3393_macaddress_get(struct cmac *cmac, u8 mac_addr[6])
+       return 0;
+ }
+-static int pm3393_macaddress_set(struct cmac *cmac, u8 ma[6])
++static int pm3393_macaddress_set(struct cmac *cmac, const u8 ma[6])
+ {
+       u32 val, lo, mid, hi, enabled = cmac->instance->enabled;
+diff --git a/drivers/net/ethernet/chelsio/cxgb/vsc7326.c b/drivers/net/ethernet/chelsio/cxgb/vsc7326.c
+index 873c1c7b4ca0f..81317a9baf1ad 100644
+--- a/drivers/net/ethernet/chelsio/cxgb/vsc7326.c
++++ b/drivers/net/ethernet/chelsio/cxgb/vsc7326.c
+@@ -379,7 +379,7 @@ static int mac_intr_clear(struct cmac *mac)
+ }
+ /* Expect MAC address to be in network byte order. */
+-static int mac_set_address(struct cmac* mac, u8 addr[6])
++static int mac_set_address(struct cmac* mac, const u8 addr[6])
+ {
+       u32 val;
+       int port = mac->instance->index;
+diff --git a/drivers/net/ethernet/chelsio/cxgb3/common.h b/drivers/net/ethernet/chelsio/cxgb3/common.h
+index b706f2fbe4f48..a309016f7f8cb 100644
+--- a/drivers/net/ethernet/chelsio/cxgb3/common.h
++++ b/drivers/net/ethernet/chelsio/cxgb3/common.h
+@@ -710,7 +710,7 @@ int t3_mac_enable(struct cmac *mac, int which);
+ int t3_mac_disable(struct cmac *mac, int which);
+ int t3_mac_set_mtu(struct cmac *mac, unsigned int mtu);
+ int t3_mac_set_rx_mode(struct cmac *mac, struct net_device *dev);
+-int t3_mac_set_address(struct cmac *mac, unsigned int idx, u8 addr[6]);
++int t3_mac_set_address(struct cmac *mac, unsigned int idx, const u8 addr[6]);
+ int t3_mac_set_num_ucast(struct cmac *mac, int n);
+ const struct mac_stats *t3_mac_update_stats(struct cmac *mac);
+ int t3_mac_set_speed_duplex_fc(struct cmac *mac, int speed, int duplex, int fc);
+diff --git a/drivers/net/ethernet/chelsio/cxgb3/xgmac.c b/drivers/net/ethernet/chelsio/cxgb3/xgmac.c
+index 3af19a5503724..1bdc6cad1e49a 100644
+--- a/drivers/net/ethernet/chelsio/cxgb3/xgmac.c
++++ b/drivers/net/ethernet/chelsio/cxgb3/xgmac.c
+@@ -240,7 +240,7 @@ static void set_addr_filter(struct cmac *mac, int idx, const u8 * addr)
+ }
+ /* Set one of the station's unicast MAC addresses. */
+-int t3_mac_set_address(struct cmac *mac, unsigned int idx, u8 addr[6])
++int t3_mac_set_address(struct cmac *mac, unsigned int idx, const u8 addr[6])
+ {
+       if (idx >= mac->nucast)
+               return -EINVAL;
+diff --git a/drivers/net/ethernet/cisco/enic/enic_pp.c b/drivers/net/ethernet/cisco/enic/enic_pp.c
+index e6a83198c3dda..80f46dbd5117b 100644
+--- a/drivers/net/ethernet/cisco/enic/enic_pp.c
++++ b/drivers/net/ethernet/cisco/enic/enic_pp.c
+@@ -73,9 +73,9 @@ static int enic_set_port_profile(struct enic *enic, int vf)
+       struct vic_provinfo *vp;
+       const u8 oui[3] = VIC_PROVINFO_CISCO_OUI;
+       const __be16 os_type = htons(VIC_GENERIC_PROV_OS_TYPE_LINUX);
++      const u8 *client_mac;
+       char uuid_str[38];
+       char client_mac_str[18];
+-      u8 *client_mac;
+       int err;
+       ENIC_PP_BY_INDEX(enic, vf, pp, &err);
+diff --git a/drivers/net/ethernet/dlink/dl2k.c b/drivers/net/ethernet/dlink/dl2k.c
+index 202ecb1320534..993bba0ffb161 100644
+--- a/drivers/net/ethernet/dlink/dl2k.c
++++ b/drivers/net/ethernet/dlink/dl2k.c
+@@ -567,7 +567,7 @@ static void rio_hw_init(struct net_device *dev)
+        */
+       for (i = 0; i < 3; i++)
+               dw16(StationAddr0 + 2 * i,
+-                   cpu_to_le16(((u16 *)dev->dev_addr)[i]));
++                   cpu_to_le16(((const u16 *)dev->dev_addr)[i]));
+       set_multicast (dev);
+       if (np->coalesce) {
+diff --git a/drivers/net/ethernet/dnet.c b/drivers/net/ethernet/dnet.c
+index 14dc2e13bf038..667ef2b180470 100644
+--- a/drivers/net/ethernet/dnet.c
++++ b/drivers/net/ethernet/dnet.c
+@@ -60,11 +60,11 @@ static void __dnet_set_hwaddr(struct dnet *bp)
+ {
+       u16 tmp;
+-      tmp = be16_to_cpup((__be16 *)bp->dev->dev_addr);
++      tmp = be16_to_cpup((const __be16 *)bp->dev->dev_addr);
+       dnet_writew_mac(bp, DNET_INTERNAL_MAC_ADDR_0_REG, tmp);
+-      tmp = be16_to_cpup((__be16 *)(bp->dev->dev_addr + 2));
++      tmp = be16_to_cpup((const __be16 *)(bp->dev->dev_addr + 2));
+       dnet_writew_mac(bp, DNET_INTERNAL_MAC_ADDR_1_REG, tmp);
+-      tmp = be16_to_cpup((__be16 *)(bp->dev->dev_addr + 4));
++      tmp = be16_to_cpup((const __be16 *)(bp->dev->dev_addr + 4));
+       dnet_writew_mac(bp, DNET_INTERNAL_MAC_ADDR_2_REG, tmp);
+ }
+diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c
+index 1288b5e3d2201..b4f5e57d0285c 100644
+--- a/drivers/net/ethernet/emulex/benet/be_cmds.c
++++ b/drivers/net/ethernet/emulex/benet/be_cmds.c
+@@ -1080,7 +1080,7 @@ int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
+ }
+ /* Uses synchronous MCCQ */
+-int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr,
++int be_cmd_pmac_add(struct be_adapter *adapter, const u8 *mac_addr,
+                   u32 if_id, u32 *pmac_id, u32 domain)
+ {
+       struct be_mcc_wrb *wrb;
+diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h
+index 9e17d6a7ab8cd..e2085c68c0ee7 100644
+--- a/drivers/net/ethernet/emulex/benet/be_cmds.h
++++ b/drivers/net/ethernet/emulex/benet/be_cmds.h
+@@ -2385,7 +2385,7 @@ int be_pci_fnum_get(struct be_adapter *adapter);
+ int be_fw_wait_ready(struct be_adapter *adapter);
+ int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
+                         bool permanent, u32 if_handle, u32 pmac_id);
+-int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr, u32 if_id,
++int be_cmd_pmac_add(struct be_adapter *adapter, const u8 *mac_addr, u32 if_id,
+                   u32 *pmac_id, u32 domain);
+ int be_cmd_pmac_del(struct be_adapter *adapter, u32 if_id, int pmac_id,
+                   u32 domain);
+diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
+index a61b368286e0b..b91029db1f211 100644
+--- a/drivers/net/ethernet/emulex/benet/be_main.c
++++ b/drivers/net/ethernet/emulex/benet/be_main.c
+@@ -272,7 +272,7 @@ void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm, u16 num_popped)
+       iowrite32(val, adapter->db + DB_CQ_OFFSET);
+ }
+-static int be_dev_mac_add(struct be_adapter *adapter, u8 *mac)
++static int be_dev_mac_add(struct be_adapter *adapter, const u8 *mac)
+ {
+       int i;
+diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
+index 7f456297fc458..b6c3c562107c8 100644
+--- a/drivers/net/ethernet/ethoc.c
++++ b/drivers/net/ethernet/ethoc.c
+@@ -806,8 +806,8 @@ static int ethoc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+ static void ethoc_do_set_mac_address(struct net_device *dev)
+ {
++      const unsigned char *mac = dev->dev_addr;
+       struct ethoc *priv = netdev_priv(dev);
+-      unsigned char *mac = dev->dev_addr;
+       ethoc_write(priv, MAC_ADDR0, (mac[2] << 24) | (mac[3] << 16) |
+                                    (mac[4] <<  8) | (mac[5] <<  0));
+diff --git a/drivers/net/ethernet/fealnx.c b/drivers/net/ethernet/fealnx.c
+index 819266d463b07..ab194c9b0691e 100644
+--- a/drivers/net/ethernet/fealnx.c
++++ b/drivers/net/ethernet/fealnx.c
+@@ -827,7 +827,7 @@ static int netdev_open(struct net_device *dev)
+               return -EAGAIN;
+       for (i = 0; i < 3; i++)
+-              iowrite16(((unsigned short*)dev->dev_addr)[i],
++              iowrite16(((const unsigned short *)dev->dev_addr)[i],
+                               ioaddr + PAR0 + i*2);
+       init_ring(dev);
+diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+index fe5fc2b3406f9..1766b7d94ffa0 100644
+--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
++++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+@@ -272,7 +272,7 @@ static int dpaa_netdev_init(struct net_device *net_dev,
+       } else {
+               eth_hw_addr_random(net_dev);
+               err = priv->mac_dev->change_addr(priv->mac_dev->fman_mac,
+-                      (enet_addr_t *)net_dev->dev_addr);
++                      (const enet_addr_t *)net_dev->dev_addr);
+               if (err) {
+                       dev_err(dev, "Failed to set random MAC address\n");
+                       return -EINVAL;
+@@ -452,7 +452,7 @@ static int dpaa_set_mac_address(struct net_device *net_dev, void *addr)
+       mac_dev = priv->mac_dev;
+       err = mac_dev->change_addr(mac_dev->fman_mac,
+-                                 (enet_addr_t *)net_dev->dev_addr);
++                                 (const enet_addr_t *)net_dev->dev_addr);
+       if (err < 0) {
+               netif_err(priv, drv, net_dev, "mac_dev->change_addr() = %d\n",
+                         err);
+diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/fman_dtsec.c
+index bce3c9398887c..1950a8936bc0c 100644
+--- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c
++++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c
+@@ -366,7 +366,7 @@ static void set_dflts(struct dtsec_cfg *cfg)
+       cfg->maximum_frame = DEFAULT_MAXIMUM_FRAME;
+ }
+-static void set_mac_address(struct dtsec_regs __iomem *regs, u8 *adr)
++static void set_mac_address(struct dtsec_regs __iomem *regs, const u8 *adr)
+ {
+       u32 tmp;
+@@ -516,7 +516,7 @@ static int init(struct dtsec_regs __iomem *regs, struct dtsec_cfg *cfg,
+       if (addr) {
+               MAKE_ENET_ADDR_FROM_UINT64(addr, eth_addr);
+-              set_mac_address(regs, (u8 *)eth_addr);
++              set_mac_address(regs, (const u8 *)eth_addr);
+       }
+       /* HASH */
+@@ -1022,7 +1022,7 @@ int dtsec_accept_rx_pause_frames(struct fman_mac *dtsec, bool en)
+       return 0;
+ }
+-int dtsec_modify_mac_address(struct fman_mac *dtsec, enet_addr_t *enet_addr)
++int dtsec_modify_mac_address(struct fman_mac *dtsec, const enet_addr_t *enet_addr)
+ {
+       struct dtsec_regs __iomem *regs = dtsec->regs;
+       enum comm_mode mode = COMM_MODE_NONE;
+@@ -1041,7 +1041,7 @@ int dtsec_modify_mac_address(struct fman_mac *dtsec, enet_addr_t *enet_addr)
+        * Station address have to be swapped (big endian to little endian
+        */
+       dtsec->addr = ENET_ADDR_TO_UINT64(*enet_addr);
+-      set_mac_address(dtsec->regs, (u8 *)(*enet_addr));
++      set_mac_address(dtsec->regs, (const u8 *)(*enet_addr));
+       graceful_start(dtsec, mode);
+diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.h b/drivers/net/ethernet/freescale/fman/fman_dtsec.h
+index 5149d96ec2c15..68512c3bd6e52 100644
+--- a/drivers/net/ethernet/freescale/fman/fman_dtsec.h
++++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.h
+@@ -37,7 +37,7 @@
+ struct fman_mac *dtsec_config(struct fman_mac_params *params);
+ int dtsec_set_promiscuous(struct fman_mac *dtsec, bool new_val);
+-int dtsec_modify_mac_address(struct fman_mac *dtsec, enet_addr_t *enet_addr);
++int dtsec_modify_mac_address(struct fman_mac *dtsec, const enet_addr_t *enet_addr);
+ int dtsec_adjust_link(struct fman_mac *dtsec,
+                     u16 speed);
+ int dtsec_restart_autoneg(struct fman_mac *dtsec);
+diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c
+index 62f42921933d6..2216b7f51d26e 100644
+--- a/drivers/net/ethernet/freescale/fman/fman_memac.c
++++ b/drivers/net/ethernet/freescale/fman/fman_memac.c
+@@ -354,7 +354,7 @@ struct fman_mac {
+       bool allmulti_enabled;
+ };
+-static void add_addr_in_paddr(struct memac_regs __iomem *regs, u8 *adr,
++static void add_addr_in_paddr(struct memac_regs __iomem *regs, const u8 *adr,
+                             u8 paddr_num)
+ {
+       u32 tmp0, tmp1;
+@@ -897,12 +897,12 @@ int memac_accept_rx_pause_frames(struct fman_mac *memac, bool en)
+       return 0;
+ }
+-int memac_modify_mac_address(struct fman_mac *memac, enet_addr_t *enet_addr)
++int memac_modify_mac_address(struct fman_mac *memac, const enet_addr_t *enet_addr)
+ {
+       if (!is_init_done(memac->memac_drv_param))
+               return -EINVAL;
+-      add_addr_in_paddr(memac->regs, (u8 *)(*enet_addr), 0);
++      add_addr_in_paddr(memac->regs, (const u8 *)(*enet_addr), 0);
+       return 0;
+ }
+@@ -1058,7 +1058,7 @@ int memac_init(struct fman_mac *memac)
+       /* MAC Address */
+       if (memac->addr != 0) {
+               MAKE_ENET_ADDR_FROM_UINT64(memac->addr, eth_addr);
+-              add_addr_in_paddr(memac->regs, (u8 *)eth_addr, 0);
++              add_addr_in_paddr(memac->regs, (const u8 *)eth_addr, 0);
+       }
+       fixed_link = memac_drv_param->fixed_link;
+diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.h b/drivers/net/ethernet/freescale/fman/fman_memac.h
+index b2c671ec0ce79..3820f7a229834 100644
+--- a/drivers/net/ethernet/freescale/fman/fman_memac.h
++++ b/drivers/net/ethernet/freescale/fman/fman_memac.h
+@@ -40,7 +40,7 @@
+ struct fman_mac *memac_config(struct fman_mac_params *params);
+ int memac_set_promiscuous(struct fman_mac *memac, bool new_val);
+-int memac_modify_mac_address(struct fman_mac *memac, enet_addr_t *enet_addr);
++int memac_modify_mac_address(struct fman_mac *memac, const enet_addr_t *enet_addr);
+ int memac_adjust_link(struct fman_mac *memac, u16 speed);
+ int memac_cfg_max_frame_len(struct fman_mac *memac, u16 new_val);
+ int memac_cfg_reset_on_init(struct fman_mac *memac, bool enable);
+diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c
+index 41946b16f6c72..311c1906e0446 100644
+--- a/drivers/net/ethernet/freescale/fman/fman_tgec.c
++++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c
+@@ -221,7 +221,7 @@ struct fman_mac {
+       bool allmulti_enabled;
+ };
+-static void set_mac_address(struct tgec_regs __iomem *regs, u8 *adr)
++static void set_mac_address(struct tgec_regs __iomem *regs, const u8 *adr)
+ {
+       u32 tmp0, tmp1;
+@@ -514,13 +514,13 @@ int tgec_accept_rx_pause_frames(struct fman_mac *tgec, bool en)
+       return 0;
+ }
+-int tgec_modify_mac_address(struct fman_mac *tgec, enet_addr_t *p_enet_addr)
++int tgec_modify_mac_address(struct fman_mac *tgec, const enet_addr_t *p_enet_addr)
+ {
+       if (!is_init_done(tgec->cfg))
+               return -EINVAL;
+       tgec->addr = ENET_ADDR_TO_UINT64(*p_enet_addr);
+-      set_mac_address(tgec->regs, (u8 *)(*p_enet_addr));
++      set_mac_address(tgec->regs, (const u8 *)(*p_enet_addr));
+       return 0;
+ }
+@@ -704,7 +704,7 @@ int tgec_init(struct fman_mac *tgec)
+       if (tgec->addr) {
+               MAKE_ENET_ADDR_FROM_UINT64(tgec->addr, eth_addr);
+-              set_mac_address(tgec->regs, (u8 *)eth_addr);
++              set_mac_address(tgec->regs, (const u8 *)eth_addr);
+       }
+       /* interrupts */
+diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.h b/drivers/net/ethernet/freescale/fman/fman_tgec.h
+index 3bfd1062b386d..b28b20b261482 100644
+--- a/drivers/net/ethernet/freescale/fman/fman_tgec.h
++++ b/drivers/net/ethernet/freescale/fman/fman_tgec.h
+@@ -37,7 +37,7 @@
+ struct fman_mac *tgec_config(struct fman_mac_params *params);
+ int tgec_set_promiscuous(struct fman_mac *tgec, bool new_val);
+-int tgec_modify_mac_address(struct fman_mac *tgec, enet_addr_t *enet_addr);
++int tgec_modify_mac_address(struct fman_mac *tgec, const enet_addr_t *enet_addr);
+ int tgec_cfg_max_frame_len(struct fman_mac *tgec, u16 new_val);
+ int tgec_enable(struct fman_mac *tgec, enum comm_mode mode);
+ int tgec_disable(struct fman_mac *tgec, enum comm_mode mode);
+diff --git a/drivers/net/ethernet/freescale/fman/mac.h b/drivers/net/ethernet/freescale/fman/mac.h
+index 824a81a9f3507..daa285a9b8b25 100644
+--- a/drivers/net/ethernet/freescale/fman/mac.h
++++ b/drivers/net/ethernet/freescale/fman/mac.h
+@@ -66,7 +66,7 @@ struct mac_device {
+       int (*stop)(struct mac_device *mac_dev);
+       void (*adjust_link)(struct mac_device *mac_dev);
+       int (*set_promisc)(struct fman_mac *mac_dev, bool enable);
+-      int (*change_addr)(struct fman_mac *mac_dev, enet_addr_t *enet_addr);
++      int (*change_addr)(struct fman_mac *mac_dev, const enet_addr_t *enet_addr);
+       int (*set_allmulti)(struct fman_mac *mac_dev, bool enable);
+       int (*set_tstamp)(struct fman_mac *mac_dev, bool enable);
+       int (*set_multi)(struct net_device *net_dev,
+diff --git a/drivers/net/ethernet/hisilicon/hisi_femac.c b/drivers/net/ethernet/hisilicon/hisi_femac.c
+index 05cb4582a58d5..d881f8de74fc3 100644
+--- a/drivers/net/ethernet/hisilicon/hisi_femac.c
++++ b/drivers/net/ethernet/hisilicon/hisi_femac.c
+@@ -427,7 +427,7 @@ static void hisi_femac_free_skb_rings(struct hisi_femac_priv *priv)
+ }
+ static int hisi_femac_set_hw_mac_addr(struct hisi_femac_priv *priv,
+-                                    unsigned char *mac)
++                                    const unsigned char *mac)
+ {
+       u32 reg;
+diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
+index 923191b9a87d4..b981b6cbe6fff 100644
+--- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
++++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
+@@ -429,7 +429,7 @@ static void hix5hd2_port_disable(struct hix5hd2_priv *priv)
+ static void hix5hd2_hw_set_mac_addr(struct net_device *dev)
+ {
+       struct hix5hd2_priv *priv = netdev_priv(dev);
+-      unsigned char *mac = dev->dev_addr;
++      const unsigned char *mac = dev->dev_addr;
+       u32 val;
+       val = mac[1] | (mac[0] << 8);
+diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h b/drivers/net/ethernet/hisilicon/hns/hnae.h
+index 2b7db1c22321e..3d6de4cfa9f78 100644
+--- a/drivers/net/ethernet/hisilicon/hns/hnae.h
++++ b/drivers/net/ethernet/hisilicon/hns/hnae.h
+@@ -499,7 +499,7 @@ struct hnae_ae_ops {
+                                  u32 *tx_usecs_high, u32 *rx_usecs_high);
+       void (*set_promisc_mode)(struct hnae_handle *handle, u32 en);
+       int (*get_mac_addr)(struct hnae_handle *handle, void **p);
+-      int (*set_mac_addr)(struct hnae_handle *handle, void *p);
++      int (*set_mac_addr)(struct hnae_handle *handle, const void *p);
+       int (*add_uc_addr)(struct hnae_handle *handle,
+                          const unsigned char *addr);
+       int (*rm_uc_addr)(struct hnae_handle *handle,
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
+index 75e4ec569da84..b13ee48b458c5 100644
+--- a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
++++ b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
+@@ -207,7 +207,7 @@ static void hns_ae_fini_queue(struct hnae_queue *q)
+               hns_rcb_reset_ring_hw(q);
+ }
+-static int hns_ae_set_mac_address(struct hnae_handle *handle, void *p)
++static int hns_ae_set_mac_address(struct hnae_handle *handle, const void *p)
+ {
+       int ret;
+       struct hns_mac_cb *mac_cb = hns_get_mac_cb(handle);
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
+index f387a859a2010..8f391e2adcc0b 100644
+--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
++++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_gmac.c
+@@ -450,7 +450,7 @@ static void hns_gmac_update_stats(void *mac_drv)
+               += dsaf_read_dev(drv, GMAC_TX_PAUSE_FRAMES_REG);
+ }
+-static void hns_gmac_set_mac_addr(void *mac_drv, char *mac_addr)
++static void hns_gmac_set_mac_addr(void *mac_drv, const char *mac_addr)
+ {
+       struct mac_driver *drv = (struct mac_driver *)mac_drv;
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+index ec9a02495df47..236ee9b9d1e60 100644
+--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
++++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
+@@ -269,7 +269,7 @@ int hns_mac_get_inner_port_num(struct hns_mac_cb *mac_cb, u8 vmid, u8 *port_num)
+  *@addr:mac address
+  */
+ int hns_mac_change_vf_addr(struct hns_mac_cb *mac_cb,
+-                         u32 vmid, char *addr)
++                         u32 vmid, const char *addr)
+ {
+       int ret;
+       struct mac_driver *mac_ctrl_drv = hns_mac_get_drv(mac_cb);
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
+index 8943ffab4418d..e3bb05959ba97 100644
+--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
++++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h
+@@ -348,7 +348,7 @@ struct mac_driver {
+       /*disable mac when disable nic or dsaf*/
+       void (*mac_disable)(void *mac_drv, enum mac_commom_mode mode);
+       /* config mac address*/
+-      void (*set_mac_addr)(void *mac_drv,     char *mac_addr);
++      void (*set_mac_addr)(void *mac_drv,     const char *mac_addr);
+       /*adjust mac mode of port,include speed and duplex*/
+       int (*adjust_link)(void *mac_drv, enum mac_speed speed,
+                          u32 full_duplex);
+@@ -425,7 +425,8 @@ int hns_mac_init(struct dsaf_device *dsaf_dev);
+ void mac_adjust_link(struct net_device *net_dev);
+ bool hns_mac_need_adjust_link(struct hns_mac_cb *mac_cb, int speed, int duplex);
+ void hns_mac_get_link_status(struct hns_mac_cb *mac_cb,       u32 *link_status);
+-int hns_mac_change_vf_addr(struct hns_mac_cb *mac_cb, u32 vmid, char *addr);
++int hns_mac_change_vf_addr(struct hns_mac_cb *mac_cb, u32 vmid,
++                         const char *addr);
+ int hns_mac_set_multi(struct hns_mac_cb *mac_cb,
+                     u32 port_num, char *addr, bool enable);
+ int hns_mac_vm_config_bc_en(struct hns_mac_cb *mac_cb, u32 vm, bool enable);
+diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
+index 401fef5f1d07d..fc26ffaae6202 100644
+--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
++++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_xgmac.c
+@@ -255,7 +255,7 @@ static void hns_xgmac_pausefrm_cfg(void *mac_drv, u32 rx_en, u32 tx_en)
+       dsaf_write_dev(drv, XGMAC_MAC_PAUSE_CTRL_REG, origin);
+ }
+-static void hns_xgmac_set_pausefrm_mac_addr(void *mac_drv, char *mac_addr)
++static void hns_xgmac_set_pausefrm_mac_addr(void *mac_drv, const char *mac_addr)
+ {
+       struct mac_driver *drv = (struct mac_driver *)mac_drv;
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
+index 695e299f534d5..b51afb83d023e 100644
+--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h
++++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h
+@@ -590,7 +590,7 @@ struct hnae3_ae_ops {
+                                  u32 *tx_usecs_high, u32 *rx_usecs_high);
+       void (*get_mac_addr)(struct hnae3_handle *handle, u8 *p);
+-      int (*set_mac_addr)(struct hnae3_handle *handle, void *p,
++      int (*set_mac_addr)(struct hnae3_handle *handle, const void *p,
+                           bool is_first);
+       int (*do_ioctl)(struct hnae3_handle *handle,
+                       struct ifreq *ifr, int cmd);
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+index 9e33f0f0b75dd..12274c2b9feab 100644
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+@@ -9444,7 +9444,7 @@ int hclge_update_mac_node_for_dev_addr(struct hclge_vport *vport,
+       return 0;
+ }
+-static int hclge_set_mac_addr(struct hnae3_handle *handle, void *p,
++static int hclge_set_mac_addr(struct hnae3_handle *handle, const void *p,
+                             bool is_first)
+ {
+       const unsigned char *new_addr = (const unsigned char *)p;
+diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
+index 880feeac06375..bd8468c2d9a68 100644
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
+@@ -1349,7 +1349,7 @@ static void hclgevf_get_mac_addr(struct hnae3_handle *handle, u8 *p)
+               ether_addr_copy(p, hdev->hw.mac.mac_addr);
+ }
+-static int hclgevf_set_mac_addr(struct hnae3_handle *handle, void *p,
++static int hclgevf_set_mac_addr(struct hnae3_handle *handle, const void *p,
+                               bool is_first)
+ {
+       struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle);
+diff --git a/drivers/net/ethernet/i825xx/sun3_82586.c b/drivers/net/ethernet/i825xx/sun3_82586.c
+index 0696f723228a1..18d32302c3c7a 100644
+--- a/drivers/net/ethernet/i825xx/sun3_82586.c
++++ b/drivers/net/ethernet/i825xx/sun3_82586.c
+@@ -461,7 +461,7 @@ static int init586(struct net_device *dev)
+       ias_cmd->cmd_cmd        = swab16(CMD_IASETUP | CMD_LAST);
+       ias_cmd->cmd_link       = 0xffff;
+-      memcpy((char *)&ias_cmd->iaddr,(char *) dev->dev_addr,ETH_ALEN);
++      memcpy((char *)&ias_cmd->iaddr,(const char *) dev->dev_addr,ETH_ALEN);
+       p->scb->cbl_offset = make16(ias_cmd);
+diff --git a/drivers/net/ethernet/intel/i40e/i40e.h b/drivers/net/ethernet/intel/i40e/i40e.h
+index 22802222d34d1..453a85410634e 100644
+--- a/drivers/net/ethernet/intel/i40e/i40e.h
++++ b/drivers/net/ethernet/intel/i40e/i40e.h
+@@ -437,7 +437,7 @@ static inline bool i40e_is_channel_macvlan(struct i40e_channel *ch)
+       return !!ch->fwd;
+ }
+-static inline u8 *i40e_channel_mac(struct i40e_channel *ch)
++static inline const u8 *i40e_channel_mac(struct i40e_channel *ch)
+ {
+       if (i40e_is_channel_macvlan(ch))
+               return ch->fwd->netdev->dev_addr;
+diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_hw.c b/drivers/net/ethernet/intel/ixgb/ixgb_hw.c
+index a430871d1c27e..c8d1e815ec6bc 100644
+--- a/drivers/net/ethernet/intel/ixgb/ixgb_hw.c
++++ b/drivers/net/ethernet/intel/ixgb/ixgb_hw.c
+@@ -549,7 +549,7 @@ ixgb_mta_set(struct ixgb_hw *hw,
+  *****************************************************************************/
+ void
+ ixgb_rar_set(struct ixgb_hw *hw,
+-                u8 *addr,
++                const u8 *addr,
+                 u32 index)
+ {
+       u32 rar_low, rar_high;
+diff --git a/drivers/net/ethernet/intel/ixgb/ixgb_hw.h b/drivers/net/ethernet/intel/ixgb/ixgb_hw.h
+index 6064583095da7..70bcff5fb3db9 100644
+--- a/drivers/net/ethernet/intel/ixgb/ixgb_hw.h
++++ b/drivers/net/ethernet/intel/ixgb/ixgb_hw.h
+@@ -740,7 +740,7 @@ bool ixgb_adapter_start(struct ixgb_hw *hw);
+ void ixgb_check_for_link(struct ixgb_hw *hw);
+ bool ixgb_check_for_bad_link(struct ixgb_hw *hw);
+-void ixgb_rar_set(struct ixgb_hw *hw, u8 *addr, u32 index);
++void ixgb_rar_set(struct ixgb_hw *hw, const u8 *addr, u32 index);
+ /* Filters (multicast, vlan, receive) */
+ void ixgb_mc_addr_list_update(struct ixgb_hw *hw, u8 *mc_addr_list,
+diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
+index fc67e9d31f6da..d37a0fba3d16b 100644
+--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
++++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
+@@ -1770,7 +1770,7 @@ static void uc_addr_get(struct mv643xx_eth_private *mp, unsigned char *addr)
+       addr[5] = mac_l & 0xff;
+ }
+-static void uc_addr_set(struct mv643xx_eth_private *mp, unsigned char *addr)
++static void uc_addr_set(struct mv643xx_eth_private *mp, const u8 *addr)
+ {
+       wrlp(mp, MAC_ADDR_HIGH,
+               (addr[0] << 24) | (addr[1] << 16) | (addr[2] << 8) | addr[3]);
+diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
+index 5fa81322a44be..3f124268bd4d4 100644
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -1623,8 +1623,8 @@ static void mvneta_set_ucast_addr(struct mvneta_port *pp, u8 last_nibble,
+ }
+ /* Set mac address */
+-static void mvneta_mac_addr_set(struct mvneta_port *pp, unsigned char *addr,
+-                              int queue)
++static void mvneta_mac_addr_set(struct mvneta_port *pp,
++                              const unsigned char *addr, int queue)
+ {
+       unsigned int mac_h;
+       unsigned int mac_l;
+diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
+index 8ebd13f089db2..11ef1d8dea15c 100644
+--- a/drivers/net/ethernet/marvell/pxa168_eth.c
++++ b/drivers/net/ethernet/marvell/pxa168_eth.c
+@@ -389,7 +389,7 @@ static void inverse_every_nibble(unsigned char *mac_addr)
+  * Outputs
+  * return the calculated entry.
+  */
+-static u32 hash_function(unsigned char *mac_addr_orig)
++static u32 hash_function(const unsigned char *mac_addr_orig)
+ {
+       u32 hash_result;
+       u32 addr0;
+@@ -434,7 +434,7 @@ static u32 hash_function(unsigned char *mac_addr_orig)
+  * -ENOSPC if table full
+  */
+ static int add_del_hash_entry(struct pxa168_eth_private *pep,
+-                            unsigned char *mac_addr,
++                            const unsigned char *mac_addr,
+                             u32 rd, u32 skip, int del)
+ {
+       struct addr_table_entry *entry, *start;
+@@ -521,7 +521,7 @@ static int add_del_hash_entry(struct pxa168_eth_private *pep,
+  */
+ static void update_hash_table_mac_address(struct pxa168_eth_private *pep,
+                                         unsigned char *oaddr,
+-                                        unsigned char *addr)
++                                        const unsigned char *addr)
+ {
+       /* Delete old entry */
+       if (oaddr)
+diff --git a/drivers/net/ethernet/mediatek/mtk_star_emac.c b/drivers/net/ethernet/mediatek/mtk_star_emac.c
+index 8f3493e146e50..67f9e4415ae92 100644
+--- a/drivers/net/ethernet/mediatek/mtk_star_emac.c
++++ b/drivers/net/ethernet/mediatek/mtk_star_emac.c
+@@ -522,7 +522,7 @@ static void mtk_star_dma_resume_tx(struct mtk_star_priv *priv)
+ static void mtk_star_set_mac_addr(struct net_device *ndev)
+ {
+       struct mtk_star_priv *priv = netdev_priv(ndev);
+-      u8 *mac_addr = ndev->dev_addr;
++      const u8 *mac_addr = ndev->dev_addr;
+       unsigned int high, low;
+       high = mac_addr[0] << 8 | mac_addr[1] << 0;
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
+index d226cc5ab1d16..aeff1d972a464 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c
+@@ -71,12 +71,12 @@ struct mlx5e_l2_hash_node {
+       bool   mpfs;
+ };
+-static inline int mlx5e_hash_l2(u8 *addr)
++static inline int mlx5e_hash_l2(const u8 *addr)
+ {
+       return addr[5];
+ }
+-static void mlx5e_add_l2_to_hash(struct hlist_head *hash, u8 *addr)
++static void mlx5e_add_l2_to_hash(struct hlist_head *hash, const u8 *addr)
+ {
+       struct mlx5e_l2_hash_node *hn;
+       int ix = mlx5e_hash_l2(addr);
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
+index 10940b8dc83e2..8ffc69e57dc65 100644
+--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
+@@ -223,7 +223,7 @@ void mlx5i_uninit_underlay_qp(struct mlx5e_priv *priv)
+ int mlx5i_create_underlay_qp(struct mlx5e_priv *priv)
+ {
+-      unsigned char *dev_addr = priv->netdev->dev_addr;
++      const unsigned char *dev_addr = priv->netdev->dev_addr;
+       u32 out[MLX5_ST_SZ_DW(create_qp_out)] = {};
+       u32 in[MLX5_ST_SZ_DW(create_qp_in)] = {};
+       struct mlx5i_priv *ipriv = priv->ppriv;
+diff --git a/drivers/net/ethernet/micrel/ks8842.c b/drivers/net/ethernet/micrel/ks8842.c
+index b27713906d3a6..b639557dbdc68 100644
+--- a/drivers/net/ethernet/micrel/ks8842.c
++++ b/drivers/net/ethernet/micrel/ks8842.c
+@@ -380,7 +380,7 @@ static void ks8842_read_mac_addr(struct ks8842_adapter *adapter, u8 *dest)
+       }
+ }
+-static void ks8842_write_mac_addr(struct ks8842_adapter *adapter, u8 *mac)
++static void ks8842_write_mac_addr(struct ks8842_adapter *adapter, const u8 *mac)
+ {
+       unsigned long flags;
+       unsigned i;
+diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
+index f56bcd3e36d21..4de7ac046265a 100644
+--- a/drivers/net/ethernet/micrel/ksz884x.c
++++ b/drivers/net/ethernet/micrel/ksz884x.c
+@@ -4033,7 +4033,7 @@ static void hw_set_add_addr(struct ksz_hw *hw)
+       }
+ }
+-static int hw_add_addr(struct ksz_hw *hw, u8 *mac_addr)
++static int hw_add_addr(struct ksz_hw *hw, const u8 *mac_addr)
+ {
+       int i;
+       int j = ADDITIONAL_ENTRIES;
+@@ -4054,7 +4054,7 @@ static int hw_add_addr(struct ksz_hw *hw, u8 *mac_addr)
+       return -1;
+ }
+-static int hw_del_addr(struct ksz_hw *hw, u8 *mac_addr)
++static int hw_del_addr(struct ksz_hw *hw, const u8 *mac_addr)
+ {
+       int i;
+diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+index 97c2604df019a..e6f18e004036a 100644
+--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
++++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+@@ -796,7 +796,8 @@ static int myri10ge_load_firmware(struct myri10ge_priv *mgp, int adopt)
+       return status;
+ }
+-static int myri10ge_update_mac_address(struct myri10ge_priv *mgp, u8 * addr)
++static int myri10ge_update_mac_address(struct myri10ge_priv *mgp,
++                                     const u8 * addr)
+ {
+       struct myri10ge_cmd cmd;
+       int status;
+diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c
+index 65ccdbe665e5c..7b50c5135bfa1 100644
+--- a/drivers/net/ethernet/neterion/s2io.c
++++ b/drivers/net/ethernet/neterion/s2io.c
+@@ -5217,7 +5217,7 @@ static int s2io_set_mac_addr(struct net_device *dev, void *p)
+  *  as defined in errno.h file on failure.
+  */
+-static int do_s2io_prog_unicast(struct net_device *dev, u8 *addr)
++static int do_s2io_prog_unicast(struct net_device *dev, const u8 *addr)
+ {
+       struct s2io_nic *sp = netdev_priv(dev);
+       register u64 mac_addr = 0, perm_addr = 0;
+diff --git a/drivers/net/ethernet/neterion/s2io.h b/drivers/net/ethernet/neterion/s2io.h
+index 5a6032212c19d..a4266d1544abb 100644
+--- a/drivers/net/ethernet/neterion/s2io.h
++++ b/drivers/net/ethernet/neterion/s2io.h
+@@ -1073,7 +1073,7 @@ static void s2io_reset(struct s2io_nic * sp);
+ static int s2io_poll_msix(struct napi_struct *napi, int budget);
+ static int s2io_poll_inta(struct napi_struct *napi, int budget);
+ static void s2io_init_pci(struct s2io_nic * sp);
+-static int do_s2io_prog_unicast(struct net_device *dev, u8 *addr);
++static int do_s2io_prog_unicast(struct net_device *dev, const u8 *addr);
+ static void s2io_alarm_handle(struct timer_list *t);
+ static irqreturn_t
+ s2io_msix_ring_handle(int irq, void *dev_id);
+diff --git a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
+index babd374333f34..cb43651ea9ba8 100644
+--- a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
++++ b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
+@@ -837,7 +837,7 @@ nfp_tunnel_put_ipv6_off(struct nfp_app *app, struct nfp_ipv6_addr_entry *entry)
+ }
+ static int
+-__nfp_tunnel_offload_mac(struct nfp_app *app, u8 *mac, u16 idx, bool del)
++__nfp_tunnel_offload_mac(struct nfp_app *app, const u8 *mac, u16 idx, bool del)
+ {
+       struct nfp_tun_mac_addr_offload payload;
+@@ -886,7 +886,7 @@ static bool nfp_tunnel_is_mac_idx_global(u16 nfp_mac_idx)
+ }
+ static struct nfp_tun_offloaded_mac *
+-nfp_tunnel_lookup_offloaded_macs(struct nfp_app *app, u8 *mac)
++nfp_tunnel_lookup_offloaded_macs(struct nfp_app *app, const u8 *mac)
+ {
+       struct nfp_flower_priv *priv = app->priv;
+@@ -1005,7 +1005,7 @@ nfp_tunnel_add_shared_mac(struct nfp_app *app, struct net_device *netdev,
+ static int
+ nfp_tunnel_del_shared_mac(struct nfp_app *app, struct net_device *netdev,
+-                        u8 *mac, bool mod)
++                        const u8 *mac, bool mod)
+ {
+       struct nfp_flower_priv *priv = app->priv;
+       struct nfp_flower_repr_priv *repr_priv;
+diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
+index b42b65fb034ed..0b8d605f5ad95 100644
+--- a/drivers/net/ethernet/nxp/lpc_eth.c
++++ b/drivers/net/ethernet/nxp/lpc_eth.c
+@@ -419,7 +419,7 @@ struct netdata_local {
+ /*
+  * MAC support functions
+  */
+-static void __lpc_set_mac(struct netdata_local *pldat, u8 *mac)
++static void __lpc_set_mac(struct netdata_local *pldat, const u8 *mac)
+ {
+       u32 tmp;
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c
+index ba445724ee65e..3478f6fba8265 100644
+--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c
++++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c
+@@ -951,7 +951,7 @@ qed_llh_remove_filter(struct qed_hwfn *p_hwfn,
+ }
+ int qed_llh_add_mac_filter(struct qed_dev *cdev,
+-                         u8 ppfid, u8 mac_addr[ETH_ALEN])
++                         u8 ppfid, const u8 mac_addr[ETH_ALEN])
+ {
+       struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev);
+       struct qed_ptt *p_ptt = qed_ptt_acquire(p_hwfn);
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev_api.h b/drivers/net/ethernet/qlogic/qed/qed_dev_api.h
+index a0a766a1723cc..2475058e7caaa 100644
+--- a/drivers/net/ethernet/qlogic/qed/qed_dev_api.h
++++ b/drivers/net/ethernet/qlogic/qed/qed_dev_api.h
+@@ -381,7 +381,7 @@ int qed_llh_set_roce_affinity(struct qed_dev *cdev, enum qed_eng eng);
+  * Return: Int.
+  */
+ int qed_llh_add_mac_filter(struct qed_dev *cdev,
+-                         u8 ppfid, u8 mac_addr[ETH_ALEN]);
++                         u8 ppfid, const u8 mac_addr[ETH_ALEN]);
+ /**
+  * qed_llh_remove_mac_filter(): Remove a LLH MAC filter from the given
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_l2.c b/drivers/net/ethernet/qlogic/qed/qed_l2.c
+index 6ffa6425a75a5..0872b6c85ab87 100644
+--- a/drivers/net/ethernet/qlogic/qed/qed_l2.c
++++ b/drivers/net/ethernet/qlogic/qed/qed_l2.c
+@@ -2857,7 +2857,7 @@ static int qed_fp_cqe_completion(struct qed_dev *dev,
+                                     cqe);
+ }
+-static int qed_req_bulletin_update_mac(struct qed_dev *cdev, u8 *mac)
++static int qed_req_bulletin_update_mac(struct qed_dev *cdev, const u8 *mac)
+ {
+       int i, ret;
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c
+index 26700b0b4b370..6e902d57c793c 100644
+--- a/drivers/net/ethernet/qlogic/qed/qed_main.c
++++ b/drivers/net/ethernet/qlogic/qed/qed_main.c
+@@ -2892,7 +2892,7 @@ static int qed_update_drv_state(struct qed_dev *cdev, bool active)
+       return status;
+ }
+-static int qed_update_mac(struct qed_dev *cdev, u8 *mac)
++static int qed_update_mac(struct qed_dev *cdev, const u8 *mac)
+ {
+       struct qed_hwfn *hwfn = QED_LEADING_HWFN(cdev);
+       struct qed_ptt *ptt;
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.c b/drivers/net/ethernet/qlogic/qed/qed_mcp.c
+index 24cd415677756..b734c120d508f 100644
+--- a/drivers/net/ethernet/qlogic/qed/qed_mcp.c
++++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.c
+@@ -2854,7 +2854,7 @@ int qed_mcp_ov_update_mtu(struct qed_hwfn *p_hwfn,
+ }
+ int qed_mcp_ov_update_mac(struct qed_hwfn *p_hwfn,
+-                        struct qed_ptt *p_ptt, u8 *mac)
++                        struct qed_ptt *p_ptt, const u8 *mac)
+ {
+       struct qed_mcp_mb_params mb_params;
+       u32 mfw_mac[2];
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_mcp.h b/drivers/net/ethernet/qlogic/qed/qed_mcp.h
+index 352b757183e8e..526cfdf7ffcca 100644
+--- a/drivers/net/ethernet/qlogic/qed/qed_mcp.h
++++ b/drivers/net/ethernet/qlogic/qed/qed_mcp.h
+@@ -536,7 +536,7 @@ int qed_mcp_ov_update_mtu(struct qed_hwfn *p_hwfn,
+  * Return: Int - 0 - Operation was successul.
+  */
+ int qed_mcp_ov_update_mac(struct qed_hwfn *p_hwfn,
+-                        struct qed_ptt *p_ptt, u8 *mac);
++                        struct qed_ptt *p_ptt, const u8 *mac);
+ /**
+  * qed_mcp_ov_update_wol(): Send WOL mode to MFW.
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_rdma.c b/drivers/net/ethernet/qlogic/qed/qed_rdma.c
+index 4f4b79250a2b2..725ace88272ed 100644
+--- a/drivers/net/ethernet/qlogic/qed/qed_rdma.c
++++ b/drivers/net/ethernet/qlogic/qed/qed_rdma.c
+@@ -1966,7 +1966,7 @@ static void qed_rdma_remove_user(void *rdma_cxt, u16 dpi)
+ static int qed_roce_ll2_set_mac_filter(struct qed_dev *cdev,
+                                      u8 *old_mac_address,
+-                                     u8 *new_mac_address)
++                                     const u8 *new_mac_address)
+ {
+       int rc = 0;
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_vf.c b/drivers/net/ethernet/qlogic/qed/qed_vf.c
+index e2a5a6a373cbe..f25d9676e5723 100644
+--- a/drivers/net/ethernet/qlogic/qed/qed_vf.c
++++ b/drivers/net/ethernet/qlogic/qed/qed_vf.c
+@@ -1379,7 +1379,7 @@ int qed_vf_pf_get_coalesce(struct qed_hwfn *p_hwfn,
+ int
+ qed_vf_pf_bulletin_update_mac(struct qed_hwfn *p_hwfn,
+-                            u8 *p_mac)
++                            const u8 *p_mac)
+ {
+       struct qed_vf_iov *p_iov = p_hwfn->vf_iov_info;
+       struct vfpf_bulletin_update_mac_tlv *p_req;
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_vf.h b/drivers/net/ethernet/qlogic/qed/qed_vf.h
+index 976201fc7d4ae..a6492f2654879 100644
+--- a/drivers/net/ethernet/qlogic/qed/qed_vf.h
++++ b/drivers/net/ethernet/qlogic/qed/qed_vf.h
+@@ -1070,7 +1070,7 @@ u32 qed_vf_hw_bar_size(struct qed_hwfn *p_hwfn, enum BAR_ID bar_id);
+  *
+  * Return: Int.
+  */
+-int qed_vf_pf_bulletin_update_mac(struct qed_hwfn *p_hwfn, u8 *p_mac);
++int qed_vf_pf_bulletin_update_mac(struct qed_hwfn *p_hwfn, const u8 *p_mac);
+ #else
+ static inline void qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
+@@ -1259,7 +1259,7 @@ static inline int qed_vf_pf_tunnel_param_update(struct qed_hwfn *p_hwfn,
+ }
+ static inline int qed_vf_pf_bulletin_update_mac(struct qed_hwfn *p_hwfn,
+-                                              u8 *p_mac)
++                                              const u8 *p_mac)
+ {
+       return -EINVAL;
+ }
+diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c
+index 03c51dd37e1f3..3010833ddde33 100644
+--- a/drivers/net/ethernet/qlogic/qede/qede_filter.c
++++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c
+@@ -617,7 +617,7 @@ void qede_fill_rss_params(struct qede_dev *edev,
+ static int qede_set_ucast_rx_mac(struct qede_dev *edev,
+                                enum qed_filter_xcast_params_type opcode,
+-                               unsigned char mac[ETH_ALEN])
++                               const unsigned char mac[ETH_ALEN])
+ {
+       struct qed_filter_ucast_params ucast;
+diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
+index 87b8c032195d0..06104d2ff5b35 100644
+--- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c
++++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
+@@ -420,7 +420,7 @@ static void emac_mac_dma_config(struct emac_adapter *adpt)
+ }
+ /* set MAC address */
+-static void emac_set_mac_address(struct emac_adapter *adpt, u8 *addr)
++static void emac_set_mac_address(struct emac_adapter *adpt, const u8 *addr)
+ {
+       u32 sta;
+diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c
+index 5a8a6977ec9a7..91e136bc2c679 100644
+--- a/drivers/net/ethernet/rdc/r6040.c
++++ b/drivers/net/ethernet/rdc/r6040.c
+@@ -453,7 +453,7 @@ static void r6040_down(struct net_device *dev)
+ {
+       struct r6040_private *lp = netdev_priv(dev);
+       void __iomem *ioaddr = lp->base;
+-      u16 *adrp;
++      const u16 *adrp;
+       /* Stop MAC */
+       iowrite16(MSK_INT, ioaddr + MIER);      /* Mask Off Interrupt */
+@@ -462,7 +462,7 @@ static void r6040_down(struct net_device *dev)
+       r6040_reset_mac(lp);
+       /* Restore MAC Address to MIDx */
+-      adrp = (u16 *) dev->dev_addr;
++      adrp = (const u16 *) dev->dev_addr;
+       iowrite16(adrp[0], ioaddr + MID_0L);
+       iowrite16(adrp[1], ioaddr + MID_0M);
+       iowrite16(adrp[2], ioaddr + MID_0H);
+@@ -731,13 +731,13 @@ static void r6040_mac_address(struct net_device *dev)
+ {
+       struct r6040_private *lp = netdev_priv(dev);
+       void __iomem *ioaddr = lp->base;
+-      u16 *adrp;
++      const u16 *adrp;
+       /* Reset MAC */
+       r6040_reset_mac(lp);
+       /* Restore MAC Address */
+-      adrp = (u16 *) dev->dev_addr;
++      adrp = (const u16 *) dev->dev_addr;
+       iowrite16(adrp[0], ioaddr + MID_0L);
+       iowrite16(adrp[1], ioaddr + MID_0M);
+       iowrite16(adrp[2], ioaddr + MID_0H);
+@@ -849,13 +849,13 @@ static void r6040_multicast_list(struct net_device *dev)
+       unsigned long flags;
+       struct netdev_hw_addr *ha;
+       int i;
+-      u16 *adrp;
++      const u16 *adrp;
+       u16 hash_table[4] = { 0 };
+       spin_lock_irqsave(&lp->lock, flags);
+       /* Keep our MAC Address */
+-      adrp = (u16 *)dev->dev_addr;
++      adrp = (const u16 *)dev->dev_addr;
+       iowrite16(adrp[0], ioaddr + MID_0L);
+       iowrite16(adrp[1], ioaddr + MID_0M);
+       iowrite16(adrp[2], ioaddr + MID_0H);
+diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
+index 049dc6cf46116..0f45107db8dda 100644
+--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
++++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_common.h
+@@ -329,7 +329,7 @@ struct sxgbe_core_ops {
+       /* Set power management mode (e.g. magic frame) */
+       void (*pmt)(void __iomem *ioaddr, unsigned long mode);
+       /* Set/Get Unicast MAC addresses */
+-      void (*set_umac_addr)(void __iomem *ioaddr, unsigned char *addr,
++      void (*set_umac_addr)(void __iomem *ioaddr, const unsigned char *addr,
+                             unsigned int reg_n);
+       void (*get_umac_addr)(void __iomem *ioaddr, unsigned char *addr,
+                             unsigned int reg_n);
+diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
+index e96e2bd295efb..7d9f257de92a8 100644
+--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
++++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_core.c
+@@ -85,7 +85,8 @@ static void sxgbe_core_pmt(void __iomem *ioaddr, unsigned long mode)
+ }
+ /* Set/Get Unicast MAC addresses */
+-static void sxgbe_core_set_umac_addr(void __iomem *ioaddr, unsigned char *addr,
++static void sxgbe_core_set_umac_addr(void __iomem *ioaddr,
++                                   const unsigned char *addr,
+                                    unsigned int reg_n)
+ {
+       u32 high_word, low_word;
+diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
+index b20dbda37c7ef..d8b3b339a8df2 100644
+--- a/drivers/net/ethernet/sfc/ef10.c
++++ b/drivers/net/ethernet/sfc/ef10.c
+@@ -1038,7 +1038,7 @@ int efx_ef10_vadaptor_free(struct efx_nic *efx, unsigned int port_id)
+ }
+ int efx_ef10_vport_add_mac(struct efx_nic *efx,
+-                         unsigned int port_id, u8 *mac)
++                         unsigned int port_id, const u8 *mac)
+ {
+       MCDI_DECLARE_BUF(inbuf, MC_CMD_VPORT_ADD_MAC_ADDRESS_IN_LEN);
+@@ -1050,7 +1050,7 @@ int efx_ef10_vport_add_mac(struct efx_nic *efx,
+ }
+ int efx_ef10_vport_del_mac(struct efx_nic *efx,
+-                         unsigned int port_id, u8 *mac)
++                         unsigned int port_id, const u8 *mac)
+ {
+       MCDI_DECLARE_BUF(inbuf, MC_CMD_VPORT_DEL_MAC_ADDRESS_IN_LEN);
+diff --git a/drivers/net/ethernet/sfc/ef10_sriov.c b/drivers/net/ethernet/sfc/ef10_sriov.c
+index eeaecea77cb83..92550c7e85ce2 100644
+--- a/drivers/net/ethernet/sfc/ef10_sriov.c
++++ b/drivers/net/ethernet/sfc/ef10_sriov.c
+@@ -484,7 +484,7 @@ static int efx_ef10_vport_del_vf_mac(struct efx_nic *efx, unsigned int port_id,
+       return rc;
+ }
+-int efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int vf_i, u8 *mac)
++int efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int vf_i, const u8 *mac)
+ {
+       struct efx_ef10_nic_data *nic_data = efx->nic_data;
+       struct ef10_vf *vf;
+diff --git a/drivers/net/ethernet/sfc/ef10_sriov.h b/drivers/net/ethernet/sfc/ef10_sriov.h
+index cfe556d17313f..3c703ca878b0a 100644
+--- a/drivers/net/ethernet/sfc/ef10_sriov.h
++++ b/drivers/net/ethernet/sfc/ef10_sriov.h
+@@ -39,7 +39,7 @@ static inline void efx_ef10_sriov_reset(struct efx_nic *efx) {}
+ void efx_ef10_sriov_fini(struct efx_nic *efx);
+ static inline void efx_ef10_sriov_flr(struct efx_nic *efx, unsigned vf_i) {}
+-int efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int vf, u8 *mac);
++int efx_ef10_sriov_set_vf_mac(struct efx_nic *efx, int vf, const u8 *mac);
+ int efx_ef10_sriov_set_vf_vlan(struct efx_nic *efx, int vf_i,
+                              u16 vlan, u8 qos);
+@@ -60,9 +60,9 @@ int efx_ef10_vswitching_restore_vf(struct efx_nic *efx);
+ void efx_ef10_vswitching_remove_pf(struct efx_nic *efx);
+ void efx_ef10_vswitching_remove_vf(struct efx_nic *efx);
+ int efx_ef10_vport_add_mac(struct efx_nic *efx,
+-                         unsigned int port_id, u8 *mac);
++                         unsigned int port_id, const u8 *mac);
+ int efx_ef10_vport_del_mac(struct efx_nic *efx,
+-                         unsigned int port_id, u8 *mac);
++                         unsigned int port_id, const u8 *mac);
+ int efx_ef10_vadaptor_alloc(struct efx_nic *efx, unsigned int port_id);
+ int efx_ef10_vadaptor_query(struct efx_nic *efx, unsigned int port_id,
+                           u32 *port_flags, u32 *vadaptor_flags,
+diff --git a/drivers/net/ethernet/sfc/net_driver.h b/drivers/net/ethernet/sfc/net_driver.h
+index 6df500dbb6b7f..67a9758467b1e 100644
+--- a/drivers/net/ethernet/sfc/net_driver.h
++++ b/drivers/net/ethernet/sfc/net_driver.h
+@@ -1482,7 +1482,7 @@ struct efx_nic_type {
+       bool (*sriov_wanted)(struct efx_nic *efx);
+       void (*sriov_reset)(struct efx_nic *efx);
+       void (*sriov_flr)(struct efx_nic *efx, unsigned vf_i);
+-      int (*sriov_set_vf_mac)(struct efx_nic *efx, int vf_i, u8 *mac);
++      int (*sriov_set_vf_mac)(struct efx_nic *efx, int vf_i, const u8 *mac);
+       int (*sriov_set_vf_vlan)(struct efx_nic *efx, int vf_i, u16 vlan,
+                                u8 qos);
+       int (*sriov_set_vf_spoofchk)(struct efx_nic *efx, int vf_i,
+diff --git a/drivers/net/ethernet/sfc/siena_sriov.c b/drivers/net/ethernet/sfc/siena_sriov.c
+index 441e7f3e53751..f12851a527d9f 100644
+--- a/drivers/net/ethernet/sfc/siena_sriov.c
++++ b/drivers/net/ethernet/sfc/siena_sriov.c
+@@ -1591,7 +1591,7 @@ void efx_fini_sriov(void)
+       destroy_workqueue(vfdi_workqueue);
+ }
+-int efx_siena_sriov_set_vf_mac(struct efx_nic *efx, int vf_i, u8 *mac)
++int efx_siena_sriov_set_vf_mac(struct efx_nic *efx, int vf_i, const u8 *mac)
+ {
+       struct siena_nic_data *nic_data = efx->nic_data;
+       struct siena_vf *vf;
+diff --git a/drivers/net/ethernet/sfc/siena_sriov.h b/drivers/net/ethernet/sfc/siena_sriov.h
+index e441c89c25ce5..e548c4daf1897 100644
+--- a/drivers/net/ethernet/sfc/siena_sriov.h
++++ b/drivers/net/ethernet/sfc/siena_sriov.h
+@@ -46,7 +46,7 @@ bool efx_siena_sriov_wanted(struct efx_nic *efx);
+ void efx_siena_sriov_reset(struct efx_nic *efx);
+ void efx_siena_sriov_flr(struct efx_nic *efx, unsigned flr);
+-int efx_siena_sriov_set_vf_mac(struct efx_nic *efx, int vf, u8 *mac);
++int efx_siena_sriov_set_vf_mac(struct efx_nic *efx, int vf, const u8 *mac);
+ int efx_siena_sriov_set_vf_vlan(struct efx_nic *efx, int vf,
+                               u16 vlan, u8 qos);
+ int efx_siena_sriov_set_vf_spoofchk(struct efx_nic *efx, int vf,
+diff --git a/drivers/net/ethernet/sis/sis900.c b/drivers/net/ethernet/sis/sis900.c
+index 60a0c0e9ded22..d105779ba3b29 100644
+--- a/drivers/net/ethernet/sis/sis900.c
++++ b/drivers/net/ethernet/sis/sis900.c
+@@ -1098,7 +1098,7 @@ sis900_init_rxfilter (struct net_device * net_dev)
+       /* load MAC addr to filter data register */
+       for (i = 0 ; i < 3 ; i++) {
+-              u32 w = (u32) *((u16 *)(net_dev->dev_addr)+i);
++              u32 w = (u32) *((const u16 *)(net_dev->dev_addr)+i);
+               sw32(rfcr, i << RFADDR_shift);
+               sw32(rfdr, w);
+diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
+index b330dcbe949df..42f79147739b9 100644
+--- a/drivers/net/ethernet/smsc/smsc911x.c
++++ b/drivers/net/ethernet/smsc/smsc911x.c
+@@ -1508,7 +1508,7 @@ static int smsc911x_soft_reset(struct smsc911x_data *pdata)
+ /* Sets the device MAC address to dev_addr, called with mac_lock held */
+ static void
+-smsc911x_set_hw_mac_address(struct smsc911x_data *pdata, u8 dev_addr[6])
++smsc911x_set_hw_mac_address(struct smsc911x_data *pdata, const u8 dev_addr[6])
+ {
+       u32 mac_high16 = (dev_addr[5] << 8) | dev_addr[4];
+       u32 mac_low32 = (dev_addr[3] << 24) | (dev_addr[2] << 16) |
+diff --git a/drivers/net/ethernet/smsc/smsc9420.c b/drivers/net/ethernet/smsc/smsc9420.c
+index fdbd2a43e2675..2bded73136008 100644
+--- a/drivers/net/ethernet/smsc/smsc9420.c
++++ b/drivers/net/ethernet/smsc/smsc9420.c
+@@ -404,7 +404,7 @@ static const struct ethtool_ops smsc9420_ethtool_ops = {
+ static void smsc9420_set_mac_address(struct net_device *dev)
+ {
+       struct smsc9420_pdata *pd = netdev_priv(dev);
+-      u8 *dev_addr = dev->dev_addr;
++      const u8 *dev_addr = dev->dev_addr;
+       u32 mac_high16 = (dev_addr[5] << 8) | dev_addr[4];
+       u32 mac_low32 = (dev_addr[3] << 24) | (dev_addr[2] << 16) |
+           (dev_addr[1] << 8) | dev_addr[0];
+diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
+index c113ec56f5b02..c03ac229e9367 100644
+--- a/drivers/net/ethernet/stmicro/stmmac/common.h
++++ b/drivers/net/ethernet/stmicro/stmmac/common.h
+@@ -545,13 +545,13 @@ int dwmac4_setup(struct stmmac_priv *priv);
+ int dwxgmac2_setup(struct stmmac_priv *priv);
+ int dwxlgmac2_setup(struct stmmac_priv *priv);
+-void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
++void stmmac_set_mac_addr(void __iomem *ioaddr, const u8 addr[6],
+                        unsigned int high, unsigned int low);
+ void stmmac_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
+                        unsigned int high, unsigned int low);
+ void stmmac_set_mac(void __iomem *ioaddr, bool enable);
+-void stmmac_dwmac4_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
++void stmmac_dwmac4_set_mac_addr(void __iomem *ioaddr, const u8 addr[6],
+                               unsigned int high, unsigned int low);
+ void stmmac_dwmac4_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
+                               unsigned int high, unsigned int low);
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+index 06e2af9387d7c..fda53b4b9406f 100644
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+@@ -634,7 +634,7 @@ static void sun8i_dwmac_set_mac(void __iomem *ioaddr, bool enable)
+  * If addr is NULL, clear the slot
+  */
+ static void sun8i_dwmac_set_umac_addr(struct mac_device_info *hw,
+-                                    unsigned char *addr,
++                                    const unsigned char *addr,
+                                     unsigned int reg_n)
+ {
+       void __iomem *ioaddr = hw->pcsr;
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+index fc8759f146c7c..76edb9b726756 100644
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+@@ -104,7 +104,7 @@ static void dwmac1000_dump_regs(struct mac_device_info *hw, u32 *reg_space)
+ }
+ static void dwmac1000_set_umac_addr(struct mac_device_info *hw,
+-                                  unsigned char *addr,
++                                  const unsigned char *addr,
+                                   unsigned int reg_n)
+ {
+       void __iomem *ioaddr = hw->pcsr;
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
+index ebcad8dd99dbb..75071a7d551a8 100644
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_core.c
+@@ -68,7 +68,7 @@ static int dwmac100_irq_status(struct mac_device_info *hw,
+ }
+ static void dwmac100_set_umac_addr(struct mac_device_info *hw,
+-                                 unsigned char *addr,
++                                 const unsigned char *addr,
+                                  unsigned int reg_n)
+ {
+       void __iomem *ioaddr = hw->pcsr;
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+index 29480314a4867..f6d6a6d9c5553 100644
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+@@ -334,7 +334,7 @@ static void dwmac4_pmt(struct mac_device_info *hw, unsigned long mode)
+ }
+ static void dwmac4_set_umac_addr(struct mac_device_info *hw,
+-                               unsigned char *addr, unsigned int reg_n)
++                               const unsigned char *addr, unsigned int reg_n)
+ {
+       void __iomem *ioaddr = hw->pcsr;
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
+index 7011c08d2e012..7c26394f665e4 100644
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
+@@ -187,7 +187,7 @@ int dwmac4_dma_interrupt(void __iomem *ioaddr,
+       return ret;
+ }
+-void stmmac_dwmac4_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
++void stmmac_dwmac4_set_mac_addr(void __iomem *ioaddr, const u8 addr[6],
+                               unsigned int high, unsigned int low)
+ {
+       unsigned long data;
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
+index 01d0a14f67520..9b6138b117766 100644
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
+@@ -239,7 +239,7 @@ void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr)
+       do {} while ((readl(ioaddr + DMA_CONTROL) & DMA_CONTROL_FTF));
+ }
+-void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
++void stmmac_set_mac_addr(void __iomem *ioaddr, const u8 addr[6],
+                        unsigned int high, unsigned int low)
+ {
+       unsigned long data;
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
+index 3568bf3ccfbe7..c2181c277291b 100644
+--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
+@@ -335,7 +335,8 @@ static void dwxgmac2_pmt(struct mac_device_info *hw, unsigned long mode)
+ }
+ static void dwxgmac2_set_umac_addr(struct mac_device_info *hw,
+-                                 unsigned char *addr, unsigned int reg_n)
++                                 const unsigned char *addr,
++                                 unsigned int reg_n)
+ {
+       void __iomem *ioaddr = hw->pcsr;
+       u32 value;
+diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h
+index cc229ccd5d81d..58e5c6c428dc0 100644
+--- a/drivers/net/ethernet/stmicro/stmmac/hwif.h
++++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h
+@@ -330,7 +330,8 @@ struct stmmac_ops {
+       /* Set power management mode (e.g. magic frame) */
+       void (*pmt)(struct mac_device_info *hw, unsigned long mode);
+       /* Set/Get Unicast MAC addresses */
+-      void (*set_umac_addr)(struct mac_device_info *hw, unsigned char *addr,
++      void (*set_umac_addr)(struct mac_device_info *hw,
++                            const unsigned char *addr,
+                             unsigned int reg_n);
+       void (*get_umac_addr)(struct mac_device_info *hw, unsigned char *addr,
+                             unsigned int reg_n);
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
+index ea7200b7b6477..4705344077b6b 100644
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
+@@ -36,7 +36,7 @@ struct stmmac_packet_attrs {
+       int vlan_id_in;
+       int vlan_id_out;
+       unsigned char *src;
+-      unsigned char *dst;
++      const unsigned char *dst;
+       u32 ip_src;
+       u32 ip_dst;
+       int tcp;
+@@ -249,8 +249,8 @@ static int stmmac_test_loopback_validate(struct sk_buff *skb,
+                                        struct net_device *orig_ndev)
+ {
+       struct stmmac_test_priv *tpriv = pt->af_packet_priv;
++      const unsigned char *dst = tpriv->packet->dst;
+       unsigned char *src = tpriv->packet->src;
+-      unsigned char *dst = tpriv->packet->dst;
+       struct stmmachdr *shdr;
+       struct ethhdr *ehdr;
+       struct udphdr *uhdr;
+diff --git a/drivers/net/ethernet/sun/sunbmac.c b/drivers/net/ethernet/sun/sunbmac.c
+index c646575e79d5c..d70426670c370 100644
+--- a/drivers/net/ethernet/sun/sunbmac.c
++++ b/drivers/net/ethernet/sun/sunbmac.c
+@@ -623,7 +623,7 @@ static int bigmac_init_hw(struct bigmac *bp, bool non_blocking)
+       void __iomem *cregs        = bp->creg;
+       void __iomem *bregs        = bp->bregs;
+       __u32 bblk_dvma = (__u32)bp->bblock_dvma;
+-      unsigned char *e = &bp->dev->dev_addr[0];
++      const unsigned char *e = &bp->dev->dev_addr[0];
+       /* Latch current counters into statistics. */
+       bigmac_get_counters(bp, bregs);
+diff --git a/drivers/net/ethernet/sun/sunqe.c b/drivers/net/ethernet/sun/sunqe.c
+index 577cd9753d8e3..7591d2d77eb63 100644
+--- a/drivers/net/ethernet/sun/sunqe.c
++++ b/drivers/net/ethernet/sun/sunqe.c
+@@ -144,7 +144,7 @@ static int qe_init(struct sunqe *qep, int from_irq)
+       void __iomem *cregs = qep->qcregs;
+       void __iomem *mregs = qep->mregs;
+       void __iomem *gregs = qecp->gregs;
+-      unsigned char *e = &qep->dev->dev_addr[0];
++      const unsigned char *e = &qep->dev->dev_addr[0];
+       __u32 qblk_dvma = (__u32)qep->qblock_dvma;
+       u32 tmp;
+       int i;
+diff --git a/drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c b/drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c
+index bf6c1c6779ff3..76eb7db80f133 100644
+--- a/drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c
++++ b/drivers/net/ethernet/synopsys/dwc-xlgmac-hw.c
+@@ -57,7 +57,7 @@ static int xlgmac_enable_rx_csum(struct xlgmac_pdata *pdata)
+       return 0;
+ }
+-static int xlgmac_set_mac_address(struct xlgmac_pdata *pdata, u8 *addr)
++static int xlgmac_set_mac_address(struct xlgmac_pdata *pdata, const u8 *addr)
+ {
+       unsigned int mac_addr_hi, mac_addr_lo;
+diff --git a/drivers/net/ethernet/synopsys/dwc-xlgmac.h b/drivers/net/ethernet/synopsys/dwc-xlgmac.h
+index 8598aaf3ec994..98e3a271e017a 100644
+--- a/drivers/net/ethernet/synopsys/dwc-xlgmac.h
++++ b/drivers/net/ethernet/synopsys/dwc-xlgmac.h
+@@ -410,7 +410,7 @@ struct xlgmac_hw_ops {
+       void (*dev_xmit)(struct xlgmac_channel *channel);
+       int (*dev_read)(struct xlgmac_channel *channel);
+-      int (*set_mac_address)(struct xlgmac_pdata *pdata, u8 *addr);
++      int (*set_mac_address)(struct xlgmac_pdata *pdata, const u8 *addr);
+       int (*config_rx_mode)(struct xlgmac_pdata *pdata);
+       int (*enable_rx_csum)(struct xlgmac_pdata *pdata);
+       int (*disable_rx_csum)(struct xlgmac_pdata *pdata);
+diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c
+index 77c448ad67ce1..eab7d78d7c720 100644
+--- a/drivers/net/ethernet/ti/tlan.c
++++ b/drivers/net/ethernet/ti/tlan.c
+@@ -184,7 +184,7 @@ static void        tlan_print_list(struct tlan_list *, char *, int);
+ static void   tlan_read_and_clear_stats(struct net_device *, int);
+ static void   tlan_reset_adapter(struct net_device *);
+ static void   tlan_finish_reset(struct net_device *);
+-static void   tlan_set_mac(struct net_device *, int areg, char *mac);
++static void   tlan_set_mac(struct net_device *, int areg, const char *mac);
+ static void   __tlan_phy_print(struct net_device *);
+ static void   tlan_phy_print(struct net_device *);
+@@ -2346,7 +2346,7 @@ tlan_finish_reset(struct net_device *dev)
+  *
+  **************************************************************/
+-static void tlan_set_mac(struct net_device *dev, int areg, char *mac)
++static void tlan_set_mac(struct net_device *dev, int areg, const char *mac)
+ {
+       int i;
+diff --git a/drivers/net/ethernet/toshiba/tc35815.c b/drivers/net/ethernet/toshiba/tc35815.c
+index 52245ac60fc74..07f9f8e19890b 100644
+--- a/drivers/net/ethernet/toshiba/tc35815.c
++++ b/drivers/net/ethernet/toshiba/tc35815.c
+@@ -1859,7 +1859,8 @@ static struct net_device_stats *tc35815_get_stats(struct net_device *dev)
+       return &dev->stats;
+ }
+-static void tc35815_set_cam_entry(struct net_device *dev, int index, unsigned char *addr)
++static void tc35815_set_cam_entry(struct net_device *dev, int index,
++                                const unsigned char *addr)
+ {
+       struct tc35815_local *lp = netdev_priv(dev);
+       struct tc35815_regs __iomem *tr =
+diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+index 093c75da38c47..84e459358b055 100644
+--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
++++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+@@ -206,12 +206,13 @@ static void xemaclite_disable_interrupts(struct net_local *drvdata)
+  * This function writes data from a 16-bit aligned buffer to a 32-bit aligned
+  * address in the EmacLite device.
+  */
+-static void xemaclite_aligned_write(void *src_ptr, u32 *dest_ptr,
++static void xemaclite_aligned_write(const void *src_ptr, u32 *dest_ptr,
+                                   unsigned length)
+ {
++      const u16 *from_u16_ptr;
+       u32 align_buffer;
+       u32 *to_u32_ptr;
+-      u16 *from_u16_ptr, *to_u16_ptr;
++      u16 *to_u16_ptr;
+       to_u32_ptr = dest_ptr;
+       from_u16_ptr = src_ptr;
+@@ -470,7 +471,7 @@ static u16 xemaclite_recv_data(struct net_local *drvdata, u8 *data, int maxlen)
+  * buffers (if configured).
+  */
+ static void xemaclite_update_address(struct net_local *drvdata,
+-                                   u8 *address_ptr)
++                                   const u8 *address_ptr)
+ {
+       void __iomem *addr;
+       u32 reg_data;
+diff --git a/drivers/net/ethernet/xircom/xirc2ps_cs.c b/drivers/net/ethernet/xircom/xirc2ps_cs.c
+index f8bbd1489af15..10f42b7df8b35 100644
+--- a/drivers/net/ethernet/xircom/xirc2ps_cs.c
++++ b/drivers/net/ethernet/xircom/xirc2ps_cs.c
+@@ -1276,7 +1276,7 @@ struct set_address_info {
+       unsigned int ioaddr;
+ };
+-static void set_address(struct set_address_info *sa_info, char *addr)
++static void set_address(struct set_address_info *sa_info, const char *addr)
+ {
+       unsigned int ioaddr = sa_info->ioaddr;
+       int i;
+diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c
+index cef43b1344a94..b349c359089e0 100644
+--- a/drivers/net/phy/mscc/mscc_main.c
++++ b/drivers/net/phy/mscc/mscc_main.c
+@@ -273,12 +273,12 @@ static int vsc85xx_downshift_set(struct phy_device *phydev, u8 count)
+ static int vsc85xx_wol_set(struct phy_device *phydev,
+                          struct ethtool_wolinfo *wol)
+ {
++      const u8 *mac_addr = phydev->attached_dev->dev_addr;
+       int rc;
+       u16 reg_val;
+       u8  i;
+       u16 pwd[3] = {0, 0, 0};
+       struct ethtool_wolinfo *wol_conf = wol;
+-      u8 *mac_addr = phydev->attached_dev->dev_addr;
+       mutex_lock(&phydev->lock);
+       rc = phy_select_page(phydev, MSCC_PHY_PAGE_EXTENDED_2);
+diff --git a/drivers/net/usb/aqc111.c b/drivers/net/usb/aqc111.c
+index bc5e3f45c499e..6db37eb6c5cc8 100644
+--- a/drivers/net/usb/aqc111.c
++++ b/drivers/net/usb/aqc111.c
+@@ -119,7 +119,7 @@ static int aqc111_write_cmd_nopm(struct usbnet *dev, u8 cmd, u16 value,
+ }
+ static int aqc111_write_cmd(struct usbnet *dev, u8 cmd, u16 value,
+-                          u16 index, u16 size, void *data)
++                          u16 index, u16 size, const void *data)
+ {
+       int ret;
+diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
+index c419baf478134..7f5680c0b230c 100644
+--- a/drivers/net/usb/ax88179_178a.c
++++ b/drivers/net/usb/ax88179_178a.c
+@@ -209,7 +209,7 @@ static int __ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+ }
+ static int __ax88179_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+-                             u16 size, void *data, int in_pm)
++                             u16 size, const void *data, int in_pm)
+ {
+       int ret;
+       int (*fn)(struct usbnet *, u8, u8, u16, u16, const void *, u16);
+@@ -272,7 +272,7 @@ static int ax88179_read_cmd_nopm(struct usbnet *dev, u8 cmd, u16 value,
+ }
+ static int ax88179_write_cmd_nopm(struct usbnet *dev, u8 cmd, u16 value,
+-                                u16 index, u16 size, void *data)
++                                u16 index, u16 size, const void *data)
+ {
+       int ret;
+@@ -313,7 +313,7 @@ static int ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+ }
+ static int ax88179_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+-                           u16 size, void *data)
++                           u16 size, const void *data)
+ {
+       int ret;
+@@ -463,7 +463,7 @@ static int ax88179_auto_detach(struct usbnet *dev, int in_pm)
+       u16 tmp16;
+       u8 tmp8;
+       int (*fnr)(struct usbnet *, u8, u16, u16, u16, void *);
+-      int (*fnw)(struct usbnet *, u8, u16, u16, u16, void *);
++      int (*fnw)(struct usbnet *, u8, u16, u16, u16, const void *);
+       if (!in_pm) {
+               fnr = ax88179_read_cmd;
+diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c
+index 97ba67042d126..24db5768a3c04 100644
+--- a/drivers/net/usb/catc.c
++++ b/drivers/net/usb/catc.c
+@@ -615,7 +615,7 @@ static void catc_stats_timer(struct timer_list *t)
+  * Receive modes. Broadcast, Multicast, Promisc.
+  */
+-static void catc_multicast(unsigned char *addr, u8 *multicast)
++static void catc_multicast(const unsigned char *addr, u8 *multicast)
+ {
+       u32 crc;
+diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
+index 56f1c334cdd29..1959e12a3ff8a 100644
+--- a/drivers/net/usb/dm9601.c
++++ b/drivers/net/usb/dm9601.c
+@@ -93,7 +93,8 @@ static int dm_write_reg(struct usbnet *dev, u8 reg, u8 value)
+                               value, reg, NULL, 0);
+ }
+-static void dm_write_async(struct usbnet *dev, u8 reg, u16 length, void *data)
++static void dm_write_async(struct usbnet *dev, u8 reg, u16 length,
++                         const void *data)
+ {
+       usbnet_write_cmd_async(dev, DM_WRITE_REGS,
+                              USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
+index a31a3b9cbd58d..8f484c4949d9a 100644
+--- a/drivers/net/usb/mcs7830.c
++++ b/drivers/net/usb/mcs7830.c
+@@ -140,7 +140,8 @@ static int mcs7830_hif_get_mac_address(struct usbnet *dev, unsigned char *addr)
+       return 0;
+ }
+-static int mcs7830_hif_set_mac_address(struct usbnet *dev, unsigned char *addr)
++static int mcs7830_hif_set_mac_address(struct usbnet *dev,
++                                     const unsigned char *addr)
+ {
+       int ret = mcs7830_set_reg(dev, HIF_REG_ETHERNET_ADDR, ETH_ALEN, addr);
+diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c
+index 1fac6ee273c4e..279a540aef107 100644
+--- a/drivers/net/usb/sr9700.c
++++ b/drivers/net/usb/sr9700.c
+@@ -56,7 +56,8 @@ static int sr_write_reg(struct usbnet *dev, u8 reg, u8 value)
+                               value, reg, NULL, 0);
+ }
+-static void sr_write_async(struct usbnet *dev, u8 reg, u16 length, void *data)
++static void sr_write_async(struct usbnet *dev, u8 reg, u16 length,
++                         const void *data)
+ {
+       usbnet_write_cmd_async(dev, SR_WR_REGS, SR_REQ_WR_REG,
+                              0, reg, data, length);
+diff --git a/include/linux/qed/qed_eth_if.h b/include/linux/qed/qed_eth_if.h
+index 4df0bf0a0864e..e1bf3219b4e6a 100644
+--- a/include/linux/qed/qed_eth_if.h
++++ b/include/linux/qed/qed_eth_if.h
+@@ -331,7 +331,7 @@ struct qed_eth_ops {
+       int (*configure_arfs_searcher)(struct qed_dev *cdev,
+                                      enum qed_filter_config_mode mode);
+       int (*get_coalesce)(struct qed_dev *cdev, u16 *coal, void *handle);
+-      int (*req_bulletin_update_mac)(struct qed_dev *cdev, u8 *mac);
++      int (*req_bulletin_update_mac)(struct qed_dev *cdev, const u8 *mac);
+ };
+ const struct qed_eth_ops *qed_get_eth_ops(void);
+diff --git a/include/linux/qed/qed_if.h b/include/linux/qed/qed_if.h
+index f39451aaaeec2..905de11cc2096 100644
+--- a/include/linux/qed/qed_if.h
++++ b/include/linux/qed/qed_if.h
+@@ -1111,7 +1111,7 @@ struct qed_common_ops {
+  *
+  * Return: Int.
+  */
+-      int (*update_mac)(struct qed_dev *cdev, u8 *mac);
++      int (*update_mac)(struct qed_dev *cdev, const u8 *mac);
+ /**
+  * update_mtu(): API to inform the change in the mtu.
+diff --git a/include/linux/qed/qed_rdma_if.h b/include/linux/qed/qed_rdma_if.h
+index aeb242cefebfa..3b76c07fbcf8e 100644
+--- a/include/linux/qed/qed_rdma_if.h
++++ b/include/linux/qed/qed_rdma_if.h
+@@ -662,7 +662,8 @@ struct qed_rdma_ops {
+                            u8 connection_handle,
+                            struct qed_ll2_stats *p_stats);
+       int (*ll2_set_mac_filter)(struct qed_dev *cdev,
+-                                u8 *old_mac_address, u8 *new_mac_address);
++                                u8 *old_mac_address,
++                                const u8 *new_mac_address);
+       int (*iwarp_set_engine_affin)(struct qed_dev *cdev, bool b_reset);
+-- 
+2.43.0
+
diff --git a/queue-5.15/iio-imu-adis16475-add-spi_device_id-table.patch b/queue-5.15/iio-imu-adis16475-add-spi_device_id-table.patch
new file mode 100644 (file)
index 0000000..cffb9c2
--- /dev/null
@@ -0,0 +1,176 @@
+From 8f418ad664bb19fa68aa0520f77fa9c6b4e18338 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 2 Nov 2023 13:52:58 +0100
+Subject: iio: imu: adis16475: add spi_device_id table
+
+From: Nuno Sa <nuno.sa@analog.com>
+
+[ Upstream commit ee4d79055aeea27f1b8c42233cc0c90d0a8b5355 ]
+
+This prevents the warning message "SPI driver has no spi_device_id for..."
+when registering the driver. More importantly, it makes sure that
+module autoloading works as spi relies on spi: modaliases and not of.
+
+While at it, move the of_device_id table to it's natural place.
+
+Fixes: fff7352bf7a3c ("iio: imu: Add support for adis16475")
+Signed-off-by: Nuno Sa <nuno.sa@analog.com>
+Link: https://lore.kernel.org/r/20231102125258.3284830-1-nuno.sa@analog.com
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/iio/imu/adis16475.c | 117 ++++++++++++++++++++++--------------
+ 1 file changed, 72 insertions(+), 45 deletions(-)
+
+diff --git a/drivers/iio/imu/adis16475.c b/drivers/iio/imu/adis16475.c
+index 9d28534db3b08..a3b9745dd1760 100644
+--- a/drivers/iio/imu/adis16475.c
++++ b/drivers/iio/imu/adis16475.c
+@@ -1273,50 +1273,6 @@ static int adis16475_config_irq_pin(struct adis16475 *st)
+       return 0;
+ }
+-static const struct of_device_id adis16475_of_match[] = {
+-      { .compatible = "adi,adis16470",
+-              .data = &adis16475_chip_info[ADIS16470] },
+-      { .compatible = "adi,adis16475-1",
+-              .data = &adis16475_chip_info[ADIS16475_1] },
+-      { .compatible = "adi,adis16475-2",
+-              .data = &adis16475_chip_info[ADIS16475_2] },
+-      { .compatible = "adi,adis16475-3",
+-              .data = &adis16475_chip_info[ADIS16475_3] },
+-      { .compatible = "adi,adis16477-1",
+-              .data = &adis16475_chip_info[ADIS16477_1] },
+-      { .compatible = "adi,adis16477-2",
+-              .data = &adis16475_chip_info[ADIS16477_2] },
+-      { .compatible = "adi,adis16477-3",
+-              .data = &adis16475_chip_info[ADIS16477_3] },
+-      { .compatible = "adi,adis16465-1",
+-              .data = &adis16475_chip_info[ADIS16465_1] },
+-      { .compatible = "adi,adis16465-2",
+-              .data = &adis16475_chip_info[ADIS16465_2] },
+-      { .compatible = "adi,adis16465-3",
+-              .data = &adis16475_chip_info[ADIS16465_3] },
+-      { .compatible = "adi,adis16467-1",
+-              .data = &adis16475_chip_info[ADIS16467_1] },
+-      { .compatible = "adi,adis16467-2",
+-              .data = &adis16475_chip_info[ADIS16467_2] },
+-      { .compatible = "adi,adis16467-3",
+-              .data = &adis16475_chip_info[ADIS16467_3] },
+-      { .compatible = "adi,adis16500",
+-              .data = &adis16475_chip_info[ADIS16500] },
+-      { .compatible = "adi,adis16505-1",
+-              .data = &adis16475_chip_info[ADIS16505_1] },
+-      { .compatible = "adi,adis16505-2",
+-              .data = &adis16475_chip_info[ADIS16505_2] },
+-      { .compatible = "adi,adis16505-3",
+-              .data = &adis16475_chip_info[ADIS16505_3] },
+-      { .compatible = "adi,adis16507-1",
+-              .data = &adis16475_chip_info[ADIS16507_1] },
+-      { .compatible = "adi,adis16507-2",
+-              .data = &adis16475_chip_info[ADIS16507_2] },
+-      { .compatible = "adi,adis16507-3",
+-              .data = &adis16475_chip_info[ADIS16507_3] },
+-      { },
+-};
+-MODULE_DEVICE_TABLE(of, adis16475_of_match);
+ static int adis16475_probe(struct spi_device *spi)
+ {
+@@ -1330,7 +1286,7 @@ static int adis16475_probe(struct spi_device *spi)
+       st = iio_priv(indio_dev);
+-      st->info = device_get_match_data(&spi->dev);
++      st->info = spi_get_device_match_data(spi);
+       if (!st->info)
+               return -EINVAL;
+@@ -1370,12 +1326,83 @@ static int adis16475_probe(struct spi_device *spi)
+       return 0;
+ }
++static const struct of_device_id adis16475_of_match[] = {
++      { .compatible = "adi,adis16470",
++              .data = &adis16475_chip_info[ADIS16470] },
++      { .compatible = "adi,adis16475-1",
++              .data = &adis16475_chip_info[ADIS16475_1] },
++      { .compatible = "adi,adis16475-2",
++              .data = &adis16475_chip_info[ADIS16475_2] },
++      { .compatible = "adi,adis16475-3",
++              .data = &adis16475_chip_info[ADIS16475_3] },
++      { .compatible = "adi,adis16477-1",
++              .data = &adis16475_chip_info[ADIS16477_1] },
++      { .compatible = "adi,adis16477-2",
++              .data = &adis16475_chip_info[ADIS16477_2] },
++      { .compatible = "adi,adis16477-3",
++              .data = &adis16475_chip_info[ADIS16477_3] },
++      { .compatible = "adi,adis16465-1",
++              .data = &adis16475_chip_info[ADIS16465_1] },
++      { .compatible = "adi,adis16465-2",
++              .data = &adis16475_chip_info[ADIS16465_2] },
++      { .compatible = "adi,adis16465-3",
++              .data = &adis16475_chip_info[ADIS16465_3] },
++      { .compatible = "adi,adis16467-1",
++              .data = &adis16475_chip_info[ADIS16467_1] },
++      { .compatible = "adi,adis16467-2",
++              .data = &adis16475_chip_info[ADIS16467_2] },
++      { .compatible = "adi,adis16467-3",
++              .data = &adis16475_chip_info[ADIS16467_3] },
++      { .compatible = "adi,adis16500",
++              .data = &adis16475_chip_info[ADIS16500] },
++      { .compatible = "adi,adis16505-1",
++              .data = &adis16475_chip_info[ADIS16505_1] },
++      { .compatible = "adi,adis16505-2",
++              .data = &adis16475_chip_info[ADIS16505_2] },
++      { .compatible = "adi,adis16505-3",
++              .data = &adis16475_chip_info[ADIS16505_3] },
++      { .compatible = "adi,adis16507-1",
++              .data = &adis16475_chip_info[ADIS16507_1] },
++      { .compatible = "adi,adis16507-2",
++              .data = &adis16475_chip_info[ADIS16507_2] },
++      { .compatible = "adi,adis16507-3",
++              .data = &adis16475_chip_info[ADIS16507_3] },
++      { },
++};
++MODULE_DEVICE_TABLE(of, adis16475_of_match);
++
++static const struct spi_device_id adis16475_ids[] = {
++      { "adis16470", (kernel_ulong_t)&adis16475_chip_info[ADIS16470] },
++      { "adis16475-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16475_1] },
++      { "adis16475-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16475_2] },
++      { "adis16475-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16475_3] },
++      { "adis16477-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16477_1] },
++      { "adis16477-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16477_2] },
++      { "adis16477-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16477_3] },
++      { "adis16465-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16465_1] },
++      { "adis16465-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16465_2] },
++      { "adis16465-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16465_3] },
++      { "adis16467-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16467_1] },
++      { "adis16467-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16467_2] },
++      { "adis16467-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16467_3] },
++      { "adis16500", (kernel_ulong_t)&adis16475_chip_info[ADIS16500] },
++      { "adis16505-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_1] },
++      { "adis16505-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_2] },
++      { "adis16505-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16505_3] },
++      { "adis16507-1", (kernel_ulong_t)&adis16475_chip_info[ADIS16507_1] },
++      { "adis16507-2", (kernel_ulong_t)&adis16475_chip_info[ADIS16507_2] },
++      { "adis16507-3", (kernel_ulong_t)&adis16475_chip_info[ADIS16507_3] },
++      { }
++};
++MODULE_DEVICE_TABLE(spi, adis16475_ids);
++
+ static struct spi_driver adis16475_driver = {
+       .driver = {
+               .name = "adis16475",
+               .of_match_table = adis16475_of_match,
+       },
+       .probe = adis16475_probe,
++      .id_table = adis16475_ids,
+ };
+ module_spi_driver(adis16475_driver);
+-- 
+2.43.0
+
diff --git a/queue-5.15/ksmbd-avoid-duplicate-opinfo_put-call-on-error-of-sm.patch b/queue-5.15/ksmbd-avoid-duplicate-opinfo_put-call-on-error-of-sm.patch
new file mode 100644 (file)
index 0000000..8fcb3fd
--- /dev/null
@@ -0,0 +1,51 @@
+From 63fbd3507a59e8df6fd08b4171c9855c65bbc7e9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Dec 2023 19:26:04 +0900
+Subject: ksmbd: avoid duplicate opinfo_put() call on error of
+ smb21_lease_break_ack()
+
+From: Namjae Jeon <linkinjeon@kernel.org>
+
+[ Upstream commit 658609d9a618d8881bf549b5893c0ba8fcff4526 ]
+
+opinfo_put() could be called twice on error of smb21_lease_break_ack().
+It will cause UAF issue if opinfo is referenced on other places.
+
+Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/ksmbd/smb2pdu.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
+index c1dde42043662..e1c640ed7acc3 100644
+--- a/fs/ksmbd/smb2pdu.c
++++ b/fs/ksmbd/smb2pdu.c
+@@ -8221,6 +8221,11 @@ static void smb21_lease_break_ack(struct ksmbd_work *work)
+                           le32_to_cpu(req->LeaseState));
+       }
++      if (ret < 0) {
++              rsp->hdr.Status = err;
++              goto err_out;
++      }
++
+       lease_state = lease->state;
+       opinfo->op_state = OPLOCK_STATE_NONE;
+       wake_up_interruptible_all(&opinfo->oplock_q);
+@@ -8228,11 +8233,6 @@ static void smb21_lease_break_ack(struct ksmbd_work *work)
+       wake_up_interruptible_all(&opinfo->oplock_brk);
+       opinfo_put(opinfo);
+-      if (ret < 0) {
+-              rsp->hdr.Status = err;
+-              goto err_out;
+-      }
+-
+       rsp->StructureSize = cpu_to_le16(36);
+       rsp->Reserved = 0;
+       rsp->Flags = 0;
+-- 
+2.43.0
+
diff --git a/queue-5.15/ksmbd-downgrade-rwh-lease-caching-state-to-rh-for-di.patch b/queue-5.15/ksmbd-downgrade-rwh-lease-caching-state-to-rh-for-di.patch
new file mode 100644 (file)
index 0000000..075827c
--- /dev/null
@@ -0,0 +1,94 @@
+From 50670666498fe3e07f4e12b1cf8354f3e22f73ae Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Dec 2023 19:26:01 +0900
+Subject: ksmbd: downgrade RWH lease caching state to RH for directory
+
+From: Namjae Jeon <linkinjeon@kernel.org>
+
+[ Upstream commit eb547407f3572d2110cb1194ecd8865b3371a7a4 ]
+
+RWH(Read + Write + Handle) caching state is not supported for directory.
+ksmbd downgrade it to RH for directory if client send RWH caching lease
+state.
+
+Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/ksmbd/oplock.c  | 9 +++++++--
+ fs/ksmbd/oplock.h  | 2 +-
+ fs/ksmbd/smb2pdu.c | 8 ++++----
+ 3 files changed, 12 insertions(+), 7 deletions(-)
+
+diff --git a/fs/ksmbd/oplock.c b/fs/ksmbd/oplock.c
+index 24716dbe7108c..600312e2c6c21 100644
+--- a/fs/ksmbd/oplock.c
++++ b/fs/ksmbd/oplock.c
+@@ -1398,10 +1398,11 @@ void create_lease_buf(u8 *rbuf, struct lease *lease)
+ /**
+  * parse_lease_state() - parse lease context containted in file open request
+  * @open_req: buffer containing smb2 file open(create) request
++ * @is_dir:   whether leasing file is directory
+  *
+  * Return:  oplock state, -ENOENT if create lease context not found
+  */
+-struct lease_ctx_info *parse_lease_state(void *open_req)
++struct lease_ctx_info *parse_lease_state(void *open_req, bool is_dir)
+ {
+       struct create_context *cc;
+       struct smb2_create_req *req = (struct smb2_create_req *)open_req;
+@@ -1419,7 +1420,11 @@ struct lease_ctx_info *parse_lease_state(void *open_req)
+               struct create_lease_v2 *lc = (struct create_lease_v2 *)cc;
+               memcpy(lreq->lease_key, lc->lcontext.LeaseKey, SMB2_LEASE_KEY_SIZE);
+-              lreq->req_state = lc->lcontext.LeaseState;
++              if (is_dir)
++                      lreq->req_state = lc->lcontext.LeaseState &
++                              ~SMB2_LEASE_WRITE_CACHING_LE;
++              else
++                      lreq->req_state = lc->lcontext.LeaseState;
+               lreq->flags = lc->lcontext.LeaseFlags;
+               lreq->epoch = lc->lcontext.Epoch;
+               lreq->duration = lc->lcontext.LeaseDuration;
+diff --git a/fs/ksmbd/oplock.h b/fs/ksmbd/oplock.h
+index ad31439c61fef..672127318c750 100644
+--- a/fs/ksmbd/oplock.h
++++ b/fs/ksmbd/oplock.h
+@@ -109,7 +109,7 @@ void opinfo_put(struct oplock_info *opinfo);
+ /* Lease related functions */
+ void create_lease_buf(u8 *rbuf, struct lease *lease);
+-struct lease_ctx_info *parse_lease_state(void *open_req);
++struct lease_ctx_info *parse_lease_state(void *open_req, bool is_dir);
+ __u8 smb2_map_lease_to_oplock(__le32 lease_state);
+ int lease_read_to_write(struct oplock_info *opinfo);
+diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
+index 7ce5746f91674..6a3cd6ea3af18 100644
+--- a/fs/ksmbd/smb2pdu.c
++++ b/fs/ksmbd/smb2pdu.c
+@@ -2729,10 +2729,6 @@ int smb2_open(struct ksmbd_work *work)
+               }
+       }
+-      req_op_level = req->RequestedOplockLevel;
+-      if (req_op_level == SMB2_OPLOCK_LEVEL_LEASE)
+-              lc = parse_lease_state(req);
+-
+       if (le32_to_cpu(req->ImpersonationLevel) > le32_to_cpu(IL_DELEGATE_LE)) {
+               pr_err("Invalid impersonationlevel : 0x%x\n",
+                      le32_to_cpu(req->ImpersonationLevel));
+@@ -3212,6 +3208,10 @@ int smb2_open(struct ksmbd_work *work)
+               need_truncate = 1;
+       }
++      req_op_level = req->RequestedOplockLevel;
++      if (req_op_level == SMB2_OPLOCK_LEVEL_LEASE)
++              lc = parse_lease_state(req, S_ISDIR(file_inode(filp)->i_mode));
++
+       share_ret = ksmbd_smb_check_shared_mode(fp->filp, fp);
+       if (!test_share_config_flag(work->tcon->share_conf, KSMBD_SHARE_FLAG_OPLOCKS) ||
+           (req_op_level == SMB2_OPLOCK_LEVEL_LEASE &&
+-- 
+2.43.0
+
diff --git a/queue-5.15/ksmbd-fix-wrong-allocation-size-update-in-smb2_open.patch b/queue-5.15/ksmbd-fix-wrong-allocation-size-update-in-smb2_open.patch
new file mode 100644 (file)
index 0000000..65d1325
--- /dev/null
@@ -0,0 +1,84 @@
+From 0e574e34baf0aa82c04f589603b15c7328f1eaf8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Dec 2023 19:26:05 +0900
+Subject: ksmbd: fix wrong allocation size update in smb2_open()
+
+From: Namjae Jeon <linkinjeon@kernel.org>
+
+[ Upstream commit a9f106c765c12d2f58aa33431bd8ce8e9d8a404a ]
+
+When client send SMB2_CREATE_ALLOCATION_SIZE create context, ksmbd update
+old size to ->AllocationSize in smb2 create response. ksmbd_vfs_getattr()
+should be called after it to get updated stat result.
+
+Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/ksmbd/smb2pdu.c | 36 ++++++++++++++++++------------------
+ 1 file changed, 18 insertions(+), 18 deletions(-)
+
+diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
+index e1c640ed7acc3..8875c04e83827 100644
+--- a/fs/ksmbd/smb2pdu.c
++++ b/fs/ksmbd/smb2pdu.c
+@@ -2516,7 +2516,7 @@ static void smb2_new_xattrs(struct ksmbd_tree_connect *tcon, const struct path *
+       da.flags = XATTR_DOSINFO_ATTRIB | XATTR_DOSINFO_CREATE_TIME |
+               XATTR_DOSINFO_ITIME;
+-      rc = ksmbd_vfs_set_dos_attrib_xattr(mnt_user_ns(path->mnt), path, &da, false);
++      rc = ksmbd_vfs_set_dos_attrib_xattr(mnt_user_ns(path->mnt), path, &da, true);
+       if (rc)
+               ksmbd_debug(SMB, "failed to store file attribute into xattr\n");
+ }
+@@ -3182,23 +3182,6 @@ int smb2_open(struct ksmbd_work *work)
+               goto err_out;
+       }
+-      rc = ksmbd_vfs_getattr(&path, &stat);
+-      if (rc)
+-              goto err_out;
+-
+-      if (stat.result_mask & STATX_BTIME)
+-              fp->create_time = ksmbd_UnixTimeToNT(stat.btime);
+-      else
+-              fp->create_time = ksmbd_UnixTimeToNT(stat.ctime);
+-      if (req->FileAttributes || fp->f_ci->m_fattr == 0)
+-              fp->f_ci->m_fattr =
+-                      cpu_to_le32(smb2_get_dos_mode(&stat, le32_to_cpu(req->FileAttributes)));
+-
+-      if (!created)
+-              smb2_update_xattrs(tcon, &path, fp);
+-      else
+-              smb2_new_xattrs(tcon, &path, fp);
+-
+       if (file_present || created)
+               ksmbd_vfs_kern_path_unlock(&parent_path, &path);
+@@ -3299,6 +3282,23 @@ int smb2_open(struct ksmbd_work *work)
+               }
+       }
++      rc = ksmbd_vfs_getattr(&path, &stat);
++      if (rc)
++              goto err_out1;
++
++      if (stat.result_mask & STATX_BTIME)
++              fp->create_time = ksmbd_UnixTimeToNT(stat.btime);
++      else
++              fp->create_time = ksmbd_UnixTimeToNT(stat.ctime);
++      if (req->FileAttributes || fp->f_ci->m_fattr == 0)
++              fp->f_ci->m_fattr =
++                      cpu_to_le32(smb2_get_dos_mode(&stat, le32_to_cpu(req->FileAttributes)));
++
++      if (!created)
++              smb2_update_xattrs(tcon, &path, fp);
++      else
++              smb2_new_xattrs(tcon, &path, fp);
++
+       memcpy(fp->client_guid, conn->ClientGUID, SMB2_CLIENT_GUID_SIZE);
+       rsp->StructureSize = cpu_to_le16(89);
+-- 
+2.43.0
+
diff --git a/queue-5.15/ksmbd-have-a-dependency-on-cifs-arc4.patch b/queue-5.15/ksmbd-have-a-dependency-on-cifs-arc4.patch
new file mode 100644 (file)
index 0000000..6e5c2bc
--- /dev/null
@@ -0,0 +1,36 @@
+From c22d864198b24fe9c1fc4ea352e7764bf4d71076 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Dec 2023 19:25:58 +0900
+Subject: ksmbd: have a dependency on cifs ARC4
+
+From: Namjae Jeon <linkinjeon@kernel.org>
+
+Omitted the change that has a dependency on cifs ARC4 from backporting
+commit f9929ef6a2a5("ksmbd: add support for key exchange").
+This patch make ksmbd have a dependeny on cifs ARC4.
+
+Fixes: c5049d2d73b2 ("ksmbd: add support for key exchange")
+Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/Kconfig | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/fs/Kconfig b/fs/Kconfig
+index a6313a969bc5f..971339ecc1a2b 100644
+--- a/fs/Kconfig
++++ b/fs/Kconfig
+@@ -369,8 +369,8 @@ source "fs/ksmbd/Kconfig"
+ config SMBFS_COMMON
+       tristate
+-      default y if CIFS=y
+-      default m if CIFS=m
++      default y if CIFS=y || SMB_SERVER=y
++      default m if CIFS=m || SMB_SERVER=m
+ source "fs/coda/Kconfig"
+ source "fs/afs/Kconfig"
+-- 
+2.43.0
+
diff --git a/queue-5.15/ksmbd-lazy-v2-lease-break-on-smb2_write.patch b/queue-5.15/ksmbd-lazy-v2-lease-break-on-smb2_write.patch
new file mode 100644 (file)
index 0000000..877f549
--- /dev/null
@@ -0,0 +1,124 @@
+From 1f1e9b56184791336c39332a28d67dc5148660d3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Dec 2023 19:26:03 +0900
+Subject: ksmbd: lazy v2 lease break on smb2_write()
+
+From: Namjae Jeon <linkinjeon@kernel.org>
+
+[ Upstream commit c2a721eead71202a0d8ddd9b56ec8dce652c71d1 ]
+
+Don't immediately send directory lease break notification on smb2_write().
+Instead, It postpones it until smb2_close().
+
+Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/ksmbd/oplock.c    | 45 ++++++++++++++++++++++++++++++++++++++++++--
+ fs/ksmbd/oplock.h    |  1 +
+ fs/ksmbd/vfs.c       |  3 +++
+ fs/ksmbd/vfs_cache.h |  1 +
+ 4 files changed, 48 insertions(+), 2 deletions(-)
+
+diff --git a/fs/ksmbd/oplock.c b/fs/ksmbd/oplock.c
+index df6f00f58f19d..2da256259722d 100644
+--- a/fs/ksmbd/oplock.c
++++ b/fs/ksmbd/oplock.c
+@@ -396,8 +396,8 @@ void close_id_del_oplock(struct ksmbd_file *fp)
+ {
+       struct oplock_info *opinfo;
+-      if (S_ISDIR(file_inode(fp->filp)->i_mode))
+-              return;
++      if (fp->reserve_lease_break)
++              smb_lazy_parent_lease_break_close(fp);
+       opinfo = opinfo_get(fp);
+       if (!opinfo)
+@@ -1127,6 +1127,47 @@ void smb_send_parent_lease_break_noti(struct ksmbd_file *fp,
+       ksmbd_inode_put(p_ci);
+ }
++void smb_lazy_parent_lease_break_close(struct ksmbd_file *fp)
++{
++      struct oplock_info *opinfo;
++      struct ksmbd_inode *p_ci = NULL;
++
++      rcu_read_lock();
++      opinfo = rcu_dereference(fp->f_opinfo);
++      rcu_read_unlock();
++
++      if (!opinfo->is_lease || opinfo->o_lease->version != 2)
++              return;
++
++      p_ci = ksmbd_inode_lookup_lock(fp->filp->f_path.dentry->d_parent);
++      if (!p_ci)
++              return;
++
++      read_lock(&p_ci->m_lock);
++      list_for_each_entry(opinfo, &p_ci->m_op_list, op_entry) {
++              if (!opinfo->is_lease)
++                      continue;
++
++              if (opinfo->o_lease->state != SMB2_OPLOCK_LEVEL_NONE) {
++                      if (!atomic_inc_not_zero(&opinfo->refcount))
++                              continue;
++
++                      atomic_inc(&opinfo->conn->r_count);
++                      if (ksmbd_conn_releasing(opinfo->conn)) {
++                              atomic_dec(&opinfo->conn->r_count);
++                              continue;
++                      }
++                      read_unlock(&p_ci->m_lock);
++                      oplock_break(opinfo, SMB2_OPLOCK_LEVEL_NONE);
++                      opinfo_conn_put(opinfo);
++                      read_lock(&p_ci->m_lock);
++              }
++      }
++      read_unlock(&p_ci->m_lock);
++
++      ksmbd_inode_put(p_ci);
++}
++
+ /**
+  * smb_grant_oplock() - handle oplock/lease request on file open
+  * @work:             smb work
+diff --git a/fs/ksmbd/oplock.h b/fs/ksmbd/oplock.h
+index b64d1536882a1..5b93ea9196c01 100644
+--- a/fs/ksmbd/oplock.h
++++ b/fs/ksmbd/oplock.h
+@@ -129,4 +129,5 @@ int find_same_lease_key(struct ksmbd_session *sess, struct ksmbd_inode *ci,
+ void destroy_lease_table(struct ksmbd_conn *conn);
+ void smb_send_parent_lease_break_noti(struct ksmbd_file *fp,
+                                     struct lease_ctx_info *lctx);
++void smb_lazy_parent_lease_break_close(struct ksmbd_file *fp);
+ #endif /* __KSMBD_OPLOCK_H */
+diff --git a/fs/ksmbd/vfs.c b/fs/ksmbd/vfs.c
+index a89529b21c866..173a488bfeee4 100644
+--- a/fs/ksmbd/vfs.c
++++ b/fs/ksmbd/vfs.c
+@@ -517,6 +517,9 @@ int ksmbd_vfs_write(struct ksmbd_work *work, struct ksmbd_file *fp,
+               }
+       }
++      /* Reserve lease break for parent dir at closing time */
++      fp->reserve_lease_break = true;
++
+       /* Do we need to break any of a levelII oplock? */
+       smb_break_all_levII_oplock(work, fp, 1);
+diff --git a/fs/ksmbd/vfs_cache.h b/fs/ksmbd/vfs_cache.h
+index 4d4938d6029b6..a528f0cc775ae 100644
+--- a/fs/ksmbd/vfs_cache.h
++++ b/fs/ksmbd/vfs_cache.h
+@@ -105,6 +105,7 @@ struct ksmbd_file {
+       struct ksmbd_readdir_data       readdir_data;
+       int                             dot_dotdot[2];
+       unsigned int                    f_state;
++      bool                            reserve_lease_break;
+ };
+ static inline void set_ctx_actor(struct dir_context *ctx,
+-- 
+2.43.0
+
diff --git a/queue-5.15/ksmbd-send-v2-lease-break-notification-for-directory.patch b/queue-5.15/ksmbd-send-v2-lease-break-notification-for-directory.patch
new file mode 100644 (file)
index 0000000..4b813a2
--- /dev/null
@@ -0,0 +1,230 @@
+From c7b17af82f97057dba4ebf940be0c2c1495e7a74 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Dec 2023 19:26:02 +0900
+Subject: ksmbd: send v2 lease break notification for directory
+
+From: Namjae Jeon <linkinjeon@kernel.org>
+
+[ Upstream commit d47d9886aeef79feba7adac701a510d65f3682b5 ]
+
+If client send different parent key, different client guid, or there is
+no parent lease key flags in create context v2 lease, ksmbd send lease
+break to client.
+
+Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/ksmbd/oplock.c    | 56 ++++++++++++++++++++++++++++++++++++++++----
+ fs/ksmbd/oplock.h    |  4 ++++
+ fs/ksmbd/smb2pdu.c   |  7 ++++++
+ fs/ksmbd/smb2pdu.h   |  1 +
+ fs/ksmbd/vfs_cache.c | 13 +++++++++-
+ fs/ksmbd/vfs_cache.h |  2 ++
+ 6 files changed, 77 insertions(+), 6 deletions(-)
+
+diff --git a/fs/ksmbd/oplock.c b/fs/ksmbd/oplock.c
+index 600312e2c6c21..df6f00f58f19d 100644
+--- a/fs/ksmbd/oplock.c
++++ b/fs/ksmbd/oplock.c
+@@ -102,6 +102,7 @@ static int alloc_lease(struct oplock_info *opinfo, struct lease_ctx_info *lctx)
+       lease->new_state = 0;
+       lease->flags = lctx->flags;
+       lease->duration = lctx->duration;
++      lease->is_dir = lctx->is_dir;
+       memcpy(lease->parent_lease_key, lctx->parent_lease_key, SMB2_LEASE_KEY_SIZE);
+       lease->version = lctx->version;
+       lease->epoch = le16_to_cpu(lctx->epoch);
+@@ -543,12 +544,13 @@ static struct oplock_info *same_client_has_lease(struct ksmbd_inode *ci,
+                       /* upgrading lease */
+                       if ((atomic_read(&ci->op_count) +
+                            atomic_read(&ci->sop_count)) == 1) {
+-                              if (lease->state ==
+-                                  (lctx->req_state & lease->state)) {
++                              if (lease->state != SMB2_LEASE_NONE_LE &&
++                                  lease->state == (lctx->req_state & lease->state)) {
+                                       lease->state |= lctx->req_state;
+                                       if (lctx->req_state &
+                                               SMB2_LEASE_WRITE_CACHING_LE)
+                                               lease_read_to_write(opinfo);
++
+                               }
+                       } else if ((atomic_read(&ci->op_count) +
+                                   atomic_read(&ci->sop_count)) > 1) {
+@@ -900,7 +902,8 @@ static int oplock_break(struct oplock_info *brk_opinfo, int req_op_level)
+                                       lease->new_state =
+                                               SMB2_LEASE_READ_CACHING_LE;
+                       } else {
+-                              if (lease->state & SMB2_LEASE_HANDLE_CACHING_LE)
++                              if (lease->state & SMB2_LEASE_HANDLE_CACHING_LE &&
++                                              !lease->is_dir)
+                                       lease->new_state =
+                                               SMB2_LEASE_READ_CACHING_LE;
+                               else
+@@ -1082,6 +1085,48 @@ static void set_oplock_level(struct oplock_info *opinfo, int level,
+       }
+ }
++void smb_send_parent_lease_break_noti(struct ksmbd_file *fp,
++                                    struct lease_ctx_info *lctx)
++{
++      struct oplock_info *opinfo;
++      struct ksmbd_inode *p_ci = NULL;
++
++      if (lctx->version != 2)
++              return;
++
++      p_ci = ksmbd_inode_lookup_lock(fp->filp->f_path.dentry->d_parent);
++      if (!p_ci)
++              return;
++
++      read_lock(&p_ci->m_lock);
++      list_for_each_entry(opinfo, &p_ci->m_op_list, op_entry) {
++              if (!opinfo->is_lease)
++                      continue;
++
++              if (opinfo->o_lease->state != SMB2_OPLOCK_LEVEL_NONE &&
++                  (!(lctx->flags & SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET_LE) ||
++                   !compare_guid_key(opinfo, fp->conn->ClientGUID,
++                                    lctx->parent_lease_key))) {
++                      if (!atomic_inc_not_zero(&opinfo->refcount))
++                              continue;
++
++                      atomic_inc(&opinfo->conn->r_count);
++                      if (ksmbd_conn_releasing(opinfo->conn)) {
++                              atomic_dec(&opinfo->conn->r_count);
++                              continue;
++                      }
++
++                      read_unlock(&p_ci->m_lock);
++                      oplock_break(opinfo, SMB2_OPLOCK_LEVEL_NONE);
++                      opinfo_conn_put(opinfo);
++                      read_lock(&p_ci->m_lock);
++              }
++      }
++      read_unlock(&p_ci->m_lock);
++
++      ksmbd_inode_put(p_ci);
++}
++
+ /**
+  * smb_grant_oplock() - handle oplock/lease request on file open
+  * @work:             smb work
+@@ -1420,10 +1465,11 @@ struct lease_ctx_info *parse_lease_state(void *open_req, bool is_dir)
+               struct create_lease_v2 *lc = (struct create_lease_v2 *)cc;
+               memcpy(lreq->lease_key, lc->lcontext.LeaseKey, SMB2_LEASE_KEY_SIZE);
+-              if (is_dir)
++              if (is_dir) {
+                       lreq->req_state = lc->lcontext.LeaseState &
+                               ~SMB2_LEASE_WRITE_CACHING_LE;
+-              else
++                      lreq->is_dir = true;
++              } else
+                       lreq->req_state = lc->lcontext.LeaseState;
+               lreq->flags = lc->lcontext.LeaseFlags;
+               lreq->epoch = lc->lcontext.Epoch;
+diff --git a/fs/ksmbd/oplock.h b/fs/ksmbd/oplock.h
+index 672127318c750..b64d1536882a1 100644
+--- a/fs/ksmbd/oplock.h
++++ b/fs/ksmbd/oplock.h
+@@ -36,6 +36,7 @@ struct lease_ctx_info {
+       __u8                    parent_lease_key[SMB2_LEASE_KEY_SIZE];
+       __le16                  epoch;
+       int                     version;
++      bool                    is_dir;
+ };
+ struct lease_table {
+@@ -54,6 +55,7 @@ struct lease {
+       __u8                    parent_lease_key[SMB2_LEASE_KEY_SIZE];
+       int                     version;
+       unsigned short          epoch;
++      bool                    is_dir;
+       struct lease_table      *l_lb;
+ };
+@@ -125,4 +127,6 @@ struct oplock_info *lookup_lease_in_table(struct ksmbd_conn *conn,
+ int find_same_lease_key(struct ksmbd_session *sess, struct ksmbd_inode *ci,
+                       struct lease_ctx_info *lctx);
+ void destroy_lease_table(struct ksmbd_conn *conn);
++void smb_send_parent_lease_break_noti(struct ksmbd_file *fp,
++                                    struct lease_ctx_info *lctx);
+ #endif /* __KSMBD_OPLOCK_H */
+diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
+index 6a3cd6ea3af18..c1dde42043662 100644
+--- a/fs/ksmbd/smb2pdu.c
++++ b/fs/ksmbd/smb2pdu.c
+@@ -3222,6 +3222,13 @@ int smb2_open(struct ksmbd_work *work)
+               }
+       } else {
+               if (req_op_level == SMB2_OPLOCK_LEVEL_LEASE) {
++                      /*
++                       * Compare parent lease using parent key. If there is no
++                       * a lease that has same parent key, Send lease break
++                       * notification.
++                       */
++                      smb_send_parent_lease_break_noti(fp, lc);
++
+                       req_op_level = smb2_map_lease_to_oplock(lc->req_state);
+                       ksmbd_debug(SMB,
+                                   "lease req for(%s) req oplock state 0x%x, lease state 0x%x\n",
+diff --git a/fs/ksmbd/smb2pdu.h b/fs/ksmbd/smb2pdu.h
+index e1d0849ee68fd..912bd94257ecf 100644
+--- a/fs/ksmbd/smb2pdu.h
++++ b/fs/ksmbd/smb2pdu.h
+@@ -737,6 +737,7 @@ struct create_posix_rsp {
+ #define SMB2_LEASE_WRITE_CACHING_LE           cpu_to_le32(0x04)
+ #define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS_LE  cpu_to_le32(0x02)
++#define SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET_LE       cpu_to_le32(0x04)
+ #define SMB2_LEASE_KEY_SIZE                   16
+diff --git a/fs/ksmbd/vfs_cache.c b/fs/ksmbd/vfs_cache.c
+index 774a387fccced..2528ce8aeebbe 100644
+--- a/fs/ksmbd/vfs_cache.c
++++ b/fs/ksmbd/vfs_cache.c
+@@ -86,6 +86,17 @@ static struct ksmbd_inode *ksmbd_inode_lookup(struct ksmbd_file *fp)
+       return __ksmbd_inode_lookup(fp->filp->f_path.dentry);
+ }
++struct ksmbd_inode *ksmbd_inode_lookup_lock(struct dentry *d)
++{
++      struct ksmbd_inode *ci;
++
++      read_lock(&inode_hash_lock);
++      ci = __ksmbd_inode_lookup(d);
++      read_unlock(&inode_hash_lock);
++
++      return ci;
++}
++
+ int ksmbd_query_inode_status(struct dentry *dentry)
+ {
+       struct ksmbd_inode *ci;
+@@ -198,7 +209,7 @@ static void ksmbd_inode_free(struct ksmbd_inode *ci)
+       kfree(ci);
+ }
+-static void ksmbd_inode_put(struct ksmbd_inode *ci)
++void ksmbd_inode_put(struct ksmbd_inode *ci)
+ {
+       if (atomic_dec_and_test(&ci->m_count))
+               ksmbd_inode_free(ci);
+diff --git a/fs/ksmbd/vfs_cache.h b/fs/ksmbd/vfs_cache.h
+index 8325cf4527c46..4d4938d6029b6 100644
+--- a/fs/ksmbd/vfs_cache.h
++++ b/fs/ksmbd/vfs_cache.h
+@@ -138,6 +138,8 @@ struct ksmbd_file *ksmbd_lookup_foreign_fd(struct ksmbd_work *work, u64 id);
+ struct ksmbd_file *ksmbd_lookup_fd_slow(struct ksmbd_work *work, u64 id,
+                                       u64 pid);
+ void ksmbd_fd_put(struct ksmbd_work *work, struct ksmbd_file *fp);
++struct ksmbd_inode *ksmbd_inode_lookup_lock(struct dentry *d);
++void ksmbd_inode_put(struct ksmbd_inode *ci);
+ struct ksmbd_file *ksmbd_lookup_durable_fd(unsigned long long id);
+ struct ksmbd_file *ksmbd_lookup_fd_cguid(char *cguid);
+ struct ksmbd_file *ksmbd_lookup_fd_inode(struct dentry *dentry);
+-- 
+2.43.0
+
diff --git a/queue-5.15/ksmbd-set-epoch-in-create-context-v2-lease.patch b/queue-5.15/ksmbd-set-epoch-in-create-context-v2-lease.patch
new file mode 100644 (file)
index 0000000..60e7b58
--- /dev/null
@@ -0,0 +1,72 @@
+From 42984ecd3721e4ad50313079a87763508a577db3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Dec 2023 19:25:59 +0900
+Subject: ksmbd: set epoch in create context v2 lease
+
+From: Namjae Jeon <linkinjeon@kernel.org>
+
+[ Upstream commit d045850b628aaf931fc776c90feaf824dca5a1cf ]
+
+To support v2 lease(directory lease), ksmbd set epoch in create context
+v2 lease response.
+
+Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/ksmbd/oplock.c | 5 ++++-
+ fs/ksmbd/oplock.h | 1 +
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/fs/ksmbd/oplock.c b/fs/ksmbd/oplock.c
+index 1cf2d2a3746a3..ed639b7b65095 100644
+--- a/fs/ksmbd/oplock.c
++++ b/fs/ksmbd/oplock.c
+@@ -104,7 +104,7 @@ static int alloc_lease(struct oplock_info *opinfo, struct lease_ctx_info *lctx)
+       lease->duration = lctx->duration;
+       memcpy(lease->parent_lease_key, lctx->parent_lease_key, SMB2_LEASE_KEY_SIZE);
+       lease->version = lctx->version;
+-      lease->epoch = 0;
++      lease->epoch = le16_to_cpu(lctx->epoch);
+       INIT_LIST_HEAD(&opinfo->lease_entry);
+       opinfo->o_lease = lease;
+@@ -1032,6 +1032,7 @@ static void copy_lease(struct oplock_info *op1, struct oplock_info *op2)
+              SMB2_LEASE_KEY_SIZE);
+       lease2->duration = lease1->duration;
+       lease2->flags = lease1->flags;
++      lease2->epoch = lease1->epoch++;
+ }
+ static int add_lease_global_list(struct oplock_info *opinfo)
+@@ -1364,6 +1365,7 @@ void create_lease_buf(u8 *rbuf, struct lease *lease)
+               memcpy(buf->lcontext.LeaseKey, lease->lease_key,
+                      SMB2_LEASE_KEY_SIZE);
+               buf->lcontext.LeaseFlags = lease->flags;
++              buf->lcontext.Epoch = cpu_to_le16(++lease->epoch);
+               buf->lcontext.LeaseState = lease->state;
+               memcpy(buf->lcontext.ParentLeaseKey, lease->parent_lease_key,
+                      SMB2_LEASE_KEY_SIZE);
+@@ -1423,6 +1425,7 @@ struct lease_ctx_info *parse_lease_state(void *open_req)
+               memcpy(lreq->lease_key, lc->lcontext.LeaseKey, SMB2_LEASE_KEY_SIZE);
+               lreq->req_state = lc->lcontext.LeaseState;
+               lreq->flags = lc->lcontext.LeaseFlags;
++              lreq->epoch = lc->lcontext.Epoch;
+               lreq->duration = lc->lcontext.LeaseDuration;
+               memcpy(lreq->parent_lease_key, lc->lcontext.ParentLeaseKey,
+                               SMB2_LEASE_KEY_SIZE);
+diff --git a/fs/ksmbd/oplock.h b/fs/ksmbd/oplock.h
+index 4b0fe6da76940..ad31439c61fef 100644
+--- a/fs/ksmbd/oplock.h
++++ b/fs/ksmbd/oplock.h
+@@ -34,6 +34,7 @@ struct lease_ctx_info {
+       __le32                  flags;
+       __le64                  duration;
+       __u8                    parent_lease_key[SMB2_LEASE_KEY_SIZE];
++      __le16                  epoch;
+       int                     version;
+ };
+-- 
+2.43.0
+
diff --git a/queue-5.15/ksmbd-set-v2-lease-capability.patch b/queue-5.15/ksmbd-set-v2-lease-capability.patch
new file mode 100644 (file)
index 0000000..5315fa2
--- /dev/null
@@ -0,0 +1,72 @@
+From b5f07dc842d10860d54fd18484065ddaceb49383 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Dec 2023 19:26:00 +0900
+Subject: ksmbd: set v2 lease capability
+
+From: Namjae Jeon <linkinjeon@kernel.org>
+
+[ Upstream commit 18dd1c367c31d0a060f737d48345747662369b64 ]
+
+Set SMB2_GLOBAL_CAP_DIRECTORY_LEASING to ->capabilities to inform server
+support directory lease to client.
+
+Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/ksmbd/oplock.c  | 4 ----
+ fs/ksmbd/smb2ops.c | 9 ++++++---
+ 2 files changed, 6 insertions(+), 7 deletions(-)
+
+diff --git a/fs/ksmbd/oplock.c b/fs/ksmbd/oplock.c
+index ed639b7b65095..24716dbe7108c 100644
+--- a/fs/ksmbd/oplock.c
++++ b/fs/ksmbd/oplock.c
+@@ -1105,10 +1105,6 @@ int smb_grant_oplock(struct ksmbd_work *work, int req_op_level, u64 pid,
+       bool prev_op_has_lease;
+       __le32 prev_op_state = 0;
+-      /* not support directory lease */
+-      if (S_ISDIR(file_inode(fp->filp)->i_mode))
+-              return 0;
+-
+       opinfo = alloc_opinfo(work, pid, tid);
+       if (!opinfo)
+               return -ENOMEM;
+diff --git a/fs/ksmbd/smb2ops.c b/fs/ksmbd/smb2ops.c
+index 9138e1c29b22a..c69943d96565a 100644
+--- a/fs/ksmbd/smb2ops.c
++++ b/fs/ksmbd/smb2ops.c
+@@ -222,7 +222,8 @@ void init_smb3_0_server(struct ksmbd_conn *conn)
+       conn->signing_algorithm = SIGNING_ALG_AES_CMAC;
+       if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_LEASES)
+-              conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING;
++              conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING |
++                      SMB2_GLOBAL_CAP_DIRECTORY_LEASING;
+       if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION &&
+           conn->cli_cap & SMB2_GLOBAL_CAP_ENCRYPTION)
+@@ -246,7 +247,8 @@ void init_smb3_02_server(struct ksmbd_conn *conn)
+       conn->signing_algorithm = SIGNING_ALG_AES_CMAC;
+       if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_LEASES)
+-              conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING;
++              conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING |
++                      SMB2_GLOBAL_CAP_DIRECTORY_LEASING;
+       if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION ||
+           (!(server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION_OFF) &&
+@@ -271,7 +273,8 @@ int init_smb3_11_server(struct ksmbd_conn *conn)
+       conn->signing_algorithm = SIGNING_ALG_AES_CMAC;
+       if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_LEASES)
+-              conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING;
++              conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING |
++                      SMB2_GLOBAL_CAP_DIRECTORY_LEASING;
+       if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION ||
+           (!(server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION_OFF) &&
+-- 
+2.43.0
+
diff --git a/queue-5.15/net-usb-ax88179_178a-avoid-failed-operations-when-de.patch b/queue-5.15/net-usb-ax88179_178a-avoid-failed-operations-when-de.patch
new file mode 100644 (file)
index 0000000..267a9d4
--- /dev/null
@@ -0,0 +1,116 @@
+From bbfe9e0439414c24a62e3325063e4b63ab7308d0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 7 Dec 2023 18:50:07 +0100
+Subject: net: usb: ax88179_178a: avoid failed operations when device is
+ disconnected
+
+From: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
+
+[ Upstream commit aef05e349bfd81c95adb4489639413fadbb74a83 ]
+
+When the device is disconnected we get the following messages showing
+failed operations:
+Nov 28 20:22:11 localhost kernel: usb 2-3: USB disconnect, device number 2
+Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3: unregister 'ax88179_178a' usb-0000:02:00.0-3, ASIX AX88179 USB 3.0 Gigabit Ethernet
+Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3: Failed to read reg index 0x0002: -19
+Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3: Failed to write reg index 0x0002: -19
+Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3 (unregistered): Failed to write reg index 0x0002: -19
+Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3 (unregistered): Failed to write reg index 0x0001: -19
+Nov 28 20:22:11 localhost kernel: ax88179_178a 2-3:1.0 enp2s0u3 (unregistered): Failed to write reg index 0x0002: -19
+
+The reason is that although the device is detached, normal stop and
+unbind operations are commanded from the driver. These operations are
+not necessary in this situation, so avoid these logs when the device is
+detached if the result of the operation is -ENODEV and if the new flag
+informing about the disconnecting status is enabled.
+
+cc:  <stable@vger.kernel.org>
+Fixes: e2ca90c276e1f ("ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabit ethernet adapter driver")
+Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Link: https://lore.kernel.org/r/20231207175007.263907-1-jtornosm@redhat.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/usb/ax88179_178a.c | 23 ++++++++++++++++++++---
+ 1 file changed, 20 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
+index 49d97ad376654..a2b1f9a0c6d9f 100644
+--- a/drivers/net/usb/ax88179_178a.c
++++ b/drivers/net/usb/ax88179_178a.c
+@@ -172,6 +172,7 @@ struct ax88179_data {
+       u8 in_pm;
+       u32 wol_supported;
+       u32 wolopts;
++      u8 disconnecting;
+ };
+ struct ax88179_int_data {
+@@ -207,6 +208,7 @@ static int __ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+ {
+       int ret;
+       int (*fn)(struct usbnet *, u8, u8, u16, u16, void *, u16);
++      struct ax88179_data *ax179_data = dev->driver_priv;
+       BUG_ON(!dev);
+@@ -218,7 +220,7 @@ static int __ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+       ret = fn(dev, cmd, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+                value, index, data, size);
+-      if (unlikely(ret < 0))
++      if (unlikely((ret < 0) && !(ret == -ENODEV && ax179_data->disconnecting)))
+               netdev_warn(dev->net, "Failed to read reg index 0x%04x: %d\n",
+                           index, ret);
+@@ -230,6 +232,7 @@ static int __ax88179_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+ {
+       int ret;
+       int (*fn)(struct usbnet *, u8, u8, u16, u16, const void *, u16);
++      struct ax88179_data *ax179_data = dev->driver_priv;
+       BUG_ON(!dev);
+@@ -241,7 +244,7 @@ static int __ax88179_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+       ret = fn(dev, cmd, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+                value, index, data, size);
+-      if (unlikely(ret < 0))
++      if (unlikely((ret < 0) && !(ret == -ENODEV && ax179_data->disconnecting)))
+               netdev_warn(dev->net, "Failed to write reg index 0x%04x: %d\n",
+                           index, ret);
+@@ -516,6 +519,20 @@ static int ax88179_resume(struct usb_interface *intf)
+       return usbnet_resume(intf);
+ }
++static void ax88179_disconnect(struct usb_interface *intf)
++{
++      struct usbnet *dev = usb_get_intfdata(intf);
++      struct ax88179_data *ax179_data;
++
++      if (!dev)
++              return;
++
++      ax179_data = dev->driver_priv;
++      ax179_data->disconnecting = 1;
++
++      usbnet_disconnect(intf);
++}
++
+ static void
+ ax88179_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
+ {
+@@ -1946,7 +1963,7 @@ static struct usb_driver ax88179_178a_driver = {
+       .suspend =      ax88179_suspend,
+       .resume =       ax88179_resume,
+       .reset_resume = ax88179_resume,
+-      .disconnect =   usbnet_disconnect,
++      .disconnect =   ax88179_disconnect,
+       .supports_autosuspend = 1,
+       .disable_hub_initiated_lpm = 1,
+ };
+-- 
+2.43.0
+
diff --git a/queue-5.15/net-usb-ax88179_178a-clean-up-pm-calls.patch b/queue-5.15/net-usb-ax88179_178a-clean-up-pm-calls.patch
new file mode 100644 (file)
index 0000000..d7c4c91
--- /dev/null
@@ -0,0 +1,325 @@
+From a172ebef62e6520fa3508ad17eb88b41dd86fc2c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Jul 2022 17:28:13 -0700
+Subject: net: usb: ax88179_178a: clean up pm calls
+
+From: Justin Chen <justinpopo6@gmail.com>
+
+[ Upstream commit 843f92052da7694e846e8e12bbe2342845d2033e ]
+
+Instead of passing in_pm flags all over the place, use the private
+struct to handle in_pm mode.
+
+Signed-off-by: Justin Chen <justinpopo6@gmail.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Stable-dep-of: aef05e349bfd ("net: usb: ax88179_178a: avoid failed operations when device is disconnected")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/usb/ax88179_178a.c | 147 +++++++++++++--------------------
+ 1 file changed, 59 insertions(+), 88 deletions(-)
+
+diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
+index 7f5680c0b230c..bd258c4e13948 100644
+--- a/drivers/net/usb/ax88179_178a.c
++++ b/drivers/net/usb/ax88179_178a.c
+@@ -169,6 +169,7 @@ struct ax88179_data {
+       u8  eee_active;
+       u16 rxctl;
+       u16 reserved;
++      u8 in_pm;
+ };
+ struct ax88179_int_data {
+@@ -185,15 +186,29 @@ static const struct {
+       {7, 0xcc, 0x4c, 0x18, 8},
+ };
++static void ax88179_set_pm_mode(struct usbnet *dev, bool pm_mode)
++{
++      struct ax88179_data *ax179_data = (struct ax88179_data *)dev->data;
++
++      ax179_data->in_pm = pm_mode;
++}
++
++static int ax88179_in_pm(struct usbnet *dev)
++{
++      struct ax88179_data *ax179_data = (struct ax88179_data *)dev->data;
++
++      return ax179_data->in_pm;
++}
++
+ static int __ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+-                            u16 size, void *data, int in_pm)
++                            u16 size, void *data)
+ {
+       int ret;
+       int (*fn)(struct usbnet *, u8, u8, u16, u16, void *, u16);
+       BUG_ON(!dev);
+-      if (!in_pm)
++      if (!ax88179_in_pm(dev))
+               fn = usbnet_read_cmd;
+       else
+               fn = usbnet_read_cmd_nopm;
+@@ -209,14 +224,14 @@ static int __ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+ }
+ static int __ax88179_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+-                             u16 size, const void *data, int in_pm)
++                             u16 size, const void *data)
+ {
+       int ret;
+       int (*fn)(struct usbnet *, u8, u8, u16, u16, const void *, u16);
+       BUG_ON(!dev);
+-      if (!in_pm)
++      if (!ax88179_in_pm(dev))
+               fn = usbnet_write_cmd;
+       else
+               fn = usbnet_write_cmd_nopm;
+@@ -249,47 +264,6 @@ static void ax88179_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value,
+       }
+ }
+-static int ax88179_read_cmd_nopm(struct usbnet *dev, u8 cmd, u16 value,
+-                               u16 index, u16 size, void *data)
+-{
+-      int ret;
+-
+-      if (2 == size) {
+-              u16 buf;
+-              ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf, 1);
+-              le16_to_cpus(&buf);
+-              *((u16 *)data) = buf;
+-      } else if (4 == size) {
+-              u32 buf;
+-              ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf, 1);
+-              le32_to_cpus(&buf);
+-              *((u32 *)data) = buf;
+-      } else {
+-              ret = __ax88179_read_cmd(dev, cmd, value, index, size, data, 1);
+-      }
+-
+-      return ret;
+-}
+-
+-static int ax88179_write_cmd_nopm(struct usbnet *dev, u8 cmd, u16 value,
+-                                u16 index, u16 size, const void *data)
+-{
+-      int ret;
+-
+-      if (2 == size) {
+-              u16 buf;
+-              buf = *((u16 *)data);
+-              cpu_to_le16s(&buf);
+-              ret = __ax88179_write_cmd(dev, cmd, value, index,
+-                                        size, &buf, 1);
+-      } else {
+-              ret = __ax88179_write_cmd(dev, cmd, value, index,
+-                                        size, data, 1);
+-      }
+-
+-      return ret;
+-}
+-
+ static int ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+                           u16 size, void *data)
+ {
+@@ -297,16 +271,16 @@ static int ax88179_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+       if (2 == size) {
+               u16 buf = 0;
+-              ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf, 0);
++              ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf);
+               le16_to_cpus(&buf);
+               *((u16 *)data) = buf;
+       } else if (4 == size) {
+               u32 buf = 0;
+-              ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf, 0);
++              ret = __ax88179_read_cmd(dev, cmd, value, index, size, &buf);
+               le32_to_cpus(&buf);
+               *((u32 *)data) = buf;
+       } else {
+-              ret = __ax88179_read_cmd(dev, cmd, value, index, size, data, 0);
++              ret = __ax88179_read_cmd(dev, cmd, value, index, size, data);
+       }
+       return ret;
+@@ -322,10 +296,10 @@ static int ax88179_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
+               buf = *((u16 *)data);
+               cpu_to_le16s(&buf);
+               ret = __ax88179_write_cmd(dev, cmd, value, index,
+-                                        size, &buf, 0);
++                                        size, &buf);
+       } else {
+               ret = __ax88179_write_cmd(dev, cmd, value, index,
+-                                        size, data, 0);
++                                        size, data);
+       }
+       return ret;
+@@ -428,52 +402,46 @@ static int ax88179_suspend(struct usb_interface *intf, pm_message_t message)
+       u16 tmp16;
+       u8 tmp8;
++      ax88179_set_pm_mode(dev, true);
++
+       usbnet_suspend(intf, message);
+       /* Disable RX path */
+-      ax88179_read_cmd_nopm(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,
+-                            2, 2, &tmp16);
++      ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,
++                       2, 2, &tmp16);
+       tmp16 &= ~AX_MEDIUM_RECEIVE_EN;
+-      ax88179_write_cmd_nopm(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,
+-                             2, 2, &tmp16);
++      ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,
++                        2, 2, &tmp16);
+       /* Force bulk-in zero length */
+-      ax88179_read_cmd_nopm(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL,
+-                            2, 2, &tmp16);
++      ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL,
++                       2, 2, &tmp16);
+       tmp16 |= AX_PHYPWR_RSTCTL_BZ | AX_PHYPWR_RSTCTL_IPRL;
+-      ax88179_write_cmd_nopm(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL,
+-                             2, 2, &tmp16);
++      ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL,
++                        2, 2, &tmp16);
+       /* change clock */
+       tmp8 = 0;
+-      ax88179_write_cmd_nopm(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, &tmp8);
++      ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, &tmp8);
+       /* Configure RX control register => stop operation */
+       tmp16 = AX_RX_CTL_STOP;
+-      ax88179_write_cmd_nopm(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, &tmp16);
++      ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, &tmp16);
++
++      ax88179_set_pm_mode(dev, false);
+       return 0;
+ }
+ /* This function is used to enable the autodetach function. */
+ /* This function is determined by offset 0x43 of EEPROM */
+-static int ax88179_auto_detach(struct usbnet *dev, int in_pm)
++static int ax88179_auto_detach(struct usbnet *dev)
+ {
+       u16 tmp16;
+       u8 tmp8;
+-      int (*fnr)(struct usbnet *, u8, u16, u16, u16, void *);
+-      int (*fnw)(struct usbnet *, u8, u16, u16, u16, const void *);
+-
+-      if (!in_pm) {
+-              fnr = ax88179_read_cmd;
+-              fnw = ax88179_write_cmd;
+-      } else {
+-              fnr = ax88179_read_cmd_nopm;
+-              fnw = ax88179_write_cmd_nopm;
+-      }
+-      if (fnr(dev, AX_ACCESS_EEPROM, 0x43, 1, 2, &tmp16) < 0)
++      if (ax88179_read_cmd(dev, AX_ACCESS_EEPROM, 0x43, 1, 2, &tmp16) < 0)
+               return 0;
+       if ((tmp16 == 0xFFFF) || (!(tmp16 & 0x0100)))
+@@ -481,13 +449,13 @@ static int ax88179_auto_detach(struct usbnet *dev, int in_pm)
+       /* Enable Auto Detach bit */
+       tmp8 = 0;
+-      fnr(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, &tmp8);
++      ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, &tmp8);
+       tmp8 |= AX_CLK_SELECT_ULR;
+-      fnw(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, &tmp8);
++      ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, &tmp8);
+-      fnr(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, &tmp16);
++      ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, &tmp16);
+       tmp16 |= AX_PHYPWR_RSTCTL_AT;
+-      fnw(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, &tmp16);
++      ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL, 2, 2, &tmp16);
+       return 0;
+ }
+@@ -498,32 +466,36 @@ static int ax88179_resume(struct usb_interface *intf)
+       u16 tmp16;
+       u8 tmp8;
++      ax88179_set_pm_mode(dev, true);
++
+       usbnet_link_change(dev, 0, 0);
+       /* Power up ethernet PHY */
+       tmp16 = 0;
+-      ax88179_write_cmd_nopm(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL,
+-                             2, 2, &tmp16);
++      ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL,
++                        2, 2, &tmp16);
+       udelay(1000);
+       tmp16 = AX_PHYPWR_RSTCTL_IPRL;
+-      ax88179_write_cmd_nopm(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL,
+-                             2, 2, &tmp16);
++      ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_PHYPWR_RSTCTL,
++                        2, 2, &tmp16);
+       msleep(200);
+       /* Ethernet PHY Auto Detach*/
+-      ax88179_auto_detach(dev, 1);
++      ax88179_auto_detach(dev);
+       /* Enable clock */
+-      ax88179_read_cmd_nopm(dev, AX_ACCESS_MAC,  AX_CLK_SELECT, 1, 1, &tmp8);
++      ax88179_read_cmd(dev, AX_ACCESS_MAC,  AX_CLK_SELECT, 1, 1, &tmp8);
+       tmp8 |= AX_CLK_SELECT_ACS | AX_CLK_SELECT_BCS;
+-      ax88179_write_cmd_nopm(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, &tmp8);
++      ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_CLK_SELECT, 1, 1, &tmp8);
+       msleep(100);
+       /* Configure RX control register => start operation */
+       tmp16 = AX_RX_CTL_DROPCRCERR | AX_RX_CTL_IPE | AX_RX_CTL_START |
+               AX_RX_CTL_AP | AX_RX_CTL_AMALL | AX_RX_CTL_AB;
+-      ax88179_write_cmd_nopm(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, &tmp16);
++      ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_RX_CTL, 2, 2, &tmp16);
++
++      ax88179_set_pm_mode(dev, false);
+       return usbnet_resume(intf);
+ }
+@@ -599,8 +571,7 @@ ax88179_get_eeprom(struct net_device *net, struct ethtool_eeprom *eeprom,
+       /* ax88179/178A returns 2 bytes from eeprom on read */
+       for (i = first_word; i <= last_word; i++) {
+               ret = __ax88179_read_cmd(dev, AX_ACCESS_EEPROM, i, 1, 2,
+-                                       &eeprom_buff[i - first_word],
+-                                       0);
++                                       &eeprom_buff[i - first_word]);
+               if (ret < 0) {
+                       kfree(eeprom_buff);
+                       return -EIO;
+@@ -1069,7 +1040,7 @@ static int ax88179_check_eeprom(struct usbnet *dev)
+               } while (buf & EEP_BUSY);
+               __ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_SROM_DATA_LOW,
+-                                 2, 2, &eeprom[i * 2], 0);
++                                 2, 2, &eeprom[i * 2]);
+               if ((i == 0) && (eeprom[0] == 0xFF))
+                       return -EINVAL;
+@@ -1707,7 +1678,7 @@ static int ax88179_reset(struct usbnet *dev)
+       msleep(200);
+       /* Ethernet PHY Auto Detach*/
+-      ax88179_auto_detach(dev, 0);
++      ax88179_auto_detach(dev);
+       /* Read MAC address from DTB or asix chip */
+       ax88179_get_mac_addr(dev);
+-- 
+2.43.0
+
diff --git a/queue-5.15/net-usb-ax88179_178a-wol-optimizations.patch b/queue-5.15/net-usb-ax88179_178a-wol-optimizations.patch
new file mode 100644 (file)
index 0000000..180f92c
--- /dev/null
@@ -0,0 +1,127 @@
+From c908edbce69b17a394109f23d9ce3b569a0718a3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Jul 2022 17:28:16 -0700
+Subject: net: usb: ax88179_178a: wol optimizations
+
+From: Justin Chen <justinpopo6@gmail.com>
+
+[ Upstream commit 5050531610a64f08461e0c309db80ca51b779fd5 ]
+
+- Check if wol is supported on reset instead of everytime get_wol
+is called.
+- Save wolopts in private data instead of relying on the HW to save it.
+- Defer enabling WoL until suspend instead of enabling it everytime
+set_wol is called.
+
+Signed-off-by: Justin Chen <justinpopo6@gmail.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Stable-dep-of: aef05e349bfd ("net: usb: ax88179_178a: avoid failed operations when device is disconnected")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/usb/ax88179_178a.c | 52 ++++++++++++++++++----------------
+ 1 file changed, 28 insertions(+), 24 deletions(-)
+
+diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
+index bd258c4e13948..49d97ad376654 100644
+--- a/drivers/net/usb/ax88179_178a.c
++++ b/drivers/net/usb/ax88179_178a.c
+@@ -170,6 +170,8 @@ struct ax88179_data {
+       u16 rxctl;
+       u16 reserved;
+       u8 in_pm;
++      u32 wol_supported;
++      u32 wolopts;
+ };
+ struct ax88179_int_data {
+@@ -399,6 +401,7 @@ ax88179_phy_write_mmd_indirect(struct usbnet *dev, u16 prtad, u16 devad,
+ static int ax88179_suspend(struct usb_interface *intf, pm_message_t message)
+ {
+       struct usbnet *dev = usb_get_intfdata(intf);
++      struct ax88179_data *priv = dev->driver_priv;
+       u16 tmp16;
+       u8 tmp8;
+@@ -406,6 +409,19 @@ static int ax88179_suspend(struct usb_interface *intf, pm_message_t message)
+       usbnet_suspend(intf, message);
++      /* Enable WoL */
++      if (priv->wolopts) {
++              ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_MONITOR_MOD,
++                               1, 1, &tmp8);
++              if (priv->wolopts & WAKE_PHY)
++                      tmp8 |= AX_MONITOR_MODE_RWLC;
++              if (priv->wolopts & WAKE_MAGIC)
++                      tmp8 |= AX_MONITOR_MODE_RWMP;
++
++              ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MONITOR_MOD,
++                                1, 1, &tmp8);
++      }
++
+       /* Disable RX path */
+       ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,
+                        2, 2, &tmp16);
+@@ -504,40 +520,22 @@ static void
+ ax88179_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
+ {
+       struct usbnet *dev = netdev_priv(net);
+-      u8 opt;
+-
+-      if (ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_MONITOR_MOD,
+-                           1, 1, &opt) < 0) {
+-              wolinfo->supported = 0;
+-              wolinfo->wolopts = 0;
+-              return;
+-      }
++      struct ax88179_data *priv = dev->driver_priv;
+-      wolinfo->supported = WAKE_PHY | WAKE_MAGIC;
+-      wolinfo->wolopts = 0;
+-      if (opt & AX_MONITOR_MODE_RWLC)
+-              wolinfo->wolopts |= WAKE_PHY;
+-      if (opt & AX_MONITOR_MODE_RWMP)
+-              wolinfo->wolopts |= WAKE_MAGIC;
++      wolinfo->supported = priv->wol_supported;
++      wolinfo->wolopts = priv->wolopts;
+ }
+ static int
+ ax88179_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
+ {
+       struct usbnet *dev = netdev_priv(net);
+-      u8 opt = 0;
++      struct ax88179_data *priv = dev->driver_priv;
+-      if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC))
++      if (wolinfo->wolopts & ~(priv->wol_supported))
+               return -EINVAL;
+-      if (wolinfo->wolopts & WAKE_PHY)
+-              opt |= AX_MONITOR_MODE_RWLC;
+-      if (wolinfo->wolopts & WAKE_MAGIC)
+-              opt |= AX_MONITOR_MODE_RWMP;
+-
+-      if (ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MONITOR_MOD,
+-                            1, 1, &opt) < 0)
+-              return -EINVAL;
++      priv->wolopts = wolinfo->wolopts;
+       return 0;
+ }
+@@ -1727,6 +1725,12 @@ static int ax88179_reset(struct usbnet *dev)
+       ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,
+                         2, 2, tmp16);
++      /* Check if WoL is supported */
++      ax179_data->wol_supported = 0;
++      if (ax88179_read_cmd(dev, AX_ACCESS_MAC, AX_MONITOR_MOD,
++                           1, 1, &tmp) > 0)
++              ax179_data->wol_supported = WAKE_MAGIC | WAKE_PHY;
++
+       ax88179_led_setting(dev);
+       ax179_data->eee_enabled = 0;
+-- 
+2.43.0
+
index 33b2c18025889e5e3d581d671897d997a3a14b93..37f1c82b636293a5f031ae04cd164688c90f4b69 100644 (file)
@@ -63,3 +63,23 @@ lib-vsprintf-fix-pfwf-when-current-node-refcount-0.patch
 kvm-arm64-vgic-force-vcpu-vgic-teardown-on-vcpu-destroy.patch
 x86-alternatives-sync-core-before-enabling-interrupts.patch
 fuse-share-lookup-state-between-submount-and-its-parent.patch
+ksmbd-have-a-dependency-on-cifs-arc4.patch
+ksmbd-set-epoch-in-create-context-v2-lease.patch
+ksmbd-set-v2-lease-capability.patch
+ksmbd-downgrade-rwh-lease-caching-state-to-rh-for-di.patch
+ksmbd-send-v2-lease-break-notification-for-directory.patch
+ksmbd-lazy-v2-lease-break-on-smb2_write.patch
+ksmbd-avoid-duplicate-opinfo_put-call-on-error-of-sm.patch
+ksmbd-fix-wrong-allocation-size-update-in-smb2_open.patch
+arm-dts-fix-occasional-boot-hang-for-am3-usb.patch
+usb-fotg210-hcd-delete-an-incorrect-bounds-test.patch
+ethernet-constify-references-to-netdev-dev_addr-in-d.patch
+net-usb-ax88179_178a-clean-up-pm-calls.patch
+net-usb-ax88179_178a-wol-optimizations.patch
+net-usb-ax88179_178a-avoid-failed-operations-when-de.patch
+spi-introduce-spi_get_device_match_data-helper.patch
+iio-imu-adis16475-add-spi_device_id-table.patch
+smb-client-fix-oob-in-smb2_query_info_init.patch
+smb-client-fix-oob-in-smbcalcsize.patch
+bluetooth-af_bluetooth-fix-use-after-free-in-bt_sock.patch
+device-property-add-const-qualifier-to-device_get_ma.patch
diff --git a/queue-5.15/smb-client-fix-oob-in-smb2_query_info_init.patch b/queue-5.15/smb-client-fix-oob-in-smb2_query_info_init.patch
new file mode 100644 (file)
index 0000000..98ad461
--- /dev/null
@@ -0,0 +1,183 @@
+From 4f4a8f35468d6672e16abdf3ce8e5ec36ae057ad Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 13 Dec 2023 12:25:57 -0300
+Subject: smb: client: fix OOB in SMB2_query_info_init()
+
+From: Paulo Alcantara <pc@manguebit.com>
+
+[ Upstream commit 33eae65c6f49770fec7a662935d4eb4a6406d24b ]
+
+A small CIFS buffer (448 bytes) isn't big enough to hold
+SMB2_QUERY_INFO request along with user's input data from
+CIFS_QUERY_INFO ioctl.  That is, if the user passed an input buffer >
+344 bytes, the client will memcpy() off the end of @req->Buffer in
+SMB2_query_info_init() thus causing the following KASAN splat:
+
+  BUG: KASAN: slab-out-of-bounds in SMB2_query_info_init+0x242/0x250 [cifs]
+  Write of size 1023 at addr ffff88801308c5a8 by task a.out/1240
+
+  CPU: 1 PID: 1240 Comm: a.out Not tainted 6.7.0-rc4 #5
+  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
+  rel-1.16.2-3-gd478f380-rebuilt.opensuse.org 04/01/2014
+  Call Trace:
+   <TASK>
+   dump_stack_lvl+0x4a/0x80
+   print_report+0xcf/0x650
+   ? srso_alias_return_thunk+0x5/0xfbef5
+   ? srso_alias_return_thunk+0x5/0xfbef5
+   ? srso_alias_return_thunk+0x5/0xfbef5
+   ? __phys_addr+0x46/0x90
+   kasan_report+0xd8/0x110
+   ? SMB2_query_info_init+0x242/0x250 [cifs]
+   ? SMB2_query_info_init+0x242/0x250 [cifs]
+   kasan_check_range+0x105/0x1b0
+   __asan_memcpy+0x3c/0x60
+   SMB2_query_info_init+0x242/0x250 [cifs]
+   ? __pfx_SMB2_query_info_init+0x10/0x10 [cifs]
+   ? srso_alias_return_thunk+0x5/0xfbef5
+   ? smb_rqst_len+0xa6/0xc0 [cifs]
+   smb2_ioctl_query_info+0x4f4/0x9a0 [cifs]
+   ? __pfx_smb2_ioctl_query_info+0x10/0x10 [cifs]
+   ? __pfx_cifsConvertToUTF16+0x10/0x10 [cifs]
+   ? kasan_set_track+0x25/0x30
+   ? srso_alias_return_thunk+0x5/0xfbef5
+   ? __kasan_kmalloc+0x8f/0xa0
+   ? srso_alias_return_thunk+0x5/0xfbef5
+   ? cifs_strndup_to_utf16+0x12d/0x1a0 [cifs]
+   ? __build_path_from_dentry_optional_prefix+0x19d/0x2d0 [cifs]
+   ? __pfx_smb2_ioctl_query_info+0x10/0x10 [cifs]
+   cifs_ioctl+0x11c7/0x1de0 [cifs]
+   ? __pfx_cifs_ioctl+0x10/0x10 [cifs]
+   ? srso_alias_return_thunk+0x5/0xfbef5
+   ? rcu_is_watching+0x23/0x50
+   ? srso_alias_return_thunk+0x5/0xfbef5
+   ? __rseq_handle_notify_resume+0x6cd/0x850
+   ? __pfx___schedule+0x10/0x10
+   ? blkcg_iostat_update+0x250/0x290
+   ? srso_alias_return_thunk+0x5/0xfbef5
+   ? ksys_write+0xe9/0x170
+   __x64_sys_ioctl+0xc9/0x100
+   do_syscall_64+0x47/0xf0
+   entry_SYSCALL_64_after_hwframe+0x6f/0x77
+  RIP: 0033:0x7f893dde49cf
+  Code: 00 48 89 44 24 18 31 c0 48 8d 44 24 60 c7 04 24 10 00 00 00 48
+  89 44 24 08 48 8d 44 24 20 48 89 44 24 10 b8 10 00 00 00 0f 05 <89>
+  c2 3d 00 f0 ff ff 77 18 48 8b 44 24 18 64 48 2b 04 25 28 00 00
+  RSP: 002b:00007ffc03ff4160 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
+  RAX: ffffffffffffffda RBX: 00007ffc03ff4378 RCX: 00007f893dde49cf
+  RDX: 00007ffc03ff41d0 RSI: 00000000c018cf07 RDI: 0000000000000003
+  RBP: 00007ffc03ff4260 R08: 0000000000000410 R09: 0000000000000001
+  R10: 00007f893dce7300 R11: 0000000000000246 R12: 0000000000000000
+  R13: 00007ffc03ff4388 R14: 00007f893df15000 R15: 0000000000406de0
+   </TASK>
+
+Fix this by increasing size of SMB2_QUERY_INFO request buffers and
+validating input length to prevent other callers from overflowing @req
+in SMB2_query_info_init() as well.
+
+Fixes: f5b05d622a3e ("cifs: add IOCTL for QUERY_INFO passthrough to userspace")
+Cc: stable@vger.kernel.org
+Reported-by: Robert Morris <rtm@csail.mit.edu>
+Signed-off-by: Paulo Alcantara <pc@manguebit.com>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/cifs/smb2pdu.c | 29 ++++++++++++++++++++++-------
+ 1 file changed, 22 insertions(+), 7 deletions(-)
+
+diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
+index f51fea2e808d1..6714e9db0ee83 100644
+--- a/fs/cifs/smb2pdu.c
++++ b/fs/cifs/smb2pdu.c
+@@ -364,10 +364,15 @@ static int __smb2_plain_req_init(__le16 smb2_command, struct cifs_tcon *tcon,
+                                void **request_buf, unsigned int *total_len)
+ {
+       /* BB eventually switch this to SMB2 specific small buf size */
+-      if (smb2_command == SMB2_SET_INFO)
++      switch (smb2_command) {
++      case SMB2_SET_INFO:
++      case SMB2_QUERY_INFO:
+               *request_buf = cifs_buf_get();
+-      else
++              break;
++      default:
+               *request_buf = cifs_small_buf_get();
++              break;
++      }
+       if (*request_buf == NULL) {
+               /* BB should we add a retry in here if not a writepage? */
+               return -ENOMEM;
+@@ -3415,8 +3420,13 @@ SMB2_query_info_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server,
+       struct smb2_query_info_req *req;
+       struct kvec *iov = rqst->rq_iov;
+       unsigned int total_len;
++      size_t len;
+       int rc;
++      if (unlikely(check_add_overflow(input_len, sizeof(*req), &len) ||
++                   len > CIFSMaxBufSize))
++              return -EINVAL;
++
+       rc = smb2_plain_req_init(SMB2_QUERY_INFO, tcon, server,
+                                (void **) &req, &total_len);
+       if (rc)
+@@ -3438,7 +3448,7 @@ SMB2_query_info_init(struct cifs_tcon *tcon, struct TCP_Server_Info *server,
+       iov[0].iov_base = (char *)req;
+       /* 1 for Buffer */
+-      iov[0].iov_len = total_len - 1 + input_len;
++      iov[0].iov_len = len;
+       return 0;
+ }
+@@ -3446,7 +3456,7 @@ void
+ SMB2_query_info_free(struct smb_rqst *rqst)
+ {
+       if (rqst && rqst->rq_iov)
+-              cifs_small_buf_release(rqst->rq_iov[0].iov_base); /* request */
++              cifs_buf_release(rqst->rq_iov[0].iov_base); /* request */
+ }
+ static int
+@@ -5176,6 +5186,11 @@ build_qfs_info_req(struct kvec *iov, struct cifs_tcon *tcon,
+       return 0;
+ }
++static inline void free_qfs_info_req(struct kvec *iov)
++{
++      cifs_buf_release(iov->iov_base);
++}
++
+ int
+ SMB311_posix_qfs_info(const unsigned int xid, struct cifs_tcon *tcon,
+             u64 persistent_fid, u64 volatile_fid, struct kstatfs *fsdata)
+@@ -5207,7 +5222,7 @@ SMB311_posix_qfs_info(const unsigned int xid, struct cifs_tcon *tcon,
+       rc = cifs_send_recv(xid, ses, server,
+                           &rqst, &resp_buftype, flags, &rsp_iov);
+-      cifs_small_buf_release(iov.iov_base);
++      free_qfs_info_req(&iov);
+       if (rc) {
+               cifs_stats_fail_inc(tcon, SMB2_QUERY_INFO_HE);
+               goto posix_qfsinf_exit;
+@@ -5258,7 +5273,7 @@ SMB2_QFS_info(const unsigned int xid, struct cifs_tcon *tcon,
+       rc = cifs_send_recv(xid, ses, server,
+                           &rqst, &resp_buftype, flags, &rsp_iov);
+-      cifs_small_buf_release(iov.iov_base);
++      free_qfs_info_req(&iov);
+       if (rc) {
+               cifs_stats_fail_inc(tcon, SMB2_QUERY_INFO_HE);
+               goto qfsinf_exit;
+@@ -5325,7 +5340,7 @@ SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon,
+       rc = cifs_send_recv(xid, ses, server,
+                           &rqst, &resp_buftype, flags, &rsp_iov);
+-      cifs_small_buf_release(iov.iov_base);
++      free_qfs_info_req(&iov);
+       if (rc) {
+               cifs_stats_fail_inc(tcon, SMB2_QUERY_INFO_HE);
+               goto qfsattr_exit;
+-- 
+2.43.0
+
diff --git a/queue-5.15/smb-client-fix-oob-in-smbcalcsize.patch b/queue-5.15/smb-client-fix-oob-in-smbcalcsize.patch
new file mode 100644 (file)
index 0000000..2264f68
--- /dev/null
@@ -0,0 +1,84 @@
+From ae9cb87d1969bb35281ecdc6204aae88ba249174 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 15 Dec 2023 19:59:14 -0300
+Subject: smb: client: fix OOB in smbCalcSize()
+
+From: Paulo Alcantara <pc@manguebit.com>
+
+[ Upstream commit b35858b3786ddbb56e1c35138ba25d6adf8d0bef ]
+
+Validate @smb->WordCount to avoid reading off the end of @smb and thus
+causing the following KASAN splat:
+
+  BUG: KASAN: slab-out-of-bounds in smbCalcSize+0x32/0x40 [cifs]
+  Read of size 2 at addr ffff88801c024ec5 by task cifsd/1328
+
+  CPU: 1 PID: 1328 Comm: cifsd Not tainted 6.7.0-rc5 #9
+  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS
+  rel-1.16.2-3-gd478f380-rebuilt.opensuse.org 04/01/2014
+  Call Trace:
+   <TASK>
+   dump_stack_lvl+0x4a/0x80
+   print_report+0xcf/0x650
+   ? srso_alias_return_thunk+0x5/0xfbef5
+   ? srso_alias_return_thunk+0x5/0xfbef5
+   ? __phys_addr+0x46/0x90
+   kasan_report+0xd8/0x110
+   ? smbCalcSize+0x32/0x40 [cifs]
+   ? smbCalcSize+0x32/0x40 [cifs]
+   kasan_check_range+0x105/0x1b0
+   smbCalcSize+0x32/0x40 [cifs]
+   checkSMB+0x162/0x370 [cifs]
+   ? __pfx_checkSMB+0x10/0x10 [cifs]
+   cifs_handle_standard+0xbc/0x2f0 [cifs]
+   ? srso_alias_return_thunk+0x5/0xfbef5
+   cifs_demultiplex_thread+0xed1/0x1360 [cifs]
+   ? __pfx_cifs_demultiplex_thread+0x10/0x10 [cifs]
+   ? srso_alias_return_thunk+0x5/0xfbef5
+   ? lockdep_hardirqs_on_prepare+0x136/0x210
+   ? __pfx_lock_release+0x10/0x10
+   ? srso_alias_return_thunk+0x5/0xfbef5
+   ? mark_held_locks+0x1a/0x90
+   ? lockdep_hardirqs_on_prepare+0x136/0x210
+   ? srso_alias_return_thunk+0x5/0xfbef5
+   ? srso_alias_return_thunk+0x5/0xfbef5
+   ? __kthread_parkme+0xce/0xf0
+   ? __pfx_cifs_demultiplex_thread+0x10/0x10 [cifs]
+   kthread+0x18d/0x1d0
+   ? kthread+0xdb/0x1d0
+   ? __pfx_kthread+0x10/0x10
+   ret_from_fork+0x34/0x60
+   ? __pfx_kthread+0x10/0x10
+   ret_from_fork_asm+0x1b/0x30
+   </TASK>
+
+This fixes CVE-2023-6606.
+
+Reported-by: j51569436@gmail.com
+Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218218
+Cc: stable@vger.kernel.org
+Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/cifs/misc.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
+index 5e4dab5dfb7a3..33328eae03d7a 100644
+--- a/fs/cifs/misc.c
++++ b/fs/cifs/misc.c
+@@ -340,6 +340,10 @@ checkSMB(char *buf, unsigned int total_read, struct TCP_Server_Info *server)
+                       cifs_dbg(VFS, "Length less than smb header size\n");
+               }
+               return -EIO;
++      } else if (total_read < sizeof(*smb) + 2 * smb->WordCount) {
++              cifs_dbg(VFS, "%s: can't read BCC due to invalid WordCount(%u)\n",
++                       __func__, smb->WordCount);
++              return -EIO;
+       }
+       /* otherwise, there is enough to get to the BCC */
+-- 
+2.43.0
+
diff --git a/queue-5.15/spi-introduce-spi_get_device_match_data-helper.patch b/queue-5.15/spi-introduce-spi_get_device_match_data-helper.patch
new file mode 100644 (file)
index 0000000..ddd5eeb
--- /dev/null
@@ -0,0 +1,65 @@
+From b1372d9e53b4aa2c46e48d2de083644fefa286a4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Oct 2022 22:54:21 +0300
+Subject: spi: Introduce spi_get_device_match_data() helper
+
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+[ Upstream commit aea672d054a21782ed8450c75febb6ba3c208ca4 ]
+
+The proposed spi_get_device_match_data() helper is for retrieving
+a driver data associated with the ID in an ID table. First, it tries
+to get driver data of the device enumerated by firmware interface
+(usually Device Tree or ACPI). If none is found it falls back to
+the SPI ID table matching.
+
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Link: https://lore.kernel.org/r/20221020195421.10482-1-andriy.shevchenko@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Stable-dep-of: ee4d79055aee ("iio: imu: adis16475: add spi_device_id table")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi.c       | 12 ++++++++++++
+ include/linux/spi/spi.h |  3 +++
+ 2 files changed, 15 insertions(+)
+
+diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
+index 06dd1be54925e..d4b186a35bb22 100644
+--- a/drivers/spi/spi.c
++++ b/drivers/spi/spi.c
+@@ -335,6 +335,18 @@ const struct spi_device_id *spi_get_device_id(const struct spi_device *sdev)
+ }
+ EXPORT_SYMBOL_GPL(spi_get_device_id);
++const void *spi_get_device_match_data(const struct spi_device *sdev)
++{
++      const void *match;
++
++      match = device_get_match_data(&sdev->dev);
++      if (match)
++              return match;
++
++      return (const void *)spi_get_device_id(sdev)->driver_data;
++}
++EXPORT_SYMBOL_GPL(spi_get_device_match_data);
++
+ static int spi_match_device(struct device *dev, struct device_driver *drv)
+ {
+       const struct spi_device *spi = to_spi_device(dev);
+diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
+index 6b0b686f6f904..9ab3dab9568ae 100644
+--- a/include/linux/spi/spi.h
++++ b/include/linux/spi/spi.h
+@@ -1499,6 +1499,9 @@ extern void spi_unregister_device(struct spi_device *spi);
+ extern const struct spi_device_id *
+ spi_get_device_id(const struct spi_device *sdev);
++extern const void *
++spi_get_device_match_data(const struct spi_device *sdev);
++
+ static inline bool
+ spi_transfer_is_last(struct spi_controller *ctlr, struct spi_transfer *xfer)
+ {
+-- 
+2.43.0
+
diff --git a/queue-5.15/usb-fotg210-hcd-delete-an-incorrect-bounds-test.patch b/queue-5.15/usb-fotg210-hcd-delete-an-incorrect-bounds-test.patch
new file mode 100644 (file)
index 0000000..cd869a5
--- /dev/null
@@ -0,0 +1,63 @@
+From 3e429e13362478aa0b6ac710fc041d11df719309 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 13 Dec 2023 16:22:43 +0300
+Subject: usb: fotg210-hcd: delete an incorrect bounds test
+
+From: Dan Carpenter <dan.carpenter@linaro.org>
+
+[ Upstream commit 7fbcd195e2b8cc952e4aeaeb50867b798040314c ]
+
+Here "temp" is the number of characters that we have written and "size"
+is the size of the buffer.  The intent was clearly to say that if we have
+written to the end of the buffer then stop.
+
+However, for that to work the comparison should have been done on the
+original "size" value instead of the "size -= temp" value.  Not only
+will that not trigger when we want to, but there is a small chance that
+it will trigger incorrectly before we want it to and we break from the
+loop slightly earlier than intended.
+
+This code was recently changed from using snprintf() to scnprintf().  With
+snprintf() we likely would have continued looping and passed a negative
+size parameter to snprintf().  This would have triggered an annoying
+WARN().  Now that we have converted to scnprintf() "size" will never
+drop below 1 and there is no real need for this test.  We could change
+the condition to "if (temp <= 1) goto done;" but just deleting the test
+is cleanest.
+
+Fixes: 7d50195f6c50 ("usb: host: Faraday fotg210-hcd driver")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
+Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
+Reviewed-by: Lee Jones <lee@kernel.org>
+Link: https://lore.kernel.org/r/ZXmwIwHe35wGfgzu@suswa
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/usb/host/fotg210-hcd.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
+index d9a3fd8af7a01..b0b6caaa29bd4 100644
+--- a/drivers/usb/host/fotg210-hcd.c
++++ b/drivers/usb/host/fotg210-hcd.c
+@@ -429,8 +429,6 @@ static void qh_lines(struct fotg210_hcd *fotg210, struct fotg210_qh *qh,
+                       temp = size;
+               size -= temp;
+               next += temp;
+-              if (temp == size)
+-                      goto done;
+       }
+       temp = snprintf(next, size, "\n");
+@@ -440,7 +438,6 @@ static void qh_lines(struct fotg210_hcd *fotg210, struct fotg210_qh *qh,
+       size -= temp;
+       next += temp;
+-done:
+       *sizep = size;
+       *nextp = next;
+ }
+-- 
+2.43.0
+