Skip to contentSkip to conversation

Patch "scsi: sg: fix SG_DXFER_FROM_DEV transfers" has been added to the 4.12-stable tree

PATCH [email protected] 4 participants 6 messages Aug 7, 2017 – Aug 9, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

scsi: sg: fix SG_DXFER_FROM_DEV transfers

to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
scsi-sg-fix-sg_dxfer_from_dev-transfers.patch
and it can be found in the queue-4.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 68c59fcea1f2c6a54c62aa896cc623c1b5bc9b47 Mon Sep 17 00:00:00 2001

From: Johannes Thumshirn <[email protected]>
Date: Fri, 7 Jul 2017 10:56:38 +0200
Subject: scsi: sg: fix SG_DXFER_FROM_DEV transfers

From: Johannes Thumshirn <[email protected]>

commit 68c59fcea1f2c6a54c62aa896cc623c1b5bc9b47 upstream.

SG_DXFER_FROM_DEV transfers do not necessarily have a dxferp as we set it to NULL for the old sg_io read/write interface, but must have a length bigger than 0. This fixes a regression introduced by commit 28676d869bbb ("scsi: sg: check for valid direction before starting the request")

---
 drivers/scsi/sg.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/sg.c +4 -1
@@ -758,8 +758,11 @@ static bool sg_is_valid_dxfer(sg_io_hdr_
 		if (hp->dxferp || hp->dxfer_len > 0)
 			return false;
 		return true;
-	case SG_DXFER_TO_DEV:
 	case SG_DXFER_FROM_DEV:
+		if (hp->dxfer_len < 0)
+			return false;
+		return true;
+	case SG_DXFER_TO_DEV:
 	case SG_DXFER_TO_FROM_DEV:
 		if (!hp->dxferp || hp->dxfer_len == 0)
 			return false;

Patches currently in stable-queue which might be from [email protected] are

queue-4.12/scsi-sg-fix-sg_dxfer_from_dev-transfers.patch

#1 lore raw
Quoted 8 lines · On 07/08/17 21:32, [email protected] wrote:

This is a note to let you know that I've just added the patch titled

scsi: sg: fix SG_DXFER_FROM_DEV transfers

to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

Quoted 7 lines

The filename of the patch is:
scsi-sg-fix-sg_dxfer_from_dev-transfers.patch
and it can be found in the queue-4.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Johannes' commit message says that the transfer must have a length bigger than 0, so the code should return false if the length is less than or equal to 0, but the test is for less than 0.

But in any case, there's another patch that removes all this sg_is_valid_dxfer() jiggery-pokery and replaces it with a simpler test. It hasn't reached Linus' tree yet but is, I believe, cc'd to stable.

Quoted 52 lines

From 68c59fcea1f2c6a54c62aa896cc623c1b5bc9b47 Mon Sep 17 00:00:00 2001
From: Johannes Thumshirn <[email protected]>
Date: Fri, 7 Jul 2017 10:56:38 +0200
Subject: scsi: sg: fix SG_DXFER_FROM_DEV transfers

From: Johannes Thumshirn <[email protected]>

commit 68c59fcea1f2c6a54c62aa896cc623c1b5bc9b47 upstream.

SG_DXFER_FROM_DEV transfers do not necessarily have a dxferp as we set it to NULL for the old sg_io read/write interface, but must have a length bigger than 0. This fixes a regression introduced by commit 28676d869bbb ("scsi: sg: check for valid direction before starting the request")

---
 drivers/scsi/sg.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/sg.c +4 -1
@@ -758,8 +758,11 @@ static bool sg_is_valid_dxfer(sg_io_hdr_
 		if (hp->dxferp || hp->dxfer_len > 0)
 			return false;
 		return true;
-	case SG_DXFER_TO_DEV:
 	case SG_DXFER_FROM_DEV:
+		if (hp->dxfer_len < 0)
+			return false;
+		return true;
+	case SG_DXFER_TO_DEV:
 	case SG_DXFER_TO_FROM_DEV:
 		if (!hp->dxferp || hp->dxfer_len == 0)
 			return false;

Patches currently in stable-queue which might be from [email protected] are

queue-4.12/scsi-sg-fix-sg_dxfer_from_dev-transfers.patch

#2 lore raw
Quoted 17 lines · Chris Clayton
Quoted 8 lines · On 07/08/17 21:32, [email protected] wrote:

This is a note to let you know that I've just added the patch titled

scsi: sg: fix SG_DXFER_FROM_DEV transfers

to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

Quoted 7 lines

The filename of the patch is:
scsi-sg-fix-sg_dxfer_from_dev-transfers.patch
and it can be found in the queue-4.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 5 lines

Johannes' commit message says that the transfer must have a length bigger than 0, so the code should return false if the length is less than or equal to 0, but the test is for less than 0.

But in any case, there's another patch that removes all this sg_is_valid_dxfer() jiggery-pokery and replaces it with a simpler test. It hasn't reached Linus' tree yet but is, I believe, cc'd to stable.

Yup, I hope James is sending it out for this weekend's -rc and then it should be backported to stable instead.

James any plans in doing otherwise?
Greg is this acceptible for you?

Thanks,
Johannes

Signature · 6 lines
Johannes Thumshirn                                          Storage
[email protected]                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg
GF: Felix Imend�rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N�rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
#3 lore raw
Quoted 27 lines · Johannes Thumshirn
Quoted 26 lines · Chris Clayton
Quoted 11 lines · On 07/08/17 21:32, [email protected] wrote:

This is a note to let you know that I've just added the patch titled

    scsi: sg: fix SG_DXFER_FROM_DEV transfers

to the 4.12-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-q
ueue.git;a=summary

Quoted 8 lines

The filename of the patch is:
     scsi-sg-fix-sg_dxfer_from_dev-transfers.patch and it can be found in the queue-4.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.

Johannes' commit message says that the transfer must have a length bigger than 0, so the code should return false if the length is less than or equal to 0, but the test is for less than 0.

Quoted 7 lines
Quoted 4 lines

But in any case, there's another patch that removes all this sg_is_valid_dxfer() jiggery-pokery and replaces it with a simpler test. It hasn't reached Linus' tree yet but is, I believe, cc'd to stable.

Yup, I hope James is sending it out for this weekend's -rc and then it should be backported to stable instead.

I'm not sure which patch you mean.  However, if you got one of my automated emails about it then it will be in today's batch for Linus.

James

Quoted 5 lines

James any plans in doing otherwise?
Greg is this acceptible for you?

Thanks,
Johannes

#4 lore raw
Quoted 2 lines · James Bottomley

I'm not sure which patch you mean. �However, if you got one of my automated emails about it then it will be in today's batch for Linus.

Yup it was (FTR I was talking about f930c7043663 scsi: sg: only check for dxfer_len greater than 256M) and is it in Linus' tree now.

Thanks a lot,
Johannes

Signature · 6 lines
Johannes Thumshirn                                          Storage
[email protected]                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg
GF: Felix Imend�rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N�rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
author maintainer
#5 lore raw
In reply to Johannes Thumshirn
Quoted 21 lines · Johannes Thumshirn
Quoted 20 lines · Chris Clayton
Quoted 8 lines · On 07/08/17 21:32, [email protected] wrote:

This is a note to let you know that I've just added the patch titled

scsi: sg: fix SG_DXFER_FROM_DEV transfers

to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

Quoted 7 lines

The filename of the patch is:
scsi-sg-fix-sg_dxfer_from_dev-transfers.patch
and it can be found in the queue-4.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Johannes' commit message says that the transfer must have a length bigger than 0, so the code should return false if the length is less than or equal to 0, but the test is for less than 0.

Quoted 8 lines
Quoted 2 lines

But in any case, there's another patch that removes all this sg_is_valid_dxfer() jiggery-pokery and replaces it with a simpler test. It hasn't reached Linus' tree yet but is, I believe, cc'd to stable.

Yup, I hope James is sending it out for this weekend's -rc and then it should be backported to stable instead.

James any plans in doing otherwise?
Greg is this acceptible for you?

That's fine, I'll queue it up when it lands in a released -rc.

thanks,

greg k-h