From 07c7224cf74c3977c69c7c9a0b0fba264f2df36a Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Thu, 1 May 2008 10:43:04 +0200 Subject: ieee1394: fix NULL pointer dereference in sysfs access Regression since "ieee1394: prevent device binding of raw1394, video1394, dv1394", commit d2ace29fa44589da51fedc06a67b3f05301f3bfd: $ cat /sys/bus/ieee1394/drivers/raw1394/device_ids triggers a NULL pointer dereference in fw_show_drv_device_ids. Reported by Miles Lane. Signed-off-by: Stefan Richter Tested-by: Miles Lane --- drivers/ieee1394/nodemgr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/ieee1394') diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 70afa3786f3f7d..c6babe802a3b56 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c @@ -520,8 +520,11 @@ static ssize_t fw_show_drv_device_ids(struct device_driver *drv, char *buf) char *scratch = buf; driver = container_of(drv, struct hpsb_protocol_driver, driver); + id = driver->id_table; + if (!id) + return 0; - for (id = driver->id_table; id->match_flags != 0; id++) { + for (; id->match_flags != 0; id++) { int need_coma = 0; if (id->match_flags & IEEE1394_MATCH_VENDOR_ID) { -- cgit 1.2.3-korg