tech-kern archive

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

swcrypto is initialized twice



Hi,

Currently(after cryptosoft.c:r1.44), software encryption driver
(swcrypto0) is initialized twice, that is, swcr_init() is called
below two call paths.
    (1) swcrypto_attach()
        <= called from module initialization
    (2) swcryptoattach()
        <= called from autoconf(9) initialization

This is wrong as it leaks struct cryptocap in crypto_drivers[].

Hmm, compare with pseudo interfaces like gif(4), It seems the
swcryptoattach() should do nothing. So, I think bellow patch
is required.
====================
--- a/sys/opencrypto/cryptosoft.c
+++ b/sys/opencrypto/cryptosoft.c
@@ -1325,8 +1325,10 @@ swcr_init(void)
 void
 swcryptoattach(int num)
 {
-
-       swcr_init();
+       /*
+        * Nothing to do here, initialization is handled by the
+        * module initialization code in swcrypto_attach() below).
+        */
 }
 
 void   swcrypto_attach(device_t, device_t, void *);
====================

Could you comment this patch?
If there is no objection, I will commit this patch within a few days.


Thanks,

-- 
//////////////////////////////////////////////////////////////////////
Internet Initiative Japan Inc.

Device Engineering Section,
IoT Platform Development Department,
Network Division,
Technology Unit

Kengo NAKAHARA <k-nakahara%iij.ad.jp@localhost>


Home | Main Index | Thread Index | Old Index