public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Kashyap Desai <kashyap.desai@avagotech.com>,
	Sumit Saxena <sumit.saxena@avagotech.com>
Cc: Uday Lingala <uday.lingala@avagotech.com>,
	"James E.J. Bottomley" <JBottomley@odin.com>,
	megaraidlinux.pdl@avagotech.com, linux-scsi@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: [patch 2/2] megaraid_sas: missing curly braces in megasas_detach_one()
Date: Sat, 07 Nov 2015 16:17:09 +0000	[thread overview]
Message-ID: <20151107161709.GB30686@mwanda> (raw)

The indenting indicates that there are supposed to be some curly braces
here.  Presumably it means we free something unintentionally leading to
a use after free.

Fixes: 3761cb4cf65e ('megaraid_sas: JBOD sequence number support')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Not tested.

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 829e9e9..91e200d 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -5932,7 +5932,7 @@ static void megasas_detach_one(struct pci_dev *pdev)
 						  fusion->max_map_sz,
 						  fusion->ld_map[i],
 						  fusion->ld_map_phys[i]);
-			if (fusion->ld_drv_map[i])
+			if (fusion->ld_drv_map[i]) {
 				free_pages((ulong)fusion->ld_drv_map[i],
 					fusion->drv_map_pages);
 				if (fusion->pd_seq_sync)
@@ -5940,6 +5940,7 @@ static void megasas_detach_one(struct pci_dev *pdev)
 						pd_seq_map_sz,
 						fusion->pd_seq_sync[i],
 						fusion->pd_seq_phys[i]);
+			}
 		}
 		free_pages((ulong)instance->ctrl_context,
 			instance->ctrl_context_pages);

             reply	other threads:[~2015-11-07 16:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-07 16:17 Dan Carpenter [this message]
2015-11-10 10:31 ` [patch 2/2] megaraid_sas: missing curly braces in megasas_detach_one() Kashyap Desai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151107161709.GB30686@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=JBottomley@odin.com \
    --cc=kashyap.desai@avagotech.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=megaraidlinux.pdl@avagotech.com \
    --cc=sumit.saxena@avagotech.com \
    --cc=uday.lingala@avagotech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox