* Re: [PATCH 0/3] Misc build fixes
From: Thomas Petazzoni @ 2016-07-07 7:06 UTC (permalink / raw)
To: Steve Grubb; +Cc: linux-audit
In-Reply-To: <2008682.VKiKRQpury@x2>
Hello,
On Wed, 06 Jul 2016 18:45:28 -0400, Steve Grubb wrote:
> On Wednesday, July 6, 2016 9:08:16 PM EDT Thomas Petazzoni wrote:
> > The first two patches in this series fix misc build issues of audit
> > with old kernel headers.
>
> I applied both. The second patch was not complete. You might want to pull
> what's in svn and make sure everything works for your target OS.
ACK, thanks!
> > The last patch fixes warnings encountered when running autoreconf on
> > audit's configure.ac.
> >
> > As a side note, are there any plans to switch the audit development to
> > a Git repository? Having to switch back to Subversion is really
> > painful, which is why the patches in this series are Git-formatted.
>
> Eventually. I'm using it for a couple other projects and when I feel
> comfortable I'll switch this over. This is a much more important project than
> the other two.
Sure. So I guess there's no need to convince you of all the advantages
of Git :)
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply
* Re: [RFC 0/7] netlink: Add allocation flag to netlink_unicast()
From: Masashi Honma @ 2016-07-07 0:35 UTC (permalink / raw)
To: ccaulfie, teigland
Cc: netdev, netfilter-devel, linux-wireless, linux-rdma, linux-audit,
cluster-devel, davem, johannes, pablo, kaber, kadlec, dledford,
sean.hefty, hal.rosenstock, paul, eparis, zbr, pshelar,
bsingharora
In-Reply-To: <1467764916-4983-1-git-send-email-masashi.honma@gmail.com>
At the fs/dlm/netlink.c#dlm_timeout_warn(),
prepare_data allocates buffer with GFP_NOFS
and send_data() sends the buffer.
But send_data() uses GFP_KERNEL or GFP_ATOMIC inside it.
Should it be replaced by GFP_NOFS ?
Masashi Honma
^ permalink raw reply
* Re: Possible bug compiling Audit 2.6.x against kernel headers older than 3.19
From: Steve Grubb @ 2016-07-06 22:52 UTC (permalink / raw)
To: linux-audit
In-Reply-To: <CAFSsvmqbDWp=OjphAH6Tf7YC8q0phwCzm86aDz050-3kxAMnZw@mail.gmail.com>
On Wednesday, July 6, 2016 10:53:37 AM EDT Adam Duskett wrote:
> Audit 2.6.x checks for AUDIT_FEATURE_VERSION to be defined in
> include/linux/audit.h (this define was introduced in kernel version
> 3.13) and then blindly assumes that struct audit_status has
> feature_bitmap.
>
> However this looks like a problem as feature_bitmap wasn't introduced
> until kernel 3.19, even though the requirements for Audit state that
> anything > 2.6.30 should work. (http://people.redhat.com/sgrubb/audit/)
Yes, but this is obvious a mistake. :-)
> This causes a compile error when attempting to compile audit 2.6.x
> against kernel headers younger than 3.19.
>
> libaudit.c:609:33: error: 'struct audit_status' has no member named
> 'feature_bitmap'
> features_bitmap = rep.status->feature_bitmap;
I think this is now fixed in svn. I don't know if you can try a pre-release or
not. I'll probably do a new release in a few days.
-Steve
^ permalink raw reply
* Re: [PATCH 3/3] configure.ac: add subdir-objects
From: Steve Grubb @ 2016-07-06 22:47 UTC (permalink / raw)
To: linux-audit
In-Reply-To: <1467832099-12255-4-git-send-email-thomas.petazzoni@free-electrons.com>
On Wednesday, July 6, 2016 9:08:19 PM EDT Thomas Petazzoni wrote:
> This allows to avoid the following warning when re-generating the
> configure script:
>
> auparse/Makefile.am:95: warning: source file '../lib/gen_tables.c' is in a
> subdirectory, auparse/Makefile.am:95: but option 'subdir-objects' is
> disabled
I saw these in the last couple weeks. However...
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> configure.ac | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac
> index 00788c4..e9f7cb9 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -37,7 +37,7 @@ echo Configuring auditd $VERSION
>
> AC_CONFIG_MACRO_DIR([m4])
> AC_CANONICAL_TARGET
> -AM_INIT_AUTOMAKE
> +AM_INIT_AUTOMAKE([subdir-objects])
> AM_PROG_LIBTOOL
> AC_SUBST(LIBTOOL_DEPS)
> OLDLIBS="$LIBS"
Applying this breaks the build
am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)
make[4]: Entering directory '/home/sgrubb/working/BUILD/audit/bindings/python/
python2'
Makefile:485: ../../../bindings/python/.deps/auparse_la-auparse_python.Plo: No
such file or directory
make[4]: *** No rule to make target '../../../bindings/python/.deps/
auparse_la-auparse_python.Plo'. Stop.
-Steve
^ permalink raw reply
* Re: [PATCH 0/3] Misc build fixes
From: Steve Grubb @ 2016-07-06 22:45 UTC (permalink / raw)
To: linux-audit
In-Reply-To: <1467832099-12255-1-git-send-email-thomas.petazzoni@free-electrons.com>
On Wednesday, July 6, 2016 9:08:16 PM EDT Thomas Petazzoni wrote:
> The first two patches in this series fix misc build issues of audit
> with old kernel headers.
I applied both. The second patch was not complete. You might want to pull
what's in svn and make sure everything works for your target OS.
> The last patch fixes warnings encountered when running autoreconf on
> audit's configure.ac.
>
> As a side note, are there any plans to switch the audit development to
> a Git repository? Having to switch back to Subversion is really
> painful, which is why the patches in this series are Git-formatted.
Eventually. I'm using it for a couple other projects and when I feel
comfortable I'll switch this over. This is a much more important project than
the other two.
-Steve
^ permalink raw reply
* [PATCH 2/3] Fix usage of audit_status.feature_bitmap
From: Thomas Petazzoni @ 2016-07-06 19:08 UTC (permalink / raw)
To: linux-audit
In-Reply-To: <1467832099-12255-1-git-send-email-thomas.petazzoni@free-electrons.com>
The feature_bitmap field of "struct audit_status" only appeared in
kernel headers >= 3.19. However, the code using it in libaudit.c is only
conditional on the existence of AUDIT_FEATURE_VERSION, which has been
added in Linux 3.13.
This means that building audit with kernel headers >= 3.13 but < 3.19
currently fails:
libaudit.c: In function 'load_feature_bitmap':
libaudit.c:609:33: error: 'struct audit_status' has no member named 'feature_bitmap'
features_bitmap = rep.status->feature_bitmap;
^
libaudit.c: In function 'audit_rule_fieldpair_data':
libaudit.c:1424:9: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
4294967295;
This commit fixes that by testing the availability of the feature_bitmap
field.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
Note: it would be worth checking this commit in details. I assumed that
the function load_feature_bitmap() would simply return with
features_bitmap set to AUDIT_FEATURES_UNSUPPORTED, just as if
HAVE_DECL_AUDIT_FEATURE_VERSION was not defined. I am not sure if it is
the appropriate behavior.
---
configure.ac | 1 +
lib/libaudit.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 219720b..00788c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,7 @@ AC_CHECK_SIZEOF([unsigned int])
AC_CHECK_SIZEOF([unsigned long])
AM_PROG_CC_C_O
AC_CHECK_DECLS([AUDIT_FEATURE_VERSION], [], [], [[#include <linux/audit.h>]])
+AC_CHECK_MEMBERS([struct audit_status.feature_bitmap], [], [], [[#include <linux/audit.h>]])
AC_CHECK_DECLS([AUDIT_VERSION_BACKLOG_WAIT_TIME], [], [], [[#include <linux/audit.h>]])
AC_CHECK_DECLS([ADDR_NO_RANDOMIZE],,, [#include <sys/personality.h>])
dnl; posix_fallocate is used in audisp-remote
diff --git a/lib/libaudit.c b/lib/libaudit.c
index 2c96f29..510d841 100644
--- a/lib/libaudit.c
+++ b/lib/libaudit.c
@@ -579,7 +579,7 @@ static void load_feature_bitmap(void)
return;
}
-#if HAVE_DECL_AUDIT_FEATURE_VERSION
+#if defined(HAVE_DECL_AUDIT_FEATURE_VERSION) && defined(HAVE_STRUCT_AUDIT_STATUS_FEATURE_BITMAP)
if ((rc = audit_request_status(fd)) > 0) {
struct audit_reply rep;
int i;
--
2.7.4
^ permalink raw reply related
* [PATCH 3/3] configure.ac: add subdir-objects
From: Thomas Petazzoni @ 2016-07-06 19:08 UTC (permalink / raw)
To: linux-audit
In-Reply-To: <1467832099-12255-1-git-send-email-thomas.petazzoni@free-electrons.com>
This allows to avoid the following warning when re-generating the
configure script:
auparse/Makefile.am:95: warning: source file '../lib/gen_tables.c' is in a subdirectory,
auparse/Makefile.am:95: but option 'subdir-objects' is disabled
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 00788c4..e9f7cb9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,7 +37,7 @@ echo Configuring auditd $VERSION
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_TARGET
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([subdir-objects])
AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
OLDLIBS="$LIBS"
--
2.7.4
^ permalink raw reply related
* [PATCH 0/3] Misc build fixes
From: Thomas Petazzoni @ 2016-07-06 19:08 UTC (permalink / raw)
To: linux-audit
Hello,
The first two patches in this series fix misc build issues of audit
with old kernel headers.
The last patch fixes warnings encountered when running autoreconf on
audit's configure.ac.
As a side note, are there any plans to switch the audit development to
a Git repository? Having to switch back to Subversion is really
painful, which is why the patches in this series are Git-formatted.
Thanks!
Thomas
Thomas Petazzoni (3):
lib/gen_tables.c: define EHWPOISON when not available
Fix usage of audit_status.feature_bitmap
configure.ac: add subdir-objects
configure.ac | 3 ++-
lib/gen_tables.c | 9 +++++++++
lib/libaudit.c | 2 +-
3 files changed, 12 insertions(+), 2 deletions(-)
--
2.7.4
^ permalink raw reply
* [PATCH 1/3] lib/gen_tables.c: define EHWPOISON when not available
From: Thomas Petazzoni @ 2016-07-06 19:08 UTC (permalink / raw)
To: linux-audit
In-Reply-To: <1467832099-12255-1-git-send-email-thomas.petazzoni@free-electrons.com>
When building on some old system with old kernel headers, the
gen_tables.c program (built natively) doesn't build due to missing
EHWPOISON. This commit defines EHWPOISON to the value found in
asm-generic kernel headers, which is correct for most (but not all
architectures).
Anyway, the whole concept of building a program on the host to generate
a table with errno values, then built into a target program is
inherently broken, so our fix is not more broken than the rest of the
mechanism used by audit.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
lib/gen_tables.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lib/gen_tables.c b/lib/gen_tables.c
index 98f576c..d0bb7f5 100644
--- a/lib/gen_tables.c
+++ b/lib/gen_tables.c
@@ -55,6 +55,15 @@
#define SHMGET 23
#define SHMCTL 24
+/*
+ * Values from asm-generic, might be different on other architectures,
+ * but anyway the concept of building a program on the host to
+ * generate errno related tables used on another architecture is
+ * broken.
+ */
+#ifndef EHWPOISON
+#define EHWPOISON 133
+#endif
/* The ratio of table size to number of non-empty elements allowed for a
"direct" s2i table; if the ratio would be bigger, bsearch tables are used
--
2.7.4
^ permalink raw reply related
* Re: Crash when loading the rules
From: Steve Grubb @ 2016-07-06 18:13 UTC (permalink / raw)
To: Laurent Bigonville; +Cc: linux-audit
In-Reply-To: <4b9c1eed-c988-9ee8-3326-2d6957be3e6d@debian.org>
Hello,
I revceived the strace file which made the email too big for the mail list.
I'm including the important part below.
On Wednesday, July 6, 2016 6:31:00 PM EDT Laurent Bigonville wrote:
> Le 06/07/16 à 18:23, Steve Grubb a écrit :
> >So, I'm note sure why you are getting a
> > core dump. If this is reproducible it might be good to get an strace to see
> > what is being handed to writev. Or maybe try it from valgrind to see if
> > that gives additional information.
>
> Valgrind is a bit broken in debian unstable due to the compressed debug
> symbols.
>
> I've attached here the output of strace
[pid 1595] write(4</var/log/audit/audit.log>, "type=SYSCALL msg=audit(1467798264.913:1259): arch=c000003e syscall=47 success=yes exit=267 a0=6 a1=7ffe30a5e630 a2=40000040 a3=ffffffff items=0 ppid=1 pid=1108 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=\"systemd-journal\" exe=\"/lib/systemd/systemd-journald\" subj=system_u:system_r:syslogd_t:s0 key=(null)\n", 364) = 364
[pid 1595] fstatfs(4</var/log/audit/audit.log>, {f_type=EXT2_SUPER_MAGIC, f_bsize=4096, f_blocks=3838052, f_bfree=1172381, f_bavail=987245, f_files=977280, f_ffree=703441, f_fsid={9930339, 726475040}, f_namelen=255, f_frsize=4096, f_flags=ST_VALID|ST_RELATIME}) = 0
This shows that it made it to write_to_log and then called check_log_file_size
[pid 1595] --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x90430527} ---
[pid 1602] +++ killed by SIGSEGV (core dumped) +++
+++ killed by SIGSEGV (core dumped) +++
The traceback is not accurate. We are somewhere else in the code. I am going
to bet that its crashing on trying to ack because in the netlink path its not
getting set to NULL. I updated svn with a 1 line fix. Can you either pull the
new code from svn and try it or add this patch to your build?
https://fedorahosted.org/audit/changeset/1320/trunk/src/auditd.c
Let me know if this does it.
Thanks,
-Steve
^ permalink raw reply
* Re: Crash when loading the rules
From: Steve Grubb @ 2016-07-06 16:23 UTC (permalink / raw)
To: Laurent Bigonville; +Cc: linux-audit
In-Reply-To: <247821ed-2bec-925a-cf1b-f9f4b60fb2ba@debian.org>
On Wednesday, July 6, 2016 5:26:44 PM EDT Laurent Bigonville wrote:
Hello,
> Le 06/07/16 à 17:23, Steve Grubb a écrit :
> > On Wednesday, July 6, 2016 4:49:58 PM EDT Laurent Bigonville wrote:
> >> With 2.6.3, when loading the rules, it's crashing and I get the
> >> following backtrace:
> >>
> >> #0 0x00007ffff687e99d in writev () at
> >> ../sysdeps/unix/syscall-template.S:84 #1 0x00005555555610ab in
> >> dispatch_event (rep=<optimized out>, is_err=0) at
> >> ../../../src/auditd-dispatch.c:189
> >> #2 0x000055555555a700 in distribute_event (e=0x555555779d80) at
> >> ../../../src/auditd.c:216
> >> #3 0x000055555555aac8 in netlink_handler (loop=<optimized out>,
> >> io=<optimized out>, revents=<optimized out>) at ../../../src/auditd.c:500
>
> > By any chance does syslog show that the dispatcher exited due to no active
> > plugins?
>
> This is what I see in syslog:
>
> Jul 6 17:25:15 valinor systemd[1]: Starting Security Auditing Service...
> Jul 6 17:25:15 valinor auditd[604]: Started dispatcher: /sbin/audispd
> pid: 608
> Jul 6 17:25:15 valinor audispd: priority_boost_parser called with: 4
> Jul 6 17:25:15 valinor audispd: max_restarts_parser called with: 10
> Jul 6 17:25:15 valinor audispd: No plugins found, exiting
OK. When this happens we should get a SIGCHLD which causes the handler to mark
the writev pipe descriptor as -1. This is checked for on the way to the
writev. So, maybe there is a race where the descriptor was ok at entry but the
child process was gone at writev time. This should have resulted in a SIGPIPE
when does not core dump but does terminate auditd. This can and should be
fixed.
However, you are getting a core dump. The only thing I can think of is if
vec[1].iov_base was assigned an invalid address. I tested this and I get
writev(6, [{"\1\0\0\0\20\0\0\0j\4\0\0\377\0\0\0", 16}, {NULL, 255}], 2) = -1
EFAULT (Bad address)
which also does not core dump. So, I'm note sure why you are getting a core
dump. If this is reproducible it might be good to get an strace to see what is
being handed to writev. Or maybe try it from valgrind to see if that gives
additional information.
-Steve
> Jul 6 17:25:16 valinor kernel: [20575.773688] audit: netlink_unicast
> sending to audit_pid=604 returned error: -111
> Jul 6 17:25:16 valinor systemd[1]: auditd.service: Main process exited,
> code=dumped, status=11/SEGV
> Jul 6 17:25:16 valinor systemd[1]: auditd.service: Unit entered failed
> state.
> Jul 6 17:25:16 valinor systemd[1]: auditd.service: Failed with result
> 'core-dump'.
^ permalink raw reply
* Re: Crash when loading the rules
From: Laurent Bigonville @ 2016-07-06 15:26 UTC (permalink / raw)
To: Steve Grubb, linux-audit
In-Reply-To: <1835912.PABrHuQGvY@x2>
Le 06/07/16 à 17:23, Steve Grubb a écrit :
> On Wednesday, July 6, 2016 4:49:58 PM EDT Laurent Bigonville wrote:
>> Hi,
>>
>> With 2.6.3, when loading the rules, it's crashing and I get the
>> following backtrace:
>>
>> #0 0x00007ffff687e99d in writev () at ../sysdeps/unix/syscall-template.S:84
>> #1 0x00005555555610ab in dispatch_event (rep=<optimized out>, is_err=0) at
>> ../../../src/auditd-dispatch.c:189
>> #2 0x000055555555a700 in distribute_event (e=0x555555779d80) at
>> ../../../src/auditd.c:216
>> #3 0x000055555555aac8 in netlink_handler (loop=<optimized out>,
>> io=<optimized out>, revents=<optimized out>) at ../../../src/auditd.c:500
>> #4 0x0000555555562eb7 in ev_invoke_pending (loop=0x555555773e80
>> <default_loop_struct>) at ../../../../src/libev/ev.c:3162
>> #5 0x000055555556623d in ev_run (loop=0x555555773e80
>> <default_loop_struct>, flags=0) at ../../../../src/libev/ev.c:3562
>> #6 0x0000555555559e06 in ev_loop (flags=0, loop=0x555555773e80
>> <default_loop_struct>) at ../../../src/libev/ev.h:835
>> #7 main (argc=<optimized out>, argv=<optimized out>) at
>> ../../../src/auditd.c:841
>>
>> The rules are pretty dump:
>>
>> -D
>> -b 8192
>> -f 1
>> --backlog_wait_time 0
>>
>> An idea what's going on?
> By any chance does syslog show that the dispatcher exited due to no active
> plugins?
This is what I see in syslog:
Jul 6 17:25:15 valinor systemd[1]: Starting Security Auditing Service...
Jul 6 17:25:15 valinor auditd[604]: Started dispatcher: /sbin/audispd
pid: 608
Jul 6 17:25:15 valinor audispd: priority_boost_parser called with: 4
Jul 6 17:25:15 valinor audispd: max_restarts_parser called with: 10
Jul 6 17:25:15 valinor audispd: No plugins found, exiting
Jul 6 17:25:15 valinor augenrules[605]: /sbin/augenrules: No change
Jul 6 17:25:15 valinor auditd[604]: Init complete, auditd 2.6.3
listening for events (startup state enable)
Jul 6 17:25:15 valinor augenrules[605]: No rules
Jul 6 17:25:15 valinor augenrules[605]: enabled 1
Jul 6 17:25:15 valinor augenrules[605]: failure 1
Jul 6 17:25:15 valinor augenrules[605]: pid 604
Jul 6 17:25:15 valinor augenrules[605]: rate_limit 0
Jul 6 17:25:15 valinor augenrules[605]: backlog_limit 8192
Jul 6 17:25:15 valinor augenrules[605]: lost 35778
Jul 6 17:25:15 valinor augenrules[605]: backlog 6
Jul 6 17:25:15 valinor augenrules[605]: backlog_wait_time 0
Jul 6 17:25:15 valinor augenrules[605]: enabled 1
Jul 6 17:25:15 valinor augenrules[605]: failure 1
Jul 6 17:25:15 valinor augenrules[605]: pid 604
Jul 6 17:25:15 valinor augenrules[605]: rate_limit 0
Jul 6 17:25:15 valinor augenrules[605]: backlog_limit 8192
Jul 6 17:25:15 valinor augenrules[605]: lost 35778
Jul 6 17:25:15 valinor augenrules[605]: backlog 7
Jul 6 17:25:15 valinor augenrules[605]: backlog_wait_time 0
Jul 6 17:25:15 valinor augenrules[605]: enabled 1
Jul 6 17:25:15 valinor augenrules[605]: failure 1
Jul 6 17:25:15 valinor augenrules[605]: pid 604
Jul 6 17:25:15 valinor augenrules[605]: rate_limit 0
Jul 6 17:25:15 valinor augenrules[605]: backlog_limit 8192
Jul 6 17:25:15 valinor augenrules[605]: lost 35778
Jul 6 17:25:15 valinor augenrules[605]: backlog 8
Jul 6 17:25:15 valinor augenrules[605]: backlog_wait_time 0
Jul 6 17:25:16 valinor systemd[1]: Started Security Auditing Service.
Jul 6 17:25:16 valinor systemd[1]: Started Process Core Dump (PID
619/UID 0).
Jul 6 17:25:16 valinor kernel: [20575.773688] audit: netlink_unicast
sending to audit_pid=604 returned error: -111
Jul 6 17:25:16 valinor systemd[1]: auditd.service: Main process exited,
code=dumped, status=11/SEGV
Jul 6 17:25:16 valinor systemd[1]: auditd.service: Unit entered failed
state.
Jul 6 17:25:16 valinor systemd[1]: auditd.service: Failed with result
'core-dump'.
^ permalink raw reply
* Re: Crash when loading the rules
From: Steve Grubb @ 2016-07-06 15:23 UTC (permalink / raw)
To: linux-audit
In-Reply-To: <bcca63cd-0435-7484-b597-48e083d7446e@debian.org>
On Wednesday, July 6, 2016 4:49:58 PM EDT Laurent Bigonville wrote:
> Hi,
>
> With 2.6.3, when loading the rules, it's crashing and I get the
> following backtrace:
>
> #0 0x00007ffff687e99d in writev () at ../sysdeps/unix/syscall-template.S:84
> #1 0x00005555555610ab in dispatch_event (rep=<optimized out>, is_err=0) at
> ../../../src/auditd-dispatch.c:189
> #2 0x000055555555a700 in distribute_event (e=0x555555779d80) at
> ../../../src/auditd.c:216
> #3 0x000055555555aac8 in netlink_handler (loop=<optimized out>,
> io=<optimized out>, revents=<optimized out>) at ../../../src/auditd.c:500
> #4 0x0000555555562eb7 in ev_invoke_pending (loop=0x555555773e80
> <default_loop_struct>) at ../../../../src/libev/ev.c:3162
> #5 0x000055555556623d in ev_run (loop=0x555555773e80
> <default_loop_struct>, flags=0) at ../../../../src/libev/ev.c:3562
> #6 0x0000555555559e06 in ev_loop (flags=0, loop=0x555555773e80
> <default_loop_struct>) at ../../../src/libev/ev.h:835
> #7 main (argc=<optimized out>, argv=<optimized out>) at
> ../../../src/auditd.c:841
>
> The rules are pretty dump:
>
> -D
> -b 8192
> -f 1
> --backlog_wait_time 0
>
> An idea what's going on?
By any chance does syslog show that the dispatcher exited due to no active
plugins?
-Steve
^ permalink raw reply
* Possible bug compiling Audit 2.6.x against kernel headers older than 3.19
From: Adam Duskett @ 2016-07-06 14:53 UTC (permalink / raw)
To: linux-audit
Audit 2.6.x checks for AUDIT_FEATURE_VERSION to be defined in
include/linux/audit.h (this define was introduced in kernel version
3.13) and then blindly assumes that struct audit_status has
feature_bitmap.
However this looks like a problem as feature_bitmap wasn't introduced
until kernel 3.19, even though the requirements for Audit state that anything >
2.6.30 should work. (http://people.redhat.com/sgrubb/audit/)
This causes a compile error when attempting to compile audit 2.6.x
against kernel headers younger than 3.19.
libaudit.c:609:33: error: 'struct audit_status' has no member named
'feature_bitmap'
features_bitmap = rep.status->feature_bitmap;
^ permalink raw reply
* Crash when loading the rules
From: Laurent Bigonville @ 2016-07-06 14:49 UTC (permalink / raw)
To: linux-audit
Hi,
With 2.6.3, when loading the rules, it's crashing and I get the
following backtrace:
#0 0x00007ffff687e99d in writev () at ../sysdeps/unix/syscall-template.S:84
#1 0x00005555555610ab in dispatch_event (rep=<optimized out>, is_err=0)
at ../../../src/auditd-dispatch.c:189
#2 0x000055555555a700 in distribute_event (e=0x555555779d80) at
../../../src/auditd.c:216
#3 0x000055555555aac8 in netlink_handler (loop=<optimized out>,
io=<optimized out>, revents=<optimized out>) at ../../../src/auditd.c:500
#4 0x0000555555562eb7 in ev_invoke_pending (loop=0x555555773e80
<default_loop_struct>) at ../../../../src/libev/ev.c:3162
#5 0x000055555556623d in ev_run (loop=0x555555773e80
<default_loop_struct>, flags=0) at ../../../../src/libev/ev.c:3562
#6 0x0000555555559e06 in ev_loop (flags=0, loop=0x555555773e80
<default_loop_struct>) at ../../../src/libev/ev.h:835
#7 main (argc=<optimized out>, argv=<optimized out>) at
../../../src/auditd.c:841
The rules are pretty dump:
-D
-b 8192
-f 1
--backlog_wait_time 0
An idea what's going on?
Cheers,
Laurent Bigonville
^ permalink raw reply
* Re: [RFC 0/7] netlink: Add allocation flag to netlink_unicast()
From: David Miller @ 2016-07-06 3:22 UTC (permalink / raw)
To: masashi.honma-Re5JQEeQqe8AvxtiuMwx3w
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
linux-audit-H+wXaHxf7aLQT0dZR+AlfA,
cluster-devel-H+wXaHxf7aLQT0dZR+AlfA,
johannes-cdvu00un1VgdHxzADdlk8Q, pablo-Cap9r6Oaw4JrovVCs/uTlw,
kaber-dcUjhNyLwpNeoWH0uzbU5w,
kadlec-K40Dz/62t/MgiyqX0sVFJYdd74u8MsAO,
dledford-H+wXaHxf7aLQT0dZR+AlfA,
sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w,
paul-r2n+y4ga6xFZroRs9YW3xA, eparis-H+wXaHxf7aLQT0dZR+AlfA,
zbr-i6C2adt8DTjR7s880joybQ, pshelar-l0M0P4e3n4LQT0dZR+AlfA,
ccaulfie-H+wXaHxf7aLQT0dZR+AlfA, teigland-H+wXaHxf7aLQT0dZR+AlfA,
bsingharora-Re5JQEeQqe8AvxtiuMwx3w
In-Reply-To: <1467764916-4983-1-git-send-email-masashi.honma-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
From: Masashi Honma <masashi.honma-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Wed, 6 Jul 2016 09:28:29 +0900
> Though currently such a use case was not found, to solve potential
> issue we will add an allocation flag to netlink_unicast().
We don't solve potential issues, we solve real issues.
There is no reason to add the GFP parameter until it is actually
needed.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [RFC 7/7] genetlink: Add allocation flag to genlmsg_reply()
From: Masashi Honma @ 2016-07-06 0:28 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA,
netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
linux-audit-H+wXaHxf7aLQT0dZR+AlfA,
cluster-devel-H+wXaHxf7aLQT0dZR+AlfA
Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q, johannes-cdvu00un1VgdHxzADdlk8Q,
pablo-Cap9r6Oaw4JrovVCs/uTlw, kaber-dcUjhNyLwpNeoWH0uzbU5w,
kadlec-K40Dz/62t/MgiyqX0sVFJYdd74u8MsAO,
dledford-H+wXaHxf7aLQT0dZR+AlfA,
sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w,
paul-r2n+y4ga6xFZroRs9YW3xA, eparis-H+wXaHxf7aLQT0dZR+AlfA,
zbr-i6C2adt8DTjR7s880joybQ, pshelar-l0M0P4e3n4LQT0dZR+AlfA,
ccaulfie-H+wXaHxf7aLQT0dZR+AlfA, teigland-H+wXaHxf7aLQT0dZR+AlfA,
bsingharora-Re5JQEeQqe8AvxtiuMwx3w, Masashi Honma
In-Reply-To: <1467764916-4983-1-git-send-email-masashi.honma-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Add allocation flag to genlmsg_reply() and remove netlink_unicast()
temporal functionality for stepwise modification.
Signed-off-by: Masashi Honma <masashi.honma-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/block/drbd/drbd_nl.c | 2 +-
drivers/net/wireless/mac80211_hwsim.c | 2 +-
include/net/genetlink.h | 7 +++++--
kernel/taskstats.c | 2 +-
net/core/devlink.c | 12 ++++++------
net/ieee802154/ieee802154.h | 3 ++-
net/ieee802154/netlink.c | 5 +++--
net/ieee802154/nl-mac.c | 4 ++--
net/ieee802154/nl-phy.c | 6 +++---
net/ieee802154/nl802154.c | 4 ++--
net/ipv4/fou.c | 2 +-
net/ipv4/tcp_metrics.c | 2 +-
net/ipv6/ila/ila_xlat.c | 2 +-
net/irda/irnetlink.c | 2 +-
net/netfilter/ipvs/ip_vs_ctl.c | 2 +-
net/netlabel/netlabel_cipso_v4.c | 2 +-
net/netlabel/netlabel_mgmt.c | 4 ++--
net/netlabel/netlabel_unlabeled.c | 2 +-
net/netlink/af_netlink.c | 2 +-
net/netlink/genetlink.c | 2 +-
net/nfc/netlink.c | 6 +++---
net/openvswitch/datapath.c | 6 +++---
net/tipc/bearer.c | 4 ++--
net/tipc/node.c | 2 +-
net/wireless/nl80211.c | 34 +++++++++++++++++-----------------
25 files changed, 63 insertions(+), 58 deletions(-)
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 0bac9c8..3162608 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -100,7 +100,7 @@ static char *drbd_m_holder = "Hands off! this is DRBD's meta data device.";
static void drbd_adm_send_reply(struct sk_buff *skb, struct genl_info *info)
{
genlmsg_end(skb, genlmsg_data(nlmsg_data(nlmsg_hdr(skb))));
- if (genlmsg_reply(skb, info))
+ if (genlmsg_reply(skb, info, GFP_KERNEL))
pr_err("error sending genl reply\n");
}
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 5c7bf77..5319cd1 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -3160,7 +3160,7 @@ static int hwsim_get_radio_nl(struct sk_buff *msg, struct genl_info *info)
goto out_err;
}
- genlmsg_reply(skb, info);
+ genlmsg_reply(skb, info, GFP_KERNEL);
break;
}
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 5f0f2ff..99c9c39 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -343,10 +343,13 @@ static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb,
* genlmsg_reply - reply to a request
* @skb: netlink message to be sent back
* @info: receiver information
+ * @flags: allocation flags
*/
-static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info)
+static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info,
+ gfp_t flags)
{
- return genlmsg_unicast(genl_info_net(info), skb, info->snd_portid, 0);
+ return genlmsg_unicast(genl_info_net(info), skb, info->snd_portid,
+ flags);
}
/**
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index ecfcaff..894d0da 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -114,7 +114,7 @@ static int send_reply(struct sk_buff *skb, struct genl_info *info)
genlmsg_end(skb, reply);
- return genlmsg_reply(skb, info);
+ return genlmsg_reply(skb, info, GFP_KERNEL);
}
/*
diff --git a/net/core/devlink.c b/net/core/devlink.c
index 933e8d4..61a1c8a 100644
--- a/net/core/devlink.c
+++ b/net/core/devlink.c
@@ -501,7 +501,7 @@ static int devlink_nl_cmd_get_doit(struct sk_buff *skb, struct genl_info *info)
return err;
}
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
}
static int devlink_nl_cmd_get_dumpit(struct sk_buff *msg,
@@ -554,7 +554,7 @@ static int devlink_nl_cmd_port_get_doit(struct sk_buff *skb,
return err;
}
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
}
static int devlink_nl_cmd_port_get_dumpit(struct sk_buff *msg,
@@ -736,7 +736,7 @@ static int devlink_nl_cmd_sb_get_doit(struct sk_buff *skb,
return err;
}
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
}
static int devlink_nl_cmd_sb_get_dumpit(struct sk_buff *msg,
@@ -843,7 +843,7 @@ static int devlink_nl_cmd_sb_pool_get_doit(struct sk_buff *skb,
return err;
}
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
}
static int __sb_pool_get_dumpit(struct sk_buff *msg, int start, int *p_idx,
@@ -1030,7 +1030,7 @@ static int devlink_nl_cmd_sb_port_pool_get_doit(struct sk_buff *skb,
return err;
}
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
}
static int __sb_port_pool_get_dumpit(struct sk_buff *msg, int start, int *p_idx,
@@ -1233,7 +1233,7 @@ static int devlink_nl_cmd_sb_tc_pool_bind_get_doit(struct sk_buff *skb,
return err;
}
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
}
static int __sb_tc_pool_bind_get_dumpit(struct sk_buff *msg,
diff --git a/net/ieee802154/ieee802154.h b/net/ieee802154/ieee802154.h
index a5d7515..76f81be 100644
--- a/net/ieee802154/ieee802154.h
+++ b/net/ieee802154/ieee802154.h
@@ -40,7 +40,8 @@ struct sk_buff *ieee802154_nl_create(int flags, u8 req);
int ieee802154_nl_mcast(struct sk_buff *msg, unsigned int group);
struct sk_buff *ieee802154_nl_new_reply(struct genl_info *info,
int flags, u8 req);
-int ieee802154_nl_reply(struct sk_buff *msg, struct genl_info *info);
+int ieee802154_nl_reply(struct sk_buff *msg, struct genl_info *info,
+ gfp_t flags);
extern struct genl_family nl802154_family;
diff --git a/net/ieee802154/netlink.c b/net/ieee802154/netlink.c
index c8133c0..9a8779b 100644
--- a/net/ieee802154/netlink.c
+++ b/net/ieee802154/netlink.c
@@ -87,14 +87,15 @@ struct sk_buff *ieee802154_nl_new_reply(struct genl_info *info,
return msg;
}
-int ieee802154_nl_reply(struct sk_buff *msg, struct genl_info *info)
+int ieee802154_nl_reply(struct sk_buff *msg, struct genl_info *info,
+ gfp_t flags)
{
struct nlmsghdr *nlh = nlmsg_hdr(msg);
void *hdr = genlmsg_data(nlmsg_data(nlh));
genlmsg_end(msg, hdr);
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, flags);
}
static const struct genl_ops ieee8021154_ops[] = {
diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c
index d3cbb32..17b5797 100644
--- a/net/ieee802154/nl-mac.c
+++ b/net/ieee802154/nl-mac.c
@@ -435,7 +435,7 @@ int ieee802154_list_iface(struct sk_buff *skb, struct genl_info *info)
dev_put(dev);
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
out_free:
nlmsg_free(msg);
out_dev:
@@ -692,7 +692,7 @@ int ieee802154_llsec_getparams(struct sk_buff *skb, struct genl_info *info)
dev_put(dev);
- return ieee802154_nl_reply(msg, info);
+ return ieee802154_nl_reply(msg, info, GFP_KERNEL);
out_free:
nlmsg_free(msg);
out_dev:
diff --git a/net/ieee802154/nl-phy.c b/net/ieee802154/nl-phy.c
index 77d7301..4862fbe 100644
--- a/net/ieee802154/nl-phy.c
+++ b/net/ieee802154/nl-phy.c
@@ -110,7 +110,7 @@ int ieee802154_list_phy(struct sk_buff *skb, struct genl_info *info)
wpan_phy_put(phy);
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
out_free:
nlmsg_free(msg);
out_dev:
@@ -255,7 +255,7 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info)
wpan_phy_put(phy);
- return ieee802154_nl_reply(msg, info);
+ return ieee802154_nl_reply(msg, info, GFP_ATOMIC);
dev_unregister:
rtnl_lock(); /* del_iface must be called with RTNL lock */
@@ -336,7 +336,7 @@ int ieee802154_del_iface(struct sk_buff *skb, struct genl_info *info)
goto nla_put_failure;
wpan_phy_put(phy);
- return ieee802154_nl_reply(msg, info);
+ return ieee802154_nl_reply(msg, info, GFP_ATOMIC);
nla_put_failure:
nlmsg_free(msg);
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 116187b..8d58da3 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -681,7 +681,7 @@ static int nl802154_get_wpan_phy(struct sk_buff *skb, struct genl_info *info)
return -ENOBUFS;
}
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
}
static inline u64 wpan_dev_id(struct wpan_dev *wpan_dev)
@@ -918,7 +918,7 @@ static int nl802154_get_interface(struct sk_buff *skb, struct genl_info *info)
return -ENOBUFS;
}
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
}
static int nl802154_new_interface(struct sk_buff *skb, struct genl_info *info)
diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c
index 321d57f..2bf8342 100644
--- a/net/ipv4/fou.c
+++ b/net/ipv4/fou.c
@@ -780,7 +780,7 @@ static int fou_nl_cmd_get_port(struct sk_buff *skb, struct genl_info *info)
if (ret < 0)
goto out_free;
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
out_free:
nlmsg_free(msg);
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
index b617826..cb624c1 100644
--- a/net/ipv4/tcp_metrics.c
+++ b/net/ipv4/tcp_metrics.c
@@ -1024,7 +1024,7 @@ static int tcp_metrics_nl_cmd_get(struct sk_buff *skb, struct genl_info *info)
goto out_free;
genlmsg_end(msg, reply);
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
nla_put_failure:
ret = -EMSGSIZE;
diff --git a/net/ipv6/ila/ila_xlat.c b/net/ipv6/ila/ila_xlat.c
index e6eca5f..2e008bf3 100644
--- a/net/ipv6/ila/ila_xlat.c
+++ b/net/ipv6/ila/ila_xlat.c
@@ -467,7 +467,7 @@ static int ila_nl_cmd_get_mapping(struct sk_buff *skb, struct genl_info *info)
if (ret < 0)
goto out_free;
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
out_free:
nlmsg_free(msg);
diff --git a/net/irda/irnetlink.c b/net/irda/irnetlink.c
index e15c40e..ffa5b5c 100644
--- a/net/irda/irnetlink.c
+++ b/net/irda/irnetlink.c
@@ -116,7 +116,7 @@ static int irda_nl_get_mode(struct sk_buff *skb, struct genl_info *info)
genlmsg_end(msg, hdr);
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
err_out:
nlmsg_free(msg);
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index c3c809b..cccf673 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -3760,7 +3760,7 @@ static int ip_vs_genl_get_cmd(struct sk_buff *skb, struct genl_info *info)
}
genlmsg_end(msg, reply);
- ret = genlmsg_reply(msg, info);
+ ret = genlmsg_reply(msg, info, GFP_KERNEL);
goto out;
nla_put_failure:
diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c
index 7fd1104..c2b6fb5 100644
--- a/net/netlabel/netlabel_cipso_v4.c
+++ b/net/netlabel/netlabel_cipso_v4.c
@@ -590,7 +590,7 @@ list_start:
rcu_read_unlock();
genlmsg_end(ans_skb, data);
- return genlmsg_reply(ans_skb, info);
+ return genlmsg_reply(ans_skb, info, GFP_KERNEL);
list_retry:
/* XXX - this limit is a guesstimate */
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c
index 13f777f..23099ee 100644
--- a/net/netlabel/netlabel_mgmt.c
+++ b/net/netlabel/netlabel_mgmt.c
@@ -577,7 +577,7 @@ static int netlbl_mgmt_listdef(struct sk_buff *skb, struct genl_info *info)
goto listdef_failure;
genlmsg_end(ans_skb, data);
- return genlmsg_reply(ans_skb, info);
+ return genlmsg_reply(ans_skb, info, GFP_KERNEL);
listdef_failure_lock:
rcu_read_unlock();
@@ -688,7 +688,7 @@ static int netlbl_mgmt_version(struct sk_buff *skb, struct genl_info *info)
goto version_failure;
genlmsg_end(ans_skb, data);
- return genlmsg_reply(ans_skb, info);
+ return genlmsg_reply(ans_skb, info, GFP_KERNEL);
version_failure:
kfree_skb(ans_skb);
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
index 9eaa9a1..bbe1337 100644
--- a/net/netlabel/netlabel_unlabeled.c
+++ b/net/netlabel/netlabel_unlabeled.c
@@ -874,7 +874,7 @@ static int netlbl_unlabel_list(struct sk_buff *skb, struct genl_info *info)
goto list_failure;
genlmsg_end(ans_skb, data);
- return genlmsg_reply(ans_skb, info);
+ return genlmsg_reply(ans_skb, info, GFP_KERNEL);
list_failure:
kfree_skb(ans_skb);
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index acc1ee6..980cc86 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1227,7 +1227,7 @@ int netlink_unicast(struct sock *ssk, struct sk_buff *skb, u32 portid,
int err;
long timeo;
- skb = netlink_trim(skb, allocation ? allocation : gfp_any());
+ skb = netlink_trim(skb, allocation);
timeo = sock_sndtimeo(ssk, nonblock);
retry:
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index a09132a..1552380 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -933,7 +933,7 @@ static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info)
if (IS_ERR(msg))
return PTR_ERR(msg);
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
}
static int genl_ctrl_event(int event, struct genl_family *family,
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index ea023b3..052a5d1 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -772,7 +772,7 @@ static int nfc_genl_get_device(struct sk_buff *skb, struct genl_info *info)
nfc_put_device(dev);
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
out_free:
nlmsg_free(msg);
@@ -1056,7 +1056,7 @@ exit:
return rc;
}
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
}
static int nfc_genl_llc_set_params(struct sk_buff *skb, struct genl_info *info)
@@ -1653,7 +1653,7 @@ int nfc_vendor_cmd_reply(struct sk_buff *skb)
}
genlmsg_end(skb, hdr);
- return genlmsg_reply(skb, dev->cur_cmd_info);
+ return genlmsg_reply(skb, dev->cur_cmd_info, gfp_any());
}
EXPORT_SYMBOL(nfc_vendor_cmd_reply);
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 374e0ec..44a3cbc 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -1274,7 +1274,7 @@ static int ovs_flow_cmd_get(struct sk_buff *skb, struct genl_info *info)
}
ovs_unlock();
- return genlmsg_reply(reply, info);
+ return genlmsg_reply(reply, info, GFP_KERNEL);
unlock:
ovs_unlock();
return err;
@@ -1760,7 +1760,7 @@ static int ovs_dp_cmd_get(struct sk_buff *skb, struct genl_info *info)
BUG_ON(err < 0);
ovs_unlock();
- return genlmsg_reply(reply, info);
+ return genlmsg_reply(reply, info, GFP_KERNEL);
err_unlock_free:
ovs_unlock();
@@ -2163,7 +2163,7 @@ static int ovs_vport_cmd_get(struct sk_buff *skb, struct genl_info *info)
BUG_ON(err < 0);
rcu_read_unlock();
- return genlmsg_reply(reply, info);
+ return genlmsg_reply(reply, info, GFP_KERNEL);
exit_unlock_free:
rcu_read_unlock();
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 8584cc4..f00d355 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -763,7 +763,7 @@ int tipc_nl_bearer_get(struct sk_buff *skb, struct genl_info *info)
goto err_out;
rtnl_unlock();
- return genlmsg_reply(rep, info);
+ return genlmsg_reply(rep, info, GFP_KERNEL);
err_out:
rtnl_unlock();
nlmsg_free(rep);
@@ -1022,7 +1022,7 @@ int tipc_nl_media_get(struct sk_buff *skb, struct genl_info *info)
goto err_out;
rtnl_unlock();
- return genlmsg_reply(rep, info);
+ return genlmsg_reply(rep, info, GFP_KERNEL);
err_out:
rtnl_unlock();
nlmsg_free(rep);
diff --git a/net/tipc/node.c b/net/tipc/node.c
index a3fc0a3..a86f21c 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -1774,7 +1774,7 @@ int tipc_nl_node_get_link(struct sk_buff *skb, struct genl_info *info)
}
}
- return genlmsg_reply(msg.skb, info);
+ return genlmsg_reply(msg.skb, info, GFP_KERNEL);
}
int tipc_nl_node_reset_link_stats(struct sk_buff *skb, struct genl_info *info)
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index e608937..d8e1984 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1948,7 +1948,7 @@ static int nl80211_get_wiphy(struct sk_buff *skb, struct genl_info *info)
return -ENOBUFS;
}
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
}
static const struct nla_policy txq_params_policy[NL80211_TXQ_ATTR_MAX + 1] = {
@@ -2574,7 +2574,7 @@ static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info)
return -ENOBUFS;
}
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
}
static const struct nla_policy mntr_flags_policy[NL80211_MNTR_FLAG_MAX + 1] = {
@@ -2833,7 +2833,7 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
}
out:
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
}
static int nl80211_del_interface(struct sk_buff *skb, struct genl_info *info)
@@ -3007,7 +3007,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
goto nla_put_failure;
genlmsg_end(msg, hdr);
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
nla_put_failure:
err = -ENOBUFS;
@@ -4050,7 +4050,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info)
return -ENOBUFS;
}
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
}
int cfg80211_check_station_change(struct wiphy *wiphy,
@@ -4852,7 +4852,7 @@ static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info)
return -ENOBUFS;
}
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
}
static int nl80211_set_mpath(struct sk_buff *skb, struct genl_info *info)
@@ -4957,7 +4957,7 @@ static int nl80211_get_mpp(struct sk_buff *skb, struct genl_info *info)
return -ENOBUFS;
}
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
}
static int nl80211_dump_mpp(struct sk_buff *skb,
@@ -5234,7 +5234,7 @@ static int nl80211_get_mesh_config(struct sk_buff *skb,
goto nla_put_failure;
nla_nest_end(msg, pinfoattr);
genlmsg_end(msg, hdr);
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
nla_put_failure:
genlmsg_cancel(msg, hdr);
@@ -5672,7 +5672,7 @@ static int nl80211_get_reg_do(struct sk_buff *skb, struct genl_info *info)
rcu_read_unlock();
genlmsg_end(msg, hdr);
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
nla_put_failure_rcu:
rcu_read_unlock();
@@ -8485,7 +8485,7 @@ static int nl80211_remain_on_channel(struct sk_buff *skb,
genlmsg_end(msg, hdr);
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
nla_put_failure:
err = -ENOBUFS;
@@ -8897,7 +8897,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
goto nla_put_failure;
genlmsg_end(msg, hdr);
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
}
return 0;
@@ -9007,7 +9007,7 @@ static int nl80211_get_power_save(struct sk_buff *skb, struct genl_info *info)
goto nla_put_failure;
genlmsg_end(msg, hdr);
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
nla_put_failure:
err = -ENOBUFS;
@@ -9428,7 +9428,7 @@ static int nl80211_get_wowlan(struct sk_buff *skb, struct genl_info *info)
}
genlmsg_end(msg, hdr);
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
nla_put_failure:
nlmsg_free(msg);
@@ -9892,7 +9892,7 @@ static int nl80211_get_coalesce(struct sk_buff *skb, struct genl_info *info)
goto nla_put_failure;
genlmsg_end(msg, hdr);
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
nla_put_failure:
nlmsg_free(msg);
@@ -10185,7 +10185,7 @@ static int nl80211_probe_client(struct sk_buff *skb,
genlmsg_end(msg, hdr);
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
nla_put_failure:
err = -ENOBUFS;
@@ -10292,7 +10292,7 @@ static int nl80211_get_protocol_features(struct sk_buff *skb,
goto nla_put_failure;
genlmsg_end(msg, hdr);
- return genlmsg_reply(msg, info);
+ return genlmsg_reply(msg, info, GFP_KERNEL);
nla_put_failure:
kfree_skb(msg);
@@ -10672,7 +10672,7 @@ int cfg80211_vendor_cmd_reply(struct sk_buff *skb)
nla_nest_end(skb, data);
genlmsg_end(skb, hdr);
- return genlmsg_reply(skb, rdev->cur_cmd_info);
+ return genlmsg_reply(skb, rdev->cur_cmd_info, gfp_any());
}
EXPORT_SYMBOL_GPL(cfg80211_vendor_cmd_reply);
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [RFC 6/7] genetlink: Add allocation flag to genlmsg_unicast()
From: Masashi Honma @ 2016-07-06 0:28 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA,
netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
linux-audit-H+wXaHxf7aLQT0dZR+AlfA,
cluster-devel-H+wXaHxf7aLQT0dZR+AlfA
Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q, johannes-cdvu00un1VgdHxzADdlk8Q,
pablo-Cap9r6Oaw4JrovVCs/uTlw, kaber-dcUjhNyLwpNeoWH0uzbU5w,
kadlec-K40Dz/62t/MgiyqX0sVFJYdd74u8MsAO,
dledford-H+wXaHxf7aLQT0dZR+AlfA,
sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w,
paul-r2n+y4ga6xFZroRs9YW3xA, eparis-H+wXaHxf7aLQT0dZR+AlfA,
zbr-i6C2adt8DTjR7s880joybQ, pshelar-l0M0P4e3n4LQT0dZR+AlfA,
ccaulfie-H+wXaHxf7aLQT0dZR+AlfA, teigland-H+wXaHxf7aLQT0dZR+AlfA,
bsingharora-Re5JQEeQqe8AvxtiuMwx3w, Masashi Honma
In-Reply-To: <1467764916-4983-1-git-send-email-masashi.honma-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Masashi Honma <masashi.honma-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/net/gtp.c | 3 ++-
drivers/net/team/team.c | 5 +++--
drivers/net/wireless/mac80211_hwsim.c | 2 +-
fs/dlm/netlink.c | 2 +-
include/net/genetlink.h | 8 +++++---
kernel/taskstats.c | 2 +-
net/hsr/hsr_netlink.c | 6 ++++--
net/l2tp/l2tp_netlink.c | 8 +++++---
net/openvswitch/datapath.c | 3 ++-
net/tipc/netlink_compat.c | 2 +-
net/wireless/nl80211.c | 9 +++++----
11 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
index 97e0cbc..0156abb 100644
--- a/drivers/net/gtp.c
+++ b/drivers/net/gtp.c
@@ -1210,7 +1210,8 @@ static int gtp_genl_get_pdp(struct sk_buff *skb, struct genl_info *info)
goto err_unlock_free;
rcu_read_unlock();
- return genlmsg_unicast(genl_info_net(info), skb2, info->snd_portid);
+ return genlmsg_unicast(genl_info_net(info), skb2, info->snd_portid,
+ GFP_ATOMIC);
err_unlock_free:
kfree_skb(skb2);
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index f9eebea..3d40b55 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -2194,7 +2194,8 @@ static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)
genlmsg_end(msg, hdr);
- return genlmsg_unicast(genl_info_net(info), msg, info->snd_portid);
+ return genlmsg_unicast(genl_info_net(info), msg, info->snd_portid,
+ GFP_KERNEL);
err_msg_put:
nlmsg_free(msg);
@@ -2240,7 +2241,7 @@ typedef int team_nl_send_func_t(struct sk_buff *skb,
static int team_nl_send_unicast(struct sk_buff *skb, struct team *team, u32 portid)
{
- return genlmsg_unicast(dev_net(team->dev), skb, portid);
+ return genlmsg_unicast(dev_net(team->dev), skb, portid, gfp_any());
}
static int team_nl_fill_one_option_get(struct sk_buff *skb, struct team *team,
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 382109bb..5c7bf77 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -1008,7 +1008,7 @@ static int hwsim_unicast_netgroup(struct mac80211_hwsim_data *data,
rcu_read_lock();
for_each_net_rcu(net) {
if (data->netgroup == hwsim_net_get_netgroup(net)) {
- res = genlmsg_unicast(net, skb, portid);
+ res = genlmsg_unicast(net, skb, portid, GFP_ATOMIC);
found = true;
break;
}
diff --git a/fs/dlm/netlink.c b/fs/dlm/netlink.c
index 1e6e227..c498616 100644
--- a/fs/dlm/netlink.c
+++ b/fs/dlm/netlink.c
@@ -59,7 +59,7 @@ static int send_data(struct sk_buff *skb)
genlmsg_end(skb, data);
- return genlmsg_unicast(&init_net, skb, listener_nlportid);
+ return genlmsg_unicast(&init_net, skb, listener_nlportid, GFP_NOFS);
}
static int user_cmd(struct sk_buff *skb, struct genl_info *info)
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index b107a35..5f0f2ff 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -331,10 +331,12 @@ int genlmsg_multicast_allns(struct genl_family *family,
* genlmsg_unicast - unicast a netlink message
* @skb: netlink message as socket buffer
* @portid: netlink portid of the destination socket
+ * @flags: allocation flags
*/
-static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 portid)
+static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb,
+ u32 portid, gfp_t flags)
{
- return nlmsg_unicast(net->genl_sock, skb, portid, 0);
+ return nlmsg_unicast(net->genl_sock, skb, portid, flags);
}
/**
@@ -344,7 +346,7 @@ static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 port
*/
static inline int genlmsg_reply(struct sk_buff *skb, struct genl_info *info)
{
- return genlmsg_unicast(genl_info_net(info), skb, info->snd_portid);
+ return genlmsg_unicast(genl_info_net(info), skb, info->snd_portid, 0);
}
/**
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index b3f05ee..ecfcaff 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -140,7 +140,7 @@ static void send_cpu_listeners(struct sk_buff *skb,
if (!skb_next)
break;
}
- rc = genlmsg_unicast(&init_net, skb_cur, s->pid);
+ rc = genlmsg_unicast(&init_net, skb_cur, s->pid, GFP_KERNEL);
if (rc == -ECONNREFUSED) {
s->valid = 0;
delcount++;
diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c
index d4d1617..dcc674f 100644
--- a/net/hsr/hsr_netlink.c
+++ b/net/hsr/hsr_netlink.c
@@ -351,7 +351,8 @@ static int hsr_get_node_status(struct sk_buff *skb_in, struct genl_info *info)
goto nla_put_failure;
genlmsg_end(skb_out, msg_head);
- genlmsg_unicast(genl_info_net(info), skb_out, info->snd_portid);
+ genlmsg_unicast(genl_info_net(info), skb_out, info->snd_portid,
+ GFP_KERNEL);
return 0;
@@ -433,7 +434,8 @@ static int hsr_get_node_list(struct sk_buff *skb_in, struct genl_info *info)
rcu_read_unlock();
genlmsg_end(skb_out, msg_head);
- genlmsg_unicast(genl_info_net(info), skb_out, info->snd_portid);
+ genlmsg_unicast(genl_info_net(info), skb_out, info->snd_portid,
+ GFP_KERNEL);
return 0;
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c
index 1d02e8d..5a3cc56 100644
--- a/net/l2tp/l2tp_netlink.c
+++ b/net/l2tp/l2tp_netlink.c
@@ -100,7 +100,8 @@ static int l2tp_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)
genlmsg_end(msg, hdr);
- return genlmsg_unicast(genl_info_net(info), msg, info->snd_portid);
+ return genlmsg_unicast(genl_info_net(info), msg, info->snd_portid,
+ GFP_KERNEL);
err_out:
nlmsg_free(msg);
@@ -450,7 +451,7 @@ static int l2tp_nl_cmd_tunnel_get(struct sk_buff *skb, struct genl_info *info)
if (ret < 0)
goto err_out;
- return genlmsg_unicast(net, msg, info->snd_portid);
+ return genlmsg_unicast(net, msg, info->snd_portid, GFP_KERNEL);
err_out:
nlmsg_free(msg);
@@ -820,7 +821,8 @@ static int l2tp_nl_cmd_session_get(struct sk_buff *skb, struct genl_info *info)
if (ret < 0)
goto err_out;
- return genlmsg_unicast(genl_info_net(info), msg, info->snd_portid);
+ return genlmsg_unicast(genl_info_net(info), msg, info->snd_portid,
+ GFP_KERNEL);
err_out:
nlmsg_free(msg);
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 524c0fd..374e0ec 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -542,7 +542,8 @@ static int queue_userspace_packet(struct datapath *dp, struct sk_buff *skb,
((struct nlmsghdr *) user_skb->data)->nlmsg_len = user_skb->len;
- err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid);
+ err = genlmsg_unicast(ovs_dp_get_net(dp), user_skb, upcall_info->portid,
+ GFP_ATOMIC);
user_skb = NULL;
out:
if (err)
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c
index 3ad9fab..205577c 100644
--- a/net/tipc/netlink_compat.c
+++ b/net/tipc/netlink_compat.c
@@ -1210,7 +1210,7 @@ send:
rep_nlh = nlmsg_hdr(msg.rep);
memcpy(rep_nlh, info->nlhdr, len);
rep_nlh->nlmsg_len = msg.rep->len;
- genlmsg_unicast(msg.net, msg.rep, NETLINK_CB(skb).portid);
+ genlmsg_unicast(msg.net, msg.rep, NETLINK_CB(skb).portid, GFP_KERNEL);
return err;
}
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 244d552..e608937 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -12648,7 +12648,7 @@ static bool __nl80211_unexpected_frame(struct net_device *dev, u8 cmd,
goto nla_put_failure;
genlmsg_end(msg, hdr);
- genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid);
+ genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid, gfp);
return true;
nla_put_failure:
@@ -12733,7 +12733,7 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
genlmsg_end(msg, hdr);
- return genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid);
+ return genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid, gfp);
nla_put_failure:
genlmsg_cancel(msg, hdr);
@@ -13245,7 +13245,8 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,
genlmsg_end(msg, hdr);
- genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, reg->nlportid);
+ genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, reg->nlportid,
+ GFP_ATOMIC);
}
spin_unlock_bh(&rdev->beacon_registrations_lock);
return;
@@ -13623,7 +13624,7 @@ void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp)
genlmsg_end(msg, hdr);
- genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid);
+ genlmsg_unicast(wiphy_net(&rdev->wiphy), msg, nlportid, gfp);
return;
nla_put_failure:
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [RFC 5/7] net: Add allocation flag to rtnl_unicast()
From: Masashi Honma @ 2016-07-06 0:28 UTC (permalink / raw)
To: netdev, netfilter-devel, linux-wireless, linux-rdma, linux-audit,
cluster-devel
Cc: davem, johannes, pablo, kaber, kadlec, dledford, sean.hefty,
hal.rosenstock, paul, eparis, zbr, pshelar, ccaulfie, teigland,
bsingharora, Masashi Honma
In-Reply-To: <1467764916-4983-1-git-send-email-masashi.honma@gmail.com>
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
include/linux/rtnetlink.h | 3 ++-
net/core/net_namespace.c | 2 +-
net/core/rtnetlink.c | 10 ++++++----
net/dcb/dcbnl.c | 2 +-
net/decnet/dn_route.c | 3 ++-
net/ipv4/devinet.c | 2 +-
net/ipv4/ipmr.c | 6 ++++--
net/ipv4/route.c | 2 +-
net/ipv6/addrconf.c | 4 ++--
net/ipv6/addrlabel.c | 2 +-
net/ipv6/ip6mr.c | 6 ++++--
net/ipv6/route.c | 2 +-
net/sched/act_api.c | 2 +-
13 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 2daece8..132730f 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -8,7 +8,8 @@
#include <uapi/linux/rtnetlink.h>
extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo);
-extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid);
+extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid,
+ gfp_t flags);
extern void rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid,
u32 group, struct nlmsghdr *nlh, gfp_t flags);
extern void rtnl_set_sk_err(struct net *net, u32 group, int error);
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 2c2eb1b..28eed58 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -646,7 +646,7 @@ static int rtnl_net_getid(struct sk_buff *skb, struct nlmsghdr *nlh)
if (err < 0)
goto err_out;
- err = rtnl_unicast(msg, net, NETLINK_CB(skb).portid);
+ err = rtnl_unicast(msg, net, NETLINK_CB(skb).portid, GFP_KERNEL);
goto out;
err_out:
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 7f7927f..89fd826 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -653,11 +653,11 @@ int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int g
return err;
}
-int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid)
+int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid, gfp_t flags)
{
struct sock *rtnl = net->rtnl;
- return nlmsg_unicast(rtnl, skb, pid, gfp_any());
+ return nlmsg_unicast(rtnl, skb, pid, flags);
}
EXPORT_SYMBOL(rtnl_unicast);
@@ -2565,7 +2565,8 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh)
WARN_ON(err == -EMSGSIZE);
kfree_skb(nskb);
} else
- err = rtnl_unicast(nskb, net, NETLINK_CB(skb).portid);
+ err = rtnl_unicast(nskb, net, NETLINK_CB(skb).portid,
+ GFP_KERNEL);
return err;
}
@@ -3601,7 +3602,8 @@ static int rtnl_stats_get(struct sk_buff *skb, struct nlmsghdr *nlh)
WARN_ON(err == -EMSGSIZE);
kfree_skb(nskb);
} else {
- err = rtnl_unicast(nskb, net, NETLINK_CB(skb).portid);
+ err = rtnl_unicast(nskb, net, NETLINK_CB(skb).portid,
+ GFP_KERNEL);
}
return err;
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 4f6c186..e4de9fe 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1749,7 +1749,7 @@ static int dcb_doit(struct sk_buff *skb, struct nlmsghdr *nlh)
nlmsg_end(reply_skb, reply_nlh);
- ret = rtnl_unicast(reply_skb, net, portid);
+ ret = rtnl_unicast(reply_skb, net, portid, GFP_KERNEL);
out:
return ret;
}
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index b1dc096..6fe02bb 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -1714,7 +1714,8 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)
goto out_free;
}
- return rtnl_unicast(skb, &init_net, NETLINK_CB(in_skb).portid);
+ return rtnl_unicast(skb, &init_net, NETLINK_CB(in_skb).portid,
+ GFP_KERNEL);
out_free:
kfree_skb(skb);
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index e333bc8..5e969e5 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1917,7 +1917,7 @@ static int inet_netconf_get_devconf(struct sk_buff *in_skb,
kfree_skb(skb);
goto errout;
}
- err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid);
+ err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid, GFP_ATOMIC);
errout:
return err;
}
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 5ad48ec..c704a2a 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -654,7 +654,8 @@ static void ipmr_destroy_unres(struct mr_table *mrt, struct mfc_cache *c)
e->error = -ETIMEDOUT;
memset(&e->msg, 0, sizeof(e->msg));
- rtnl_unicast(skb, net, NETLINK_CB(skb).portid);
+ rtnl_unicast(skb, net, NETLINK_CB(skb).portid,
+ gfp_any());
} else {
kfree_skb(skb);
}
@@ -933,7 +934,8 @@ static void ipmr_cache_resolve(struct net *net, struct mr_table *mrt,
memset(&e->msg, 0, sizeof(e->msg));
}
- rtnl_unicast(skb, net, NETLINK_CB(skb).portid);
+ rtnl_unicast(skb, net, NETLINK_CB(skb).portid,
+ gfp_any());
} else {
ip_mr_forward(net, mrt, skb, c, 0);
}
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index a1f2830..10cb0e0 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2621,7 +2621,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)
if (err < 0)
goto errout_free;
- err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid);
+ err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid, GFP_KERNEL);
errout:
return err;
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index a1f6b7b..2b0b994 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -628,7 +628,7 @@ static int inet6_netconf_get_devconf(struct sk_buff *in_skb,
kfree_skb(skb);
goto errout;
}
- err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid);
+ err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid, GFP_ATOMIC);
errout:
return err;
}
@@ -4824,7 +4824,7 @@ static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr *nlh)
kfree_skb(skb);
goto errout_ifa;
}
- err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid);
+ err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid, GFP_KERNEL);
errout_ifa:
in6_ifa_put(ifa);
errout:
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c
index a8f6986..597e0eb 100644
--- a/net/ipv6/addrlabel.c
+++ b/net/ipv6/addrlabel.c
@@ -580,7 +580,7 @@ static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr *nlh)
goto out;
}
- err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid);
+ err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid, GFP_KERNEL);
out:
return err;
}
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 487ef3b..135ba15 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -850,7 +850,8 @@ static void ip6mr_destroy_unres(struct mr6_table *mrt, struct mfc6_cache *c)
nlh->nlmsg_len = nlmsg_msg_size(sizeof(struct nlmsgerr));
skb_trim(skb, nlh->nlmsg_len);
((struct nlmsgerr *)nlmsg_data(nlh))->error = -ETIMEDOUT;
- rtnl_unicast(skb, net, NETLINK_CB(skb).portid);
+ rtnl_unicast(skb, net, NETLINK_CB(skb).portid,
+ gfp_any());
} else
kfree_skb(skb);
}
@@ -1114,7 +1115,8 @@ static void ip6mr_cache_resolve(struct net *net, struct mr6_table *mrt,
skb_trim(skb, nlh->nlmsg_len);
((struct nlmsgerr *)nlmsg_data(nlh))->error = -EMSGSIZE;
}
- rtnl_unicast(skb, net, NETLINK_CB(skb).portid);
+ rtnl_unicast(skb, net, NETLINK_CB(skb).portid,
+ gfp_any());
} else
ip6_mr_forward(net, mrt, skb, c);
}
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 4981755..81318a8 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3367,7 +3367,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)
goto errout;
}
- err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid);
+ err = rtnl_unicast(skb, net, NETLINK_CB(in_skb).portid, GFP_KERNEL);
errout:
return err;
}
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 47ec230..b988a84 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -737,7 +737,7 @@ act_get_notify(struct net *net, u32 portid, struct nlmsghdr *n,
return -EINVAL;
}
- return rtnl_unicast(skb, net, portid);
+ return rtnl_unicast(skb, net, portid, GFP_KERNEL);
}
static struct tc_action *create_a(int i)
--
2.7.4
^ permalink raw reply related
* [RFC 4/7] infiniband: Add allocation flag to ibnl_unicast()
From: Masashi Honma @ 2016-07-06 0:28 UTC (permalink / raw)
To: netdev, netfilter-devel, linux-wireless, linux-rdma, linux-audit,
cluster-devel
Cc: davem, johannes, pablo, kaber, kadlec, dledford, sean.hefty,
hal.rosenstock, paul, eparis, zbr, pshelar, ccaulfie, teigland,
bsingharora, Masashi Honma
In-Reply-To: <1467764916-4983-1-git-send-email-masashi.honma@gmail.com>
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
drivers/infiniband/core/iwpm_msg.c | 6 +++---
drivers/infiniband/core/iwpm_util.c | 5 +++--
drivers/infiniband/core/iwpm_util.h | 1 +
drivers/infiniband/core/netlink.c | 4 ++--
include/rdma/rdma_netlink.h | 3 ++-
5 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/infiniband/core/iwpm_msg.c b/drivers/infiniband/core/iwpm_msg.c
index 1c41b95..4307eab 100644
--- a/drivers/infiniband/core/iwpm_msg.c
+++ b/drivers/infiniband/core/iwpm_msg.c
@@ -174,7 +174,7 @@ int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
goto add_mapping_error;
nlmsg_request->req_buffer = pm_msg;
- ret = ibnl_unicast(skb, nlh, iwpm_user_pid);
+ ret = ibnl_unicast(skb, nlh, iwpm_user_pid, GFP_ATOMIC);
if (ret) {
skb = NULL; /* skb is freed in the netlink send-op handling */
iwpm_user_pid = IWPM_PID_UNDEFINED;
@@ -251,7 +251,7 @@ int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
goto query_mapping_error;
nlmsg_request->req_buffer = pm_msg;
- ret = ibnl_unicast(skb, nlh, iwpm_user_pid);
+ ret = ibnl_unicast(skb, nlh, iwpm_user_pid, GFP_ATOMIC);
if (ret) {
skb = NULL; /* skb is freed in the netlink send-op handling */
err_str = "Unable to send a nlmsg";
@@ -312,7 +312,7 @@ int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client)
if (ret)
goto remove_mapping_error;
- ret = ibnl_unicast(skb, nlh, iwpm_user_pid);
+ ret = ibnl_unicast(skb, nlh, iwpm_user_pid, GFP_ATOMIC);
if (ret) {
skb = NULL; /* skb is freed in the netlink send-op handling */
iwpm_user_pid = IWPM_PID_UNDEFINED;
diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
index b65e06c..6dcbb2d 100644
--- a/drivers/infiniband/core/iwpm_util.c
+++ b/drivers/infiniband/core/iwpm_util.c
@@ -609,7 +609,7 @@ static int send_mapinfo_num(u32 mapping_num, u8 nl_client, int iwpm_pid)
&mapping_num, IWPM_NLA_MAPINFO_SEND_NUM);
if (ret)
goto mapinfo_num_error;
- ret = ibnl_unicast(skb, nlh, iwpm_pid);
+ ret = ibnl_unicast(skb, nlh, iwpm_pid, GFP_ATOMIC);
if (ret) {
skb = NULL;
err_str = "Unable to send a nlmsg";
@@ -638,7 +638,8 @@ static int send_nlmsg_done(struct sk_buff *skb, u8 nl_client, int iwpm_pid)
return -ENOMEM;
}
nlh->nlmsg_type = NLMSG_DONE;
- ret = ibnl_unicast(skb, (struct nlmsghdr *)skb->data, iwpm_pid);
+ ret = ibnl_unicast(skb, (struct nlmsghdr *)skb->data, iwpm_pid,
+ GFP_ATOMIC);
if (ret)
pr_warn("%s Unable to send a nlmsg\n", __func__);
return ret;
diff --git a/drivers/infiniband/core/iwpm_util.h b/drivers/infiniband/core/iwpm_util.h
index af1fc14..0ced7f4 100644
--- a/drivers/infiniband/core/iwpm_util.h
+++ b/drivers/infiniband/core/iwpm_util.h
@@ -46,6 +46,7 @@
#include <linux/jhash.h>
#include <linux/kref.h>
#include <net/netlink.h>
+#include <net/sock.h>
#include <linux/errno.h>
#include <rdma/iw_portmap.h>
#include <rdma/rdma_netlink.h>
diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index 09037a9..1451238 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -227,9 +227,9 @@ static void ibnl_rcv(struct sk_buff *skb)
}
int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh,
- __u32 pid)
+ __u32 pid, gfp_t flags)
{
- return nlmsg_unicast(nls, skb, pid, gfp_any());
+ return nlmsg_unicast(nls, skb, pid, flags);
}
EXPORT_SYMBOL(ibnl_unicast);
diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h
index 5852661..0bb3010 100644
--- a/include/rdma/rdma_netlink.h
+++ b/include/rdma/rdma_netlink.h
@@ -61,10 +61,11 @@ int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh,
* @skb: The netlink skb
* @nlh: Header of the netlink message to send
* @pid: Userspace netlink process ID
+ * @flags: allocation flags
* Returns 0 on success or a negative error code.
*/
int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh,
- __u32 pid);
+ __u32 pid, gfp_t flags);
/**
* Send the supplied skb to a netlink group.
--
2.7.4
^ permalink raw reply related
* [RFC 3/7] netlink: Add allocation flag to nlmsg_unicast()
From: Masashi Honma @ 2016-07-06 0:28 UTC (permalink / raw)
To: netdev, netfilter-devel, linux-wireless, linux-rdma, linux-audit,
cluster-devel
Cc: sean.hefty, paul, bsingharora, pshelar, eparis, kaber,
hal.rosenstock, dledford, kadlec, zbr, johannes, davem, pablo
In-Reply-To: <1467764916-4983-1-git-send-email-masashi.honma@gmail.com>
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
crypto/crypto_user.c | 3 ++-
drivers/infiniband/core/netlink.c | 2 +-
include/net/genetlink.h | 2 +-
include/net/netlink.h | 6 ++++--
net/core/rtnetlink.c | 2 +-
net/netfilter/nf_tables_api.c | 10 +++++-----
net/netlink/af_netlink.c | 2 +-
net/xfrm/xfrm_user.c | 15 +++++++++------
8 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c
index 7097a33..f379b74 100644
--- a/crypto/crypto_user.c
+++ b/crypto/crypto_user.c
@@ -249,7 +249,8 @@ drop_alg:
if (err)
return err;
- return nlmsg_unicast(crypto_nlsk, skb, NETLINK_CB(in_skb).portid);
+ return nlmsg_unicast(crypto_nlsk, skb, NETLINK_CB(in_skb).portid,
+ GFP_ATOMIC);
}
static int crypto_dump_report(struct sk_buff *skb, struct netlink_callback *cb)
diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index 9b8c20c..09037a9 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -229,7 +229,7 @@ static void ibnl_rcv(struct sk_buff *skb)
int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh,
__u32 pid)
{
- return nlmsg_unicast(nls, skb, pid);
+ return nlmsg_unicast(nls, skb, pid, gfp_any());
}
EXPORT_SYMBOL(ibnl_unicast);
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 8d4608c..b107a35 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -334,7 +334,7 @@ int genlmsg_multicast_allns(struct genl_family *family,
*/
static inline int genlmsg_unicast(struct net *net, struct sk_buff *skb, u32 portid)
{
- return nlmsg_unicast(net->genl_sock, skb, portid);
+ return nlmsg_unicast(net->genl_sock, skb, portid, 0);
}
/**
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 898e449..df5b533 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -585,12 +585,14 @@ static inline int nlmsg_multicast(struct sock *sk, struct sk_buff *skb,
* @sk: netlink socket to spread message to
* @skb: netlink message as socket buffer
* @portid: netlink portid of the destination socket
+ * @flags: allocation flags
*/
-static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb, u32 portid)
+static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb,
+ u32 portid, gfp_t flags)
{
int err;
- err = netlink_unicast(sk, skb, portid, MSG_DONTWAIT, 0);
+ err = netlink_unicast(sk, skb, portid, MSG_DONTWAIT, flags);
if (err > 0)
err = 0;
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 3433633f..7f7927f 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -657,7 +657,7 @@ int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid)
{
struct sock *rtnl = net->rtnl;
- return nlmsg_unicast(rtnl, skb, pid);
+ return nlmsg_unicast(rtnl, skb, pid, gfp_any());
}
EXPORT_SYMBOL(rtnl_unicast);
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 2c88187..4afb751 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -581,7 +581,7 @@ static int nf_tables_gettable(struct net *net, struct sock *nlsk,
if (err < 0)
goto err;
- return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
+ return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid, GFP_KERNEL);
err:
kfree_skb(skb2);
@@ -1144,7 +1144,7 @@ static int nf_tables_getchain(struct net *net, struct sock *nlsk,
if (err < 0)
goto err;
- return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
+ return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid, GFP_KERNEL);
err:
kfree_skb(skb2);
@@ -1976,7 +1976,7 @@ static int nf_tables_getrule(struct net *net, struct sock *nlsk,
if (err < 0)
goto err;
- return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
+ return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid, GFP_KERNEL);
err:
kfree_skb(skb2);
@@ -2664,7 +2664,7 @@ static int nf_tables_getset(struct net *net, struct sock *nlsk,
if (err < 0)
goto err;
- return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
+ return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid, GFP_KERNEL);
err:
kfree_skb(skb2);
@@ -3798,7 +3798,7 @@ static int nf_tables_getgen(struct net *net, struct sock *nlsk,
if (err < 0)
goto err;
- return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid);
+ return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid, GFP_KERNEL);
err:
kfree_skb(skb2);
return err;
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index c68bf74..acc1ee6 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2328,7 +2328,7 @@ int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 portid,
if (report) {
int err2;
- err2 = nlmsg_unicast(sk, skb, portid);
+ err2 = nlmsg_unicast(sk, skb, portid, flags);
if (!err || err == -ESRCH)
err = err2;
}
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index d516845..4af9977 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1108,7 +1108,7 @@ static int xfrm_get_spdinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
if (build_spdinfo(r_skb, net, sportid, seq, *flags) < 0)
BUG();
- return nlmsg_unicast(net->xfrm.nlsk, r_skb, sportid);
+ return nlmsg_unicast(net->xfrm.nlsk, r_skb, sportid, GFP_ATOMIC);
}
static inline size_t xfrm_sadinfo_msgsize(void)
@@ -1166,7 +1166,7 @@ static int xfrm_get_sadinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
if (build_sadinfo(r_skb, net, sportid, seq, *flags) < 0)
BUG();
- return nlmsg_unicast(net->xfrm.nlsk, r_skb, sportid);
+ return nlmsg_unicast(net->xfrm.nlsk, r_skb, sportid, GFP_ATOMIC);
}
static int xfrm_get_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
@@ -1186,7 +1186,8 @@ static int xfrm_get_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
if (IS_ERR(resp_skb)) {
err = PTR_ERR(resp_skb);
} else {
- err = nlmsg_unicast(net->xfrm.nlsk, resp_skb, NETLINK_CB(skb).portid);
+ err = nlmsg_unicast(net->xfrm.nlsk, resp_skb,
+ NETLINK_CB(skb).portid, GFP_ATOMIC);
}
xfrm_state_put(x);
out_noput:
@@ -1244,7 +1245,8 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh,
goto out;
}
- err = nlmsg_unicast(net->xfrm.nlsk, resp_skb, NETLINK_CB(skb).portid);
+ err = nlmsg_unicast(net->xfrm.nlsk, resp_skb, NETLINK_CB(skb).portid,
+ GFP_ATOMIC);
out:
xfrm_state_put(x);
@@ -1760,7 +1762,7 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
err = PTR_ERR(resp_skb);
} else {
err = nlmsg_unicast(net->xfrm.nlsk, resp_skb,
- NETLINK_CB(skb).portid);
+ NETLINK_CB(skb).portid, GFP_KERNEL);
}
} else {
xfrm_audit_policy_delete(xp, err ? 0 : 1, true);
@@ -1914,7 +1916,8 @@ static int xfrm_get_ae(struct sk_buff *skb, struct nlmsghdr *nlh,
if (build_aevent(r_skb, x, &c) < 0)
BUG();
- err = nlmsg_unicast(net->xfrm.nlsk, r_skb, NETLINK_CB(skb).portid);
+ err = nlmsg_unicast(net->xfrm.nlsk, r_skb, NETLINK_CB(skb).portid,
+ GFP_ATOMIC);
spin_unlock_bh(&x->lock);
xfrm_state_put(x);
return err;
--
2.7.4
^ permalink raw reply related
* [RFC 2/7] netfilter: Add allocation flag to nfnetlink_unicast()
From: Masashi Honma @ 2016-07-06 0:28 UTC (permalink / raw)
To: netdev, netfilter-devel, linux-wireless, linux-rdma, linux-audit,
cluster-devel
Cc: davem, johannes, pablo, kaber, kadlec, dledford, sean.hefty,
hal.rosenstock, paul, eparis, zbr, pshelar, ccaulfie, teigland,
bsingharora, Masashi Honma
In-Reply-To: <1467764916-4983-1-git-send-email-masashi.honma@gmail.com>
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
include/linux/netfilter/nfnetlink.h | 2 +-
net/netfilter/nfnetlink.c | 4 ++--
net/netfilter/nfnetlink_log.c | 4 ++--
net/netfilter/nfnetlink_queue.c | 3 ++-
4 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h
index 1d82dd5..a1c7808 100644
--- a/include/linux/netfilter/nfnetlink.h
+++ b/include/linux/netfilter/nfnetlink.h
@@ -38,7 +38,7 @@ int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid,
unsigned int group, int echo, gfp_t flags);
int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error);
int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid,
- int flags);
+ int flags, gfp_t allocation);
void nfnl_lock(__u8 subsys_id);
void nfnl_unlock(__u8 subsys_id);
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index f6193e7..b0910c7 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -141,9 +141,9 @@ int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error)
EXPORT_SYMBOL_GPL(nfnetlink_set_err);
int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid,
- int flags)
+ int flags, gfp_t allocation)
{
- return netlink_unicast(net->nfnl, skb, portid, flags, 0);
+ return netlink_unicast(net->nfnl, skb, portid, flags, allocation);
}
EXPORT_SYMBOL_GPL(nfnetlink_unicast);
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index 11f81c8..c834306 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -357,8 +357,8 @@ __nfulnl_send(struct nfulnl_instance *inst)
goto out;
}
}
- nfnetlink_unicast(inst->skb, inst->net, inst->peer_portid,
- MSG_DONTWAIT);
+ nfnetlink_unicast(inst->skb, inst->net, inst->peer_portid, MSG_DONTWAIT,
+ gfp_any());
out:
inst->qlen = 0;
inst->skb = NULL;
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index 5d36a09..8d7b6ff 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -638,7 +638,8 @@ __nfqnl_enqueue_packet(struct net *net, struct nfqnl_instance *queue,
*packet_id_ptr = htonl(entry->id);
/* nfnetlink_unicast will either free the nskb or add it to a socket */
- err = nfnetlink_unicast(nskb, net, queue->peer_portid, MSG_DONTWAIT);
+ err = nfnetlink_unicast(nskb, net, queue->peer_portid, MSG_DONTWAIT,
+ GFP_ATOMIC);
if (err < 0) {
if (queue->flags & NFQA_CFG_F_FAIL_OPEN) {
failopen = 1;
--
2.7.4
^ permalink raw reply related
* [RFC 1/7] netlink: Add allocation flag to netlink_unicast()
From: Masashi Honma @ 2016-07-06 0:28 UTC (permalink / raw)
To: netdev, netfilter-devel, linux-wireless, linux-rdma, linux-audit,
cluster-devel
Cc: davem, johannes, pablo, kaber, kadlec, dledford, sean.hefty,
hal.rosenstock, paul, eparis, zbr, pshelar, ccaulfie, teigland,
bsingharora, Masashi Honma
In-Reply-To: <1467764916-4983-1-git-send-email-masashi.honma@gmail.com>
Though netlink_broadcast() has allocation flag which can specify
memory allocation type (ex. GFP_KERNEL/GFP_ATOMIC), netlink_unicast()
does not have it. This can cause "BUG: sleeping function called from
invalid context at" with CONFIG_DEBUG_ATOMIC_SLEEP enabled kernel when
calling netlink_unicast() inside RCU read-side section and not in IRQ.
This patch adds an allocation flag to netlink_unicast().
At this moment, the allocation flag could be zero to imply gfp_any().
This is a temporal functionality for stepwise modification and
removed at the end of the series of patches.
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
---
drivers/connector/connector.c | 2 +-
include/linux/netlink.h | 3 ++-
include/net/netlink.h | 2 +-
kernel/audit.c | 9 +++++----
net/core/rtnetlink.c | 2 +-
net/ipv4/fib_frontend.c | 2 +-
net/ipv4/inet_diag.c | 2 +-
net/ipv4/udp_diag.c | 2 +-
net/netfilter/ipset/ip_set_core.c | 11 +++++++----
net/netfilter/nf_conntrack_netlink.c | 9 ++++++---
net/netfilter/nfnetlink.c | 2 +-
net/netfilter/nfnetlink_acct.c | 2 +-
net/netfilter/nfnetlink_cthelper.c | 2 +-
net/netfilter/nfnetlink_cttimeout.c | 5 +++--
net/netfilter/nft_compat.c | 4 ++--
net/netlink/af_netlink.c | 12 +++++++-----
net/sctp/sctp_diag.c | 2 +-
net/unix/diag.c | 2 +-
samples/connector/cn_test.c | 2 +-
19 files changed, 44 insertions(+), 33 deletions(-)
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 25693b0..44470e6 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -125,7 +125,7 @@ int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, u32 __group,
return netlink_broadcast(dev->nls, skb, portid, group,
gfp_mask);
return netlink_unicast(dev->nls, skb, portid,
- !gfpflags_allow_blocking(gfp_mask));
+ !gfpflags_allow_blocking(gfp_mask), gfp_mask);
}
EXPORT_SYMBOL_GPL(cn_netlink_send_mult);
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index da14ab6..f90d24a 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -69,7 +69,8 @@ extern void __netlink_clear_multicast_users(struct sock *sk, unsigned int group)
extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
extern int netlink_has_listeners(struct sock *sk, unsigned int group);
-extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid, int nonblock);
+extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 portid,
+ int nonblock, gfp_t allocation);
extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 portid,
__u32 group, gfp_t allocation);
extern int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb,
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 254a0fc..898e449 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -590,7 +590,7 @@ static inline int nlmsg_unicast(struct sock *sk, struct sk_buff *skb, u32 portid
{
int err;
- err = netlink_unicast(sk, skb, portid, MSG_DONTWAIT);
+ err = netlink_unicast(sk, skb, portid, MSG_DONTWAIT, 0);
if (err > 0)
err = 0;
diff --git a/kernel/audit.c b/kernel/audit.c
index 8d528f9..131577d 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -411,7 +411,7 @@ static void kauditd_send_skb(struct sk_buff *skb)
restart:
/* take a reference in case we can't send it and we want to hold it */
skb_get(skb);
- err = netlink_unicast(audit_sock, skb, audit_nlk_portid, 0);
+ err = netlink_unicast(audit_sock, skb, audit_nlk_portid, 0, gfp_any());
if (err < 0) {
pr_err("netlink_unicast sending to audit_pid=%d returned error: %d\n",
audit_pid, err);
@@ -547,7 +547,7 @@ int audit_send_list(void *_dest)
mutex_unlock(&audit_cmd_mutex);
while ((skb = __skb_dequeue(&dest->q)) != NULL)
- netlink_unicast(aunet->nlsk, skb, dest->portid, 0);
+ netlink_unicast(aunet->nlsk, skb, dest->portid, 0, gfp_any());
put_net(net);
kfree(dest);
@@ -591,7 +591,7 @@ static int audit_send_reply_thread(void *arg)
/* Ignore failure. It'll only happen if the sender goes away,
because our timeout is set to infinite. */
- netlink_unicast(aunet->nlsk , reply->skb, reply->portid, 0);
+ netlink_unicast(aunet->nlsk , reply->skb, reply->portid, 0, gfp_any());
put_net(net);
kfree(reply);
return 0;
@@ -814,7 +814,8 @@ static int audit_replace(pid_t pid)
if (!skb)
return -ENOMEM;
- return netlink_unicast(audit_sock, skb, audit_nlk_portid, 0);
+ return netlink_unicast(audit_sock, skb, audit_nlk_portid, 0,
+ GFP_KERNEL);
}
static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index eb49ca2..3433633f 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -649,7 +649,7 @@ int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int g
atomic_inc(&skb->users);
netlink_broadcast(rtnl, skb, pid, group, GFP_KERNEL);
if (echo)
- err = netlink_unicast(rtnl, skb, pid, MSG_DONTWAIT);
+ err = netlink_unicast(rtnl, skb, pid, MSG_DONTWAIT, GFP_KERNEL);
return err;
}
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index ef2ebeb..6a4286f 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -1096,7 +1096,7 @@ static void nl_fib_input(struct sk_buff *skb)
portid = NETLINK_CB(skb).portid; /* netlink portid */
NETLINK_CB(skb).portid = 0; /* from kernel */
NETLINK_CB(skb).dst_group = 0; /* unicast */
- netlink_unicast(net->ipv4.fibnl, skb, portid, MSG_DONTWAIT);
+ netlink_unicast(net->ipv4.fibnl, skb, portid, MSG_DONTWAIT, GFP_KERNEL);
}
static int __net_init nl_fib_lookup_init(struct net *net)
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 38c2c47..2963b5f 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -441,7 +441,7 @@ int inet_diag_dump_one_icsk(struct inet_hashinfo *hashinfo,
goto out;
}
err = netlink_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid,
- MSG_DONTWAIT);
+ MSG_DONTWAIT, GFP_KERNEL);
if (err > 0)
err = 0;
diff --git a/net/ipv4/udp_diag.c b/net/ipv4/udp_diag.c
index 3d5ccf4..69ac502 100644
--- a/net/ipv4/udp_diag.c
+++ b/net/ipv4/udp_diag.c
@@ -83,7 +83,7 @@ static int udp_dump_one(struct udp_table *tbl, struct sk_buff *in_skb,
goto out;
}
err = netlink_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid,
- MSG_DONTWAIT);
+ MSG_DONTWAIT, GFP_KERNEL);
if (err > 0)
err = 0;
out:
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index a748b0c..fcbe122 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -1510,7 +1510,7 @@ call_ad(struct sock *ctnl, struct sk_buff *skb, struct ip_set *set,
*errline = lineno;
netlink_unicast(ctnl, skb2, NETLINK_CB(skb).portid,
- MSG_DONTWAIT);
+ MSG_DONTWAIT, GFP_KERNEL);
/* Signal netlink not to send its ACK/errmsg. */
return -EINTR;
}
@@ -1695,7 +1695,8 @@ static int ip_set_header(struct net *net, struct sock *ctnl,
goto nla_put_failure;
nlmsg_end(skb2, nlh2);
- ret = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).portid, MSG_DONTWAIT);
+ ret = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).portid, MSG_DONTWAIT,
+ GFP_KERNEL);
if (ret < 0)
return ret;
@@ -1755,7 +1756,8 @@ static int ip_set_type(struct net *net, struct sock *ctnl, struct sk_buff *skb,
nlmsg_end(skb2, nlh2);
pr_debug("Send TYPE, nlmsg_len: %u\n", nlh2->nlmsg_len);
- ret = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).portid, MSG_DONTWAIT);
+ ret = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).portid, MSG_DONTWAIT,
+ GFP_KERNEL);
if (ret < 0)
return ret;
@@ -1798,7 +1800,8 @@ static int ip_set_protocol(struct net *net, struct sock *ctnl,
goto nla_put_failure;
nlmsg_end(skb2, nlh2);
- ret = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).portid, MSG_DONTWAIT);
+ ret = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).portid, MSG_DONTWAIT,
+ GFP_KERNEL);
if (ret < 0)
return ret;
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index a18d1ce..6537e8d 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1224,7 +1224,8 @@ static int ctnetlink_get_conntrack(struct net *net, struct sock *ctnl,
if (err <= 0)
goto free;
- err = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).portid, MSG_DONTWAIT);
+ err = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).portid, MSG_DONTWAIT,
+ GFP_KERNEL);
if (err < 0)
goto out;
@@ -2083,7 +2084,8 @@ static int ctnetlink_stat_ct(struct net *net, struct sock *ctnl,
if (err <= 0)
goto free;
- err = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).portid, MSG_DONTWAIT);
+ err = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).portid, MSG_DONTWAIT,
+ GFP_KERNEL);
if (err < 0)
goto out;
@@ -2821,7 +2823,8 @@ static int ctnetlink_get_expect(struct net *net, struct sock *ctnl,
if (err <= 0)
goto free;
- err = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).portid, MSG_DONTWAIT);
+ err = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).portid, MSG_DONTWAIT,
+ GFP_KERNEL);
if (err < 0)
goto out;
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 2278d9a..f6193e7 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -143,7 +143,7 @@ EXPORT_SYMBOL_GPL(nfnetlink_set_err);
int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid,
int flags)
{
- return netlink_unicast(net->nfnl, skb, portid, flags);
+ return netlink_unicast(net->nfnl, skb, portid, flags, 0);
}
EXPORT_SYMBOL_GPL(nfnetlink_unicast);
diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c
index 1b4de4b..8b5bd59 100644
--- a/net/netfilter/nfnetlink_acct.c
+++ b/net/netfilter/nfnetlink_acct.c
@@ -311,7 +311,7 @@ static int nfnl_acct_get(struct net *net, struct sock *nfnl,
break;
}
ret = netlink_unicast(nfnl, skb2, NETLINK_CB(skb).portid,
- MSG_DONTWAIT);
+ MSG_DONTWAIT, GFP_KERNEL);
if (ret > 0)
ret = 0;
diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c
index e924e95..e46b7cd 100644
--- a/net/netfilter/nfnetlink_cthelper.c
+++ b/net/netfilter/nfnetlink_cthelper.c
@@ -559,7 +559,7 @@ static int nfnl_cthelper_get(struct net *net, struct sock *nfnl,
}
ret = netlink_unicast(nfnl, skb2, NETLINK_CB(skb).portid,
- MSG_DONTWAIT);
+ MSG_DONTWAIT, GFP_KERNEL);
if (ret > 0)
ret = 0;
diff --git a/net/netfilter/nfnetlink_cttimeout.c b/net/netfilter/nfnetlink_cttimeout.c
index 3c84f14..813eb8a 100644
--- a/net/netfilter/nfnetlink_cttimeout.c
+++ b/net/netfilter/nfnetlink_cttimeout.c
@@ -279,7 +279,7 @@ static int cttimeout_get_timeout(struct net *net, struct sock *ctnl,
break;
}
ret = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).portid,
- MSG_DONTWAIT);
+ MSG_DONTWAIT, GFP_KERNEL);
if (ret > 0)
ret = 0;
@@ -496,7 +496,8 @@ static int cttimeout_default_get(struct net *net, struct sock *ctnl,
err = -ENOMEM;
goto err;
}
- ret = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).portid, MSG_DONTWAIT);
+ ret = netlink_unicast(ctnl, skb2, NETLINK_CB(skb).portid,
+ MSG_DONTWAIT, GFP_KERNEL);
if (ret > 0)
ret = 0;
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c
index 6228c42..7de9ea4 100644
--- a/net/netfilter/nft_compat.c
+++ b/net/netfilter/nft_compat.c
@@ -582,8 +582,8 @@ static int nfnl_compat_get(struct net *net, struct sock *nfnl,
return -ENOSPC;
}
- ret = netlink_unicast(nfnl, skb2, NETLINK_CB(skb).portid,
- MSG_DONTWAIT);
+ ret = netlink_unicast(nfnl, skb2, NETLINK_CB(skb).portid, MSG_DONTWAIT,
+ GFP_KERNEL);
if (ret > 0)
ret = 0;
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 627f898..c68bf74 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1220,14 +1220,14 @@ static int netlink_unicast_kernel(struct sock *sk, struct sk_buff *skb,
return ret;
}
-int netlink_unicast(struct sock *ssk, struct sk_buff *skb,
- u32 portid, int nonblock)
+int netlink_unicast(struct sock *ssk, struct sk_buff *skb, u32 portid,
+ int nonblock, gfp_t allocation)
{
struct sock *sk;
int err;
long timeo;
- skb = netlink_trim(skb, gfp_any());
+ skb = netlink_trim(skb, allocation ? allocation : gfp_any());
timeo = sock_sndtimeo(ssk, nonblock);
retry:
@@ -1783,7 +1783,8 @@ static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)
atomic_inc(&skb->users);
netlink_broadcast(sk, skb, dst_portid, dst_group, GFP_KERNEL);
}
- err = netlink_unicast(sk, skb, dst_portid, msg->msg_flags&MSG_DONTWAIT);
+ err = netlink_unicast(sk, skb, dst_portid,
+ msg->msg_flags & MSG_DONTWAIT, GFP_KERNEL);
out:
scm_destroy(&scm);
@@ -2250,7 +2251,8 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err)
errmsg = nlmsg_data(rep);
errmsg->error = err;
memcpy(&errmsg->msg, nlh, payload > sizeof(*errmsg) ? nlh->nlmsg_len : sizeof(*nlh));
- netlink_unicast(in_skb->sk, skb, NETLINK_CB(in_skb).portid, MSG_DONTWAIT);
+ netlink_unicast(in_skb->sk, skb, NETLINK_CB(in_skb).portid,
+ MSG_DONTWAIT, GFP_KERNEL);
}
EXPORT_SYMBOL(netlink_ack);
diff --git a/net/sctp/sctp_diag.c b/net/sctp/sctp_diag.c
index f69edcf..4e66405 100644
--- a/net/sctp/sctp_diag.c
+++ b/net/sctp/sctp_diag.c
@@ -259,7 +259,7 @@ static int sctp_tsp_dump_one(struct sctp_transport *tsp, void *p)
}
err = netlink_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid,
- MSG_DONTWAIT);
+ MSG_DONTWAIT, GFP_KERNEL);
if (err > 0)
err = 0;
out:
diff --git a/net/unix/diag.c b/net/unix/diag.c
index 4d96797..5e7e952 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -280,7 +280,7 @@ again:
goto again;
}
err = netlink_unicast(net->diag_nlsk, rep, NETLINK_CB(in_skb).portid,
- MSG_DONTWAIT);
+ MSG_DONTWAIT, GFP_KERNEL);
if (err > 0)
err = 0;
out:
diff --git a/samples/connector/cn_test.c b/samples/connector/cn_test.c
index d12cc94..640d11b 100644
--- a/samples/connector/cn_test.c
+++ b/samples/connector/cn_test.c
@@ -116,7 +116,7 @@ static int cn_test_want_notify(void)
NETLINK_CB(skb).dst_group = ctl->group;
//netlink_broadcast(nls, skb, 0, ctl->group, GFP_ATOMIC);
- netlink_unicast(nls, skb, 0, 0);
+ netlink_unicast(nls, skb, 0, 0, GFP_ATOMIC);
pr_info("request was sent: group=0x%x\n", ctl->group);
--
2.7.4
^ permalink raw reply related
* [RFC 0/7] netlink: Add allocation flag to netlink_unicast()
From: Masashi Honma @ 2016-07-06 0:28 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA,
netfilter-devel-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA,
linux-audit-H+wXaHxf7aLQT0dZR+AlfA,
cluster-devel-H+wXaHxf7aLQT0dZR+AlfA
Cc: davem-fT/PcQaiUtIeIZ0/mPfg9Q, johannes-cdvu00un1VgdHxzADdlk8Q,
pablo-Cap9r6Oaw4JrovVCs/uTlw, kaber-dcUjhNyLwpNeoWH0uzbU5w,
kadlec-K40Dz/62t/MgiyqX0sVFJYdd74u8MsAO,
dledford-H+wXaHxf7aLQT0dZR+AlfA,
sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w,
paul-r2n+y4ga6xFZroRs9YW3xA, eparis-H+wXaHxf7aLQT0dZR+AlfA,
zbr-i6C2adt8DTjR7s880joybQ, pshelar-l0M0P4e3n4LQT0dZR+AlfA,
ccaulfie-H+wXaHxf7aLQT0dZR+AlfA, teigland-H+wXaHxf7aLQT0dZR+AlfA,
bsingharora-Re5JQEeQqe8AvxtiuMwx3w, Masashi Honma
Though netlink_broadcast() has allocation flag which can specify
memory allocation type (ex. GFP_KERNEL/GFP_ATOMIC), netlink_unicast()
does not have it. This can cause "BUG: sleeping function called from
invalid context at" with CONFIG_DEBUG_ATOMIC_SLEEP enabled kernel when
calling netlink_unicast() inside RCU read-side section and not in IRQ.
Though currently such a use case was not found, to solve potential
issue we will add an allocation flag to netlink_unicast(). Previously
netlink_unicast() have used gfp_any() as a flag. We replaced it to
GFP_KERNEL or GFP_ATOMIC or etc by guessing based on context. If we
could not determine the value, we remain it gfp_any(). We welcome
comments like "this gfp_any() should be GFP_KERNEL". Of course other
comments are welcome as well.
This series of patches are not tested.
This is a RFC because this does not fix existing issue.
Masashi Honma (7):
netlink: Add allocation flag to netlink_unicast()
netfilter: Add allocation flag to nfnetlink_unicast()
netlink: Add allocation flag to nlmsg_unicast()
infiniband: Add allocation flag to ibnl_unicast()
net: Add allocation flag to rtnl_unicast()
genetlink: Add allocation flag to genlmsg_unicast()
genetlink: Add allocation flag to genlmsg_reply()
crypto/crypto_user.c | 3 ++-
drivers/block/drbd/drbd_nl.c | 2 +-
drivers/connector/connector.c | 2 +-
drivers/infiniband/core/iwpm_msg.c | 6 ++---
drivers/infiniband/core/iwpm_util.c | 5 ++--
drivers/infiniband/core/iwpm_util.h | 1 +
drivers/infiniband/core/netlink.c | 4 ++--
drivers/net/gtp.c | 3 ++-
drivers/net/team/team.c | 5 ++--
drivers/net/wireless/mac80211_hwsim.c | 4 ++--
fs/dlm/netlink.c | 2 +-
include/linux/netfilter/nfnetlink.h | 2 +-
include/linux/netlink.h | 3 ++-
include/linux/rtnetlink.h | 3 ++-
include/net/genetlink.h | 13 +++++++----
include/net/netlink.h | 6 +++--
include/rdma/rdma_netlink.h | 3 ++-
kernel/audit.c | 9 ++++----
kernel/taskstats.c | 4 ++--
net/core/devlink.c | 12 +++++-----
net/core/net_namespace.c | 2 +-
net/core/rtnetlink.c | 12 ++++++----
net/dcb/dcbnl.c | 2 +-
net/decnet/dn_route.c | 3 ++-
net/hsr/hsr_netlink.c | 6 +++--
net/ieee802154/ieee802154.h | 3 ++-
net/ieee802154/netlink.c | 5 ++--
net/ieee802154/nl-mac.c | 4 ++--
net/ieee802154/nl-phy.c | 6 ++---
net/ieee802154/nl802154.c | 4 ++--
net/ipv4/devinet.c | 2 +-
net/ipv4/fib_frontend.c | 2 +-
net/ipv4/fou.c | 2 +-
net/ipv4/inet_diag.c | 2 +-
net/ipv4/ipmr.c | 6 +++--
net/ipv4/route.c | 2 +-
net/ipv4/tcp_metrics.c | 2 +-
net/ipv4/udp_diag.c | 2 +-
net/ipv6/addrconf.c | 4 ++--
net/ipv6/addrlabel.c | 2 +-
net/ipv6/ila/ila_xlat.c | 2 +-
net/ipv6/ip6mr.c | 6 +++--
net/ipv6/route.c | 2 +-
net/irda/irnetlink.c | 2 +-
net/l2tp/l2tp_netlink.c | 8 ++++---
net/netfilter/ipset/ip_set_core.c | 11 +++++----
net/netfilter/ipvs/ip_vs_ctl.c | 2 +-
net/netfilter/nf_conntrack_netlink.c | 9 +++++---
net/netfilter/nf_tables_api.c | 10 ++++----
net/netfilter/nfnetlink.c | 4 ++--
net/netfilter/nfnetlink_acct.c | 2 +-
net/netfilter/nfnetlink_cthelper.c | 2 +-
net/netfilter/nfnetlink_cttimeout.c | 5 ++--
net/netfilter/nfnetlink_log.c | 4 ++--
net/netfilter/nfnetlink_queue.c | 3 ++-
net/netfilter/nft_compat.c | 4 ++--
net/netlabel/netlabel_cipso_v4.c | 2 +-
net/netlabel/netlabel_mgmt.c | 4 ++--
net/netlabel/netlabel_unlabeled.c | 2 +-
net/netlink/af_netlink.c | 14 +++++++-----
net/netlink/genetlink.c | 2 +-
net/nfc/netlink.c | 6 ++---
net/openvswitch/datapath.c | 9 ++++----
net/sched/act_api.c | 2 +-
net/sctp/sctp_diag.c | 2 +-
net/tipc/bearer.c | 4 ++--
net/tipc/netlink_compat.c | 2 +-
net/tipc/node.c | 2 +-
net/unix/diag.c | 2 +-
net/wireless/nl80211.c | 43 ++++++++++++++++++-----------------
net/xfrm/xfrm_user.c | 15 +++++++-----
samples/connector/cn_test.c | 2 +-
72 files changed, 199 insertions(+), 155 deletions(-)
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* audit 2.6.3 released
From: Steve Grubb @ 2016-07-05 13:15 UTC (permalink / raw)
To: linux-audit
Hello,
I've just released a new version of the audit daemon. It can be downloaded
from http://people.redhat.com/sgrubb/audit. It will also be in rawhide
soon. The ChangeLog is:
- Fix NULL poiinter deref in auparse
- Optionally add dependency to libcap-ng in audit.pc
This is another bug fix release. The NULL ptr deref in auparse is crashing
auditd. And this adds a missing library dependency in the package config file
reported by Laurent.
Please let me know if you run across any problems with this release.
-Steve
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox