* [PATCH net-next 0/5] net: constify 'struct bin_attribute'
@ 2024-12-16 11:30 Thomas Weißschuh
2024-12-16 11:30 ` [PATCH net-next 1/5] net: bridge: " Thomas Weißschuh
` (5 more replies)
0 siblings, 6 replies; 15+ messages in thread
From: Thomas Weißschuh @ 2024-12-16 11:30 UTC (permalink / raw)
To: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn,
Heiner Kallweit, Russell King, Kalle Valo, Manish Chopra,
Rahul Verma, GR-Linux-NIC-Dev, Andrew Lunn, Shahed Shaikh
Cc: bridge, netdev, linux-kernel, linux-wireless,
Thomas Weißschuh
The sysfs core now allows instances of 'struct bin_attribute' to be
moved into read-only memory. Make use of that to protect them against
accidental or malicious modifications.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (5):
net: bridge: constify 'struct bin_attribute'
net: phy: ks8995: constify 'struct bin_attribute'
wlcore: sysfs: constify 'struct bin_attribute'
netxen_nic: constify 'struct bin_attribute'
qlcnic: constify 'struct bin_attribute'
.../net/ethernet/qlogic/netxen/netxen_nic_main.c | 20 +++----
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | 70 +++++++++++-----------
drivers/net/phy/spi_ks8995.c | 8 +--
drivers/net/wireless/ti/wlcore/sysfs.c | 4 +-
net/bridge/br_sysfs_br.c | 6 +-
5 files changed, 54 insertions(+), 54 deletions(-)
---
base-commit: 2d8308bf5b67dff50262d8a9260a50113b3628c6
change-id: 20241215-sysfs-const-bin_attr-net-4d8c00e56604
Best regards,
--
Thomas Weißschuh <linux@weissschuh.net>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH net-next 1/5] net: bridge: constify 'struct bin_attribute'
2024-12-16 11:30 [PATCH net-next 0/5] net: constify 'struct bin_attribute' Thomas Weißschuh
@ 2024-12-16 11:30 ` Thomas Weißschuh
2024-12-17 10:27 ` Simon Horman
2024-12-17 10:43 ` Nikolay Aleksandrov
2024-12-16 11:30 ` [PATCH net-next 2/5] net: phy: ks8995: " Thomas Weißschuh
` (4 subsequent siblings)
5 siblings, 2 replies; 15+ messages in thread
From: Thomas Weißschuh @ 2024-12-16 11:30 UTC (permalink / raw)
To: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn,
Heiner Kallweit, Russell King, Kalle Valo, Manish Chopra,
Rahul Verma, GR-Linux-NIC-Dev, Andrew Lunn, Shahed Shaikh
Cc: bridge, netdev, linux-kernel, linux-wireless,
Thomas Weißschuh
The sysfs core now allows instances of 'struct bin_attribute' to be
moved into read-only memory. Make use of that to protect them against
accidental or malicious modifications.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
net/bridge/br_sysfs_br.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index ea733542244c7e7feeffef3c993404529ba88559..c1176a5e02c43ce32cb3dc152e9aa08eb535a419 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -1002,7 +1002,7 @@ static const struct attribute_group bridge_group = {
* Returns the number of bytes read.
*/
static ssize_t brforward_read(struct file *filp, struct kobject *kobj,
- struct bin_attribute *bin_attr,
+ const struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
struct device *dev = kobj_to_dev(kobj);
@@ -1023,10 +1023,10 @@ static ssize_t brforward_read(struct file *filp, struct kobject *kobj,
return n;
}
-static struct bin_attribute bridge_forward = {
+static const struct bin_attribute bridge_forward = {
.attr = { .name = SYSFS_BRIDGE_FDB,
.mode = 0444, },
- .read = brforward_read,
+ .read_new = brforward_read,
};
/*
--
2.47.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next 2/5] net: phy: ks8995: constify 'struct bin_attribute'
2024-12-16 11:30 [PATCH net-next 0/5] net: constify 'struct bin_attribute' Thomas Weißschuh
2024-12-16 11:30 ` [PATCH net-next 1/5] net: bridge: " Thomas Weißschuh
@ 2024-12-16 11:30 ` Thomas Weißschuh
2024-12-16 15:40 ` Andrew Lunn
2024-12-16 11:30 ` [PATCH net-next 3/5] wlcore: sysfs: " Thomas Weißschuh
` (3 subsequent siblings)
5 siblings, 1 reply; 15+ messages in thread
From: Thomas Weißschuh @ 2024-12-16 11:30 UTC (permalink / raw)
To: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn,
Heiner Kallweit, Russell King, Kalle Valo, Manish Chopra,
Rahul Verma, GR-Linux-NIC-Dev, Andrew Lunn, Shahed Shaikh
Cc: bridge, netdev, linux-kernel, linux-wireless,
Thomas Weißschuh
The sysfs core now allows instances of 'struct bin_attribute' to be
moved into read-only memory. Make use of that to protect them against
accidental or malicious modifications.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/net/phy/spi_ks8995.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/phy/spi_ks8995.c b/drivers/net/phy/spi_ks8995.c
index 7196e927c2cd8bd73ef2492260182d48daac19ef..076a370be849e00c57a3be0bbce83c4665c49593 100644
--- a/drivers/net/phy/spi_ks8995.c
+++ b/drivers/net/phy/spi_ks8995.c
@@ -289,7 +289,7 @@ static int ks8995_reset(struct ks8995_switch *ks)
}
static ssize_t ks8995_registers_read(struct file *filp, struct kobject *kobj,
- struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count)
+ const struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count)
{
struct device *dev;
struct ks8995_switch *ks8995;
@@ -301,7 +301,7 @@ static ssize_t ks8995_registers_read(struct file *filp, struct kobject *kobj,
}
static ssize_t ks8995_registers_write(struct file *filp, struct kobject *kobj,
- struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count)
+ const struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count)
{
struct device *dev;
struct ks8995_switch *ks8995;
@@ -401,8 +401,8 @@ static const struct bin_attribute ks8995_registers_attr = {
.mode = 0600,
},
.size = KS8995_REGS_SIZE,
- .read = ks8995_registers_read,
- .write = ks8995_registers_write,
+ .read_new = ks8995_registers_read,
+ .write_new = ks8995_registers_write,
};
/* ------------------------------------------------------------------------ */
--
2.47.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next 3/5] wlcore: sysfs: constify 'struct bin_attribute'
2024-12-16 11:30 [PATCH net-next 0/5] net: constify 'struct bin_attribute' Thomas Weißschuh
2024-12-16 11:30 ` [PATCH net-next 1/5] net: bridge: " Thomas Weißschuh
2024-12-16 11:30 ` [PATCH net-next 2/5] net: phy: ks8995: " Thomas Weißschuh
@ 2024-12-16 11:30 ` Thomas Weißschuh
2024-12-16 12:46 ` Kalle Valo
2024-12-18 18:05 ` [net-next,3/5] wifi: " Kalle Valo
2024-12-16 11:30 ` [PATCH net-next 4/5] netxen_nic: " Thomas Weißschuh
` (2 subsequent siblings)
5 siblings, 2 replies; 15+ messages in thread
From: Thomas Weißschuh @ 2024-12-16 11:30 UTC (permalink / raw)
To: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn,
Heiner Kallweit, Russell King, Kalle Valo, Manish Chopra,
Rahul Verma, GR-Linux-NIC-Dev, Andrew Lunn, Shahed Shaikh
Cc: bridge, netdev, linux-kernel, linux-wireless,
Thomas Weißschuh
The sysfs core now allows instances of 'struct bin_attribute' to be
moved into read-only memory. Make use of that to protect them against
accidental or malicious modifications.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/net/wireless/ti/wlcore/sysfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ti/wlcore/sysfs.c b/drivers/net/wireless/ti/wlcore/sysfs.c
index c07acfcbbd9c8179bd312840efda43e7e9c5e6a0..7c57d4c8744ad5d19f11c5765cc7bf27aadbf740 100644
--- a/drivers/net/wireless/ti/wlcore/sysfs.c
+++ b/drivers/net/wireless/ti/wlcore/sysfs.c
@@ -88,7 +88,7 @@ static ssize_t hw_pg_ver_show(struct device *dev,
static DEVICE_ATTR_RO(hw_pg_ver);
static ssize_t wl1271_sysfs_read_fwlog(struct file *filp, struct kobject *kobj,
- struct bin_attribute *bin_attr,
+ const struct bin_attribute *bin_attr,
char *buffer, loff_t pos, size_t count)
{
struct device *dev = kobj_to_dev(kobj);
@@ -121,7 +121,7 @@ static ssize_t wl1271_sysfs_read_fwlog(struct file *filp, struct kobject *kobj,
static const struct bin_attribute fwlog_attr = {
.attr = { .name = "fwlog", .mode = 0400 },
- .read = wl1271_sysfs_read_fwlog,
+ .read_new = wl1271_sysfs_read_fwlog,
};
int wlcore_sysfs_init(struct wl1271 *wl)
--
2.47.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next 4/5] netxen_nic: constify 'struct bin_attribute'
2024-12-16 11:30 [PATCH net-next 0/5] net: constify 'struct bin_attribute' Thomas Weißschuh
` (2 preceding siblings ...)
2024-12-16 11:30 ` [PATCH net-next 3/5] wlcore: sysfs: " Thomas Weißschuh
@ 2024-12-16 11:30 ` Thomas Weißschuh
2024-12-17 10:28 ` Simon Horman
2024-12-16 11:30 ` [PATCH net-next 5/5] qlcnic: " Thomas Weißschuh
2024-12-18 3:10 ` [PATCH net-next 0/5] net: " patchwork-bot+netdevbpf
5 siblings, 1 reply; 15+ messages in thread
From: Thomas Weißschuh @ 2024-12-16 11:30 UTC (permalink / raw)
To: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn,
Heiner Kallweit, Russell King, Kalle Valo, Manish Chopra,
Rahul Verma, GR-Linux-NIC-Dev, Andrew Lunn, Shahed Shaikh
Cc: bridge, netdev, linux-kernel, linux-wireless,
Thomas Weißschuh
The sysfs core now allows instances of 'struct bin_attribute' to be
moved into read-only memory. Make use of that to protect them against
accidental or malicious modifications.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index 9cff0a8ffb2c55de195983051e4e7f8568528c0f..3383ee1dad14e2cb40062b27f32a7cffb6f3fac2 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -2832,7 +2832,7 @@ netxen_sysfs_validate_crb(struct netxen_adapter *adapter,
static ssize_t
netxen_sysfs_read_crb(struct file *filp, struct kobject *kobj,
- struct bin_attribute *attr,
+ const struct bin_attribute *attr,
char *buf, loff_t offset, size_t size)
{
struct device *dev = kobj_to_dev(kobj);
@@ -2860,7 +2860,7 @@ netxen_sysfs_read_crb(struct file *filp, struct kobject *kobj,
static ssize_t
netxen_sysfs_write_crb(struct file *filp, struct kobject *kobj,
- struct bin_attribute *attr,
+ const struct bin_attribute *attr,
char *buf, loff_t offset, size_t size)
{
struct device *dev = kobj_to_dev(kobj);
@@ -2901,7 +2901,7 @@ netxen_sysfs_validate_mem(struct netxen_adapter *adapter,
static ssize_t
netxen_sysfs_read_mem(struct file *filp, struct kobject *kobj,
- struct bin_attribute *attr,
+ const struct bin_attribute *attr,
char *buf, loff_t offset, size_t size)
{
struct device *dev = kobj_to_dev(kobj);
@@ -2922,7 +2922,7 @@ netxen_sysfs_read_mem(struct file *filp, struct kobject *kobj,
}
static ssize_t netxen_sysfs_write_mem(struct file *filp, struct kobject *kobj,
- struct bin_attribute *attr, char *buf,
+ const struct bin_attribute *attr, char *buf,
loff_t offset, size_t size)
{
struct device *dev = kobj_to_dev(kobj);
@@ -2946,20 +2946,20 @@ static ssize_t netxen_sysfs_write_mem(struct file *filp, struct kobject *kobj,
static const struct bin_attribute bin_attr_crb = {
.attr = { .name = "crb", .mode = 0644 },
.size = 0,
- .read = netxen_sysfs_read_crb,
- .write = netxen_sysfs_write_crb,
+ .read_new = netxen_sysfs_read_crb,
+ .write_new = netxen_sysfs_write_crb,
};
static const struct bin_attribute bin_attr_mem = {
.attr = { .name = "mem", .mode = 0644 },
.size = 0,
- .read = netxen_sysfs_read_mem,
- .write = netxen_sysfs_write_mem,
+ .read_new = netxen_sysfs_read_mem,
+ .write_new = netxen_sysfs_write_mem,
};
static ssize_t
netxen_sysfs_read_dimm(struct file *filp, struct kobject *kobj,
- struct bin_attribute *attr,
+ const struct bin_attribute *attr,
char *buf, loff_t offset, size_t size)
{
struct device *dev = kobj_to_dev(kobj);
@@ -3082,7 +3082,7 @@ netxen_sysfs_read_dimm(struct file *filp, struct kobject *kobj,
static const struct bin_attribute bin_attr_dimm = {
.attr = { .name = "dimm", .mode = 0644 },
.size = sizeof(struct netxen_dimm_cfg),
- .read = netxen_sysfs_read_dimm,
+ .read_new = netxen_sysfs_read_dimm,
};
--
2.47.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next 5/5] qlcnic: constify 'struct bin_attribute'
2024-12-16 11:30 [PATCH net-next 0/5] net: constify 'struct bin_attribute' Thomas Weißschuh
` (3 preceding siblings ...)
2024-12-16 11:30 ` [PATCH net-next 4/5] netxen_nic: " Thomas Weißschuh
@ 2024-12-16 11:30 ` Thomas Weißschuh
2024-12-17 10:28 ` Simon Horman
2024-12-18 3:03 ` Jakub Kicinski
2024-12-18 3:10 ` [PATCH net-next 0/5] net: " patchwork-bot+netdevbpf
5 siblings, 2 replies; 15+ messages in thread
From: Thomas Weißschuh @ 2024-12-16 11:30 UTC (permalink / raw)
To: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn,
Heiner Kallweit, Russell King, Kalle Valo, Manish Chopra,
Rahul Verma, GR-Linux-NIC-Dev, Andrew Lunn, Shahed Shaikh
Cc: bridge, netdev, linux-kernel, linux-wireless,
Thomas Weißschuh
The sysfs core now allows instances of 'struct bin_attribute' to be
moved into read-only memory. Make use of that to protect them against
accidental or malicious modifications.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c | 70 +++++++++++------------
1 file changed, 35 insertions(+), 35 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
index 74125188beb82515f57a20ae24dcd526943d05ee..82c357865f19ba8f272426abc09f47b40d6b53da 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
@@ -264,7 +264,7 @@ static int qlcnic_sysfs_validate_crb(struct qlcnic_adapter *adapter,
}
static ssize_t qlcnic_sysfs_read_crb(struct file *filp, struct kobject *kobj,
- struct bin_attribute *attr, char *buf,
+ const struct bin_attribute *attr, char *buf,
loff_t offset, size_t size)
{
struct device *dev = kobj_to_dev(kobj);
@@ -281,7 +281,7 @@ static ssize_t qlcnic_sysfs_read_crb(struct file *filp, struct kobject *kobj,
}
static ssize_t qlcnic_sysfs_write_crb(struct file *filp, struct kobject *kobj,
- struct bin_attribute *attr, char *buf,
+ const struct bin_attribute *attr, char *buf,
loff_t offset, size_t size)
{
struct device *dev = kobj_to_dev(kobj);
@@ -310,7 +310,7 @@ static int qlcnic_sysfs_validate_mem(struct qlcnic_adapter *adapter,
}
static ssize_t qlcnic_sysfs_read_mem(struct file *filp, struct kobject *kobj,
- struct bin_attribute *attr, char *buf,
+ const struct bin_attribute *attr, char *buf,
loff_t offset, size_t size)
{
struct device *dev = kobj_to_dev(kobj);
@@ -332,7 +332,7 @@ static ssize_t qlcnic_sysfs_read_mem(struct file *filp, struct kobject *kobj,
}
static ssize_t qlcnic_sysfs_write_mem(struct file *filp, struct kobject *kobj,
- struct bin_attribute *attr, char *buf,
+ const struct bin_attribute *attr, char *buf,
loff_t offset, size_t size)
{
struct device *dev = kobj_to_dev(kobj);
@@ -396,7 +396,7 @@ static int validate_pm_config(struct qlcnic_adapter *adapter,
static ssize_t qlcnic_sysfs_write_pm_config(struct file *filp,
struct kobject *kobj,
- struct bin_attribute *attr,
+ const struct bin_attribute *attr,
char *buf, loff_t offset,
size_t size)
{
@@ -446,7 +446,7 @@ static ssize_t qlcnic_sysfs_write_pm_config(struct file *filp,
static ssize_t qlcnic_sysfs_read_pm_config(struct file *filp,
struct kobject *kobj,
- struct bin_attribute *attr,
+ const struct bin_attribute *attr,
char *buf, loff_t offset,
size_t size)
{
@@ -539,7 +539,7 @@ static int validate_esw_config(struct qlcnic_adapter *adapter,
static ssize_t qlcnic_sysfs_write_esw_config(struct file *file,
struct kobject *kobj,
- struct bin_attribute *attr,
+ const struct bin_attribute *attr,
char *buf, loff_t offset,
size_t size)
{
@@ -623,7 +623,7 @@ static ssize_t qlcnic_sysfs_write_esw_config(struct file *file,
static ssize_t qlcnic_sysfs_read_esw_config(struct file *file,
struct kobject *kobj,
- struct bin_attribute *attr,
+ const struct bin_attribute *attr,
char *buf, loff_t offset,
size_t size)
{
@@ -675,7 +675,7 @@ static int validate_npar_config(struct qlcnic_adapter *adapter,
static ssize_t qlcnic_sysfs_write_npar_config(struct file *file,
struct kobject *kobj,
- struct bin_attribute *attr,
+ const struct bin_attribute *attr,
char *buf, loff_t offset,
size_t size)
{
@@ -722,7 +722,7 @@ static ssize_t qlcnic_sysfs_write_npar_config(struct file *file,
static ssize_t qlcnic_sysfs_read_npar_config(struct file *file,
struct kobject *kobj,
- struct bin_attribute *attr,
+ const struct bin_attribute *attr,
char *buf, loff_t offset,
size_t size)
{
@@ -769,7 +769,7 @@ static ssize_t qlcnic_sysfs_read_npar_config(struct file *file,
static ssize_t qlcnic_sysfs_get_port_stats(struct file *file,
struct kobject *kobj,
- struct bin_attribute *attr,
+ const struct bin_attribute *attr,
char *buf, loff_t offset,
size_t size)
{
@@ -804,7 +804,7 @@ static ssize_t qlcnic_sysfs_get_port_stats(struct file *file,
static ssize_t qlcnic_sysfs_get_esw_stats(struct file *file,
struct kobject *kobj,
- struct bin_attribute *attr,
+ const struct bin_attribute *attr,
char *buf, loff_t offset,
size_t size)
{
@@ -839,7 +839,7 @@ static ssize_t qlcnic_sysfs_get_esw_stats(struct file *file,
static ssize_t qlcnic_sysfs_clear_esw_stats(struct file *file,
struct kobject *kobj,
- struct bin_attribute *attr,
+ const struct bin_attribute *attr,
char *buf, loff_t offset,
size_t size)
{
@@ -868,7 +868,7 @@ static ssize_t qlcnic_sysfs_clear_esw_stats(struct file *file,
static ssize_t qlcnic_sysfs_clear_port_stats(struct file *file,
struct kobject *kobj,
- struct bin_attribute *attr,
+ const struct bin_attribute *attr,
char *buf, loff_t offset,
size_t size)
{
@@ -898,7 +898,7 @@ static ssize_t qlcnic_sysfs_clear_port_stats(struct file *file,
static ssize_t qlcnic_sysfs_read_pci_config(struct file *file,
struct kobject *kobj,
- struct bin_attribute *attr,
+ const struct bin_attribute *attr,
char *buf, loff_t offset,
size_t size)
{
@@ -938,7 +938,7 @@ static ssize_t qlcnic_sysfs_read_pci_config(struct file *file,
static ssize_t qlcnic_83xx_sysfs_flash_read_handler(struct file *filp,
struct kobject *kobj,
- struct bin_attribute *attr,
+ const struct bin_attribute *attr,
char *buf, loff_t offset,
size_t size)
{
@@ -1115,7 +1115,7 @@ static int qlcnic_83xx_sysfs_flash_write(struct qlcnic_adapter *adapter,
static ssize_t qlcnic_83xx_sysfs_flash_write_handler(struct file *filp,
struct kobject *kobj,
- struct bin_attribute *attr,
+ const struct bin_attribute *attr,
char *buf, loff_t offset,
size_t size)
{
@@ -1195,64 +1195,64 @@ static const struct device_attribute dev_attr_beacon = {
static const struct bin_attribute bin_attr_crb = {
.attr = { .name = "crb", .mode = 0644 },
.size = 0,
- .read = qlcnic_sysfs_read_crb,
- .write = qlcnic_sysfs_write_crb,
+ .read_new = qlcnic_sysfs_read_crb,
+ .write_new = qlcnic_sysfs_write_crb,
};
static const struct bin_attribute bin_attr_mem = {
.attr = { .name = "mem", .mode = 0644 },
.size = 0,
- .read = qlcnic_sysfs_read_mem,
- .write = qlcnic_sysfs_write_mem,
+ .read_new = qlcnic_sysfs_read_mem,
+ .write_new = qlcnic_sysfs_write_mem,
};
static const struct bin_attribute bin_attr_npar_config = {
.attr = { .name = "npar_config", .mode = 0644 },
.size = 0,
- .read = qlcnic_sysfs_read_npar_config,
- .write = qlcnic_sysfs_write_npar_config,
+ .read_new = qlcnic_sysfs_read_npar_config,
+ .write_new = qlcnic_sysfs_write_npar_config,
};
static const struct bin_attribute bin_attr_pci_config = {
.attr = { .name = "pci_config", .mode = 0644 },
.size = 0,
- .read = qlcnic_sysfs_read_pci_config,
- .write = NULL,
+ .read_new = qlcnic_sysfs_read_pci_config,
+ .write_new = NULL,
};
static const struct bin_attribute bin_attr_port_stats = {
.attr = { .name = "port_stats", .mode = 0644 },
.size = 0,
- .read = qlcnic_sysfs_get_port_stats,
- .write = qlcnic_sysfs_clear_port_stats,
+ .read_new = qlcnic_sysfs_get_port_stats,
+ .write_new = qlcnic_sysfs_clear_port_stats,
};
static const struct bin_attribute bin_attr_esw_stats = {
.attr = { .name = "esw_stats", .mode = 0644 },
.size = 0,
- .read = qlcnic_sysfs_get_esw_stats,
- .write = qlcnic_sysfs_clear_esw_stats,
+ .read_new = qlcnic_sysfs_get_esw_stats,
+ .write_new = qlcnic_sysfs_clear_esw_stats,
};
static const struct bin_attribute bin_attr_esw_config = {
.attr = { .name = "esw_config", .mode = 0644 },
.size = 0,
- .read = qlcnic_sysfs_read_esw_config,
- .write = qlcnic_sysfs_write_esw_config,
+ .read_new = qlcnic_sysfs_read_esw_config,
+ .write_new = qlcnic_sysfs_write_esw_config,
};
static const struct bin_attribute bin_attr_pm_config = {
.attr = { .name = "pm_config", .mode = 0644 },
.size = 0,
- .read = qlcnic_sysfs_read_pm_config,
- .write = qlcnic_sysfs_write_pm_config,
+ .read_new = qlcnic_sysfs_read_pm_config,
+ .write_new = qlcnic_sysfs_write_pm_config,
};
static const struct bin_attribute bin_attr_flash = {
.attr = { .name = "flash", .mode = 0644 },
.size = 0,
- .read = qlcnic_83xx_sysfs_flash_read_handler,
- .write = qlcnic_83xx_sysfs_flash_write_handler,
+ .read_new = qlcnic_83xx_sysfs_flash_read_handler,
+ .write_new = qlcnic_83xx_sysfs_flash_write_handler,
};
#ifdef CONFIG_QLCNIC_HWMON
--
2.47.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 3/5] wlcore: sysfs: constify 'struct bin_attribute'
2024-12-16 11:30 ` [PATCH net-next 3/5] wlcore: sysfs: " Thomas Weißschuh
@ 2024-12-16 12:46 ` Kalle Valo
2024-12-18 18:05 ` [net-next,3/5] wifi: " Kalle Valo
1 sibling, 0 replies; 15+ messages in thread
From: Kalle Valo @ 2024-12-16 12:46 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn,
Heiner Kallweit, Russell King, Manish Chopra, Rahul Verma,
GR-Linux-NIC-Dev, Andrew Lunn, Shahed Shaikh, bridge, netdev,
linux-kernel, linux-wireless
Thomas Weißschuh <linux@weissschuh.net> writes:
> The sysfs core now allows instances of 'struct bin_attribute' to be
> moved into read-only memory. Make use of that to protect them against
> accidental or malicious modifications.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
'wifi:' missing from subject and this should go to wireless-next. I can
take that separately from other patches.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 2/5] net: phy: ks8995: constify 'struct bin_attribute'
2024-12-16 11:30 ` [PATCH net-next 2/5] net: phy: ks8995: " Thomas Weißschuh
@ 2024-12-16 15:40 ` Andrew Lunn
0 siblings, 0 replies; 15+ messages in thread
From: Andrew Lunn @ 2024-12-16 15:40 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Heiner Kallweit,
Russell King, Kalle Valo, Manish Chopra, Rahul Verma,
GR-Linux-NIC-Dev, Andrew Lunn, Shahed Shaikh, bridge, netdev,
linux-kernel, linux-wireless
On Mon, Dec 16, 2024 at 12:30:09PM +0100, Thomas Weißschuh wrote:
> The sysfs core now allows instances of 'struct bin_attribute' to be
> moved into read-only memory. Make use of that to protect them against
> accidental or malicious modifications.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 1/5] net: bridge: constify 'struct bin_attribute'
2024-12-16 11:30 ` [PATCH net-next 1/5] net: bridge: " Thomas Weißschuh
@ 2024-12-17 10:27 ` Simon Horman
2024-12-17 10:43 ` Nikolay Aleksandrov
1 sibling, 0 replies; 15+ messages in thread
From: Simon Horman @ 2024-12-17 10:27 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, Heiner Kallweit,
Russell King, Kalle Valo, Manish Chopra, Rahul Verma,
GR-Linux-NIC-Dev, Andrew Lunn, Shahed Shaikh, bridge, netdev,
linux-kernel, linux-wireless
On Mon, Dec 16, 2024 at 12:30:08PM +0100, Thomas Weißschuh wrote:
> The sysfs core now allows instances of 'struct bin_attribute' to be
> moved into read-only memory. Make use of that to protect them against
> accidental or malicious modifications.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 4/5] netxen_nic: constify 'struct bin_attribute'
2024-12-16 11:30 ` [PATCH net-next 4/5] netxen_nic: " Thomas Weißschuh
@ 2024-12-17 10:28 ` Simon Horman
0 siblings, 0 replies; 15+ messages in thread
From: Simon Horman @ 2024-12-17 10:28 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, Heiner Kallweit,
Russell King, Kalle Valo, Manish Chopra, Rahul Verma,
GR-Linux-NIC-Dev, Andrew Lunn, Shahed Shaikh, bridge, netdev,
linux-kernel, linux-wireless
On Mon, Dec 16, 2024 at 12:30:11PM +0100, Thomas Weißschuh wrote:
> The sysfs core now allows instances of 'struct bin_attribute' to be
> moved into read-only memory. Make use of that to protect them against
> accidental or malicious modifications.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 5/5] qlcnic: constify 'struct bin_attribute'
2024-12-16 11:30 ` [PATCH net-next 5/5] qlcnic: " Thomas Weißschuh
@ 2024-12-17 10:28 ` Simon Horman
2024-12-18 3:03 ` Jakub Kicinski
1 sibling, 0 replies; 15+ messages in thread
From: Simon Horman @ 2024-12-17 10:28 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, Heiner Kallweit,
Russell King, Kalle Valo, Manish Chopra, Rahul Verma,
GR-Linux-NIC-Dev, Andrew Lunn, Shahed Shaikh, bridge, netdev,
linux-kernel, linux-wireless
On Mon, Dec 16, 2024 at 12:30:12PM +0100, Thomas Weißschuh wrote:
> The sysfs core now allows instances of 'struct bin_attribute' to be
> moved into read-only memory. Make use of that to protect them against
> accidental or malicious modifications.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 1/5] net: bridge: constify 'struct bin_attribute'
2024-12-16 11:30 ` [PATCH net-next 1/5] net: bridge: " Thomas Weißschuh
2024-12-17 10:27 ` Simon Horman
@ 2024-12-17 10:43 ` Nikolay Aleksandrov
1 sibling, 0 replies; 15+ messages in thread
From: Nikolay Aleksandrov @ 2024-12-17 10:43 UTC (permalink / raw)
To: Thomas Weißschuh, Roopa Prabhu, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
Andrew Lunn, Heiner Kallweit, Russell King, Kalle Valo,
Manish Chopra, Rahul Verma, GR-Linux-NIC-Dev, Andrew Lunn,
Shahed Shaikh
Cc: bridge, netdev, linux-kernel, linux-wireless
On 12/16/24 13:30, Thomas Weißschuh wrote:
> The sysfs core now allows instances of 'struct bin_attribute' to be
> moved into read-only memory. Make use of that to protect them against
> accidental or malicious modifications.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> net/bridge/br_sysfs_br.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
> index ea733542244c7e7feeffef3c993404529ba88559..c1176a5e02c43ce32cb3dc152e9aa08eb535a419 100644
> --- a/net/bridge/br_sysfs_br.c
> +++ b/net/bridge/br_sysfs_br.c
> @@ -1002,7 +1002,7 @@ static const struct attribute_group bridge_group = {
> * Returns the number of bytes read.
> */
> static ssize_t brforward_read(struct file *filp, struct kobject *kobj,
> - struct bin_attribute *bin_attr,
> + const struct bin_attribute *bin_attr,
> char *buf, loff_t off, size_t count)
> {
> struct device *dev = kobj_to_dev(kobj);
> @@ -1023,10 +1023,10 @@ static ssize_t brforward_read(struct file *filp, struct kobject *kobj,
> return n;
> }
>
> -static struct bin_attribute bridge_forward = {
> +static const struct bin_attribute bridge_forward = {
> .attr = { .name = SYSFS_BRIDGE_FDB,
> .mode = 0444, },
> - .read = brforward_read,
> + .read_new = brforward_read,
> };
>
> /*
>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 5/5] qlcnic: constify 'struct bin_attribute'
2024-12-16 11:30 ` [PATCH net-next 5/5] qlcnic: " Thomas Weißschuh
2024-12-17 10:28 ` Simon Horman
@ 2024-12-18 3:03 ` Jakub Kicinski
1 sibling, 0 replies; 15+ messages in thread
From: Jakub Kicinski @ 2024-12-18 3:03 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Andrew Lunn, Heiner Kallweit,
Russell King, Kalle Valo, Manish Chopra, Rahul Verma,
GR-Linux-NIC-Dev, Andrew Lunn, Shahed Shaikh, bridge, netdev,
linux-kernel, linux-wireless
On Mon, 16 Dec 2024 12:30:12 +0100 Thomas Weißschuh wrote:
> - .read = qlcnic_sysfs_read_pci_config,
> - .write = NULL,
> + .read_new = qlcnic_sysfs_read_pci_config,
> + .write_new = NULL,
Please delete the NULL assignment instead.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next 0/5] net: constify 'struct bin_attribute'
2024-12-16 11:30 [PATCH net-next 0/5] net: constify 'struct bin_attribute' Thomas Weißschuh
` (4 preceding siblings ...)
2024-12-16 11:30 ` [PATCH net-next 5/5] qlcnic: " Thomas Weißschuh
@ 2024-12-18 3:10 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 15+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-12-18 3:10 UTC (permalink / raw)
To: =?utf-8?q?Thomas_Wei=C3=9Fschuh_=3Clinux=40weissschuh=2Enet=3E?=
Cc: roopa, razor, davem, edumazet, kuba, pabeni, horms, andrew,
hkallweit1, linux, kvalo, manishc, rahulv, GR-Linux-NIC-Dev,
andrew+netdev, shshaikh, bridge, netdev, linux-kernel,
linux-wireless
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 16 Dec 2024 12:30:07 +0100 you wrote:
> The sysfs core now allows instances of 'struct bin_attribute' to be
> moved into read-only memory. Make use of that to protect them against
> accidental or malicious modifications.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> Thomas Weißschuh (5):
> net: bridge: constify 'struct bin_attribute'
> net: phy: ks8995: constify 'struct bin_attribute'
> wlcore: sysfs: constify 'struct bin_attribute'
> netxen_nic: constify 'struct bin_attribute'
> qlcnic: constify 'struct bin_attribute'
>
> [...]
Here is the summary with links:
- [net-next,1/5] net: bridge: constify 'struct bin_attribute'
https://git.kernel.org/netdev/net-next/c/a2558b410de3
- [net-next,2/5] net: phy: ks8995: constify 'struct bin_attribute'
https://git.kernel.org/netdev/net-next/c/2d7b422fa795
- [net-next,3/5] wlcore: sysfs: constify 'struct bin_attribute'
(no matching commit)
- [net-next,4/5] netxen_nic: constify 'struct bin_attribute'
https://git.kernel.org/netdev/net-next/c/ae026eae08e7
- [net-next,5/5] qlcnic: constify 'struct bin_attribute'
(no matching commit)
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [net-next,3/5] wifi: wlcore: sysfs: constify 'struct bin_attribute'
2024-12-16 11:30 ` [PATCH net-next 3/5] wlcore: sysfs: " Thomas Weißschuh
2024-12-16 12:46 ` Kalle Valo
@ 2024-12-18 18:05 ` Kalle Valo
1 sibling, 0 replies; 15+ messages in thread
From: Kalle Valo @ 2024-12-18 18:05 UTC (permalink / raw)
To: Thomas Weißschuh
Cc: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Andrew Lunn,
Heiner Kallweit, Russell King, Manish Chopra, Rahul Verma,
GR-Linux-NIC-Dev, Andrew Lunn, Shahed Shaikh, bridge, netdev,
linux-kernel, linux-wireless, Thomas Weißschuh
Thomas Weißschuh <linux@weissschuh.net> wrote:
> The sysfs core now allows instances of 'struct bin_attribute' to be
> moved into read-only memory. Make use of that to protect them against
> accidental or malicious modifications.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Patch applied to wireless-next.git, thanks.
8ab3bf476413 wifi: wlcore: sysfs: constify 'struct bin_attribute'
--
https://patchwork.kernel.org/project/linux-wireless/patch/20241216-sysfs-const-bin_attr-net-v1-3-ec460b91f274@weissschuh.net/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2024-12-18 18:05 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-16 11:30 [PATCH net-next 0/5] net: constify 'struct bin_attribute' Thomas Weißschuh
2024-12-16 11:30 ` [PATCH net-next 1/5] net: bridge: " Thomas Weißschuh
2024-12-17 10:27 ` Simon Horman
2024-12-17 10:43 ` Nikolay Aleksandrov
2024-12-16 11:30 ` [PATCH net-next 2/5] net: phy: ks8995: " Thomas Weißschuh
2024-12-16 15:40 ` Andrew Lunn
2024-12-16 11:30 ` [PATCH net-next 3/5] wlcore: sysfs: " Thomas Weißschuh
2024-12-16 12:46 ` Kalle Valo
2024-12-18 18:05 ` [net-next,3/5] wifi: " Kalle Valo
2024-12-16 11:30 ` [PATCH net-next 4/5] netxen_nic: " Thomas Weißschuh
2024-12-17 10:28 ` Simon Horman
2024-12-16 11:30 ` [PATCH net-next 5/5] qlcnic: " Thomas Weißschuh
2024-12-17 10:28 ` Simon Horman
2024-12-18 3:03 ` Jakub Kicinski
2024-12-18 3:10 ` [PATCH net-next 0/5] net: " patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).