From ee7f22ddbc3e408597a35954b56541d3ca754e81 Mon Sep 17 00:00:00 2001 From: dchagin Date: Sat, 12 Apr 2014 06:50:11 +0000 Subject: MFC r264151: Prevent alq from panic when the invalid alq_file path specified. --- sys/kern/kern_alq.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sys') diff --git a/sys/kern/kern_alq.c b/sys/kern/kern_alq.c index 1e6fcf7..7f8c603 100644 --- a/sys/kern/kern_alq.c +++ b/sys/kern/kern_alq.c @@ -488,10 +488,12 @@ alq_open(struct alq **alqp, const char *file, struct ucred *cred, int cmode, KASSERT((count >= 0), ("%s: count < 0", __func__)); if (count > 0) { - ret = alq_open_flags(alqp, file, cred, cmode, size*count, 0); - (*alqp)->aq_flags |= AQ_LEGACY; - (*alqp)->aq_entmax = count; - (*alqp)->aq_entlen = size; + if ((ret = alq_open_flags(alqp, file, cred, cmode, + size*count, 0)) == 0) { + (*alqp)->aq_flags |= AQ_LEGACY; + (*alqp)->aq_entmax = count; + (*alqp)->aq_entlen = size; + } } else ret = alq_open_flags(alqp, file, cred, cmode, size, 0); -- cgit v1.1