From: Bhanu Prakash Gollapudi Date: Fri, 5 Aug 2011 00:38:51 +0000 (-0700) Subject: [SCSI] bnx2fc: Prevent creating of NPIV port with duplicate WWN X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=861efc547ce517e3d75a507ebc2268e6a0dfa767;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [SCSI] bnx2fc: Prevent creating of NPIV port with duplicate WWN This patch adds a validation step before allowing creation of a new NPIV port. It checks whether the WWPN passed for the new NPIV port to be created is unique for the given physical port. Signed-off-by: Bhanu Prakash Gollapudi Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c index 25d3bcd179b1..351ca4cb403f 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c +++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c @@ -1020,6 +1020,17 @@ static int bnx2fc_vport_create(struct fc_vport *vport, bool disabled) struct bnx2fc_interface *interface = port->priv; struct net_device *netdev = interface->netdev; struct fc_lport *vn_port; + int rc; + char buf[32]; + + rc = fcoe_validate_vport_create(vport); + if (rc) { + fcoe_wwn_to_str(vport->port_name, buf, sizeof(buf)); + printk(KERN_ERR PFX "Failed to create vport, " + "WWPN (0x%s) already exists\n", + buf); + return rc; + } if (!test_bit(BNX2FC_FLAG_FW_INIT_DONE, &interface->hba->flags)) { printk(KERN_ERR PFX "vn ports cannot be created on"