Mailing List Archive

[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).

Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
---
drivers/block/xen-blkfront.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 70f3b1b..6147a4e 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -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);

/*
Re: [PATCH] blkfront: fix data size for xenbus_gather in, blkfront_connect [ In reply to ]
On Mon, 2011-05-02 at 12:06 +0100, Marek Marczykowski wrote:
> 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).
>
> Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>

Good catch.

Acked-by: Ian Campbell <ian.campbell@citrix.com>

> ---
> drivers/block/xen-blkfront.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index 70f3b1b..6147a4e 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -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
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH] blkfront: fix data size for xenbus_gather in, blkfront_connect [ In reply to ]
On Mon, May 02, 2011 at 01:06:19PM +0200, Marek Marczykowski wrote:
> 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?
>
> Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
> ---
> drivers/block/xen-blkfront.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index 70f3b1b..6147a4e 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -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
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH] blkfront: fix data size for xenbus_gather in, blkfront_connect [ In reply to ]
On Tue, 2011-05-03 at 16:40 +0100, Konrad Rzeszutek Wilk wrote:
> On Mon, May 02, 2011 at 01:06:19PM +0200, Marek Marczykowski wrote:
> > 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?
> >
> > Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
> > ---
> > drivers/block/xen-blkfront.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> > index 70f3b1b..6147a4e 100644
> > --- a/drivers/block/xen-blkfront.c
> > +++ b/drivers/block/xen-blkfront.c
> > @@ -1151,7 +1151,7 @@ static void blkfront_connect(struct blkfront_info
> > *info)

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

> > }
> >
> > err = xenbus_gather(XBT_NIL, info->xbdev->otherend,
> > - "feature-barrier", "%lu", &barrier,
> > + "feature-barrier", "%d", &barrier,
> > NULL);
> >
> > /*
> >
>
>
>
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xensource.com
> > http://lists.xensource.com/xen-devel
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Re: [PATCH] blkfront: fix data size for xenbus_gather in, blkfront_connect [ In reply to ]
On 03.05.2011 17:40, Konrad Rzeszutek Wilk wrote:
> On Mon, May 02, 2011 at 01:06:19PM +0200, Marek Marczykowski wrote:
>> 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?

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

> Can you send the patch as attachment please?

Sure, attached.

>> Signed-off-by: Marek Marczykowski <marmarek@mimuw.edu.pl>
>> ---
>> drivers/block/xen-blkfront.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
>> index 70f3b1b..6147a4e 100644
>> --- a/drivers/block/xen-blkfront.c
>> +++ b/drivers/block/xen-blkfront.c
>> @@ -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
>> Xen-devel@lists.xensource.com
>> http://lists.xensource.com/xen-devel
>


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