提交 f96d279f 编写于 作者: Z zhengbin 提交者: Martin K. Petersen

scsi: fcoe: fix null-ptr-deref Read in fc_release_transport

In fcoe_if_init, if fc_attach_transport(&fcoe_vport_fc_functions)
fails, need to free the previously memory and return fail, otherwise
will trigger null-ptr-deref Read in fc_release_transport.

fcoe_exit
  fcoe_if_exit
    fc_release_transport(fcoe_vport_scsi_transport)

Link: https://lore.kernel.org/r/1566279789-58207-1-git-send-email-zhengbin13@huawei.comReported-by: NHulk Robot <hulkci@huawei.com>
Reviewed-by: NHannes Reinecke <hare@suse.com>
Signed-off-by: Nzhengbin <zhengbin13@huawei.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 7ce5eed0
......@@ -1250,15 +1250,21 @@ static int __init fcoe_if_init(void)
/* attach to scsi transport */
fcoe_nport_scsi_transport =
fc_attach_transport(&fcoe_nport_fc_functions);
if (!fcoe_nport_scsi_transport)
goto err;
fcoe_vport_scsi_transport =
fc_attach_transport(&fcoe_vport_fc_functions);
if (!fcoe_nport_scsi_transport) {
printk(KERN_ERR "fcoe: Failed to attach to the FC transport\n");
return -ENODEV;
}
if (!fcoe_vport_scsi_transport)
goto err_vport;
return 0;
err_vport:
fc_release_transport(fcoe_nport_scsi_transport);
err:
printk(KERN_ERR "fcoe: Failed to attach to the FC transport\n");
return -ENODEV;
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册