Skip to contentSkip to conversation

libdrm/radeon: Fix section size mismatch to reset the section.

PATCH In review Pauli Nieminen 2 participants 3 messages Feb 1, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libdrm/radeon: Fix section size mismatch to reset the section.

If there is section size mismatch reusing the section object makes section start fail.
Reseting the object before doing error checking prevents the possible flood of errors.

---
 radeon/radeon_cs_gem.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
radeon/radeon_cs_gem.c +1 -1
index c2301ad..9bfcda0 100644
@@ -255,6 +255,7 @@ static int cs_gem_end(struct radeon_cs_int *cs,
                 file, func, line);
         return -EPIPE;
     }
+    cs->section_ndw = 0;
     if (cs->section_ndw != cs->section_cdw) {
         fprintf(stderr, "CS section size missmatch start at (%s,%s,%d) %d vs %d\n",
                 cs->section_file, cs->section_func, cs->section_line, cs->section_ndw, cs->section_cdw);
@@ -262,7 +263,6 @@ static int cs_gem_end(struct radeon_cs_int *cs,
                 file, func, line);
         return -EPIPE;
     }
-    cs->section_ndw = 0;
     return 0;
 }
 
Signature · 10 lines
1.6.3.3


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--
#1 lore raw
Quoted 5 lines · Pauli Nieminen

If there is section size mismatch reusing the section object makes section start fail.
Reseting the object before doing error checking prevents the possible flood of errors.

That can't be right. did you read what your patch does?

of course it'll never call the printf now.

Dave.

Quoted 29 lines

---
 radeon/radeon_cs_gem.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
radeon/radeon_cs_gem.c +1 -2
index c2301ad..9bfcda0 100644
@@ -255,6 +255,7 @@ static int cs_gem_end(struct radeon_cs_int *cs,
                 file, func, line);
         return -EPIPE;
     }
+    cs->section_ndw = 0;
     if (cs->section_ndw != cs->section_cdw) {
         fprintf(stderr, "CS section size missmatch start at (%s,%s,%d) %d vs %d\n",
                 cs->section_file, cs->section_func, cs->section_line, cs->section_ndw, cs->section_cdw);
@@ -262,7 +263,6 @@ static int cs_gem_end(struct radeon_cs_int *cs,
                 file, func, line);
         return -EPIPE;
     }
-    cs->section_ndw = 0;
     return 0;
  }
 
--

1.6.3.3

Quoted 12 lines

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
--

#2 lore raw

Yes. That was bad mistake.

Better solution is to do the resetting of the section also in the error path.

Attached the fixed patch.

radeon/radeon_cs_gem.c +0 -0
index c2301ad..45a219c 100644
@@ -260,7 +260,10 @@ static int cs_gem_end(struct radeon_cs_int *cs,
                 cs->section_file, cs->section_func, cs->section_line,
cs->section_ndw, cs->section_cdw);
         fprintf(stderr, "CS section end at (%s,%s,%d)\n",
                 file, func, line);
-        return -EPIPE;
+
+       /* We must reset the section even when there is error. */
+       cs->section_ndw = 0;
+       return -EPIPE;
     }
     cs->section_ndw = 0;
     return 0;
Quoted 46 lines · Dave Airlie
Quoted 5 lines · Pauli Nieminen

If there is section size mismatch reusing the section object makes section start fail.
Reseting the object before doing error checking prevents the possible flood of errors.

That can't be right. did you read what your patch does?

of course it'll never call the printf now.

Dave.

Quoted 10 lines
---
 radeon/radeon_cs_gem.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
radeon/radeon_cs_gem.c +0 -0
index c2301ad..9bfcda0 100644

radeon/radeon_cs_gem.c static int cs_gem_end(struct radeon_cs_int *cs, · line 260

Quoted 6 lines
radeon/radeon_cs_gem.c +1 -0
@@ -255,6 +255,7 @@ static int cs_gem_end(struct radeon_cs_int *cs,
                file, func, line);
        return -EPIPE;
    }
+    cs->section_ndw = 0;
    if (cs->section_ndw != cs->section_cdw) {
        fprintf(stderr, "CS section size missmatch start at (%s,%s,%d) %d

vs %d\n",

radeon/radeon_cs_gem.c static int cs_gem_end(struct radeon_cs_int *cs, · line 261

Quoted 1 line
radeon/radeon_cs_gem.c +0 -0
                cs->section_file, cs->section_func, cs->section_line,

cs->section_ndw, cs->section_cdw);

Quoted 9 lines
radeon/radeon_cs_gem.c +0 -2
@@ -262,7 +263,6 @@ static int cs_gem_end(struct radeon_cs_int *cs,
                file, func, line);
        return -EPIPE;
    }
-    cs->section_ndw = 0;
    return 0;
 }
 
--
Quoted 4 lines

1.6.3.3

------------------------------------------------------------------------------

Quoted 14 lines
Quoted 2 lines

The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the

business

Quoted 2 lines

Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call

away.

Quoted 7 lines

http://p.sf.net/sfu/theplanet-com
--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel

From d68b32afcbe935f7db5b7efc1f4b422849732039 Mon Sep 17 00:00:00 2001
From: Pauli Nieminen <[email protected]>
Date: Mon, 1 Feb 2010 20:19:33 +0200
Subject: [PATCH] libdrm/radeon: Fix section size mismatch to reset the section.

If there is section size mismatch reusing the section object makes section start fail.
Reseting the object before doing error checking prevents the possible flood of errors.

---
 radeon/radeon_cs_gem.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
radeon/radeon_cs_gem.c +4 -1
index c2301ad..45a219c 100644
@@ -260,7 +260,10 @@ static int cs_gem_end(struct radeon_cs_int *cs,
                 cs->section_file, cs->section_func, cs->section_line, cs->section_ndw, cs->section_cdw);
         fprintf(stderr, "CS section end at (%s,%s,%d)\n",
                 file, func, line);
-        return -EPIPE;
+
+	/* We must reset the section even when there is error. */
+	cs->section_ndw = 0;
+	return -EPIPE;
     }
     cs->section_ndw = 0;
     return 0;
Signature · 1 line
1.6.3.3

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com

--
_______________________________________________
Dri-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dri-devel