]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
firewire: sbp2: fix freeing of unallocated memory
authorStefan Richter <stefanr@s5r6.in-berlin.de>
Thu, 3 Sep 2009 21:07:35 +0000 (23:07 +0200)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Sat, 5 Sep 2009 13:59:34 +0000 (15:59 +0200)
If a target writes invalid status (typically status of a command that
already timed out), firewire-sbp2 attempts to put away an ORB that
doesn't exist.  https://bugzilla.redhat.com/show_bug.cgi?id=519772

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/firewire/sbp2.c

index d27cb058da82eda9ad7bf3e9e5e0ba6448d0adb7..05f0c0c55f4a51cfd92aeffd286f30d8a38fb92c 100644 (file)
@@ -456,12 +456,12 @@ static void sbp2_status_write(struct fw_card *card, struct fw_request *request,
        }
        spin_unlock_irqrestore(&card->lock, flags);
 
-       if (&orb->link != &lu->orb_list)
+       if (&orb->link != &lu->orb_list) {
                orb->callback(orb, &status);
-       else
+               kref_put(&orb->kref, free_orb);
+       } else {
                fw_error("status write for unknown orb\n");
-
-       kref_put(&orb->kref, free_orb);
+       }
 
        fw_send_response(card, request, RCODE_COMPLETE);
 }