dvdrtools-users
[Top][All Lists]
Advanced

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

[Dvdrtools-users] [Fwd: data corruption in 2.4.19/drivers/scsi/sg.c]


From: Andy Polyakov
Subject: [Dvdrtools-users] [Fwd: data corruption in 2.4.19/drivers/scsi/sg.c]
Date: Wed, 21 Aug 2002 10:00:10 +0200

Of potential interest to subscribers of this list. I'm writing
"potential" because I haven't actually experience the problem
with cdrecord (maybe yet, kernel could have managed to keep
buffers neatly aligned while talking to cdrecord those times
I tries). It's VMware that is immediately affected by this. A.

-------- Original Message --------
Subject: data corruption in 2.4.19/drivers/scsi/sg.c
Date: Wed, 21 Aug 2002 01:49:12 +0200
From: Andy Polyakov <address@hidden>
To: address@hidden

Hi,

As subject suggests generic scsi module from 2.4.19 corrupts data.
Backing back to 2.4.18 code [as suggested below] fixes the problem.
>From the attached patch it's not clear what's causing the problem
as the code appears equivalent. Corruption occurs if you break out
the inner loop few lines later:

                if (ksglen > usglen) {
                    ...
                    p += usglen;
                    ksglen -= usglen;
                    break;
                }

and reenter it. Then ksglen and p are reset which results in some
duplicate data injection.

Cheers. Andy.

--- ./drivers/scsi/sg.c.orig    Sat Aug  3 02:39:44 2002
+++ ./drivers/scsi/sg.c Wed Aug 21 00:44:16 2002
@@ -1884,11 +1884,16 @@
            res = sg_u_iovec(hp, iovec_count, j, 1, &usglen, &up);
            if (res) return res;
 
+#if 0
            for (; k < schp->k_use_sg; ++k, ++sclp) {
                ksglen = (int)sclp->length;
                p = sclp->address;
                if (NULL == p)
                    break;
+#else
+           for (; (k < schp->k_use_sg) && p;
+               ++k, ++sclp, ksglen = (int)sclp->length, p = sclp->address) {
+#endif
                ok = (SG_USER_MEM != mem_src_arr[k]);
                if (usglen <= 0)
                    break;
@@ -2040,11 +2045,16 @@
            res = sg_u_iovec(hp, iovec_count, j, 0, &usglen, &up);
            if (res) return res;
 
+#if 0
            for (; k < schp->k_use_sg; ++k, ++sclp) {
                ksglen = (int)sclp->length;
                p = sclp->address;
                if (NULL == p)
                    break;
+#else
+           for (; (k < schp->k_use_sg) && p;
+               ++k, ++sclp, ksglen = (int)sclp->length, p = sclp->address) {
+#endif
                ok = (SG_USER_MEM != mem_src_arr[k]);
                if (usglen <= 0)
                    break;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]