Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

isdn: fix multiple sleep_on races

The isdn core code uses a couple of wait queues with
interruptible_sleep_on, which is racy and about to get
removed from the kernel. Fortunately, we know for each case
what we are waiting for, so they can all be converted to
the better wait_event_interruptible interface.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: netdev@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Arnd Bergmann and committed by
David S. Miller
94fcf696 c11da83b

+8 -5
+8 -5
drivers/isdn/i4l/isdn_common.c
··· 777 777 return 0; 778 778 if (skb_queue_empty(&dev->drv[di]->rpqueue[channel])) { 779 779 if (sleep) 780 - interruptible_sleep_on(sleep); 780 + wait_event_interruptible(*sleep, 781 + !skb_queue_empty(&dev->drv[di]->rpqueue[channel])); 781 782 else 782 783 return 0; 783 784 } ··· 1073 1072 retval = -EAGAIN; 1074 1073 goto out; 1075 1074 } 1076 - interruptible_sleep_on(&(dev->info_waitq)); 1075 + wait_event_interruptible(dev->info_waitq, 1076 + file->private_data); 1077 1077 } 1078 1078 p = isdn_statstr(); 1079 1079 file->private_data = NULL; ··· 1130 1128 retval = -EAGAIN; 1131 1129 goto out; 1132 1130 } 1133 - interruptible_sleep_on(&(dev->drv[drvidx]->st_waitq)); 1131 + wait_event_interruptible(dev->drv[drvidx]->st_waitq, 1132 + dev->drv[drvidx]->stavail); 1134 1133 } 1135 1134 if (dev->drv[drvidx]->interface->readstat) { 1136 1135 if (count > dev->drv[drvidx]->stavail) ··· 1191 1188 goto out; 1192 1189 } 1193 1190 chidx = isdn_minor2chan(minor); 1194 - while ((retval = isdn_writebuf_stub(drvidx, chidx, buf, count)) == 0) 1195 - interruptible_sleep_on(&dev->drv[drvidx]->snd_waitq[chidx]); 1191 + wait_event_interruptible(dev->drv[drvidx]->snd_waitq[chidx], 1192 + (retval = isdn_writebuf_stub(drvidx, chidx, buf, count))); 1196 1193 goto out; 1197 1194 } 1198 1195 if (minor <= ISDN_MINOR_CTRLMAX) {