NetBSD Problem Report #13112
Received: (qmail 10070 invoked from network); 5 Jun 2001 01:51:04 -0000
Message-Id: <20010605015258.CEFAD4628@kiku.my.domain>
Date: Tue, 5 Jun 2001 10:52:58 +0900 (JST)
From: toshii@netbsd.org
Sender: toshii@kiku.my.domain
Reply-To: toshii@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: argument check missing in wi_ioctl?
X-Send-Pr-Version: 3.95
>Number: 13112
>Category: kern
>Synopsis: argument check missing in wi_ioctl?
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jun 05 01:52:00 +0000 2001
>Closed-Date: Sun Mar 31 10:46:41 +0000 2002
>Last-Modified: Sun Mar 31 10:46:41 +0000 2002
>Originator: IWAMOTO Toshihiro
>Release: NetBSD-current
>Organization:
>Environment:
NetBSD/hpcarm
>Description:
It looks like nobody checks wreq.wi_len passed as an ioctl argument.
Passing large value may cause kernel page fault.
>How-To-Repeat:
code inspection.
>Fix:
maybe the following patch.
This patch is not tested yet and other fixes may also be necessary.
It is also possible that this PR is bogus and the patch isn't
needed.
(I'll not likely to have enough time to look in this in a week or so.)
Index: wi.c
===================================================================
RCS file: /cvs/cvsroot/syssrc/sys/dev/ic/wi.c,v
retrieving revision 1.16
diff -u -r1.16 wi.c
--- wi.c 2001/06/04 03:34:47 1.16
+++ wi.c 2001/06/05 01:43:37
@@ -1241,6 +1241,8 @@
} else {
if (sc->sc_enabled == 0)
error = wi_getdef(sc, &wreq);
+ else if (wreq.wi_len > WI_MAX_DATALEN)
+ error = EINVAL;
else if (wi_read_record(sc, (struct wi_ltv_gen *)&wreq))
error = EINVAL;
}
@@ -1261,7 +1263,9 @@
error = wi_mgmt_xmit(sc, (caddr_t)&wreq.wi_val,
wreq.wi_len);
} else {
- if (sc->sc_enabled != 0)
+ if (wreq.wi_len > WI_MAX_DATALEN)
+ error = EINVAL;
+ else if (sc->sc_enabled != 0)
error = wi_write_record(sc,
(struct wi_ltv_gen *)&wreq);
if (error == 0)
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: jdolecek
State-Changed-When: Sun Mar 31 02:46:28 PST 2002
State-Changed-Why:
Proposed fix committed.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.