* [PATCH] bpfilter: fix building without CONFIG_INET
@ 2018-05-29 9:55 Arnd Bergmann
2018-05-29 12:14 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2018-05-29 9:55 UTC (permalink / raw)
To: David S. Miller, Arnd Bergmann, Alexei Starovoitov; +Cc: netdev, linux-kernel
bpfilter_process_sockopt is a callback that gets called from
ip_setsockopt() and ip_getsockopt(). However, when CONFIG_INET is
disabled, it never gets called at all, and assigning a function to the
callback pointer results in a link failure:
net/bpfilter/bpfilter_kern.o: In function `__stop_umh':
bpfilter_kern.c:(.text.unlikely+0x3): undefined reference to `bpfilter_process_sockopt'
net/bpfilter/bpfilter_kern.o: In function `load_umh':
bpfilter_kern.c:(.init.text+0x73): undefined reference to `bpfilter_process_sockopt'
Since there is no caller in this configuration, I assume we can
simply make the assignment conditional.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
This happened on last week's linux-next tree. Since there hasn't
been an update since, it's possible that this is fixed in another
tree already.
---
net/bpfilter/bpfilter_kern.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/bpfilter/bpfilter_kern.c b/net/bpfilter/bpfilter_kern.c
index 7596314b61c7..b13d058f8c34 100644
--- a/net/bpfilter/bpfilter_kern.c
+++ b/net/bpfilter/bpfilter_kern.c
@@ -33,7 +33,8 @@ static void shutdown_umh(struct umh_info *info)
static void __stop_umh(void)
{
- if (bpfilter_process_sockopt) {
+ if (IS_ENABLED(CONFIG_INET) &&
+ bpfilter_process_sockopt) {
bpfilter_process_sockopt = NULL;
shutdown_umh(&info);
}
@@ -98,7 +99,9 @@ static int __init load_umh(void)
stop_umh();
return -EFAULT;
}
- bpfilter_process_sockopt = &__bpfilter_process_sockopt;
+ if (IS_ENABLED(CONFIG_INET))
+ bpfilter_process_sockopt = &__bpfilter_process_sockopt;
+
return 0;
}
--
2.9.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] bpfilter: fix building without CONFIG_INET
2018-05-29 9:55 [PATCH] bpfilter: fix building without CONFIG_INET Arnd Bergmann
@ 2018-05-29 12:14 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-05-29 12:14 UTC (permalink / raw)
To: arnd; +Cc: ast, netdev, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Date: Tue, 29 May 2018 11:55:06 +0200
> bpfilter_process_sockopt is a callback that gets called from
> ip_setsockopt() and ip_getsockopt(). However, when CONFIG_INET is
> disabled, it never gets called at all, and assigning a function to the
> callback pointer results in a link failure:
>
> net/bpfilter/bpfilter_kern.o: In function `__stop_umh':
> bpfilter_kern.c:(.text.unlikely+0x3): undefined reference to `bpfilter_process_sockopt'
> net/bpfilter/bpfilter_kern.o: In function `load_umh':
> bpfilter_kern.c:(.init.text+0x73): undefined reference to `bpfilter_process_sockopt'
>
> Since there is no caller in this configuration, I assume we can
> simply make the assignment conditional.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied, thanks Arnd.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-29 12:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-29 9:55 [PATCH] bpfilter: fix building without CONFIG_INET Arnd Bergmann
2018-05-29 12:14 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).