~ubuntu-branches/ubuntu/lucid/linux-lts-backport-oneiric/lucid-security

« back to all changes in this revision

Viewing changes to drivers/infiniband/ulp/srp/ib_srp.c

  • Committer: Package Import Robot
  • Author(s): Luis Henriques, Luis Henriques, Upstream Kernel Changes
  • Date: 2012-09-05 17:54:34 UTC
  • Revision ID: package-import@ubuntu.com-20120905175434-yxs4x3rwksepfbf0
Tags: 3.0.0-26.42~lucid1
[Luis Henriques]

* Release Tracking Bug
  - LP: #1046423

[ Upstream Kernel Changes ]

* rds: set correct msg_namelen
  - LP: #1031112
  - CVE-2012-3430
* x86: Simplify code by removing a !SMP #ifdefs from 'struct cpuinfo_x86'
  - LP: #1037281
* Redefine ATOMIC_INIT and ATOMIC64_INIT to drop the casts
  - LP: #1037281
* SUNRPC: return negative value in case rpcbind client creation error
  - LP: #1037281
* nilfs2: fix deadlock issue between chcp and thaw ioctls
  - LP: #1037281
* pcdp: use early_ioremap/early_iounmap to access pcdp table
  - LP: #1037281
* mm: fix wrong argument of migrate_huge_pages() in
  soft_offline_huge_page()
  - LP: #1037281
* ARM: 7478/1: errata: extend workaround for erratum #720789
  - LP: #1037281
* ARM: 7479/1: mm: avoid NULL dereference when flushing gate_vma with
  VIVT caches
  - LP: #1037281
* mm: mmu_notifier: fix freed page still mapped in secondary MMU
  - LP: #1037281
* mac80211: cancel mesh path timer
  - LP: #1037281
* x86, nops: Missing break resulting in incorrect selection on Intel
  - LP: #1037281
* random: Add support for architectural random hooks
  - LP: #1037281
* fix typo/thinko in get_random_bytes()
  - LP: #1037281
* random: Use arch_get_random_int instead of cycle counter if avail
  - LP: #1037281
* random: Use arch-specific RNG to initialize the entropy store
  - LP: #1037281
* random: Adjust the number of loops when initializing
  - LP: #1037281
* drivers/char/random.c: fix boot id uniqueness race
  - LP: #1037281
* random: make 'add_interrupt_randomness()' do something sane
  - LP: #1037281
* random: use lockless techniques in the interrupt path
  - LP: #1037281
* random: create add_device_randomness() interface
  - LP: #1037281
* usb: feed USB device information to the /dev/random driver
  - LP: #1037281
* net: feed /dev/random with the MAC address when registering a device
  - LP: #1037281
* random: use the arch-specific rng in xfer_secondary_pool
  - LP: #1037281
* random: add new get_random_bytes_arch() function
  - LP: #1037281
* random: add tracepoints for easier debugging and verification
  - LP: #1037281
* MAINTAINERS: Theodore Ts'o is taking over the random driver
  - LP: #1037281
* rtc: wm831x: Feed the write counter into device_add_randomness()
  - LP: #1037281
* mfd: wm831x: Feed the device UUID into device_add_randomness()
  - LP: #1037281
* random: remove rand_initialize_irq()
  - LP: #1037281
* random: Add comment to random_initialize()
  - LP: #1037281
* dmi: Feed DMI table to /dev/random driver
  - LP: #1037281
* random: mix in architectural randomness in extract_buf()
  - LP: #1037281
* x86, microcode: microcode_core.c simple_strtoul cleanup
  - LP: #1037281
* x86, microcode: Sanitize per-cpu microcode reloading interface
  - LP: #1037281
* mm: hugetlbfs: close race during teardown of hugetlbfs shared page
  tables
  - LP: #1037281
* ARM: mxs: Remove MMAP_MIN_ADDR setting from mxs_defconfig
  - LP: #1037281
* ARM: pxa: remove irq_to_gpio from ezx-pcap driver
  - LP: #1037281
* cfg80211: process pending events when unregistering net device
  - LP: #1037281
* cfg80211: fix interface combinations check for ADHOC(IBSS)
  - LP: #1037281
* e1000e: NIC goes up and immediately goes down
  - LP: #1037281
* Input: wacom - Bamboo One 1024 pressure fix
  - LP: #1037281
* rt61pci: fix NULL pointer dereference in config_lna_gain
  - LP: #1037281
* Linux 3.0.41
  - LP: #1037281
* eCryptfs: Revert to a writethrough cache model
  - LP: #1034012
* net: Allow driver to limit number of GSO segments per skb
  - LP: #1037456
  - CVE-2012-3412
* tcp: do not scale TSO segment size with reordering degree
  - LP: #1037456
  - CVE-2012-3412
* tcp: Apply device TSO segment limit earlier
  - LP: #1037456
  - CVE-2012-3412
* sfc: Replace some literal constants with EFX_PAGE_SIZE/EFX_BUF_SIZE
  - LP: #1037456
  - CVE-2012-3412
* sfc: Fix maximum number of TSO segments and minimum TX queue size
  - LP: #1037456
  - CVE-2012-3412
* s390/compat: fix mmap compat system calls
  - LP: #1042241
* fuse: verify all ioctl retry iov elements
  - LP: #1042241
* xen: mark local pages as FOREIGN in the m2p_override
  - LP: #1042241
* drm/i915: correctly order the ring init sequence
  - LP: #1042241
* drm/radeon: do not reenable crtc after moving vram start address
  - LP: #1042241
* ext4: avoid kmemcheck complaint from reading uninitialized memory
  - LP: #1042241
* xhci: Add Etron XHCI_TRUST_TX_LENGTH quirk.
  - LP: #1042241
* xhci: Increase reset timeout for Renesas 720201 host.
  - LP: #1042241
* xhci: Switch PPT ports to EHCI on shutdown.
  - LP: #1042241
* USB: add USB_VENDOR_AND_INTERFACE_INFO() macro
  - LP: #1042241
* USB: support the new interfaces of Huawei Data Card devices in option
  driver
  - LP: #1042241
* USB: option: add ZTE K5006-Z
  - LP: #1042241
* USB: ftdi_sio: Add VID/PID for Kondo Serial USB
  - LP: #1042241
* usb: serial: mos7840: Fixup mos7840_chars_in_buffer()
  - LP: #1042241
* IB/srp: Fix a race condition
  - LP: #1042241
* Linux 3.0.42
  - LP: #1042241

Show diffs side-by-side

added added

removed removed

Lines of Context:
568
568
                        scmnd->sc_data_direction);
569
569
}
570
570
 
571
 
static void srp_remove_req(struct srp_target_port *target,
572
 
                           struct srp_request *req, s32 req_lim_delta)
573
 
{
574
 
        unsigned long flags;
575
 
 
576
 
        srp_unmap_data(req->scmnd, target, req);
 
571
/**
 
572
 * srp_claim_req - Take ownership of the scmnd associated with a request.
 
573
 * @target: SRP target port.
 
574
 * @req: SRP request.
 
575
 * @scmnd: If NULL, take ownership of @req->scmnd. If not NULL, only take
 
576
 *         ownership of @req->scmnd if it equals @scmnd.
 
577
 *
 
578
 * Return value:
 
579
 * Either NULL or a pointer to the SCSI command the caller became owner of.
 
580
 */
 
581
static struct scsi_cmnd *srp_claim_req(struct srp_target_port *target,
 
582
                                       struct srp_request *req,
 
583
                                       struct scsi_cmnd *scmnd)
 
584
{
 
585
        unsigned long flags;
 
586
 
 
587
        spin_lock_irqsave(&target->lock, flags);
 
588
        if (!scmnd) {
 
589
                scmnd = req->scmnd;
 
590
                req->scmnd = NULL;
 
591
        } else if (req->scmnd == scmnd) {
 
592
                req->scmnd = NULL;
 
593
        } else {
 
594
                scmnd = NULL;
 
595
        }
 
596
        spin_unlock_irqrestore(&target->lock, flags);
 
597
 
 
598
        return scmnd;
 
599
}
 
600
 
 
601
/**
 
602
 * srp_free_req() - Unmap data and add request to the free request list.
 
603
 */
 
604
static void srp_free_req(struct srp_target_port *target,
 
605
                         struct srp_request *req, struct scsi_cmnd *scmnd,
 
606
                         s32 req_lim_delta)
 
607
{
 
608
        unsigned long flags;
 
609
 
 
610
        srp_unmap_data(scmnd, target, req);
 
611
 
577
612
        spin_lock_irqsave(&target->lock, flags);
578
613
        target->req_lim += req_lim_delta;
579
 
        req->scmnd = NULL;
580
614
        list_add_tail(&req->list, &target->free_reqs);
581
615
        spin_unlock_irqrestore(&target->lock, flags);
582
616
}
583
617
 
584
618
static void srp_reset_req(struct srp_target_port *target, struct srp_request *req)
585
619
{
586
 
        req->scmnd->result = DID_RESET << 16;
587
 
        req->scmnd->scsi_done(req->scmnd);
588
 
        srp_remove_req(target, req, 0);
 
620
        struct scsi_cmnd *scmnd = srp_claim_req(target, req, NULL);
 
621
 
 
622
        if (scmnd) {
 
623
                scmnd->result = DID_RESET << 16;
 
624
                scmnd->scsi_done(scmnd);
 
625
                srp_free_req(target, req, scmnd, 0);
 
626
        }
589
627
}
590
628
 
591
629
static int srp_reconnect_target(struct srp_target_port *target)
1055
1093
                complete(&target->tsk_mgmt_done);
1056
1094
        } else {
1057
1095
                req = &target->req_ring[rsp->tag];
1058
 
                scmnd = req->scmnd;
1059
 
                if (!scmnd)
 
1096
                scmnd = srp_claim_req(target, req, NULL);
 
1097
                if (!scmnd) {
1060
1098
                        shost_printk(KERN_ERR, target->scsi_host,
1061
1099
                                     "Null scmnd for RSP w/tag %016llx\n",
1062
1100
                                     (unsigned long long) rsp->tag);
 
1101
 
 
1102
                        spin_lock_irqsave(&target->lock, flags);
 
1103
                        target->req_lim += be32_to_cpu(rsp->req_lim_delta);
 
1104
                        spin_unlock_irqrestore(&target->lock, flags);
 
1105
 
 
1106
                        return;
 
1107
                }
1063
1108
                scmnd->result = rsp->status;
1064
1109
 
1065
1110
                if (rsp->flags & SRP_RSP_FLAG_SNSVALID) {
1074
1119
                else if (rsp->flags & (SRP_RSP_FLAG_DIOVER | SRP_RSP_FLAG_DIUNDER))
1075
1120
                        scsi_set_resid(scmnd, be32_to_cpu(rsp->data_in_res_cnt));
1076
1121
 
1077
 
                srp_remove_req(target, req, be32_to_cpu(rsp->req_lim_delta));
 
1122
                srp_free_req(target, req, scmnd,
 
1123
                             be32_to_cpu(rsp->req_lim_delta));
 
1124
 
1078
1125
                scmnd->host_scribble = NULL;
1079
1126
                scmnd->scsi_done(scmnd);
1080
1127
        }
1613
1660
{
1614
1661
        struct srp_target_port *target = host_to_target(scmnd->device->host);
1615
1662
        struct srp_request *req = (struct srp_request *) scmnd->host_scribble;
1616
 
        int ret = SUCCESS;
1617
1663
 
1618
1664
        shost_printk(KERN_ERR, target->scsi_host, "SRP abort called\n");
1619
1665
 
1620
 
        if (!req || target->qp_in_error)
1621
 
                return FAILED;
1622
 
        if (srp_send_tsk_mgmt(target, req->index, scmnd->device->lun,
1623
 
                              SRP_TSK_ABORT_TASK))
1624
 
                return FAILED;
1625
 
 
1626
 
        if (req->scmnd) {
1627
 
                if (!target->tsk_mgmt_status) {
1628
 
                        srp_remove_req(target, req, 0);
1629
 
                        scmnd->result = DID_ABORT << 16;
1630
 
                } else
1631
 
                        ret = FAILED;
1632
 
        }
1633
 
 
1634
 
        return ret;
 
1666
        if (!req || target->qp_in_error || !srp_claim_req(target, req, scmnd))
 
1667
                return FAILED;
 
1668
        srp_send_tsk_mgmt(target, req->index, scmnd->device->lun,
 
1669
                          SRP_TSK_ABORT_TASK);
 
1670
        srp_free_req(target, req, scmnd, 0);
 
1671
        scmnd->result = DID_ABORT << 16;
 
1672
 
 
1673
        return SUCCESS;
1635
1674
}
1636
1675
 
1637
1676
static int srp_reset_device(struct scsi_cmnd *scmnd)