git: DragonFly_RELEASE_5_2 if_tap: Disallow to destroy an opened device

Aaron LI aly at crater.dragonflybsd.org
Thu Aug 30 06:58:12 PDT 2018


commit 07f09928e5993fbd5dcc7b98b37cdb429dfe225f
Author: Aaron LI <aly at aaronly.me>
Date:   Thu Aug 30 21:13:27 2018 +0800

    if_tap: Disallow to destroy an opened device
    
    When a tap device (created via 'ifconfig') is opened, disallow to destroy
    it (e.g., ifconfig destroy).  Otherwise, a panic occurs when the caller
    closes the device, since it has been already destroyed.
    
    Test case:
    [A]% ifconfig tap0 create
    [B]% # run a program that opens '/dev/tap0' and keep it running
    [A]% ifconfig tap0 destroy
    [B]% # exit the program which will then close '/dev/tap0'
    => panic!
    
    In addition:
    * Add an assertion to tapclose() to assert the device must exist.
    * Return EINVAL instead of ENOIX when try to destroy an manually created
      tap device.

Summary of changes:
 sys/net/tap/if_tap.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/07f09928e5993fbd5dcc7b98b37cdb429dfe225f


-- 
DragonFly BSD source repository



More information about the Commits mailing list