Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH] scsi: aacraid: Fix an Oops in error handling
@ 2020-05-13  9:37 Dan Carpenter
  2020-05-15  1:10 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-05-13  9:37 UTC (permalink / raw)
  To: Adaptec OEM Raid Solutions, Zou Wei
  Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	kernel-janitors

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(+)

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;
 	}
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-15  1:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-13  9:37 [PATCH] scsi: aacraid: Fix an Oops in error handling Dan Carpenter
2020-05-15  1:10 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox