mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 10:19:26 +00:00
We don't have to drop a lock around malloc(M_NOWAIT).
This commit is contained in:
parent
eadca5921d
commit
a05071e803
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=181475
@ -221,17 +221,17 @@ padlock_newsession(device_t dev, uint32_t *sidp, struct cryptoini *cri)
|
||||
ses->ses_used = 1;
|
||||
TAILQ_INSERT_TAIL(&sc->sc_sessions, ses, ses_next);
|
||||
}
|
||||
rw_wunlock(&sc->sc_sessions_lock);
|
||||
if (ses == NULL) {
|
||||
ses = malloc(sizeof(*ses), M_PADLOCK, M_NOWAIT | M_ZERO);
|
||||
if (ses == NULL)
|
||||
if (ses == NULL) {
|
||||
rw_wunlock(&sc->sc_sessions_lock);
|
||||
return (ENOMEM);
|
||||
}
|
||||
ses->ses_used = 1;
|
||||
rw_wlock(&sc->sc_sessions_lock);
|
||||
ses->ses_id = sc->sc_sid++;
|
||||
TAILQ_INSERT_TAIL(&sc->sc_sessions, ses, ses_next);
|
||||
rw_wunlock(&sc->sc_sessions_lock);
|
||||
}
|
||||
rw_wunlock(&sc->sc_sessions_lock);
|
||||
|
||||
error = padlock_cipher_setup(ses, encini);
|
||||
if (error != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user