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]
Message-ID: <CA+M3ks7EO-Fy4KFEu5NgpsK73z2BsEhEsBZ8qraFoPnT7nTVLQ@mail.gmail.com>
Date:   Wed, 13 Feb 2019 10:07:38 +0100
From:   Benjamin Gaignard <benjamin.gaignard@...aro.org>
To:     Wen Yang <wen.yang99@....com.cn>
Cc:     Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-media@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        xue.zhihong@....com.cn, wang.yi59@....com.cn,
        "Hans Verkuil (hansverk)" <hansverk@...co.com>,
        Wen Yang <yellowriver2010@...mail.com>
Subject: Re: [PATCH v2 4/4] media: platform: sti: fix possible object
 reference leak

Le mer. 13 févr. 2019 à 00:49, Wen Yang <wen.yang99@....com.cn> a écrit :
>
> The call to of_parse_phandle() returns a node pointer with refcount
> incremented thus it must be explicitly decremented here after the last
> usage.
> The of_find_device_by_node() takes a reference to the underlying device
> structure, we also should release that reference.
>
> Hans Verkuil says:
> The cec driver should never take a reference of the hdmi device.
> It never accesses the HDMI device, it only needs the HDMI device pointer as
> a key in the notifier list.
> The real problem is that several CEC drivers take a reference of the HDMI
> device and never release it. So those drivers need to be fixed.
>
> This patch fixes those two issues.

Reviewed-by: Benjamin Gaignard <benjamin.gaignard@...aro.org>

>
> Fixes: fc4e009c6c98 ("[media] stih-cec: add CEC notifier support")
> Suggested-by: Hans Verkuil (hansverk) <hansverk@...co.com>
> Signed-off-by: Wen Yang <wen.yang99@....com.cn>
> Cc: Hans Verkuil (hansverk) <hansverk@...co.com>
> Cc: Benjamin Gaignard <benjamin.gaignard@...aro.org>
> Cc: Mauro Carvalho Chehab <mchehab@...nel.org>
> Cc: Wen Yang <yellowriver2010@...mail.com>
> Cc: linux-media@...r.kernel.org
> ---
> v2->v1:
> - move of_node_put() to just after the 'hdmi_dev = of_find_device_by_node(np)'.
> - put_device() can be done before the cec = devm_kzalloc line.
>
>  drivers/media/platform/sti/cec/stih-cec.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/media/platform/sti/cec/stih-cec.c b/drivers/media/platform/sti/cec/stih-cec.c
> index d34099f..721021f 100644
> --- a/drivers/media/platform/sti/cec/stih-cec.c
> +++ b/drivers/media/platform/sti/cec/stih-cec.c
> @@ -317,9 +317,11 @@ static int stih_cec_probe(struct platform_device *pdev)
>         }
>
>         hdmi_dev = of_find_device_by_node(np);
> +       of_node_put(np);
>         if (!hdmi_dev)
>                 return -EPROBE_DEFER;
>
> +       put_device(&hdmi_dev->dev);
>         cec->notifier = cec_notifier_get(&hdmi_dev->dev);
>         if (!cec->notifier)
>                 return -ENOMEM;
> --
> 2.9.5
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ