IB/ehca: Require in_wc in process_mad()
authorAlexander Schmidt <alexs@linux.vnet.ibm.com>
Tue, 16 Feb 2010 08:59:50 +0000 (08:59 +0000)
committerRoland Dreier <rolandd@cisco.com>
Fri, 19 Feb 2010 19:13:39 +0000 (11:13 -0800)
If the caller does not pass a valid in_wc to process_mad(), return MAD
failure status, as it is not possible to generate a valid MAD redirect
response (and redirects are the only MAD responses ehca generates).

Signed-off-by: Alexander Schmidt <alexs@linux.vnet.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/ehca/ehca_sqp.c

index 8c1213f8916a19bfdccab6f3dcaf08f14065c509..dba8f9f8b9964bcfe61a899b6a7c5e2500b807dc 100644 (file)
@@ -222,7 +222,7 @@ int ehca_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
 {
        int ret;
 
-       if (!port_num || port_num > ibdev->phys_port_cnt)
+       if (!port_num || port_num > ibdev->phys_port_cnt || !in_wc)
                return IB_MAD_RESULT_FAILURE;
 
        /* accept only pma request */