Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=317b50b8ad2f544a12c8f29d99a91225e8c5db1d
Commit:     317b50b8ad2f544a12c8f29d99a91225e8c5db1d
Parent:     8f73a6880183dd11b97d70e738cf82d15931d98b
Author:     Andrew Paprocki <[EMAIL PROTECTED]>
AuthorDate: Mon Oct 15 15:43:12 2007 -0400
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Mon Oct 15 15:44:22 2007 -0400

    libata: prevent devices with blank model names from being DMA blacklisted
    
    The strn_pattern_cmp routine does not handle a blank name parameter
    properly. The only patterns which should match a blank name are "*"
    and an explicit "". If the function is passed a blank name in current
    code, it will always match against the patt parameter. The bug manifests
    itself as the device with the empty model name always matching the first
    device in the DMA blacklist, forcing it to revert to PIO mode.
    
    Signed-off-by: Andrew Paprocki <[EMAIL PROTECTED]>
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/ata/libata-core.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index d696999..68699b3 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4014,8 +4014,14 @@ int strn_pattern_cmp(const char *patt, const char *name, 
int wildchar)
        p = strchr(patt, wildchar);
        if (p && ((*(p + 1)) == 0))
                len = p - patt;
-       else
+       else {
                len = strlen(name);
+               if (!len) {
+                       if (!*patt)
+                               return 0;
+                       return -1;
+               }
+       }
 
        return strncmp(patt, name, len);
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to