]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sif: DNE QPs were created even with limited mode
authorKnut Omang <knut.omang@oracle.com>
Thu, 2 Jun 2016 08:38:07 +0000 (10:38 +0200)
committerKnut Omang <knut.omang@oracle.com>
Sun, 3 Jul 2016 14:01:39 +0000 (16:01 +0200)
This could potentially lead to situations where it is not
possible to upgrade firmware.

Also make all QP creation fail in limited mode, otherwise
someone might create one and try to run traffic on it.
In particular any use of PQPs will lead to kernel null pointer
exceptions as they have not been initialized.

Signed-off-by: Knut Omang <knut.omang@oracle.com>
drivers/infiniband/hw/sif/sif_qp.c
drivers/infiniband/hw/sif/sif_r3.c

index c7fdfc99ae9b340f1410f0a7546e1e7984483ab5..ab88057f63915103df5bb88ca3260a5e283739dd 100644 (file)
@@ -171,6 +171,14 @@ struct sif_qp *create_qp(struct sif_dev *sdev,
        u32 max_sge;
        int min_tso_inline;
 
+       /* In limited mode QPs are not usable and possibly hazardous as nothing is set up
+        * avoid any creation of any such:
+        */
+       if (unlikely(sdev->limited_mode)) {
+               sif_log(sdev, SIF_INFO, "limited mode does not support QP creation!");
+               return ERR_PTR(-ENODEV);
+       }
+
        if (init_attr->send_cq)
                send_cq = to_scq(init_attr->send_cq);
        if (init_attr->recv_cq)
index 455025787cf271cff110fe49a5ebb6d1bfc2f83c..06b270d28cc226be2619c41b7fc2069730455f7f 100644 (file)
@@ -36,6 +36,9 @@ int sif_r3_init(struct sif_dev *sdev)
        int ret;
        bool dne_qp_alloc = false;
 
+       if (sdev->limited_mode)
+               return 0;
+
        if (eps_fw_version_lt(&sdev->es[sdev->mbox_epsc], 0, 58)) {
                ret = sif_hw_allocate_dne_qp(sdev);
                if (ret)