lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 27 Feb 2015 21:11:37 +0100
From:	Aleksander Morgado <aleksander@...ksander.es>
To:	j.dumon@...ion.com
Cc:	linux-usb@...r.kernel.org,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	Aleksander Morgado <aleksander@...ksander.es>
Subject: Re: [PATCH] hso: add missing spinlock grab when iterating the serial table

On Fri, Feb 27, 2015 at 7:44 PM, Aleksander Morgado
<aleksander@...ksander.es> wrote:
> Access to the 'serial_table' array needs to be protected by the spinlock.
>
> Signed-off-by: Aleksander Morgado <aleksander@...ksander.es>
> ---
>  drivers/net/usb/hso.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
> index 3c8dfe5..4f6deff 100644
> --- a/drivers/net/usb/hso.c
> +++ b/drivers/net/usb/hso.c
> @@ -607,19 +607,24 @@ static struct hso_serial *get_serial_by_shared_int_and_type(
>                                         struct hso_shared_int *shared_int,
>                                         int mux)
>  {
> +       struct hso_serial *serial = NULL;
>         int i, port;
> +       unsigned long flags;
>
>         port = hso_mux_to_port(mux);
>
> +       spin_lock_irqsave(&serial_table_lock, flags);
>         for (i = 0; i < HSO_SERIAL_TTY_MINORS; i++) {
>                 if (serial_table[i] &&
>                     (dev2ser(serial_table[i])->shared_int == shared_int) &&
>                     ((serial_table[i]->port_spec & HSO_PORT_MASK) == port)) {
> -                       return dev2ser(serial_table[i]);
> +                       serial = dev2ser(serial_table[i]);
> +                       break;
>                 }
>         }
> +       spin_unlock_irqrestore(&serial_table_lock, flags);
>
> -       return NULL;
> +       return serial;
>  }
>
>  static struct hso_serial *get_serial_by_index(unsigned index)
> --
> 2.3.1
>

Seems there are actually more places where this has to be done; I'll
send an updated version of the patch.


-- 
Aleksander
https://aleksander.es
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ