Skip to content

Commit 36d926b

Browse files
dlunevyoshfuji
authored andcommitted
[IPV6]: inet_sk(sk)->cork.opt leak
IPv6 UDP sockets wth IPv4 mapped address use udp_sendmsg to send the data actually. In this case ip_flush_pending_frames should be called instead of ip6_flush_pending_frames. Signed-off-by: Denis V. Lunev <[email protected]> Signed-off-by: YOSHIFUJI Hideaki <[email protected]>
1 parent 49d074f commit 36d926b

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

include/net/udp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ extern void udp_err(struct sk_buff *, u32);
135135

136136
extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk,
137137
struct msghdr *msg, size_t len);
138+
extern void udp_flush_pending_frames(struct sock *sk);
138139

139140
extern int udp_rcv(struct sk_buff *skb);
140141
extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);

net/ipv4/udp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ void udp_err(struct sk_buff *skb, u32 info)
420420
/*
421421
* Throw away all pending data and cancel the corking. Socket is locked.
422422
*/
423-
static void udp_flush_pending_frames(struct sock *sk)
423+
void udp_flush_pending_frames(struct sock *sk)
424424
{
425425
struct udp_sock *up = udp_sk(sk);
426426

@@ -430,6 +430,7 @@ static void udp_flush_pending_frames(struct sock *sk)
430430
ip_flush_pending_frames(sk);
431431
}
432432
}
433+
EXPORT_SYMBOL(udp_flush_pending_frames);
433434

434435
/**
435436
* udp4_hwcsum_outgoing - handle outgoing HW checksumming

net/ipv6/udp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,9 @@ static void udp_v6_flush_pending_frames(struct sock *sk)
534534
{
535535
struct udp_sock *up = udp_sk(sk);
536536

537-
if (up->pending) {
537+
if (up->pending == AF_INET)
538+
udp_flush_pending_frames(sk);
539+
else if (up->pending) {
538540
up->len = 0;
539541
up->pending = 0;
540542
ip6_flush_pending_frames(sk);

0 commit comments

Comments
 (0)