diff mbox

[linux-cifs-client,3/3] cifs: fix artificial limit on reading symlinks

Message ID 1243205117-3351-4-git-send-email-jlayton@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton May 24, 2009, 10:45 p.m. UTC
There's no reason to limit the size of a symlink that we can read to
4000 bytes. That may be nowhere near PATH_MAX if the server is sending
UCS2 strings. CIFS should be able to read in a symlink up to the size of
the buffer. The size of the header has already been accounted for when
creating the slabcache, so CIFSMaxBufSize should be the correct size to
pass in.

Fixes samba bug #6384.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 fs/cifs/cifssmb.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

Comments

Steve French May 25, 2009, 1:47 a.m. UTC | #1
Good catch.  There are probably a couple of other examples like this
that need to be changed.   We could make this a min() call rather
than simply setting it to MaxBufSize ... but your change should work

On Sun, May 24, 2009 at 5:45 PM, Jeff Layton <jlayton@redhat.com> wrote:
> There's no reason to limit the size of a symlink that we can read to
> 4000 bytes. That may be nowhere near PATH_MAX if the server is sending
> UCS2 strings. CIFS should be able to read in a symlink up to the size of
> the buffer. The size of the header has already been accounted for when
> creating the slabcache, so CIFSMaxBufSize should be the correct size to
> pass in.
>
> Fixes samba bug #6384.
>
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>  fs/cifs/cifssmb.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
> index d062602..aece2a8 100644
> --- a/fs/cifs/cifssmb.c
> +++ b/fs/cifs/cifssmb.c
> @@ -2427,8 +2427,7 @@ querySymLinkRetry:
>        params = 2 /* level */  + 4 /* rsrvd */  + name_len /* incl null */ ;
>        pSMB->TotalDataCount = 0;
>        pSMB->MaxParameterCount = cpu_to_le16(2);
> -       /* BB find exact max data count below from sess structure BB */
> -       pSMB->MaxDataCount = cpu_to_le16(4000);
> +       pSMB->MaxDataCount = cpu_to_le16(CIFSMaxBufSize);
>        pSMB->MaxSetupCount = 0;
>        pSMB->Reserved = 0;
>        pSMB->Flags = 0;
> --
> 1.6.0.6
>
>
diff mbox

Patch

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index d062602..aece2a8 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -2427,8 +2427,7 @@  querySymLinkRetry:
 	params = 2 /* level */  + 4 /* rsrvd */  + name_len /* incl null */ ;
 	pSMB->TotalDataCount = 0;
 	pSMB->MaxParameterCount = cpu_to_le16(2);
-	/* BB find exact max data count below from sess structure BB */
-	pSMB->MaxDataCount = cpu_to_le16(4000);
+	pSMB->MaxDataCount = cpu_to_le16(CIFSMaxBufSize);
 	pSMB->MaxSetupCount = 0;
 	pSMB->Reserved = 0;
 	pSMB->Flags = 0;