Pull in patch that properly includes stdint.h
[pkg-k5-afs_openafs.git] / debian / patches / 0005-afs-fix-kernel_write-kernel_read-arguments.patch
blobc55e675b2a6f7378439b25369fd1e0f0ed0f4107
1 From: Marcio Barbosa <mbarbosa@sinenomine.net>
2 Date: Thu, 16 Nov 2017 17:24:03 -0500
3 Subject: afs: fix kernel_write / kernel_read arguments
5 The order / content of the arguments passed to kernel_write and
6 kernel_read are not right. As a result, the kernel will panic if one of
7 the functions in question is called.
9 [kaduk@mit.edu: include configure check for multiple kernel_read()
10 variants, per linux commits bdd1d2d3d251c65b74ac4493e08db18971c09240
11 and e13ec939e96b13e664bb6cee361cc976a0ee621a]
13 FIXES 134440
15 Change-Id: I4753dee61f1b986bbe6a12b5568d1a8db30c65f8
16 Reviewed-on: https://gerrit.openafs.org/12769
17 Tested-by: BuildBot <buildbot@rampaginggeek.com>
18 Tested-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
19 Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
20 ---
21 acinclude.m4 | 1 +
22 src/afs/LINUX/osi_compat.h | 8 ++++++++
23 src/cf/linux-test4.m4 | 12 ++++++++++++
24 3 files changed, 21 insertions(+)
26 diff --git a/acinclude.m4 b/acinclude.m4
27 index 94b9436..ebfa0cb 100644
28 --- a/acinclude.m4
29 +++ b/acinclude.m4
30 @@ -1134,6 +1134,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
31 LINUX_DOP_D_REVALIDATE_TAKES_UNSIGNED
32 LINUX_IOP_LOOKUP_TAKES_UNSIGNED
33 LINUX_D_INVALIDATE_IS_VOID
34 + LINUX_KERNEL_READ_OFFSET_IS_LAST
36 dnl If we are guaranteed that keyrings will work - that is
37 dnl a) The kernel has keyrings enabled
38 diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
39 index 9871535..78be496 100644
40 --- a/src/afs/LINUX/osi_compat.h
41 +++ b/src/afs/LINUX/osi_compat.h
42 @@ -606,7 +606,11 @@ afs_file_read(struct file *filp, char __user *buf, size_t len, loff_t *pos)
43 #if defined(HAVE_LINUX___VFS_WRITE)
44 return __vfs_read(filp, buf, len, pos);
45 #elif defined(HAVE_LINUX_KERNEL_WRITE)
46 +# if defined(LINUX_KERNEL_READ_OFFSET_IS_LAST)
47 return kernel_read(filp, buf, len, pos);
48 +# else
49 + return kernel_read(filp, *pos, buf, len);
50 +# endif
51 #else
52 return filp->f_op->read(filp, buf, len, pos);
53 #endif
54 @@ -618,7 +622,11 @@ afs_file_write(struct file *filp, char __user *buf, size_t len, loff_t *pos)
55 #if defined(HAVE_LINUX___VFS_WRITE)
56 return __vfs_write(filp, buf, len, pos);
57 #elif defined(HAVE_LINUX_KERNEL_WRITE)
58 +# if defined(LINUX_KERNEL_READ_OFFSET_IS_LAST)
59 return kernel_write(filp, buf, len, pos);
60 +# else
61 + return kernel_write(filp, buf, len, *pos);
62 +# endif
63 #else
64 return filp->f_op->write(filp, buf, len, pos);
65 #endif
66 diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
67 index 46323ed..5a4615f 100644
68 --- a/src/cf/linux-test4.m4
69 +++ b/src/cf/linux-test4.m4
70 @@ -824,3 +824,15 @@ AC_DEFUN([LINUX_D_INVALIDATE_IS_VOID], [
71 [define if your d_invalidate returns void],
72 [])
75 +AC_DEFUN([LINUX_KERNEL_READ_OFFSET_IS_LAST], [
76 + AC_CHECK_LINUX_BUILD([whether offset is the last argument to kernel_read],
77 + [ac_cv_linux_func_kernel_read_offset_is_last],
78 + [#include <linux/fs.h>],
79 + [
80 + ssize_t kernel_read(struct file *, void *, size_t, loff_t *);
81 + ],
82 + [KERNEL_READ_OFFSET_IS_LAST],
83 + [define if your kernel_read has offset as the last argument],
84 + [])
85 +])