diff options
author | ariff <ariff@FreeBSD.org> | 2005-11-03 08:19:04 +0000 |
---|---|---|
committer | ariff <ariff@FreeBSD.org> | 2005-11-03 08:19:04 +0000 |
commit | 94d7cede201189260f4418cb20a641ce856ad4b8 (patch) | |
tree | 0fde0ea7a8ff152ee05f8304b67d1d74a71a3d65 /sys | |
parent | adb08ca53a433355e2d8993aeccca6d5dfd54947 (diff) | |
download | FreeBSD-src-94d7cede201189260f4418cb20a641ce856ad4b8.zip FreeBSD-src-94d7cede201189260f4418cb20a641ce856ad4b8.tar.gz |
Appropriate NULL pointer checking to avoid mysterious panic during
device cloning.
Approved by: netchild (mentor)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/sound/pcm/dsp.c | 2 | ||||
-rw-r--r-- | sys/dev/sound/pcm/mixer.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 3cb09d7..5f94199 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -1157,7 +1157,7 @@ dsp_clone(void *arg, struct ucred *cred, char *name, int namelen, panic("Unknown devtype %d", devtype); } - if ((pdev->si_drv1 == NULL) && (pdev->si_drv2 == NULL)) { + if ((pdev != NULL) && (pdev->si_drv1 == NULL) && (pdev->si_drv2 == NULL)) { *dev = pdev; dev_ref(*dev); return; diff --git a/sys/dev/sound/pcm/mixer.c b/sys/dev/sound/pcm/mixer.c index 6b8dac1..b8f78d3 100644 --- a/sys/dev/sound/pcm/mixer.c +++ b/sys/dev/sound/pcm/mixer.c @@ -515,7 +515,7 @@ mixer_clone(void *arg, struct ucred *cred, char *name, int namelen, return; if (strcmp(name, "mixer") == 0) { sd = devclass_get_softc(pcm_devclass, snd_unit); - if (sd != NULL) { + if (sd != NULL && sd->mixer_dev != NULL) { *dev = sd->mixer_dev; dev_ref(*dev); } |