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>] [day] [month] [year] [list]
Message-Id: <20230110153803.5755-1-jiasheng@iscas.ac.cn>
Date:   Tue, 10 Jan 2023 23:38:03 +0800
From:   Jiasheng Jiang <jiasheng@...as.ac.cn>
To:     daniel@...ll.ch
Cc:     jani.nikula@...ux.intel.com, joonas.lahtinen@...ux.intel.com,
        rodrigo.vivi@...el.com, tvrtko.ursulin@...ux.intel.com,
        airlied@...il.com, ville.syrjala@...ux.intel.com,
        manasi.d.navare@...el.com, stanislav.lisovskiy@...el.com,
        lucas.demarchi@...el.com, intel-gfx@...ts.freedesktop.org,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
        Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: Re: [PATCH] drm/i915: Add missing check and destroy for alloc_workqueue

On Sat, Jan 07, 2023 at 02:29:22AM +0800, Daniel Vetter wrote:
>On Fri, Jan 06, 2023 at 05:09:34PM +0800, Jiasheng Jiang wrote:
>> Add checks for the return value of alloc_workqueue and
>> alloc_ordered_workqueue as they may return NULL pointer and cause NULL
>> pointer dereference.
>> Moreover, destroy them when fails later in order to avoid memory leak.
>> Because in `drivers/gpu/drm/i915/i915_driver.c`, if
>> intel_modeset_init_noirq fails, its workqueues will not be destroyed.
>> 
>> Fixes: c26a058680dc ("drm/i915: Use a high priority wq for nonblocking plane updates")
>> Fixes: 757fffcfdffb ("drm/i915: Put all non-blocking modesets onto an ordered wq")
>> Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
> 
> So you have an entire pile of these, and I think that's a really good
> excuse to
> - create a drmm_alloc_workqueue helper for these (and
>   drmm_alloc_ordered_workqueue) using the drmm_add_action_or_reset()
>   function for automatic drm_device cleanup
> - use that instead in all drivers, which means you do not have to make any
>   error handling mor complex
> 
> Up for that? In that case please also convert any existing alloc*workqueue
> callsites in drm, and make this all a patch series (since then there would
> be dependencies).

Fine, I have submitted two patches. The first one create the
drmm_alloc_workqueue and drmm_alloc_ordered_workqueue helpers. And the
second one replace the alloc*workqueue with DRM helpers in
`drivers/gpu/drm/i915/display/intel_display.c`.
If there is no problem in these two, I will submitted the other patches
that replace the alloc*workqueue in other DRM files.

Thanks,
Jiang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ