From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-il1-f176.google.com (mail-il1-f176.google.com [209.85.166.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA7ED433D5 for ; Mon, 23 Dec 2024 22:24:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734992696; cv=none; b=WQS1rakpFlpcJEQGIp0YO4GzSxr3X1KUNGLErGr5DId9uQ5EQH2ty+5vV/5QIBbikG2vdDEXN56J0wXyDbdRY/DCXef4xx5hSsLZJIlCPuI/FnVj/knzJ3f3+38a16cviapRUS6ljR/oM6ecqFR1GcOHnUHmxcorhtObgMJr8uM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734992696; c=relaxed/simple; bh=POu7UZ77HY1uYRvLC/GJPTZJ+KhyS5srPJcWfpvoi3c=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=CkWxatQ2ey85ibKigsp4Sz9gJuspntNoGd2KR2Da9OZ4clZBIH6LzR6HBLDqGi7f9FC9Ay3BkUC4lpqbW6zlMPQbwwyAe3Uz9l0wS/xkYIf8mSM3pMv/wGJLK5Y3Q/pojGZ1ddTj9Hdv6Rid6/4bEJE7AkiaVp9pK/gFvDbxlHk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=KyL95g6i; arc=none smtp.client-ip=209.85.166.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="KyL95g6i" Received: by mail-il1-f176.google.com with SMTP id e9e14a558f8ab-3a814831760so16750585ab.1 for ; Mon, 23 Dec 2024 14:24:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1734992694; x=1735597494; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=SkaGX1PrkiIvFeAcmNiJvskCXGw4dXzt7gXU2Vfhu0Y=; b=KyL95g6iPmcuR5x6xiCVK1xdciscnaYdQaHvmFmZ0X7s4HBeE/5T0byjRZR/Zy/+1H YX+ZvQl9PMsgixJfLuXVJCWZbOc3vJBYeRYvYn3/X5fhxdwxExL5RmL7HORygFlyY8WN 7llz2ZGouDCO5JuelpfNInjfqH0Lxh256zUgQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734992694; x=1735597494; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SkaGX1PrkiIvFeAcmNiJvskCXGw4dXzt7gXU2Vfhu0Y=; b=jOyLbJhrwnFjOk9sppzr1BOTOOuMak3F7Crvr4fd+UE8s5L7S8VWzD9LocqSMnIwUG 7XSpCm87/Wims/XzAkPk+h1/x43OhHDCnQsChruoxJL1w6RopRDc6bW1KmNnKmKqtEgd zjKTywy1np+v0tiOkHPLEldBNSkJRA27JSo804Z0yY2xaAX1ooVThcuk1sALJtbhTY9e YwajaePl6OfIDhLsPPVCeujX1vd6u2lPx9NtGWHp9j2y3z6LT069ZwJjz8BE3eymSOW3 o+dSQsNiIYg8tN59g8Or0EY1ONMc/FJmC2EvrElXtTjXfSnMmEby0BAzP1svTPWJnV/s IuUQ== X-Forwarded-Encrypted: i=1; AJvYcCUeISHSt/XjYppSc9cmZ2xmfiFk7wi1ZzBCuVN1GWM06VJNO0VrCmrZnZZRWxyaRVkiUBYGzWZZpYcDkWg=@vger.kernel.org X-Gm-Message-State: AOJu0Yy5zn0mqcKowIyHv5TbQ6cVPzvfYEr9fgqOzLA35UYzBcdiBKrR LvNZe30lyuP9qqEcrPb0UeA4tLA7hTiQZc+aBE6EhErX+8CO9QbY8ZlZXIe51LKqnlzNwrUgBM3 1 X-Gm-Gg: ASbGncu8cq74em1tKF6UTyh1bAr5fmbhLj+FzErIJoGaBGcfkhevkFimkxAbNq2n4+u baDKN6TAMey9MaPjAUhwb2k/jTHL5b8nCwiCFwZEEE38fNj+n1e+nYvv8G4ZYNQm+0fZ99BhONp KoDTD4cIZfimlEPtx9ICqG3nxfOlNVRld9bUz4RXrmLFvJcvBtNcYkAA1H+96iTkHpqPhBROPsm 6Nw6bc0kiKHzToSNLBtiFIDhqB6R/6LnNfSrR30bzXtlNmiERcTR4r1gC7Gvn2bdi8l X-Google-Smtp-Source: AGHT+IET2wTP/W886Ou15XAObLqh9H6MMnbSX3VqhkzDmOy6rz/Q98b/nT/DOATXUaU+LMb59JJyBg== X-Received: by 2002:a05:6e02:20c1:b0:3a7:1c73:e18e with SMTP id e9e14a558f8ab-3c2d5434974mr104979605ab.21.1734992694013; Mon, 23 Dec 2024 14:24:54 -0800 (PST) Received: from [192.168.1.128] ([38.175.170.29]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3c0deae6828sm26882705ab.25.2024.12.23.14.24.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Dec 2024 14:24:53 -0800 (PST) Message-ID: Date: Mon, 23 Dec 2024 15:24:52 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] usbip: vudc: Constify 'struct bin_attribute' To: =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , Valentina Manea , Shuah Khan , Hongren Zheng , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan References: <20241222-sysfs-const-bin_attr-usbip-v1-1-20d611a9bfa4@weissschuh.net> Content-Language: en-US From: Shuah Khan In-Reply-To: <20241222-sysfs-const-bin_attr-usbip-v1-1-20d611a9bfa4@weissschuh.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 > --- > 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 Greg, please take this up. thanks, -- Shuah