diff options
author | Karsten Keil <kkeil@suse.de> | 2006-06-29 07:16:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-29 14:59:14 -0400 |
commit | 09fca29de4bdfd7eff47acbc6bd71c5fb5b79d79 (patch) | |
tree | 4b18c8f881803fde2ff62f11921bbbe1fe333e25 /drivers/isdn/i4l | |
parent | 0f6c10ead876492b386a19474e6dca4710eeef8e (diff) |
[PATCH] i4l:add some checks for valid drvid and driver pointer
If all drivers go away before all ISDN network interfaces are closed we got
a OOps on removing interfaces, this patch avoid it.
Signed-off-by: Karsten Keil <kkeil@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/isdn/i4l')
-rw-r--r-- | drivers/isdn/i4l/isdn_common.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index b26e509ec759..eb21063e6f63 100644 --- a/drivers/isdn/i4l/isdn_common.c +++ b/drivers/isdn/i4l/isdn_common.c | |||
@@ -340,6 +340,16 @@ isdn_command(isdn_ctrl *cmd) | |||
340 | printk(KERN_WARNING "isdn_command command(%x) driver -1\n", cmd->command); | 340 | printk(KERN_WARNING "isdn_command command(%x) driver -1\n", cmd->command); |
341 | return(1); | 341 | return(1); |
342 | } | 342 | } |
343 | if (!dev->drv[cmd->driver]) { | ||
344 | printk(KERN_WARNING "isdn_command command(%x) dev->drv[%d] NULL\n", | ||
345 | cmd->command, cmd->driver); | ||
346 | return(1); | ||
347 | } | ||
348 | if (!dev->drv[cmd->driver]->interface) { | ||
349 | printk(KERN_WARNING "isdn_command command(%x) dev->drv[%d]->interface NULL\n", | ||
350 | cmd->command, cmd->driver); | ||
351 | return(1); | ||
352 | } | ||
343 | if (cmd->command == ISDN_CMD_SETL2) { | 353 | if (cmd->command == ISDN_CMD_SETL2) { |
344 | int idx = isdn_dc2minor(cmd->driver, cmd->arg & 255); | 354 | int idx = isdn_dc2minor(cmd->driver, cmd->arg & 255); |
345 | unsigned long l2prot = (cmd->arg >> 8) & 255; | 355 | unsigned long l2prot = (cmd->arg >> 8) & 255; |
@@ -1903,6 +1913,11 @@ isdn_free_channel(int di, int ch, int usage) | |||
1903 | { | 1913 | { |
1904 | int i; | 1914 | int i; |
1905 | 1915 | ||
1916 | if ((di < 0) || (ch < 0)) { | ||
1917 | printk(KERN_WARNING "%s: called with invalid drv(%d) or channel(%d)\n", | ||
1918 | __FUNCTION__, di, ch); | ||
1919 | return; | ||
1920 | } | ||
1906 | for (i = 0; i < ISDN_MAX_CHANNELS; i++) | 1921 | for (i = 0; i < ISDN_MAX_CHANNELS; i++) |
1907 | if (((!usage) || ((dev->usage[i] & ISDN_USAGE_MASK) == usage)) && | 1922 | if (((!usage) || ((dev->usage[i] & ISDN_USAGE_MASK) == usage)) && |
1908 | (dev->drvmap[i] == di) && | 1923 | (dev->drvmap[i] == di) && |
@@ -1918,7 +1933,8 @@ isdn_free_channel(int di, int ch, int usage) | |||
1918 | dev->v110[i] = NULL; | 1933 | dev->v110[i] = NULL; |
1919 | // 20.10.99 JIM, try to reinitialize v110 ! | 1934 | // 20.10.99 JIM, try to reinitialize v110 ! |
1920 | isdn_info_update(); | 1935 | isdn_info_update(); |
1921 | skb_queue_purge(&dev->drv[di]->rpqueue[ch]); | 1936 | if (dev->drv[di]) |
1937 | skb_queue_purge(&dev->drv[di]->rpqueue[ch]); | ||
1922 | } | 1938 | } |
1923 | } | 1939 | } |
1924 | 1940 | ||