diff mbox series

drm/i915: Fix memory leaks in scatterlist

Message ID 20230201232801.123684-1-matthew.s.atwood@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Fix memory leaks in scatterlist | expand

Commit Message

Matt Atwood Feb. 1, 2023, 11:28 p.m. UTC
This patch fixes memory leaks on error escapes in i915_scatterlist.c

Fixes: c3bfba9a2225 ("drm/i915: Check for integer truncation on scatterlist creation")
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Matt Atwood <matthew.s.atwood@intel.com>
---
 drivers/gpu/drm/i915/i915_scatterlist.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Harish Chegondi Feb. 2, 2023, 7:55 a.m. UTC | #1
On Wed, Feb 01, 2023 at 03:28:01PM -0800, Matt Atwood wrote:
> This patch fixes memory leaks on error escapes in i915_scatterlist.c
> 
> Fixes: c3bfba9a2225 ("drm/i915: Check for integer truncation on scatterlist creation")
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Matt Atwood <matthew.s.atwood@intel.com>
Reviewed-by: Harish Chegondi <harish.chegondi@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_scatterlist.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_scatterlist.c b/drivers/gpu/drm/i915/i915_scatterlist.c
> index 756289e43dff6..7c7a86921b1c7 100644
> --- a/drivers/gpu/drm/i915/i915_scatterlist.c
> +++ b/drivers/gpu/drm/i915/i915_scatterlist.c
> @@ -98,8 +98,10 @@ struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node,
>  	st = &rsgt->table;
>  	/* restricted by sg_alloc_table */
>  	if (WARN_ON(overflows_type(DIV_ROUND_UP_ULL(node->size, segment_pages),
> -				   unsigned int)))
> +				   unsigned int))) {
> +		i915_refct_sgt_put(rsgt);
>  		return ERR_PTR(-E2BIG);
> +	}
>  
>  	if (sg_alloc_table(st, DIV_ROUND_UP_ULL(node->size, segment_pages),
>  			   GFP_KERNEL)) {
> @@ -183,8 +185,10 @@ struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res,
>  	i915_refct_sgt_init(rsgt, size);
>  	st = &rsgt->table;
>  	/* restricted by sg_alloc_table */
> -	if (WARN_ON(overflows_type(PFN_UP(res->size), unsigned int)))
> +	if (WARN_ON(overflows_type(PFN_UP(res->size), unsigned int))) {
> +		i915_refct_sgt_put(rsgt);
>  		return ERR_PTR(-E2BIG);
> +	}
>  
>  	if (sg_alloc_table(st, PFN_UP(res->size), GFP_KERNEL)) {
>  		i915_refct_sgt_put(rsgt);
> -- 
> 2.39.1
>
Matt Roper Feb. 6, 2023, 4:56 p.m. UTC | #2
On Sun, Feb 05, 2023 at 11:20:36AM +0000, Patchwork wrote:
> == Series Details ==
> 
> Series: drm/i915: Fix memory leaks in scatterlist (rev2)
> URL   : https://patchwork.freedesktop.org/series/113576/
> State : success
> 
> == Summary ==
> 
> CI Bug Log - changes from CI_DRM_12692_full -> Patchwork_113576v2_full
> ====================================================
> 
> Summary
> -------
> 
>   **SUCCESS**

Applied to drm-intel-next.  Thanks for the patch and review.


Matt

> 
>   No regressions found.
> 
>   External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/index.html
> 
> Participating hosts (9 -> 10)
> ------------------------------
> 
>   Additional (1): shard-rkl0 
> 
> Possible new issues
> -------------------
> 
>   Here are the unknown changes that may have been introduced in Patchwork_113576v2_full:
> 
> ### IGT changes ###
> 
> #### Suppressed ####
> 
>   The following results come from untrusted machines, tests, or statuses.
>   They do not affect the overall result.
> 
>   * {igt@v3d/v3d_submit_cl@multi-and-single-sync}:
>     - {shard-dg1}:        NOTRUN -> [SKIP][1] +6 similar issues
>    [1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-dg1-16/igt@v3d/v3d_submit_cl@multi-and-single-sync.html
> 
>   
> Known issues
> ------------
> 
>   Here are the changes found in Patchwork_113576v2_full that come from known issues:
> 
> ### IGT changes ###
> 
> #### Issues hit ####
> 
>   * igt@gem_exec_fair@basic-none@rcs0:
>     - shard-glk:          [PASS][2] -> [FAIL][3] ([i915#2842])
>    [2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-glk5/igt@gem_exec_fair@basic-none@rcs0.html
>    [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-glk7/igt@gem_exec_fair@basic-none@rcs0.html
> 
>   * igt@gen7_exec_parse@basic-offset:
>     - shard-glk:          NOTRUN -> [SKIP][4] ([fdo#109271]) +14 similar issues
>    [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-glk8/igt@gen7_exec_parse@basic-offset.html
> 
>   * igt@gen9_exec_parse@allowed-single:
>     - shard-glk:          [PASS][5] -> [ABORT][6] ([i915#5566])
>    [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-glk5/igt@gen9_exec_parse@allowed-single.html
>    [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-glk2/igt@gen9_exec_parse@allowed-single.html
> 
>   * igt@kms_flip@flip-vs-expired-vblank@a-hdmi-a2:
>     - shard-glk:          [PASS][7] -> [FAIL][8] ([i915#79])
>    [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-glk5/igt@kms_flip@flip-vs-expired-vblank@a-hdmi-a2.html
>    [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-glk7/igt@kms_flip@flip-vs-expired-vblank@a-hdmi-a2.html
> 
>   * igt@kms_psr2_sf@cursor-plane-move-continuous-exceed-fully-sf:
>     - shard-glk:          NOTRUN -> [SKIP][9] ([fdo#109271] / [i915#658])
>    [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-glk8/igt@kms_psr2_sf@cursor-plane-move-continuous-exceed-fully-sf.html
> 
>   * igt@kms_writeback@writeback-fb-id:
>     - shard-glk:          NOTRUN -> [SKIP][10] ([fdo#109271] / [i915#2437])
>    [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-glk8/igt@kms_writeback@writeback-fb-id.html
> 
>   
> #### Possible fixes ####
> 
>   * igt@gem_ctx_persistence@legacy-engines-hang@blt:
>     - {shard-rkl}:        [SKIP][11] ([i915#6252]) -> [PASS][12]
>    [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-rkl-5/igt@gem_ctx_persistence@legacy-engines-hang@blt.html
>    [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-rkl-2/igt@gem_ctx_persistence@legacy-engines-hang@blt.html
> 
>   * igt@gem_exec_capture@pi@vcs0:
>     - {shard-rkl}:        [ABORT][13] -> [PASS][14]
>    [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-rkl-1/igt@gem_exec_capture@pi@vcs0.html
>    [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-rkl-2/igt@gem_exec_capture@pi@vcs0.html
> 
>   * igt@gem_exec_fair@basic-deadline:
>     - shard-glk:          [FAIL][15] ([i915#2846]) -> [PASS][16]
>    [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-glk1/igt@gem_exec_fair@basic-deadline.html
>    [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-glk3/igt@gem_exec_fair@basic-deadline.html
> 
>   * igt@gem_exec_fair@basic-none-vip@rcs0:
>     - {shard-rkl}:        [FAIL][17] ([i915#2842]) -> [PASS][18]
>    [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-rkl-3/igt@gem_exec_fair@basic-none-vip@rcs0.html
>    [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-rkl-5/igt@gem_exec_fair@basic-none-vip@rcs0.html
> 
>   * igt@gem_exec_reloc@basic-wc-read-noreloc:
>     - {shard-rkl}:        [SKIP][19] ([i915#3281]) -> [PASS][20] +10 similar issues
>    [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-rkl-2/igt@gem_exec_reloc@basic-wc-read-noreloc.html
>    [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-rkl-5/igt@gem_exec_reloc@basic-wc-read-noreloc.html
> 
>   * igt@gem_tiled_partial_pwrite_pread@writes:
>     - {shard-rkl}:        [SKIP][21] ([i915#3282]) -> [PASS][22] +2 similar issues
>    [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-rkl-2/igt@gem_tiled_partial_pwrite_pread@writes.html
>    [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-rkl-5/igt@gem_tiled_partial_pwrite_pread@writes.html
> 
>   * igt@gen9_exec_parse@bb-chained:
>     - {shard-rkl}:        [SKIP][23] ([i915#2527]) -> [PASS][24] +2 similar issues
>    [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-rkl-2/igt@gen9_exec_parse@bb-chained.html
>    [24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-rkl-5/igt@gen9_exec_parse@bb-chained.html
> 
>   * igt@i915_pm_dc@dc9-dpms:
>     - {shard-rkl}:        [SKIP][25] ([i915#3361]) -> [PASS][26]
>    [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-rkl-5/igt@i915_pm_dc@dc9-dpms.html
>    [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-rkl-6/igt@i915_pm_dc@dc9-dpms.html
> 
>   * igt@i915_pm_rpm@modeset-lpsp:
>     - {shard-rkl}:        [SKIP][27] ([i915#1397]) -> [PASS][28]
>    [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-rkl-5/igt@i915_pm_rpm@modeset-lpsp.html
>    [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-rkl-6/igt@i915_pm_rpm@modeset-lpsp.html
> 
>   * {igt@i915_power@sanity}:
>     - {shard-rkl}:        [SKIP][29] ([i915#7984]) -> [PASS][30]
>    [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-rkl-3/igt@i915_power@sanity.html
>    [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-rkl-5/igt@i915_power@sanity.html
> 
>   * igt@kms_big_fb@x-tiled-32bpp-rotate-0:
>     - {shard-rkl}:        [SKIP][31] ([i915#1845] / [i915#4098]) -> [PASS][32] +5 similar issues
>    [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-rkl-5/igt@kms_big_fb@x-tiled-32bpp-rotate-0.html
>    [32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-rkl-6/igt@kms_big_fb@x-tiled-32bpp-rotate-0.html
> 
>   * igt@kms_cursor_legacy@flip-vs-cursor@atomic-transitions-varying-size:
>     - shard-glk:          [FAIL][33] ([i915#2346]) -> [PASS][34]
>    [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-glk2/igt@kms_cursor_legacy@flip-vs-cursor@atomic-transitions-varying-size.html
>    [34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-glk4/igt@kms_cursor_legacy@flip-vs-cursor@atomic-transitions-varying-size.html
> 
>   * igt@kms_fbcon_fbt@psr-suspend:
>     - {shard-rkl}:        [SKIP][35] ([fdo#110189] / [i915#3955]) -> [PASS][36]
>    [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-rkl-5/igt@kms_fbcon_fbt@psr-suspend.html
>    [36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-rkl-6/igt@kms_fbcon_fbt@psr-suspend.html
> 
>   * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt:
>     - {shard-rkl}:        [SKIP][37] ([i915#1849] / [i915#4098]) -> [PASS][38] +6 similar issues
>    [37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-rkl-5/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt.html
>    [38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-rkl-6/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt.html
> 
>   * igt@kms_frontbuffer_tracking@fbc-rgb101010-draw-blt:
>     - {shard-tglu}:       [SKIP][39] ([i915#1849]) -> [PASS][40] +1 similar issue
>    [39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-tglu-6/igt@kms_frontbuffer_tracking@fbc-rgb101010-draw-blt.html
>    [40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-tglu-1/igt@kms_frontbuffer_tracking@fbc-rgb101010-draw-blt.html
> 
>   * igt@kms_psr@sprite_render:
>     - {shard-rkl}:        [SKIP][41] ([i915#1072]) -> [PASS][42]
>    [41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-rkl-5/igt@kms_psr@sprite_render.html
>    [42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-rkl-6/igt@kms_psr@sprite_render.html
> 
>   * igt@kms_universal_plane@universal-plane-pipe-c-functional:
>     - {shard-tglu}:       [SKIP][43] ([fdo#109274]) -> [PASS][44] +1 similar issue
>    [43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-tglu-6/igt@kms_universal_plane@universal-plane-pipe-c-functional.html
>    [44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-tglu-1/igt@kms_universal_plane@universal-plane-pipe-c-functional.html
> 
>   * igt@kms_vblank@pipe-a-query-forked:
>     - {shard-tglu}:       [SKIP][45] ([i915#7651]) -> [PASS][46] +11 similar issues
>    [45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-tglu-6/igt@kms_vblank@pipe-a-query-forked.html
>    [46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-tglu-1/igt@kms_vblank@pipe-a-query-forked.html
> 
>   * igt@kms_vblank@pipe-c-wait-idle-hang:
>     - {shard-tglu}:       [SKIP][47] ([i915#1845] / [i915#7651]) -> [PASS][48] +4 similar issues
>    [47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-tglu-6/igt@kms_vblank@pipe-c-wait-idle-hang.html
>    [48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-tglu-1/igt@kms_vblank@pipe-c-wait-idle-hang.html
> 
>   * igt@prime_vgem@coherency-gtt:
>     - {shard-rkl}:        [SKIP][49] ([fdo#109295] / [fdo#111656] / [i915#3708]) -> [PASS][50]
>    [49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12692/shard-rkl-3/igt@prime_vgem@coherency-gtt.html
>    [50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/shard-rkl-5/igt@prime_vgem@coherency-gtt.html
> 
>   
>   {name}: This element is suppressed. This means it is ignored when computing
>           the status of the difference (SUCCESS, WARNING, or FAILURE).
> 
>   [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
>   [fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
>   [fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
>   [fdo#109283]: https://bugs.freedesktop.org/show_bug.cgi?id=109283
>   [fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
>   [fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
>   [fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
>   [fdo#109300]: https://bugs.freedesktop.org/show_bug.cgi?id=109300
>   [fdo#109303]: https://bugs.freedesktop.org/show_bug.cgi?id=109303
>   [fdo#109307]: https://bugs.freedesktop.org/show_bug.cgi?id=109307
>   [fdo#109312]: https://bugs.freedesktop.org/show_bug.cgi?id=109312
>   [fdo#109313]: https://bugs.freedesktop.org/show_bug.cgi?id=109313
>   [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
>   [fdo#109506]: https://bugs.freedesktop.org/show_bug.cgi?id=109506
>   [fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
>   [fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
>   [fdo#110542]: https://bugs.freedesktop.org/show_bug.cgi?id=110542
>   [fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
>   [fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
>   [fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
>   [fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
>   [fdo#111644]: https://bugs.freedesktop.org/show_bug.cgi?id=111644
>   [fdo#111656]: https://bugs.freedesktop.org/show_bug.cgi?id=111656
>   [fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
>   [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
>   [fdo#112054]: https://bugs.freedesktop.org/show_bug.cgi?id=112054
>   [fdo#112283]: https://bugs.freedesktop.org/show_bug.cgi?id=112283
>   [i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
>   [i915#132]: https://gitlab.freedesktop.org/drm/intel/issues/132
>   [i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
>   [i915#1769]: https://gitlab.freedesktop.org/drm/intel/issues/1769
>   [i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
>   [i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
>   [i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
>   [i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
>   [i915#1902]: https://gitlab.freedesktop.org/drm/intel/issues/1902
>   [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
>   [i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
>   [i915#2436]: https://gitlab.freedesktop.org/drm/intel/issues/2436
>   [i915#2437]: https://gitlab.freedesktop.org/drm/intel/issues/2437
>   [i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
>   [i915#2532]: https://gitlab.freedesktop.org/drm/intel/issues/2532
>   [i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
>   [i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
>   [i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
>   [i915#2658]: https://gitlab.freedesktop.org/drm/intel/issues/2658
>   [i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
>   [i915#2681]: https://gitlab.freedesktop.org/drm/intel/issues/2681
>   [i915#2705]: https://gitlab.freedesktop.org/drm/intel/issues/2705
>   [i915#280]: https://gitlab.freedesktop.org/drm/intel/issues/280
>   [i915#284]: https://gitlab.freedesktop.org/drm/intel/issues/284
>   [i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
>   [i915#2846]: https://gitlab.freedesktop.org/drm/intel/issues/2846
>   [i915#2856]: https://gitlab.freedesktop.org/drm/intel/issues/2856
>   [i915#2920]: https://gitlab.freedesktop.org/drm/intel/issues/2920
>   [i915#315]: https://gitlab.freedesktop.org/drm/intel/issues/315
>   [i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
>   [i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
>   [i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
>   [i915#3299]: https://gitlab.freedesktop.org/drm/intel/issues/3299
>   [i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
>   [i915#3318]: https://gitlab.freedesktop.org/drm/intel/issues/3318
>   [i915#3323]: https://gitlab.freedesktop.org/drm/intel/issues/3323
>   [i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
>   [i915#3361]: https://gitlab.freedesktop.org/drm/intel/issues/3361
>   [i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
>   [i915#3469]: https://gitlab.freedesktop.org/drm/intel/issues/3469
>   [i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
>   [i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
>   [i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
>   [i915#3558]: https://gitlab.freedesktop.org/drm/intel/issues/3558
>   [i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
>   [i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
>   [i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
>   [i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
>   [i915#3734]: https://gitlab.freedesktop.org/drm/intel/issues/3734
>   [i915#3742]: https://gitlab.freedesktop.org/drm/intel/issues/3742
>   [i915#3826]: https://gitlab.freedesktop.org/drm/intel/issues/3826
>   [i915#3840]: https://gitlab.freedesktop.org/drm/intel/issues/3840
>   [i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
>   [i915#3938]: https://gitlab.freedesktop.org/drm/intel/issues/3938
>   [i915#3955]: https://gitlab.freedesktop.org/drm/intel/issues/3955
>   [i915#3966]: https://gitlab.freedesktop.org/drm/intel/issues/3966
>   [i915#3989]: https://gitlab.freedesktop.org/drm/intel/issues/3989
>   [i915#4036]: https://gitlab.freedesktop.org/drm/intel/issues/4036
>   [i915#404]: https://gitlab.freedesktop.org/drm/intel/issues/404
>   [i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
>   [i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
>   [i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
>   [i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
>   [i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
>   [i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
>   [i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
>   [i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
>   [i915#4213]: https://gitlab.freedesktop.org/drm/intel/issues/4213
>   [i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
>   [i915#4281]: https://gitlab.freedesktop.org/drm/intel/issues/4281
>   [i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
>   [i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
>   [i915#4565]: https://gitlab.freedesktop.org/drm/intel/issues/4565
>   [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
>   [i915#4771]: https://gitlab.freedesktop.org/drm/intel/issues/4771
>   [i915#4812]: https://gitlab.freedesktop.org/drm/intel/issues/4812
>   [i915#4818]: https://gitlab.freedesktop.org/drm/intel/issues/4818
>   [i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
>   [i915#4852]: https://gitlab.freedesktop.org/drm/intel/issues/4852
>   [i915#4859]: https://gitlab.freedesktop.org/drm/intel/issues/4859
>   [i915#4860]: https://gitlab.freedesktop.org/drm/intel/issues/4860
>   [i915#4880]: https://gitlab.freedesktop.org/drm/intel/issues/4880
>   [i915#4958]: https://gitlab.freedesktop.org/drm/intel/issues/4958
>   [i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
>   [i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
>   [i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
>   [i915#5288]: https://gitlab.freedesktop.org/drm/intel/issues/5288
>   [i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
>   [i915#5325]: https://gitlab.freedesktop.org/drm/intel/issues/5325
>   [i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
>   [i915#5439]: https://gitlab.freedesktop.org/drm/intel/issues/5439
>   [i915#5461]: https://gitlab.freedesktop.org/drm/intel/issues/5461
>   [i915#5563]: https://gitlab.freedesktop.org/drm/intel/issues/5563
>   [i915#5566]: https://gitlab.freedesktop.org/drm/intel/issues/5566
>   [i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
>   [i915#6245]: https://gitlab.freedesktop.org/drm/intel/issues/6245
>   [i915#6247]: https://gitlab.freedesktop.org/drm/intel/issues/6247
>   [i915#6248]: https://gitlab.freedesktop.org/drm/intel/issues/6248
>   [i915#6252]: https://gitlab.freedesktop.org/drm/intel/issues/6252
>   [i915#6268]: https://gitlab.freedesktop.org/drm/intel/issues/6268
>   [i915#6301]: https://gitlab.freedesktop.org/drm/intel/issues/6301
>   [i915#6334]: https://gitlab.freedesktop.org/drm/intel/issues/6334
>   [i915#6335]: https://gitlab.freedesktop.org/drm/intel/issues/6335
>   [i915#6344]: https://gitlab.freedesktop.org/drm/intel/issues/6344
>   [i915#6433]: https://gitlab.freedesktop.org/drm/intel/issues/6433
>   [i915#6497]: https://gitlab.freedesktop.org/drm/intel/issues/6497
>   [i915#6524]: https://gitlab.freedesktop.org/drm/intel/issues/6524
>   [i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
>   [i915#6768]: https://gitlab.freedesktop.org/drm/intel/issues/6768
>   [i915#6944]: https://gitlab.freedesktop.org/drm/intel/issues/6944
>   [i915#6946]: https://gitlab.freedesktop.org/drm/intel/issues/6946
>   [i915#6953]: https://gitlab.freedesktop.org/drm/intel/issues/6953
>   [i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
>   [i915#7118]: https://gitlab.freedesktop.org/drm/intel/issues/7118
>   [i915#7330]: https://gitlab.freedesktop.org/drm/intel/issues/7330
>   [i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
>   [i915#7651]: https://gitlab.freedesktop.org/drm/intel/issues/7651
>   [i915#7697]: https://gitlab.freedesktop.org/drm/intel/issues/7697
>   [i915#7701]: https://gitlab.freedesktop.org/drm/intel/issues/7701
>   [i915#7707]: https://gitlab.freedesktop.org/drm/intel/issues/7707
>   [i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711
>   [i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
>   [i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
>   [i915#7949]: https://gitlab.freedesktop.org/drm/intel/issues/7949
>   [i915#7975]: https://gitlab.freedesktop.org/drm/intel/issues/7975
>   [i915#7984]: https://gitlab.freedesktop.org/drm/intel/issues/7984
> 
> 
> Build changes
> -------------
> 
>   * Linux: CI_DRM_12692 -> Patchwork_113576v2
> 
>   CI-20190529: 20190529
>   CI_DRM_12692: f3800283e8ba9f8e93936a76458e3afa14e38149 @ git://anongit.freedesktop.org/gfx-ci/linux
>   IGT_7149: 1c7ea154b625e1fb826f1519b816b4256dd10b62 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
>   Patchwork_113576v2: f3800283e8ba9f8e93936a76458e3afa14e38149 @ git://anongit.freedesktop.org/gfx-ci/linux
> 
> == Logs ==
> 
> For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_113576v2/index.html
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_scatterlist.c b/drivers/gpu/drm/i915/i915_scatterlist.c
index 756289e43dff6..7c7a86921b1c7 100644
--- a/drivers/gpu/drm/i915/i915_scatterlist.c
+++ b/drivers/gpu/drm/i915/i915_scatterlist.c
@@ -98,8 +98,10 @@  struct i915_refct_sgt *i915_rsgt_from_mm_node(const struct drm_mm_node *node,
 	st = &rsgt->table;
 	/* restricted by sg_alloc_table */
 	if (WARN_ON(overflows_type(DIV_ROUND_UP_ULL(node->size, segment_pages),
-				   unsigned int)))
+				   unsigned int))) {
+		i915_refct_sgt_put(rsgt);
 		return ERR_PTR(-E2BIG);
+	}
 
 	if (sg_alloc_table(st, DIV_ROUND_UP_ULL(node->size, segment_pages),
 			   GFP_KERNEL)) {
@@ -183,8 +185,10 @@  struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res,
 	i915_refct_sgt_init(rsgt, size);
 	st = &rsgt->table;
 	/* restricted by sg_alloc_table */
-	if (WARN_ON(overflows_type(PFN_UP(res->size), unsigned int)))
+	if (WARN_ON(overflows_type(PFN_UP(res->size), unsigned int))) {
+		i915_refct_sgt_put(rsgt);
 		return ERR_PTR(-E2BIG);
+	}
 
 	if (sg_alloc_table(st, PFN_UP(res->size), GFP_KERNEL)) {
 		i915_refct_sgt_put(rsgt);