From: Oleksij Rempel o.rempel@pengutronix.de
mainline inclusion from mainline-v5.4-rc8 commit 975987e7015bb12a482df7f14fd524417d2c8e8f category: bugfix bugzilla: 38684 CVE: NA
---------------------------
In j1939 we need our own struct sock::sk_destruct callback. Export the generic af_can can_sock_destruct() that allows us to chain-call it.
Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol") Signed-off-by: Oleksij Rempel o.rempel@pengutronix.de
Conflicts: net/can/af_can.c include/linux/can/core.h
Signed-off-by: Zhang Changzhong zhangchangzhong@huawei.com Reviewed-by: YueHaibing yuehaibing@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- include/linux/can/core.h | 1 + net/can/af_can.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/linux/can/core.h b/include/linux/can/core.h index 85bdc7d25067..f70b5ae61906 100644 --- a/include/linux/can/core.h +++ b/include/linux/can/core.h @@ -65,6 +65,7 @@ extern void can_rx_unregister(struct net *net, struct net_device *dev, void *data);
extern int can_send(struct sk_buff *skb, int loop); +void can_sock_destruct(struct sock *sk); extern int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
#endif /* !_CAN_CORE_H */ diff --git a/net/can/af_can.c b/net/can/af_can.c index 1ba9b7cacf93..7c80315ff356 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c @@ -103,11 +103,12 @@ int can_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) } EXPORT_SYMBOL(can_ioctl);
-static void can_sock_destruct(struct sock *sk) +void can_sock_destruct(struct sock *sk) { skb_queue_purge(&sk->sk_receive_queue); skb_queue_purge(&sk->sk_error_queue); } +EXPORT_SYMBOL(can_sock_destruct);
static const struct can_proto *can_get_proto(int protocol) {