Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys/kern Pull up following revision(s) (requested by buhr...



details:   https://anonhg.NetBSD.org/src/rev/387292359ff0
branches:  netbsd-9
changeset: 373520:387292359ff0
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Feb 14 16:19:00 2023 +0000

description:
Pull up following revision(s) (requested by buhrow in ticket #1595):

        sys/kern/subr_devsw.c: revision 1.50

        When a device driver calls devsw_attach() it has the option of attaching a block device
structure and a character device structure, or, just the character device structure.
With the existing code, if a driver elects not to attach a block device structure and if it
asks for a major number to be dynamically assigned to its character interface,
that driver will not be able to detach and reattach its character driver interface.  This is a very
long standing bug which didn't come to light until we began using loadable kernel modules more
heavily.  this patch fixes this problem.  With this patch in place, drivers that implement only
a character device interface may detach and reattach that character interface as often as they
need to.

Fixes PR kern/57229

diffstat:

 sys/kern/subr_devsw.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 81eb3a728438 -r 387292359ff0 sys/kern/subr_devsw.c
--- a/sys/kern/subr_devsw.c     Tue Feb 14 16:10:00 2023 +0000
+++ b/sys/kern/subr_devsw.c     Tue Feb 14 16:19:00 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_devsw.c,v 1.38 2017/11/07 18:35:57 christos Exp $ */
+/*     $NetBSD: subr_devsw.c,v 1.38.8.1 2023/02/14 16:19:00 martin Exp $       */
 
 /*-
  * Copyright (c) 2001, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.38 2017/11/07 18:35:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_devsw.c,v 1.38.8.1 2023/02/14 16:19:00 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dtrace.h"
@@ -139,7 +139,7 @@
                if (conv->d_name == NULL || strcmp(devname, conv->d_name) != 0)
                        continue;
 
-               if (*bmajor < 0)
+               if ((bdev != NULL) && (*bmajor < 0)) 
                        *bmajor = conv->d_bmajor;
                if (*cmajor < 0)
                        *cmajor = conv->d_cmajor;



Home | Main Index | Thread Index | Old Index