fs: dlm: Protect IPV6 field access by CONFIG_IPV6
Subsystems (3)
PATCH 1/1 fs: dlm: Protect IPV6 field access by CONFIG_IPV6
If CONFIG_IPV6=n:
In file included from fs/dlm/lowcomms.c:46:
fs/dlm/lowcomms.c: In function ?lowcomms_error_report?:
./include/net/sock.h:386:34: error: ?struct sock_common? has no member named ?skc_v6_daddr?; did you mean ?skc_daddr??
386 | #define sk_v6_daddr __sk_common.skc_v6_daddr
| ^~~~~~~~~~~~
./include/linux/printk.h:422:19: note: in expansion of macro ?sk_v6_daddr?
422 | _p_func(_fmt, ##__VA_ARGS__); \
| ^~~~~~~~~~~
./include/linux/printk.h:450:26: note: in expansion of macro ?printk_index_wrap?
450 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~~~
./include/linux/printk.h:644:3: note: in expansion of macro ?printk?
644 | printk(fmt, ##__VA_ARGS__); \
| ^~~~~~
fs/dlm/lowcomms.c:612:3: note: in expansion of macro ?printk_ratelimited?
612 | printk_ratelimited(KERN_ERR "dlm: node %d: socket error "
| ^~~~~~~~~~~~~~~~~~Fix this by protecting the code that accesses IPV6-only fields by a check for CONFIG_IPV6.
Reported-by Randy Dunlap <[email protected]>
Fixes 4c3d90570bcc2b33 ("fs: dlm: don't call kernel_getpeername() in error_report()")
Signed-off-by Geert Uytterhoeven <[email protected]>
--- fs/dlm/lowcomms.c | 2 ++ 1 file changed, 2 insertions(+)
fs/dlm/lowcomms.c +2 -0
@@ -608,6 +608,7 @@ static void lowcomms_error_report(struct sock *sk)ntohs (inet->inet_dport), sk->sk_err, sk->sk_err_soft);break ; +#if IS_ENABLED (CONFIG_IPV6 )case AF_INET6 :printk_ratelimited (KERN_ERR "dlm: node %d: socket error " "sending to node %d at %pI6c, "
@@ -616,6 +617,7 @@ static void lowcomms_error_report(struct sock *sk)ntohs (inet->inet_dport), sk->sk_err, sk->sk_err_soft);break ; +#endif default :printk_ratelimited (KERN_ERR "dlm: node %d: socket error " "invalid socket family %d set, "
Signature · 1 line
2.25.1
Alexander Aring
maintainerHi,
Quoted 21 lines · Geert Uytterhoeven
If
CONFIG_IPV6=n:In file included from fs/dlm/lowcomms.c:46: fs/dlm/lowcomms.c: In function ?lowcomms_error_report?: ./include/net/sock.h:386:34: error: ?struct sock_common? has no member named ?skc_v6_daddr?; did you mean ?skc_daddr?? 386 | #define sk_v6_daddr __sk_common.skc_v6_daddr | ^~~~~~~~~~~~ ./include/linux/printk.h:422:19: note: in expansion of macro ?sk_v6_daddr? 422 | _p_func(_fmt, ##__VA_ARGS__); \ | ^~~~~~~~~~~ ./include/linux/printk.h:450:26: note: in expansion of macro ?printk_index_wrap? 450 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__) | ^~~~~~~~~~~~~~~~~ ./include/linux/printk.h:644:3: note: in expansion of macro ?printk? 644 | printk(fmt, ##__VA_ARGS__); \ | ^~~~~~ fs/dlm/lowcomms.c:612:3: note: in expansion of macro ?printk_ratelimited? 612 | printk_ratelimited(KERN_ERR "dlm: node %d: socket error " | ^~~~~~~~~~~~~~~~~~
Quoted 7 lines
Fix this by protecting the code that accesses IPV6-only fields by a check for
CONFIG_IPV6.Reported-by Randy Dunlap <[email protected]>Fixes 4c3d90570bcc2b33 ("fs: dlm: don't call kernel_getpeername() in error_report()")Signed-off-by Geert Uytterhoeven <[email protected]>---
Thanks, but the issue has already been fixed in the same way [0].
- Alex