[PATCH 5/5] Staging: ipack/devices/ipoctal: check for availability of helper functions in ipoctal_match()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When installing the module, there could be a kernel oops due to a dereference of
a NULL pointer.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@xxxxxxxxxx>
---
 drivers/staging/ipack/devices/ipoctal.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/ipack/devices/ipoctal.c b/drivers/staging/ipack/devices/ipoctal.c
index 7e370d3..df42b9b 100644
--- a/drivers/staging/ipack/devices/ipoctal.c
+++ b/drivers/staging/ipack/devices/ipoctal.c
@@ -799,6 +799,9 @@ static int ipoctal_match(struct ipack_device *dev)
 	int res;
 	unsigned char board_id;
 
+	if ((!dev->ops) || (!dev->ops->map_space) || (!dev->ops->unmap_space))
+		return -ENODEV;
+
 	res = dev->ops->map_space(dev, 0, IPACK_ID_SPACE);
 	if (res)
 		return res;
-- 
1.7.10

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux