public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 01/52] USB: serial: store owner from modules with usb_serial_register_drivers()
Date: Mon, 15 Apr 2024 10:56:24 +0200	[thread overview]
Message-ID: <ZhzruFpJPfORWqYv@hovoldconsulting.com> (raw)
In-Reply-To: <20240328-module-owner-usb-serial-v1-1-bc46c9ffbf56@linaro.org>

On Thu, Mar 28, 2024 at 11:05:39PM +0100, Krzysztof Kozlowski wrote:
> Modules registering driver with usb_serial_register_drivers() might
> forget to set .owner field.  The field is used by some of other kernel
> parts for reference counting (try_module_get()), so it is expected that
> drivers will set it.
> 
> Solve the problem by moving this task away from the drivers to the core
> amba bus code, just like we did for platform_driver in

"amba"

> commit 9447057eaff8 ("platform_device: use a macro instead of
> platform_driver_register").
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
>  drivers/usb/serial/usb-serial.c | 12 +++++++-----
>  include/linux/usb/serial.h      |  7 +++++--
>  2 files changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
> index f1e91eb7f8a4..a659f2096a1a 100644
> --- a/drivers/usb/serial/usb-serial.c
> +++ b/drivers/usb/serial/usb-serial.c
> @@ -1459,17 +1459,18 @@ static void usb_serial_deregister(struct usb_serial_driver *device)
>  }
>  
>  /**
> - * usb_serial_register_drivers - register drivers for a usb-serial module
> + * __usb_serial_register_drivers - register drivers for a usb-serial module
>   * @serial_drivers: NULL-terminated array of pointers to drivers to be registered
> + * @owner: owning module/driver

Just "module"

>   * @name: name of the usb_driver for this set of @serial_drivers
>   * @id_table: list of all devices this @serial_drivers set binds to
>   *
>   * Registers all the drivers in the @serial_drivers array, and dynamically
>   * creates a struct usb_driver with the name @name and id_table of @id_table.
>   */
> -int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[],
> -				const char *name,
> -				const struct usb_device_id *id_table)
> +int __usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[],
> +				  struct module *owner, const char *name,
> +				  const struct usb_device_id *id_table)

Johan

  reply	other threads:[~2024-04-15  8:56 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28 22:05 [PATCH 00/52] USB: store owner from modules with usb_serial_register_drivers() Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 01/52] USB: serial: " Krzysztof Kozlowski
2024-04-15  8:56   ` Johan Hovold [this message]
2024-05-03  9:54     ` Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 02/52] USB: serial: aircable: drop driver owner initialization Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 03/52] USB: serial: ark3116: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 04/52] USB: serial: belkin_sa: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 05/52] USB: serial: ch341: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 06/52] USB: serial: cp210x: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 07/52] USB: serial: cyberjack: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 08/52] USB: serial: cypress_m8: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 09/52] USB: serial: digi_acceleport: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 10/52] USB: serial: empeg: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 11/52] USB: serial: f81232: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 12/52] USB: serial: ftdi_sio: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 13/52] USB: serial: garmin_gps: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 14/52] USB: serial: generic: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 15/52] USB: serial: io_edgeport: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 16/52] USB: serial: io_ti: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 17/52] USB: serial: ipaq: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 18/52] USB: serial: ipw: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 19/52] USB: serial: ir-usb: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 20/52] USB: serial: iuu: " Krzysztof Kozlowski
2024-03-28 22:05 ` [PATCH 21/52] USB: serial: keyspan: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 22/52] USB: serial: keyspan_pda: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 23/52] USB: serial: kl5kusb105: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 24/52] USB: serial: kobil_sct: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 25/52] USB: serial: mct_u232: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 26/52] USB: serial: metro_usb: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 27/52] USB: serial: mos7720: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 28/52] USB: serial: mos7840: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 29/52] USB: serial: mxuport: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 30/52] USB: serial: navman: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 31/52] USB: serial: omninet: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 32/52] USB: serial: opticon: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 33/52] USB: serial: option: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 34/52] USB: serial: oti6858: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 35/52] USB: serial: pl2303: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 36/52] USB: serial: qcaux: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 37/52] USB: serial: qcserial: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 38/52] USB: serial: quatech2: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 39/52] USB: serial: safe_serial: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 40/52] USB: serial: sierra: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 41/52] USB: serial: spcp8x5: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 42/52] USB: serial: ssu100: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 43/52] USB: serial: symbol: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 44/52] USB: serial: ti_usb_3410_5052: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 45/52] USB: serial: upd78f0730: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 46/52] USB: serial: simple: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 47/52] USB: serial: debug: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 48/52] USB: serial: visor: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 49/52] USB: serial: whiteheat: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 50/52] USB: serial: wishbone: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 51/52] USB: serial: xr: " Krzysztof Kozlowski
2024-03-28 22:06 ` [PATCH 52/52] USB: serial: xsens_mt: " Krzysztof Kozlowski
2024-04-15  8:54 ` [PATCH 00/52] USB: store owner from modules with usb_serial_register_drivers() Johan Hovold
2024-05-03  9:49   ` Krzysztof Kozlowski
2024-05-03 10:57     ` Johan Hovold
2024-05-03  9:46 ` Krzysztof Kozlowski
2024-05-03  9:48   ` Krzysztof Kozlowski

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=ZhzruFpJPfORWqYv@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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