diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-06-27 04:59:58 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-07-20 03:58:37 -0400 |
commit | a5254dbb17dd22999f808e646780c32858a3eafa (patch) | |
tree | 9d45b698d14a26d2c9b46973225c93e471f74429 | |
parent | fffa69230b7bbfc62d8cfb515c3e658224a0f88c (diff) |
[SCSI] bfa: dereferencing freed memory in bfad_im_probe()
If bfad_thread_workq(bfad) was not BFA_STATUS_OK then we freed "im"
and then dereferenced it.
I did a little clean up because it seemed nicer to return directly
instead of doing a superfluous goto. I looked at other functions in
this file and it seems like returning directly is standard.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | drivers/scsi/bfa/bfad_im.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index 1ac09afe35ee..2eebf8d4d58b 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c | |||
@@ -687,25 +687,21 @@ bfa_status_t | |||
687 | bfad_im_probe(struct bfad_s *bfad) | 687 | bfad_im_probe(struct bfad_s *bfad) |
688 | { | 688 | { |
689 | struct bfad_im_s *im; | 689 | struct bfad_im_s *im; |
690 | bfa_status_t rc = BFA_STATUS_OK; | ||
691 | 690 | ||
692 | im = kzalloc(sizeof(struct bfad_im_s), GFP_KERNEL); | 691 | im = kzalloc(sizeof(struct bfad_im_s), GFP_KERNEL); |
693 | if (im == NULL) { | 692 | if (im == NULL) |
694 | rc = BFA_STATUS_ENOMEM; | 693 | return BFA_STATUS_ENOMEM; |
695 | goto ext; | ||
696 | } | ||
697 | 694 | ||
698 | bfad->im = im; | 695 | bfad->im = im; |
699 | im->bfad = bfad; | 696 | im->bfad = bfad; |
700 | 697 | ||
701 | if (bfad_thread_workq(bfad) != BFA_STATUS_OK) { | 698 | if (bfad_thread_workq(bfad) != BFA_STATUS_OK) { |
702 | kfree(im); | 699 | kfree(im); |
703 | rc = BFA_STATUS_FAILED; | 700 | return BFA_STATUS_FAILED; |
704 | } | 701 | } |
705 | 702 | ||
706 | INIT_WORK(&im->aen_im_notify_work, bfad_aen_im_notify_handler); | 703 | INIT_WORK(&im->aen_im_notify_work, bfad_aen_im_notify_handler); |
707 | ext: | 704 | return BFA_STATUS_OK; |
708 | return rc; | ||
709 | } | 705 | } |
710 | 706 | ||
711 | void | 707 | void |