2009-07-01 18:49:19

by Abhishek Kulkarni

[permalink] [raw]
Subject: [9P PATCH 1/2] 9p: Fix incorrect parameters to v9fs_file_readn.

Fix v9fs_vfs_readpage. The offset and size parameters to v9fs_file_readn
were interchanged and hence passed incorrectly.

Signed-off-by: Abhishek Kulkarni <[email protected]>
---
:100644 100644 6fcb1e7... 9282828... M fs/9p/vfs_addr.c
fs/9p/vfs_addr.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index 6fcb1e7..9282828 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -57,7 +57,7 @@ static int v9fs_vfs_readpage(struct file *filp, struct page *page)
buffer = kmap(page);
offset = page_offset(page);

- retval = v9fs_file_readn(filp, buffer, NULL, offset, PAGE_CACHE_SIZE);
+ retval = v9fs_file_readn(filp, buffer, NULL, PAGE_CACHE_SIZE, offset);
if (retval < 0)
goto done;

--
1.6.3.3


2009-07-01 18:49:33

by Abhishek Kulkarni

[permalink] [raw]
Subject: [9P PATCH 2/2] net/9p: Fix crash due to bad mount parameters.

It is not safe to use match_int without checking the token type returned
by match_token (especially when the token type returned is Opt_err and
args is empty). Fix it.

Signed-off-by: Abhishek Kulkarni <[email protected]>
---
:100644 100644 c613ed08.. b884d98... M net/9p/trans_fd.c
net/9p/trans_fd.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index c613ed0..b884d98 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -731,12 +731,14 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
if (!*p)
continue;
token = match_token(p, tokens, args);
- r = match_int(&args[0], &option);
- if (r < 0) {
- P9_DPRINTK(P9_DEBUG_ERROR,
- "integer field, but no integer?\n");
- ret = r;
- continue;
+ if (token != Opt_err) {
+ r = match_int(&args[0], &option);
+ if (r < 0) {
+ P9_DPRINTK(P9_DEBUG_ERROR,
+ "integer field, but no integer?\n");
+ ret = r;
+ continue;
+ }
}
switch (token) {
case Opt_port:
--
1.6.3.3

2009-07-02 20:18:38

by David Miller

[permalink] [raw]
Subject: Re: [9P PATCH 2/2] net/9p: Fix crash due to bad mount parameters.

From: Abhishek Kulkarni <[email protected]>
Date: Wed, 1 Jul 2009 12:50:54 -0600

> It is not safe to use match_int without checking the token type returned
> by match_token (especially when the token type returned is Opt_err and
> args is empty). Fix it.
>
> Signed-off-by: Abhishek Kulkarni <[email protected]>

Applied.

2009-07-14 18:30:36

by Eric Van Hensbergen

[permalink] [raw]
Subject: Re: [V9fs-developer] [9P PATCH 1/2] 9p: Fix incorrect parameters to v9fs_file_readn.

applied v9fs-devel

On Wed, Jul 1, 2009 at 1:50 PM, Abhishek Kulkarni<[email protected]> wrote:
> Fix v9fs_vfs_readpage. The offset and size parameters to v9fs_file_readn
> were interchanged and hence passed incorrectly.
>
> Signed-off-by: Abhishek Kulkarni <[email protected]>
> ---
> :100644 100644 6fcb1e7... 9282828... M ?fs/9p/vfs_addr.c
> ?fs/9p/vfs_addr.c | ? ?2 +-
> ?1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
> index 6fcb1e7..9282828 100644
> --- a/fs/9p/vfs_addr.c
> +++ b/fs/9p/vfs_addr.c
> @@ -57,7 +57,7 @@ static int v9fs_vfs_readpage(struct file *filp, struct page *page)
> ? ? ? ?buffer = kmap(page);
> ? ? ? ?offset = page_offset(page);
>
> - ? ? ? retval = v9fs_file_readn(filp, buffer, NULL, offset, PAGE_CACHE_SIZE);
> + ? ? ? retval = v9fs_file_readn(filp, buffer, NULL, PAGE_CACHE_SIZE, offset);
> ? ? ? ?if (retval < 0)
> ? ? ? ? ? ? ? ?goto done;
>
> --
> 1.6.3.3
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> V9fs-developer mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/v9fs-developer
>