Skip to contentSkip to conversation

blkfront: fix data size for xenbus_gather in, blkfront_connect

PATCH In review Marek Marczykowski 3 participants 5 messages May 2, 2011 – May 3, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blkfront: fix data size for xenbus_gather in, blkfront_connect

barrier variable is int, not long. This overflow caused another variable
override: "err" (in PV code) and "binfo" (in xenlinux code - drivers/xen/blkfront/blkfront.c). The later caused incorrect device flags (RO/removable etc).

---
 drivers/block/xen-blkfront.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/block/xen-blkfront.c +0 -0
index 70f3b1b..6147a4e 100644
@@ -1151,7 +1151,7 @@ static void blkfront_connect(struct blkfront_info

*info)
}

err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
- "feature-barrier", "%lu", &barrier,
+ "feature-barrier", "%d", &barrier,
NULL);

/*

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Marek Marczykowski

barrier variable is int, not long. This overflow caused another variable
override: "err" (in PV code) and "binfo" (in xenlinux code - drivers/xen/blkfront/blkfront.c). The later caused incorrect device flags (RO/removable etc).

Good catch.

Quoted 19 lines
---
 drivers/block/xen-blkfront.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/block/xen-blkfront.c +1 -1
index 70f3b1b..6147a4e 100644
@@ -1151,7 +1151,7 @@ static void blkfront_connect(struct blkfront_info
 *info)
 	}
 
 	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
-			    "feature-barrier", "%lu", &barrier,
+			    "feature-barrier", "%d", &barrier,
 			    NULL);
 

/*

#2 lore raw
In reply to Marek Marczykowski
Quoted 4 lines · Marek Marczykowski

barrier variable is int, not long. This overflow caused another variable
override: "err" (in PV code) and "binfo" (in xenlinux code - drivers/xen/blkfront/blkfront.c). The later caused incorrect device flags (RO/removable etc).

Weird, I get this:

konrad@phenom:~/work/linux$ patch -p1 < ~/for-40-blkfront 
patching file drivers/block/xen-blkfront.c
patch: **** malformed patch at line 124: *info)

Any ideas? Can you send the patch as attachment please?

Quoted 28 lines
---
 drivers/block/xen-blkfront.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/block/xen-blkfront.c +1 -1
index 70f3b1b..6147a4e 100644
@@ -1151,7 +1151,7 @@ static void blkfront_connect(struct blkfront_info
 *info)
 	}
 
 	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
-			    "feature-barrier", "%lu", &barrier,
+			    "feature-barrier", "%d", &barrier,
 			    NULL);
 

/*

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
Quoted 19 lines · Konrad Rzeszutek Wilk
Quoted 4 lines · Marek Marczykowski

barrier variable is int, not long. This overflow caused another variable
override: "err" (in PV code) and "binfo" (in xenlinux code - drivers/xen/blkfront/blkfront.c). The later caused incorrect device flags (RO/removable etc).

Weird, I get this:

konrad@phenom:~/work/linux$ patch -p1 < ~/for-40-blkfront 
patching file drivers/block/xen-blkfront.c
patch: **** malformed patch at line 124: *info)

Any ideas? Can you send the patch as attachment please?

Quoted 6 lines
---
 drivers/block/xen-blkfront.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 6 lines

drivers/block/xen-blkfront.c static void blkfront_connect(struct blkfront_info · line 1151

Quoted 6 lines
drivers/block/xen-blkfront.c +0 -0
index 70f3b1b..6147a4e 100644
@@ -1151,7 +1151,7 @@ static void blkfront_connect(struct blkfront_info
 *info)

^ the original path was lined wrapped in at least this spot

Quoted 22 lines
Quoted 12 lines
drivers/block/xen-blkfront.c +1 -1
 	}
 
 	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
-			    "feature-barrier", "%lu", &barrier,
+			    "feature-barrier", "%d", &barrier,
 			    NULL);
 

/*

Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw
In reply to Konrad Rzeszutek Wilk
Quoted 6 lines · Konrad Rzeszutek Wilk
Quoted 4 lines · Marek Marczykowski

barrier variable is int, not long. This overflow caused another variable
override: "err" (in PV code) and "binfo" (in xenlinux code - drivers/xen/blkfront/blkfront.c). The later caused incorrect device flags (RO/removable etc).

Quoted 7 lines

Weird, I get this:

konrad@phenom:~/work/linux$ patch -p1 < ~/for-40-blkfront 
patching file drivers/block/xen-blkfront.c
patch: **** malformed patch at line 124: *info)

Any ideas?

Ehh... my email client wrapped this line...

Quoted 1 line

Can you send the patch as attachment please?

Sure, attached.

Quoted 28 lines
Quoted 27 lines
---
 drivers/block/xen-blkfront.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/block/xen-blkfront.c +1 -1
index 70f3b1b..6147a4e 100644
@@ -1151,7 +1151,7 @@ static void blkfront_connect(struct blkfront_info
 *info)
 	}
 
 	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
-			    "feature-barrier", "%lu", &barrier,
+			    "feature-barrier", "%d", &barrier,
 			    NULL);
 

/*

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Signature · 3 lines
Pozdrawiam / Best Regards,
Marek Marczykowski         | RLU #390519
marmarek at mimuw edu pl   | xmpp:marmarek at staszic waw pl

From e1ccf5d4a44013cd8828462d500f6d1a46358cff Mon Sep 17 00:00:00 2001
From: Marek Marczykowski <[email protected]>
Date: Mon, 2 May 2011 12:56:17 +0200
Subject: [PATCH] blkfront: fix data size for xenbus_gather in
blkfront_connect

barrier variable is int, not long. This overflow caused another variable
override: "err" (in PV code) and "binfo" (in xenlinux code - drivers/xen/blkfront/blkfront.c). The later caused incorrect device flags (RO/removable etc).

---
 drivers/block/xen-blkfront.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/block/xen-blkfront.c +1 -1
index 70f3b1b..6147a4e 100644
@@ -1151,7 +1151,7 @@ static void blkfront_connect(struct blkfront_info *info)
 	}
 
 	err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
-			    "feature-barrier", "%lu", &barrier,
+			    "feature-barrier", "%d", &barrier,
 			    NULL);
 
 	/*
Signature · 1 line
1.7.4.4

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel