bdev/crypto: prevent duplicates from being added to global name list
Picked up from recent update to the passthru module. Change-Id: Ie7404e5aadda6691b15020adbbc1e1f4c23d0a12 Signed-off-by: Paul Luse <paul.e.luse@intel.com> Reviewed-on: https://review.gerrithub.io/433384 (master) Reviewed-on: https://review.gerrithub.io/435673 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
b177b5fcb8
commit
9469b3ef20
@ -1116,6 +1116,13 @@ vbdev_crypto_insert_name(const char *bdev_name, const char *vbdev_name,
|
||||
int rc, j;
|
||||
bool found = false;
|
||||
|
||||
TAILQ_FOREACH(name, &g_bdev_names, link) {
|
||||
if (strcmp(vbdev_name, name->vbdev_name) == 0) {
|
||||
SPDK_ERRLOG("crypto bdev %s already exists\n", vbdev_name);
|
||||
return -EEXIST;
|
||||
}
|
||||
}
|
||||
|
||||
name = calloc(1, sizeof(struct bdev_names));
|
||||
if (!name) {
|
||||
SPDK_ERRLOG("could not allocate bdev_names\n");
|
||||
|
Loading…
Reference in New Issue
Block a user