Do not dereference NULL scp in the case the screen is not opened.

Instead, return ENXIO to the ioctl caller.

Reported and tested by:	Pawel Worach <pawel.worach gmail com>
Discussed with:	markus
MFC after:	3 days
This commit is contained in:
Konstantin Belousov 2008-01-24 15:37:48 +00:00
parent 623c393d65
commit eee74fe05d

View File

@ -1071,6 +1071,8 @@ scioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
if (error)
return error;
scp = sc_get_stat(SC_DEV(sc, i));
if (scp == NULL)
return (ENXIO);
if (scp == scp->sc->cur_scp)
return 0;
error = tsleep(&scp->smode, PZERO | PCATCH, "waitvt", 0);