Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e280d94 authored by Bryan O'Sullivan's avatar Bryan O'Sullivan Committed by Roland Dreier
Browse files

IB/ipath: fix for crash on module unload, if cfgports < portcnt



Allocate enough pointers for all possible ports, to avoid problems in
cleanup/unload.

Signed-off-by: default avatarBryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent c27fef26
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -240,7 +240,11 @@ static int init_chip_first(struct ipath_devdata *dd,
			  "only supports %u\n", ipath_cfgports,
			  "only supports %u\n", ipath_cfgports,
			  dd->ipath_portcnt);
			  dd->ipath_portcnt);
	}
	}
	dd->ipath_pd = kzalloc(sizeof(*dd->ipath_pd) * dd->ipath_cfgports,
	/*
	 * Allocate full portcnt array, rather than just cfgports, because
	 * cleanup iterates across all possible ports.
	 */
	dd->ipath_pd = kzalloc(sizeof(*dd->ipath_pd) * dd->ipath_portcnt,
			       GFP_KERNEL);
			       GFP_KERNEL);


	if (!dd->ipath_pd) {
	if (!dd->ipath_pd) {