mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: "Thomas Weißschuh" <linux@weissschuh.net>,
	"Valentina Manea" <valentina.manea.m@gmail.com>,
	"Shuah Khan" <shuah@kernel.org>, "Hongren Zheng" <i@zenithal.me>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] usbip: vudc: Constify 'struct bin_attribute'
Date: Mon, 23 Dec 2024 15:24:52 -0700	[thread overview]
Message-ID: <e8e09510-4c0a-4025-9057-2922cfe6e7e0@linuxfoundation.org> (raw)
In-Reply-To: <20241222-sysfs-const-bin_attr-usbip-v1-1-20d611a9bfa4@weissschuh.net>

On 12/22/24 13:13, 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>
> ---
>   drivers/usb/usbip/vudc_sysfs.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c
> index 907a43a008964d647d19f9631faf4a443bc00019..2aae3edfc81369e3f84aadec7050356a4347c104 100644
> --- a/drivers/usb/usbip/vudc_sysfs.c
> +++ b/drivers/usb/usbip/vudc_sysfs.c
> @@ -67,7 +67,7 @@ int get_gadget_descs(struct vudc *udc)
>    * Exposes device descriptor from the gadget driver.
>    */
>   static ssize_t dev_desc_read(struct file *file, struct kobject *kobj,
> -			     struct bin_attribute *attr, char *out,
> +			     const struct bin_attribute *attr, char *out,
>   			     loff_t off, size_t count)
>   {
>   	struct device *dev = kobj_to_dev(kobj);
> @@ -88,7 +88,7 @@ static ssize_t dev_desc_read(struct file *file, struct kobject *kobj,
>   	spin_unlock_irqrestore(&udc->lock, flags);
>   	return ret;
>   }
> -static BIN_ATTR_RO(dev_desc, sizeof(struct usb_device_descriptor));
> +static const BIN_ATTR_RO(dev_desc, sizeof(struct usb_device_descriptor));
>   
>   static ssize_t usbip_sockfd_store(struct device *dev,
>   				  struct device_attribute *attr,
> @@ -252,14 +252,14 @@ static struct attribute *dev_attrs[] = {
>   	NULL,
>   };
>   
> -static struct bin_attribute *dev_bin_attrs[] = {
> +static const struct bin_attribute *const dev_bin_attrs[] = {
>   	&bin_attr_dev_desc,
>   	NULL,
>   };
>   
>   static const struct attribute_group vudc_attr_group = {
>   	.attrs = dev_attrs,
> -	.bin_attrs = dev_bin_attrs,
> +	.bin_attrs_new = dev_bin_attrs,
>   };
>   
>   const struct attribute_group *vudc_groups[] = {
> 
> ---
> base-commit: bcde95ce32b666478d6737219caa4f8005a8f201
> change-id: 20241222-sysfs-const-bin_attr-usbip-2255bb1238ad
> 
> Best regards,


Looks good to me.

Acked-by: Shuah Khan <skhan@linuxfoundation.org>

Greg, please take this up.

thanks,
-- Shuah

      reply	other threads:[~2024-12-23 22:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-22 20:13 Thomas Weißschuh
2024-12-23 22:24 ` Shuah Khan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e8e09510-4c0a-4025-9057-2922cfe6e7e0@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=i@zenithal.me \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=shuah@kernel.org \
    --cc=valentina.manea.m@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®