[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20070511013317.3c6441f3.akpm@linux-foundation.org>
Date: Fri, 11 May 2007 01:33:17 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Frederik Deweerdt <deweerdt@...e.fr>
Cc: linux-kernel@...r.kernel.org, jorge@...er.satlink.net,
agulbra@....unit.no, netdev@...r.kernel.org,
David Howells <dhowells@...hat.com>
Subject: Re: [-mm patch] make csum_and_copy_from_user arch independent (was
Re: 2.6.21-mm2)
On Fri, 11 May 2007 10:27:38 +0200 Frederik Deweerdt <deweerdt@...e.fr> wrote:
> On Wed, May 09, 2007 at 01:23:22AM -0700, Andrew Morton wrote:
> >
> > ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.21/2.6.21-mm2/
> >
>
> ERROR: "csum_partial_copy_from_user" [net/rxrpc/af-rxrpc.ko] undefined!
>
> Linking on ARM fails because albeit a generic csum_and_copy_from_user()
> function is provided in the case ! _HAVE_ARCH_COPY_AND_CSUM_FROM_USER, the
> generic function uses csum_partial_copy_from_user() which is i386 only.
>
> The following patch uses copy_from_user() followed by csum_partial()
> to make the function platform independent.
>
> Regards,
> Frederik
>
> Signed-off-by: Frederik Deweerdt <frederik.deweerdt@...il.com>
>
> diff --git a/include/net/checksum.h b/include/net/checksum.h
> index 1242461..2eebb95 100644
> --- a/include/net/checksum.h
> +++ b/include/net/checksum.h
> @@ -30,13 +30,16 @@ static inline
> __wsum csum_and_copy_from_user (const void __user *src, void *dst,
> int len, __wsum sum, int *err_ptr)
> {
> - if (access_ok(VERIFY_READ, src, len))
> - return csum_partial_copy_from_user(src, dst, len, sum, err_ptr);
> + if (access_ok(VERIFY_READ, src, len)) {
> + if (copy_from_user(dst, src, len))
> + return -EFAULT;
> + return csum_partial(dst, len, sum);
> + }
>
> if (len)
> *err_ptr = -EFAULT;
>
> - return sum;
> + return (__force __wsum)-1; /* invalid checksum */
> }
> #endif
>
hm. Please cc netdev on net patches.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists