Skip to content

Commit 2d7d4fd

Browse files
Johannes Thumshirnmartinkpetersen
authored andcommitted
scsi: fcoe: fix use-after-free in fcoe_ctlr_els_send
KASAN reports a use-after-free in fcoe_ctlr_els_send() when we're sending a LOGO and have FIP debugging enabled. This is because we're first freeing the skb and then printing the frame's DID. But the DID is a member of the FC frame header which in turn is the skb's payload. Exchange the debug print and kfree_skb() calls so we're not touching the freed data. Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 15d2586 commit 2d7d4fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/scsi/fcoe/fcoe_ctlr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,9 +799,9 @@ int fcoe_ctlr_els_send(struct fcoe_ctlr *fip, struct fc_lport *lport,
799799
fip->send(fip, skb);
800800
return -EINPROGRESS;
801801
drop:
802-
kfree_skb(skb);
803802
LIBFCOE_FIP_DBG(fip, "drop els_send op %u d_id %x\n",
804803
op, ntoh24(fh->fh_d_id));
804+
kfree_skb(skb);
805805
return -EINVAL;
806806
}
807807
EXPORT_SYMBOL(fcoe_ctlr_els_send);

0 commit comments

Comments
 (0)