Skip to content

Commit e3ae236

Browse files
Alexander Aringdavem330
authored andcommitted
net: sock: introduce sk_error_report
This patch introduces a function wrapper to call the sk_error_report callback. That will prepare to add additional handling whenever sk_error_report is called, for example to trace socket errors. Signed-off-by: Alexander Aring <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7f4e5c5 commit e3ae236

File tree

42 files changed

+75
-67
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+75
-67
lines changed

drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2134,7 +2134,7 @@ static void chtls_abort_req_rss(struct sock *sk, struct sk_buff *skb)
21342134
sk->sk_err = ETIMEDOUT;
21352135

21362136
if (!sock_flag(sk, SOCK_DEAD))
2137-
sk->sk_error_report(sk);
2137+
sk_error_report(sk);
21382138

21392139
if (sk->sk_state == TCP_SYN_RECV && !abort_syn_rcv(sk, skb))
21402140
return;

drivers/vhost/vsock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ static void vhost_vsock_reset_orphans(struct sock *sk)
734734
vsk->peer_shutdown = SHUTDOWN_MASK;
735735
sk->sk_state = SS_UNCONNECTED;
736736
sk->sk_err = ECONNRESET;
737-
sk->sk_error_report(sk);
737+
sk_error_report(sk);
738738
}
739739

740740
static int vhost_vsock_dev_release(struct inode *inode, struct file *file)

include/linux/skmsg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static inline void sk_psock_report_error(struct sk_psock *psock, int err)
347347
struct sock *sk = psock->sk;
348348

349349
sk->sk_err = err;
350-
sk->sk_error_report(sk);
350+
sk_error_report(sk);
351351
}
352352

353353
struct sk_psock *sk_psock_init(struct sock *sk, int node);

include/net/sock.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,6 +2281,8 @@ static inline int sock_error(struct sock *sk)
22812281
return -err;
22822282
}
22832283

2284+
void sk_error_report(struct sock *sk);
2285+
22842286
static inline unsigned long sock_wspace(struct sock *sk)
22852287
{
22862288
int amt = 0;

include/net/tls.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ static inline bool tls_is_sk_tx_device_offloaded(struct sock *sk)
469469
static inline void tls_err_abort(struct sock *sk, int err)
470470
{
471471
sk->sk_err = err;
472-
sk->sk_error_report(sk);
472+
sk_error_report(sk);
473473
}
474474

475475
static inline bool tls_bigint_increment(unsigned char *seq, int len)

net/caif/caif_socket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static void caif_ctrl_cb(struct cflayer *layr,
243243
cf_sk->sk.sk_shutdown = SHUTDOWN_MASK;
244244
cf_sk->sk.sk_err = ECONNRESET;
245245
set_rx_flow_on(cf_sk);
246-
cf_sk->sk.sk_error_report(&cf_sk->sk);
246+
sk_error_report(&cf_sk->sk);
247247
break;
248248

249249
default:

net/can/bcm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,15 +1417,15 @@ static void bcm_notify(struct bcm_sock *bo, unsigned long msg,
14171417
if (notify_enodev) {
14181418
sk->sk_err = ENODEV;
14191419
if (!sock_flag(sk, SOCK_DEAD))
1420-
sk->sk_error_report(sk);
1420+
sk_error_report(sk);
14211421
}
14221422
break;
14231423

14241424
case NETDEV_DOWN:
14251425
if (bo->bound && bo->ifindex == dev->ifindex) {
14261426
sk->sk_err = ENETDOWN;
14271427
if (!sock_flag(sk, SOCK_DEAD))
1428-
sk->sk_error_report(sk);
1428+
sk_error_report(sk);
14291429
}
14301430
}
14311431
}

net/can/isotp.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ static enum hrtimer_restart isotp_rx_timer_handler(struct hrtimer *hrtimer)
168168
/* report 'connection timed out' */
169169
sk->sk_err = ETIMEDOUT;
170170
if (!sock_flag(sk, SOCK_DEAD))
171-
sk->sk_error_report(sk);
171+
sk_error_report(sk);
172172

173173
/* reset rx state */
174174
so->rx.state = ISOTP_IDLE;
@@ -339,7 +339,7 @@ static int isotp_rcv_fc(struct isotp_sock *so, struct canfd_frame *cf, int ae)
339339
/* malformed PDU - report 'not a data message' */
340340
sk->sk_err = EBADMSG;
341341
if (!sock_flag(sk, SOCK_DEAD))
342-
sk->sk_error_report(sk);
342+
sk_error_report(sk);
343343

344344
so->tx.state = ISOTP_IDLE;
345345
wake_up_interruptible(&so->wait);
@@ -392,7 +392,7 @@ static int isotp_rcv_fc(struct isotp_sock *so, struct canfd_frame *cf, int ae)
392392
/* overflow on receiver side - report 'message too long' */
393393
sk->sk_err = EMSGSIZE;
394394
if (!sock_flag(sk, SOCK_DEAD))
395-
sk->sk_error_report(sk);
395+
sk_error_report(sk);
396396
fallthrough;
397397

398398
default:
@@ -420,7 +420,7 @@ static int isotp_rcv_sf(struct sock *sk, struct canfd_frame *cf, int pcilen,
420420
/* malformed PDU - report 'not a data message' */
421421
sk->sk_err = EBADMSG;
422422
if (!sock_flag(sk, SOCK_DEAD))
423-
sk->sk_error_report(sk);
423+
sk_error_report(sk);
424424
return 1;
425425
}
426426

@@ -535,7 +535,7 @@ static int isotp_rcv_cf(struct sock *sk, struct canfd_frame *cf, int ae,
535535
/* wrong sn detected - report 'illegal byte sequence' */
536536
sk->sk_err = EILSEQ;
537537
if (!sock_flag(sk, SOCK_DEAD))
538-
sk->sk_error_report(sk);
538+
sk_error_report(sk);
539539

540540
/* reset rx state */
541541
so->rx.state = ISOTP_IDLE;
@@ -559,7 +559,7 @@ static int isotp_rcv_cf(struct sock *sk, struct canfd_frame *cf, int ae,
559559
/* malformed PDU - report 'not a data message' */
560560
sk->sk_err = EBADMSG;
561561
if (!sock_flag(sk, SOCK_DEAD))
562-
sk->sk_error_report(sk);
562+
sk_error_report(sk);
563563
return 1;
564564
}
565565

@@ -758,7 +758,7 @@ static enum hrtimer_restart isotp_tx_timer_handler(struct hrtimer *hrtimer)
758758
/* report 'communication error on send' */
759759
sk->sk_err = ECOMM;
760760
if (!sock_flag(sk, SOCK_DEAD))
761-
sk->sk_error_report(sk);
761+
sk_error_report(sk);
762762

763763
/* reset tx state */
764764
so->tx.state = ISOTP_IDLE;
@@ -1157,7 +1157,7 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len)
11571157
if (notify_enetdown) {
11581158
sk->sk_err = ENETDOWN;
11591159
if (!sock_flag(sk, SOCK_DEAD))
1160-
sk->sk_error_report(sk);
1160+
sk_error_report(sk);
11611161
}
11621162

11631163
return err;
@@ -1356,13 +1356,13 @@ static void isotp_notify(struct isotp_sock *so, unsigned long msg,
13561356

13571357
sk->sk_err = ENODEV;
13581358
if (!sock_flag(sk, SOCK_DEAD))
1359-
sk->sk_error_report(sk);
1359+
sk_error_report(sk);
13601360
break;
13611361

13621362
case NETDEV_DOWN:
13631363
sk->sk_err = ENETDOWN;
13641364
if (!sock_flag(sk, SOCK_DEAD))
1365-
sk->sk_error_report(sk);
1365+
sk_error_report(sk);
13661366
break;
13671367
}
13681368
}

net/can/j1939/socket.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ void j1939_sk_send_loop_abort(struct sock *sk, int err)
10091009
{
10101010
sk->sk_err = err;
10111011

1012-
sk->sk_error_report(sk);
1012+
sk_error_report(sk);
10131013
}
10141014

10151015
static int j1939_sk_send_loop(struct j1939_priv *priv, struct sock *sk,
@@ -1189,7 +1189,7 @@ void j1939_sk_netdev_event_netdown(struct j1939_priv *priv)
11891189
list_for_each_entry(jsk, &priv->j1939_socks, list) {
11901190
jsk->sk.sk_err = error_code;
11911191
if (!sock_flag(&jsk->sk, SOCK_DEAD))
1192-
jsk->sk.sk_error_report(&jsk->sk);
1192+
sk_error_report(&jsk->sk);
11931193

11941194
j1939_sk_queue_drop_all(priv, jsk, error_code);
11951195
}

net/can/raw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,13 @@ static void raw_notify(struct raw_sock *ro, unsigned long msg,
295295

296296
sk->sk_err = ENODEV;
297297
if (!sock_flag(sk, SOCK_DEAD))
298-
sk->sk_error_report(sk);
298+
sk_error_report(sk);
299299
break;
300300

301301
case NETDEV_DOWN:
302302
sk->sk_err = ENETDOWN;
303303
if (!sock_flag(sk, SOCK_DEAD))
304-
sk->sk_error_report(sk);
304+
sk_error_report(sk);
305305
break;
306306
}
307307
}
@@ -488,7 +488,7 @@ static int raw_bind(struct socket *sock, struct sockaddr *uaddr, int len)
488488
if (notify_enetdown) {
489489
sk->sk_err = ENETDOWN;
490490
if (!sock_flag(sk, SOCK_DEAD))
491-
sk->sk_error_report(sk);
491+
sk_error_report(sk);
492492
}
493493

494494
return err;

0 commit comments

Comments
 (0)