pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/x11/libdrm libdrm: don't return random values to the c...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/568e590e5477
branches:  trunk
changeset: 389672:568e590e5477
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Sun Jan 06 02:23:00 2019 +0000

description:
libdrm: don't return random values to the caller - don't leak fd's

xsrc/external/mit/libdrm/dist/xf86drm.c 1.21
Bump PKGREVISION.

diffstat:

 x11/libdrm/Makefile                |   3 ++-
 x11/libdrm/distinfo                |   4 ++--
 x11/libdrm/patches/patch-xf86drm.c |  23 +++++++++++++++--------
 3 files changed, 19 insertions(+), 11 deletions(-)

diffs (103 lines):

diff -r 3ae83830c823 -r 568e590e5477 x11/libdrm/Makefile
--- a/x11/libdrm/Makefile       Sun Jan 06 01:53:06 2019 +0000
+++ b/x11/libdrm/Makefile       Sun Jan 06 02:23:00 2019 +0000
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.87 2018/10/18 17:12:55 wiz Exp $
+# $NetBSD: Makefile,v 1.88 2019/01/06 02:23:00 tnn Exp $
 
 DISTNAME=              libdrm-2.4.96
+PKGREVISION=           1
 CATEGORIES=            x11 graphics
 MASTER_SITES=          http://dri.freedesktop.org/libdrm/
 EXTRACT_SUFX=          .tar.bz2
diff -r 3ae83830c823 -r 568e590e5477 x11/libdrm/distinfo
--- a/x11/libdrm/distinfo       Sun Jan 06 01:53:06 2019 +0000
+++ b/x11/libdrm/distinfo       Sun Jan 06 02:23:00 2019 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.88 2018/12/25 01:13:57 sevan Exp $
+$NetBSD: distinfo,v 1.89 2019/01/06 02:23:00 tnn Exp $
 
 SHA1 (libdrm-2.4.96.tar.bz2) = 51eb4c248a437b3f200bd1cd84461d3e0b60d71e
 RMD160 (libdrm-2.4.96.tar.bz2) = 8e13f0edf61bb0b59aaaf3cdbaadf20916782fe8
@@ -10,6 +10,6 @@
 SHA1 (patch-libsync.h) = 51623bae547e7a0c3e41fa282964b2361b1c34ab
 SHA1 (patch-radeon_radeon__bo__gem.c) = 4924fde172b2a2a713d47bf7b60a6b52851d7a8f
 SHA1 (patch-radeon_radeon__cs__gem.c) = 516b5dd6408c10a4f33f2815b3719e34a16d863a
-SHA1 (patch-xf86drm.c) = 9a76f433c3b4688575cd60362396fb74d3294a4b
+SHA1 (patch-xf86drm.c) = ae371519320eb513f38d6856ad617dff5d05278b
 SHA1 (patch-xf86drmMode.c) = 7a0d8ea4a0110b295d8cb4fe870ee523d420ea6b
 SHA1 (patch-xf86drmMode.h) = a28b02887389be8670193c119f711901af61a6b2
diff -r 3ae83830c823 -r 568e590e5477 x11/libdrm/patches/patch-xf86drm.c
--- a/x11/libdrm/patches/patch-xf86drm.c        Sun Jan 06 01:53:06 2019 +0000
+++ b/x11/libdrm/patches/patch-xf86drm.c        Sun Jan 06 02:23:00 2019 +0000
@@ -1,8 +1,8 @@
-$NetBSD: patch-xf86drm.c,v 1.2 2018/10/05 12:57:20 wiz Exp $
+$NetBSD: patch-xf86drm.c,v 1.3 2019/01/06 02:23:00 tnn Exp $
 
 Implement drmParseSubsystemType, drmParsePciBusInfo for NetBSD
 
---- xf86drm.c.orig     2018-10-04 14:50:03.000000000 +0000
+--- xf86drm.c.orig     2018-10-16 14:49:03.000000000 +0000
 +++ xf86drm.c
 @@ -84,7 +84,10 @@
  #endif
@@ -16,7 +16,7 @@
  #endif
  
  #ifdef __OpenBSD__
-@@ -2997,6 +3000,65 @@ static int drmParseSubsystemType(int maj
+@@ -3011,6 +3014,65 @@ static int drmParseSubsystemType(int maj
          return DRM_BUS_VIRTIO;
  
      return -EINVAL;
@@ -82,7 +82,7 @@
  #elif defined(__OpenBSD__)
      return DRM_BUS_PCI;
  #else
-@@ -3046,6 +3108,73 @@ static int drmParsePciBusInfo(int maj, i
+@@ -3060,6 +3122,73 @@ static int drmParsePciBusInfo(int maj, i
      info->func = func;
  
      return 0;
@@ -156,7 +156,7 @@
  #elif defined(__OpenBSD__)
      struct drm_pciinfo pinfo;
      int fd, type;
-@@ -3213,6 +3342,41 @@ static int drmParsePciDeviceInfo(int maj
+@@ -3227,6 +3356,48 @@ static int drmParsePciDeviceInfo(int maj
          return parse_config_sysfs_file(maj, min, device);
  
      return 0;
@@ -179,22 +179,29 @@
 +    if ((pcifd = open(fname, O_RDONLY)) == -1)
 +      return -errno;
 +
++    ret = -1;
 +    /* Read the id and class pci config registers.  */
 +    if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func,
 +          PCI_ID_REG, &id) == -1)
-+      return -errno;
++      goto out;
 +    if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func,
 +          PCI_CLASS_REG, &class) == -1)
-+      return -errno;
++      goto out;
 +    if (pcibus_conf_read(pcifd, businfo.bus, businfo.dev, businfo.func,
 +          PCI_SUBSYS_ID_REG, &subsys) == -1)
-+      return -errno;
++      goto out;
 +
++    ret = 0;
 +    device->vendor_id = PCI_VENDOR(id);
 +    device->device_id = PCI_PRODUCT(id);
 +    device->subvendor_id = PCI_SUBSYS_VENDOR(subsys);
 +    device->subdevice_id = PCI_SUBSYS_ID(subsys);
 +    device->revision_id = PCI_REVISION(class);
++out:
++    if (ret == -1)
++      ret = -errno;
++    close(pcifd);
++    return ret;
  #elif defined(__OpenBSD__)
      struct drm_pciinfo pinfo;
      int fd, type;



Home | Main Index | Thread Index | Old Index