diff mbox series

scsi: aacraid: Fix an Oops in error handling

Message ID 20200513093703.GB347693@mwanda (mailing list archive)
State Mainlined
Commit 25c21d20bcfdb97ba869007b284a5dbf5328ffe2
Headers show
Series scsi: aacraid: Fix an Oops in error handling | expand

Commit Message

Dan Carpenter May 13, 2020, 9:37 a.m. UTC
If the memdup_user() function fails then it results in an Oops in the
error handling code when we try to kfree() and error pointer.

Fixes: 8d925b1f00e6 ("scsi: aacraid: Use memdup_user() as a cleanup")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/scsi/aacraid/commctrl.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Martin K. Petersen May 15, 2020, 1:10 a.m. UTC | #1
On Wed, 13 May 2020 12:37:03 +0300, Dan Carpenter wrote:

> If the memdup_user() function fails then it results in an Oops in the
> error handling code when we try to kfree() and error pointer.

Applied to 5.8/scsi-queue, thanks!

[1/1] scsi: aacraid: Fix an oops in error handling
      https://git.kernel.org/mkp/scsi/c/25c21d20bcfd
diff mbox series

Patch

diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index 102658bdc15a..34e65dea992e 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -516,6 +516,7 @@  static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
 	user_srbcmd = memdup_user(user_srb, fibsize);
 	if (IS_ERR(user_srbcmd)) {
 		rcode = PTR_ERR(user_srbcmd);
+		user_srbcmd = NULL;
 		goto cleanup;
 	}