[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202501111754.vEJ6CJgk-lkp@intel.com>
Date: Sat, 11 Jan 2025 17:49:00 +0800
From: kernel test robot <lkp@...el.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
netdev@...r.kernel.org, Donald Hunter <donald.hunter@...hat.com>,
Kuniyuki Iwashima <kuniyu@...zon.com>
Subject: Re: [PATCH v1 net-next 07/12] af_unix: Set drop reason in
unix_stream_sendmsg().
Hi Kuniyuki,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Kuniyuki-Iwashima/net-dropreason-Gather-SOCKET_-drop-reasons/20250110-173850
base: net-next/main
patch link: https://lore.kernel.org/r/20250110092641.85905-8-kuniyu%40amazon.com
patch subject: [PATCH v1 net-next 07/12] af_unix: Set drop reason in unix_stream_sendmsg().
config: mips-ci20_defconfig (https://download.01.org/0day-ci/archive/20250111/202501111754.vEJ6CJgk-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250111/202501111754.vEJ6CJgk-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501111754.vEJ6CJgk-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> net/unix/af_unix.c:2303:6: warning: variable 'reason' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
2303 | if (READ_ONCE(sk->sk_shutdown) & SEND_SHUTDOWN)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/rwonce.h:47:28: note: expanded from macro 'READ_ONCE'
47 | #define READ_ONCE(x) \
| ^
net/unix/af_unix.c:2403:24: note: uninitialized use occurs here
2403 | kfree_skb_reason(skb, reason);
| ^~~~~~
net/unix/af_unix.c:2303:2: note: remove the 'if' if its condition is always false
2303 | if (READ_ONCE(sk->sk_shutdown) & SEND_SHUTDOWN)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2304 | goto out_pipe;
| ~~~~~~~~~~~~~
net/unix/af_unix.c:2268:2: note: variable 'reason' is declared here
2268 | enum skb_drop_reason reason;
| ^
1 warning generated.
vim +2303 net/unix/af_unix.c
314001f0bf9270 Rao Shoaib 2021-08-01 2264
1b784140474e4f Ying Xue 2015-03-02 2265 static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg,
1b784140474e4f Ying Xue 2015-03-02 2266 size_t len)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2267 {
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2268 enum skb_drop_reason reason;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2269 struct sock *sk = sock->sk;
49efbfa661b688 Kuniyuki Iwashima 2025-01-10 2270 struct sk_buff *skb = NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2271 struct sock *other = NULL;
7cc05662682da4 Christoph Hellwig 2015-01-28 2272 struct scm_cookie scm;
8ba69ba6a324b1 Miklos Szeredi 2009-09-11 2273 bool fds_sent = false;
49efbfa661b688 Kuniyuki Iwashima 2025-01-10 2274 int err, sent = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2275
7cc05662682da4 Christoph Hellwig 2015-01-28 2276 err = scm_send(sock, msg, &scm, false);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2277 if (err < 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2278 return err;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2279
d9f21b3613337b Kuniyuki Iwashima 2024-01-23 2280 wait_for_unix_gc(scm.fp);
d9f21b3613337b Kuniyuki Iwashima 2024-01-23 2281
314001f0bf9270 Rao Shoaib 2021-08-01 2282 if (msg->msg_flags & MSG_OOB) {
6c444255b193b5 Kuniyuki Iwashima 2024-12-13 2283 err = -EOPNOTSUPP;
4edf21aa94ee33 Kuniyuki Iwashima 2022-03-17 2284 #if IS_ENABLED(CONFIG_AF_UNIX_OOB)
314001f0bf9270 Rao Shoaib 2021-08-01 2285 if (len)
314001f0bf9270 Rao Shoaib 2021-08-01 2286 len--;
314001f0bf9270 Rao Shoaib 2021-08-01 2287 else
314001f0bf9270 Rao Shoaib 2021-08-01 2288 #endif
^1da177e4c3f41 Linus Torvalds 2005-04-16 2289 goto out_err;
314001f0bf9270 Rao Shoaib 2021-08-01 2290 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2291
^1da177e4c3f41 Linus Torvalds 2005-04-16 2292 if (msg->msg_namelen) {
8a34d4e8d9742a Kuniyuki Iwashima 2024-06-04 2293 err = READ_ONCE(sk->sk_state) == TCP_ESTABLISHED ? -EISCONN : -EOPNOTSUPP;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2294 goto out_err;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2295 } else {
830a1e5c212fb3 Benjamin LaHaise 2005-12-13 2296 other = unix_peer(sk);
6c444255b193b5 Kuniyuki Iwashima 2024-12-13 2297 if (!other) {
6c444255b193b5 Kuniyuki Iwashima 2024-12-13 2298 err = -ENOTCONN;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2299 goto out_err;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2300 }
6c444255b193b5 Kuniyuki Iwashima 2024-12-13 2301 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2302
49efbfa661b688 Kuniyuki Iwashima 2025-01-10 @2303 if (READ_ONCE(sk->sk_shutdown) & SEND_SHUTDOWN)
49efbfa661b688 Kuniyuki Iwashima 2025-01-10 2304 goto out_pipe;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2305
6eba6a372b501a Eric Dumazet 2008-11-16 2306 while (sent < len) {
49efbfa661b688 Kuniyuki Iwashima 2025-01-10 2307 int size = len - sent;
49efbfa661b688 Kuniyuki Iwashima 2025-01-10 2308 int data_len;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2309
a0dbf5f818f908 David Howells 2023-05-22 2310 if (unlikely(msg->msg_flags & MSG_SPLICE_PAGES)) {
a0dbf5f818f908 David Howells 2023-05-22 2311 skb = sock_alloc_send_pskb(sk, 0, 0,
a0dbf5f818f908 David Howells 2023-05-22 2312 msg->msg_flags & MSG_DONTWAIT,
a0dbf5f818f908 David Howells 2023-05-22 2313 &err, 0);
a0dbf5f818f908 David Howells 2023-05-22 2314 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2315 /* Keep two messages in the pipe so it schedules better */
b0632e53e0da80 Kuniyuki Iwashima 2024-06-04 2316 size = min_t(int, size, (READ_ONCE(sk->sk_sndbuf) >> 1) - 64);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2317
e370a723632177 Eric Dumazet 2013-08-08 2318 /* allow fallback to order-0 allocations */
e370a723632177 Eric Dumazet 2013-08-08 2319 size = min_t(int, size, SKB_MAX_HEAD(0) + UNIX_SKB_FRAGS_SZ);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2320
e370a723632177 Eric Dumazet 2013-08-08 2321 data_len = max_t(int, 0, size - SKB_MAX_HEAD(0));
^1da177e4c3f41 Linus Torvalds 2005-04-16 2322
31ff6aa5c86f75 Kirill Tkhai 2014-05-15 2323 data_len = min_t(size_t, size, PAGE_ALIGN(data_len));
31ff6aa5c86f75 Kirill Tkhai 2014-05-15 2324
e370a723632177 Eric Dumazet 2013-08-08 2325 skb = sock_alloc_send_pskb(sk, size - data_len, data_len,
28d6427109d13b Eric Dumazet 2013-08-08 2326 msg->msg_flags & MSG_DONTWAIT, &err,
28d6427109d13b Eric Dumazet 2013-08-08 2327 get_order(UNIX_SKB_FRAGS_SZ));
a0dbf5f818f908 David Howells 2023-05-22 2328 }
e370a723632177 Eric Dumazet 2013-08-08 2329 if (!skb)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2330 goto out_err;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2331
f78a5fda911652 David S. Miller 2011-09-16 2332 /* Only send the fds in the first buffer */
7cc05662682da4 Christoph Hellwig 2015-01-28 2333 err = unix_scm_to_skb(&scm, skb, !fds_sent);
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2334 if (err < 0) {
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2335 reason = unix_scm_err_to_reason(err);
d460b04bc452cf Kuniyuki Iwashima 2024-12-13 2336 goto out_free;
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2337 }
d460b04bc452cf Kuniyuki Iwashima 2024-12-13 2338
8ba69ba6a324b1 Miklos Szeredi 2009-09-11 2339 fds_sent = true;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2340
a0dbf5f818f908 David Howells 2023-05-22 2341 if (unlikely(msg->msg_flags & MSG_SPLICE_PAGES)) {
6bd8614fc2d076 Frederik Deweerdt 2024-12-09 2342 skb->ip_summed = CHECKSUM_UNNECESSARY;
a0dbf5f818f908 David Howells 2023-05-22 2343 err = skb_splice_from_iter(skb, &msg->msg_iter, size,
a0dbf5f818f908 David Howells 2023-05-22 2344 sk->sk_allocation);
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2345 if (err < 0) {
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2346 reason = SKB_DROP_REASON_SKB_UCOPY_FAULT;
d460b04bc452cf Kuniyuki Iwashima 2024-12-13 2347 goto out_free;
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2348 }
d460b04bc452cf Kuniyuki Iwashima 2024-12-13 2349
a0dbf5f818f908 David Howells 2023-05-22 2350 size = err;
a0dbf5f818f908 David Howells 2023-05-22 2351 refcount_add(size, &sk->sk_wmem_alloc);
a0dbf5f818f908 David Howells 2023-05-22 2352 } else {
e370a723632177 Eric Dumazet 2013-08-08 2353 skb_put(skb, size - data_len);
e370a723632177 Eric Dumazet 2013-08-08 2354 skb->data_len = data_len;
e370a723632177 Eric Dumazet 2013-08-08 2355 skb->len = size;
c0371da6047abd Al Viro 2014-11-24 2356 err = skb_copy_datagram_from_iter(skb, 0, &msg->msg_iter, size);
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2357 if (err) {
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2358 reason = SKB_DROP_REASON_SKB_UCOPY_FAULT;
d460b04bc452cf Kuniyuki Iwashima 2024-12-13 2359 goto out_free;
a0dbf5f818f908 David Howells 2023-05-22 2360 }
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2361 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2362
1c92b4e50ef926 David S. Miller 2007-05-31 2363 unix_state_lock(other);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2364
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2365 if (sock_flag(other, SOCK_DEAD)) {
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2366 reason = SKB_DROP_REASON_SOCKET_CLOSE;
49efbfa661b688 Kuniyuki Iwashima 2025-01-10 2367 goto out_pipe_unlock;
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2368 }
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2369
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2370 if (other->sk_shutdown & RCV_SHUTDOWN) {
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2371 reason = SKB_DROP_REASON_SOCKET_RCV_SHUTDOWN;
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2372 goto out_pipe_unlock;
6ca5ecbc3d69e6 Kuniyuki Iwashima 2025-01-10 2373 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2374
16e5726269611b Eric Dumazet 2011-09-19 2375 maybe_add_creds(skb, sock, other);
3c32da19a858fb Kirill Tkhai 2019-12-09 2376 scm_stat_add(other, skb);
7782040b950b5d Paolo Abeni 2020-02-28 2377 skb_queue_tail(&other->sk_receive_queue, skb);
1c92b4e50ef926 David S. Miller 2007-05-31 2378 unix_state_unlock(other);
676d23690fb62b David S. Miller 2014-04-11 2379 other->sk_data_ready(other);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2380 sent += size;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2381 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2382
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists