Skip to contentSkip to conversation

lib/igt_core: Fix closing random handles on failure.

PATCH New Maarten Lankhorst 2 participants 3 messages Mar 22, 2018 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/igt_core: Fix closing random handles on failure.

When opening fds we never check for errors correctly, so fix error handling so at least we don't possibly close random fds.

---
 lib/igt_core.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
lib/igt_core.c +11 -9
index 5092a3f035c7..9fd6ddf6184d 100644
@@ -2317,16 +2317,16 @@ int igt_system_quiet(const char *command)
 
 	/* redirect */
 	if ((nullfd = open("/dev/null", O_WRONLY)) == -1)
-		goto err;
+		goto err_ret;
 	if ((stdout_fd_copy = dup(STDOUT_FILENO)) == -1)
-		goto err;
+		goto err_null;
 	if ((stderr_fd_copy = dup(STDERR_FILENO)) == -1)
-		goto err;
+		goto err_out;
 
 	if (dup2(nullfd, STDOUT_FILENO) == -1)
-		goto err;
+		goto err_close;
 	if (dup2(nullfd, STDERR_FILENO) == -1)
-		goto err;
+		goto err_close;
 
 	/* See igt_system() for the reason for suspending the signal helper. */
 	igt_suspend_signal_helper();
@@ -2338,9 +2338,9 @@ int igt_system_quiet(const char *command)
 
 	/* restore */
 	if (dup2(stdout_fd_copy, STDOUT_FILENO) == -1)
-		goto err;
+		goto err_close;
 	if (dup2(stderr_fd_copy, STDERR_FILENO) == -1)
-		goto err;
+		goto err_close;
 
 	close(stdout_fd_copy);
 	close(stderr_fd_copy);
@@ -2349,10 +2349,12 @@ int igt_system_quiet(const char *command)
 	return WEXITSTATUS(status);
 err:
 	igt_resume_signal_helper();
-
+err_close:
 	close(stderr_fd_copy);
+err_out:
 	close(stdout_fd_copy);
+err_null:
 	close(nullfd);
-
+err_ret:
 	return -1;
 }
Signature · 6 lines
2.16.2

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for lib/igt_core: Fix closing random handles on failure.

== Series Details ==

== Series Details ==

Series: lib/igt_core: Fix closing random handles on failure.
URL : https://patchwork.freedesktop.org/series/40493/
State : success

== Summary ==

IGT patchset tested on top of latest successful build 0d5665783284fee1750bc4a9d7a0378cb5ce77fe lib: Run gem_test_engine() in an isolated context

with latest DRM-Tip kernel build CI_DRM_3968
40fcdd23bec7 drm-tip: 2018y-03m-22d-15h-28m-32s UTC integration manifest

No testlist changes.

---- Known issues:

Test debugfs_test:

        Subgroup read_all_entries:
                incomplete -> PASS       (fi-snb-2520m) fdo#103713
Test gem_mmap_gtt:
        Subgroup basic-small-bo-tiledx:
                fail       -> PASS       (fi-gdg-551) fdo#102575
Test kms_chamelium:
        Subgroup hdmi-hpd-fast:
                skip       -> FAIL       (fi-kbl-7500u) fdo#102672
Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-b-frame-sequence:
                incomplete -> PASS       (fi-cnl-y3) fdo#103191

fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#102672 https://bugs.freedesktop.org/show_bug.cgi?id=102672
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191

fi-bdw-5557u     total:285  pass:264  dwarn:0   dfail:0   fail:0   skip:21  time:431s
fi-bdw-gvtdvm    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:441s
fi-blb-e6850     total:285  pass:220  dwarn:1   dfail:0   fail:0   skip:64  time:382s
fi-bsw-n3050     total:285  pass:239  dwarn:0   dfail:0   fail:0   skip:46  time:541s
fi-bwr-2160      total:285  pass:180  dwarn:0   dfail:0   fail:0   skip:105 time:299s
fi-bxt-dsi       total:285  pass:255  dwarn:0   dfail:0   fail:0   skip:30  time:521s
fi-bxt-j4205     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:515s
fi-byt-j1900     total:285  pass:250  dwarn:0   dfail:0   fail:0   skip:35  time:519s
fi-byt-n2820     total:285  pass:246  dwarn:0   dfail:0   fail:0   skip:39  time:503s
fi-cfl-8700k     total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:416s
fi-cfl-u         total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:511s
fi-cnl-drrs      total:285  pass:254  dwarn:3   dfail:0   fail:0   skip:28  time:532s
fi-cnl-y3        total:285  pass:259  dwarn:0   dfail:0   fail:0   skip:26  time:585s
fi-elk-e7500     total:285  pass:225  dwarn:1   dfail:0   fail:0   skip:59  time:433s
fi-gdg-551       total:285  pass:177  dwarn:0   dfail:0   fail:0   skip:108 time:317s
fi-glk-1         total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:543s
fi-hsw-4770      total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:402s
fi-ilk-650       total:285  pass:225  dwarn:0   dfail:0   fail:0   skip:60  time:419s
fi-ivb-3520m     total:285  pass:256  dwarn:0   dfail:0   fail:0   skip:29  time:463s
fi-ivb-3770      total:285  pass:252  dwarn:0   dfail:0   fail:0   skip:33  time:431s
fi-kbl-7500u     total:285  pass:260  dwarn:1   dfail:0   fail:1   skip:23  time:475s
fi-kbl-7567u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:469s
fi-kbl-r         total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:513s
fi-pnv-d510      total:285  pass:219  dwarn:1   dfail:0   fail:0   skip:65  time:656s
fi-skl-6260u     total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:448s
fi-skl-6600u     total:285  pass:258  dwarn:0   dfail:0   fail:0   skip:27  time:561s
fi-skl-6700k2    total:285  pass:261  dwarn:0   dfail:0   fail:0   skip:24  time:502s
fi-skl-6770hq    total:285  pass:265  dwarn:0   dfail:0   fail:0   skip:20  time:506s
fi-skl-guc       total:285  pass:257  dwarn:0   dfail:0   fail:0   skip:28  time:430s
fi-skl-gvtdvm    total:285  pass:262  dwarn:0   dfail:0   fail:0   skip:23  time:446s
fi-snb-2520m     total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:591s
fi-snb-2600      total:285  pass:245  dwarn:0   dfail:0   fail:0   skip:40  time:401s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1181/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for lib/igt_core: Fix closing random handles on failure.

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: lib/igt_core: Fix closing random handles on failure.
URL : https://patchwork.freedesktop.org/series/40493/
State : success

== Summary ==

---- Known issues:

Test kms_flip:

        Subgroup 2x-dpms-vs-vblank-race:
                fail       -> PASS       (shard-hsw) fdo#103060 +1
Test kms_plane_multiple:
        Subgroup atomic-pipe-a-tiling-x:
                pass       -> FAIL       (shard-snb) fdo#103166
Test kms_rotation_crc:
        Subgroup primary-rotation-180:
                pass       -> FAIL       (shard-snb) fdo#103925 +1
Test kms_sysfs_edid_timing:
                warn       -> PASS       (shard-apl) fdo#100047
Test kms_vblank:
        Subgroup pipe-b-accuracy-idle:
                pass       -> FAIL       (shard-hsw) fdo#102583

fdo#103060
fdo#103166
fdo#103925
fdo#100047
fdo#102583

shard-apl        total:3484 pass:1821 dwarn:1   dfail:0   fail:7   skip:1655 time:13111s
shard-hsw        total:3484 pass:1773 dwarn:1   dfail:0   fail:2   skip:1707 time:11922s
shard-snb        total:3484 pass:1362 dwarn:1   dfail:0   fail:4   skip:2117 time:7266s

Blacklisted hosts:
shard-kbl total:3451 pass:1880 dwarn:36 dfail:0 fail:10 skip:1523 time:9463s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1181/shards.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev