From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konstantin Khorenko Date: Fri, 21 Aug 2026 18:42:28 +0200 Subject: [Devel] [PATCH RHEL10 COMMIT] ms/pcmcia: cistpl: Constify 'struct bin_attribute' In-Reply-To: <20260821163718.187766-30-khorenko@virtuozzo.com> Message-ID: <202608211642.67LGgSZ8668479@f0.sw.ru> List-Id: The commit is pushed to "branch-rh10-6.12.0-211.39.1.16.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git after rh10-6.12.0-211.39.1.16.6.vz10 ------> commit 889c35dad8118bbce4445b873c67a6d7a931db22 Author: Thomas Wei??schuh Date: Fri Aug 21 18:37:15 2026 +0200 ms/pcmcia: cistpl: Constify 'struct bin_attribute' 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 Link: https://lore.kernel.org/r/20241215-sysfs-const-bin_attr-pcmcia-v1-1-ebb82e47d834 at weissschuh.net Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 05a9896fa9e15466456a1b1dc9d2eacdf3551b79) Needed here because the RHEL10.2 base carries the sysfs side of the conversion but not the pcmcia one, so the initializer of pccard_cis_attr does not compile at all: drivers/pcmcia/cistpl.c:1608:17: error: initialization of 'ssize_t (*)(struct file *, struct kobject *, const struct bin_attribute *, char *, loff_t, size_t)' from incompatible pointer type [-Wincompatible-pointer-types] Our shipped configs have CONFIG_PCCARD=n so it goes unnoticed there, while plain x86_64 defconfig - which we now want to keep building for KUnit - enables it. Applies as is: this tree's struct bin_attribute has both the ::read/::write and the ::read_new/::write_new members, and sysfs_kf_bin_read() prefers the latter. https://virtuozzo.atlassian.net/browse/VSTOR-134732 Feature: fix ms/pcmcia Signed-off-by: Konstantin Khorenko --- drivers/pcmcia/cistpl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index d018f36f3a893..0c801e4ccc6c2 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -1540,7 +1540,7 @@ static ssize_t pccard_extract_cis(struct pcmcia_socket *s, char *buf, static ssize_t pccard_show_cis(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) { unsigned int size = 0x200; @@ -1571,7 +1571,7 @@ static ssize_t pccard_show_cis(struct file *filp, struct kobject *kobj, static ssize_t pccard_store_cis(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 pcmcia_socket *s; @@ -1605,6 +1605,6 @@ static ssize_t pccard_store_cis(struct file *filp, struct kobject *kobj, const struct bin_attribute pccard_cis_attr = { .attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR }, .size = 0x200, - .read = pccard_show_cis, - .write = pccard_store_cis, + .read_new = pccard_show_cis, + .write_new = pccard_store_cis, };