From nobody@FreeBSD.org  Mon Jul  8 23:42:44 2002
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id AF72A37B400
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  8 Jul 2002 23:42:44 -0700 (PDT)
Received: from www.freebsd.org (www.FreeBSD.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 76C9143E09
	for <freebsd-gnats-submit@FreeBSD.org>; Mon,  8 Jul 2002 23:42:44 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.12.4/8.12.4) with ESMTP id g696giOT059703
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 8 Jul 2002 23:42:44 -0700 (PDT)
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.12.4/8.12.4/Submit) id g696gi12059702;
	Mon, 8 Jul 2002 23:42:44 -0700 (PDT)
Message-Id: <200207090642.g696gi12059702@www.freebsd.org>
Date: Mon, 8 Jul 2002 23:42:44 -0700 (PDT)
From: Sarnath <sparc64@rediffmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: rman_reserve_resource - when "count > (end-start+1)"- doesn't trap it.
X-Send-Pr-Version: www-1.0

>Number:         40369
>Category:       kern
>Synopsis:       [kernel] [patch] rman_reserve_resource - when "count > (end-start+1)"- doesn't trap it.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 08 23:50:01 PDT 2002
>Closed-Date:    
>Last-Modified:  Wed Oct 26 00:00:07 GMT 2005
>Originator:     Sarnath
>Release:        4.5-RELEASE
>Organization:
--NA--
>Environment:
FreeBSD Venus.na.com 4.5-RELEASE FreeBSD 4.5-RELEASE #0: Wed Jun  5 15:56:23 IST 2002     yuhu@Venus.na.com:/usr/obj/usr/src/sys/GENERIC i386
>Description:
rman_reserve_resource allocates resources even if 
(count > (end-start+1)).
The sanity of the parameters are unchecked.
This might bomb the kernel when a BUS driver behaves wrongly.
>How-To-Repeat:
Call rman_reserve_resource with count ? (end-start+1)
>Fix:
1) One can add explictit sanity check for this.

                 OR

2) File: /usr/src/sys/kern/subr_rman.c, Line num: 232.
   Original: rend = min(s->r_end, max(start + count, end));
   Change as: rend = min(s->r_end, min(start + count, end));

>Release-Note:
>Audit-Trail:
>Unformatted:
