IB/hfi1: Fix to fully initialize send context area
authorTymoteusz Kielan <tymoteusz.kielan@intel.com>
Mon, 25 Jul 2016 20:38:01 +0000 (13:38 -0700)
committerDoug Ledford <dledford@redhat.com>
Tue, 2 Aug 2016 20:00:58 +0000 (16:00 -0400)
While handling buffer control MAD, partially initialized
dd->kernel_send_context area may cause potential dereference
of uninitialized pointers. Fix by using kzalloc_node()
instead of kmalloc_node().

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Andrzej Kacprowski <andrzej.kacprowski@intel.com>
Signed-off-by: Tymoteusz Kielan <tymoteusz.kielan@intel.com>
Signed-off-by: Andrzej Kacprowski <andrzej.kacprowski@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/hfi1/pio.c

index d4022450b73f7a9c6d8d528fbe44b3dd2fa0e00a..a99fccadf6247b5408dce945965a91c59ad1e381 100644 (file)
@@ -1956,7 +1956,7 @@ int init_pervl_scs(struct hfi1_devdata *dd)
        hfi1_init_ctxt(dd->vld[15].sc);
        dd->vld[15].mtu = enum_to_mtu(OPA_MTU_2048);
 
-       dd->kernel_send_context = kmalloc_node(dd->num_send_contexts *
+       dd->kernel_send_context = kzalloc_node(dd->num_send_contexts *
                                        sizeof(struct send_context *),
                                        GFP_KERNEL, dd->node);
        dd->kernel_send_context[0] = dd->vld[15].sc;