Skip to contentSkip to conversation

lpfc: Fix rport leak.

DISCUSSION Dan Carpenter 1 participant 1 message Jun 10, 2015 SCSI

lore
Share & tools
lore
#0 lore raw

Hello James Smart,

This is a semi-automatic email about new static checker warnings.

The patch 466e840b7809: "lpfc: Fix rport leak." from May 21, 2015, leads to the following Smatch complaint:

drivers/scsi/lpfc/lpfc_hbadisc.c:3905 lpfc_register_remote_port()
error: we previously assumed 'rdata' could be null (see line 3903)

drivers/scsi/lpfc/lpfc_hbadisc.c
3902 ndlp->rport = NULL;
3903 if (rdata && rdata->pnode == ndlp)

                            ^^^^^

Patch introduces a new check.

3904 lpfc_nlp_put(ndlp);

  3905			rdata->pnode = NULL;
                        ^^^^^^^^^^^^

Unchecked dereference.

3906 /* drop reference for earlier registeration */
3907 put_device(&rport->dev);

regards,
dan carpenter