Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Aug 2019 00:58:55 -0700
From:      Conrad Meyer <cem@freebsd.org>
To:        Xin LI <delphij@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>,  svn-src-head <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r351324 - head/sys/netgraph/bluetooth/drivers/ubt
Message-ID:  <CAG6CVpVKVvc3cv5CqcAY3wjktth0OTejrBj9yxZ5sEA8SA_ZSQ@mail.gmail.com>
In-Reply-To: <201908210745.x7L7jd30086482@repo.freebsd.org>
References:  <201908210745.x7L7jd30086482@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Xin Li,

On Wed, Aug 21, 2019 at 12:45 AM Xin LI <delphij@freebsd.org> wrote:
> URL: https://svnweb.freebsd.org/changeset/base/351324
>
> Log:
>   The 'mtx' is on stack and can contain garbages that would cause mtx_init
>   (and in turn lock_init) to think that the mutex was already initialized.
>
> --- head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c    Wed Aug 21 04:54:48 2019        (r351323)
> +++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c    Wed Aug 21 07:45:39 2019        (r351324)
> @@ -554,6 +554,7 @@ ubt_do_hci_request(struct usb_device *udev, struct ubt
>         /* Initialize INTR endpoint xfer and wait for response */
> +       bzero(&mtx, sizeof(mtx));
>         mtx_init(&mtx, "ubt pb", NULL, MTX_DEF);

This is usually spelled 'MTX_DEF | MTX_NEW' instead.

Best regards,
Conrad



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG6CVpVKVvc3cv5CqcAY3wjktth0OTejrBj9yxZ5sEA8SA_ZSQ>