Skip to content

Fixes for raw diag sockets handling

Cyrill Gorcunov netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2net: ip, raw_diag -- Fix socket leaking for destroy requestnet/ipv4/raw_diag.c+4 -11 reply
2/2net: ip, raw_diag -- Use jump for exiting from nested loopnet/ipv4/raw_diag.c+2 -11 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchDavid Ahern
1/2A-b
2/2A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [patch net-next 0/2] Fixes for raw diag sockets handling

Hi! Here are a few fixes for raw-diag sockets handling: missing sock_put call and jump for exiting from nested cycle. I made patches for iproute2 as well so will send them out soon.

Also I have a question about sockets lookup not for raw diag only (though I didn't modify lookup procedure) but in general: the structure inet_diag_req_v2 has inet_diag_sockid::idiag_if member which supposed to carry interface index from userspace request.

Then for example in INET_MATCH (include/net/inet_hashtables.h), the __dif parameter (which is @idiag_if) compared with @sk_bound_dev_if *iif* the sk_bound_dev_if has been ever set. Thus if say someone looks up for paticular device with specified index if the rest of parameters match and SO_BINDTODEVICE never been called for this device we return the socket even if idiag_if is not zero. Is it supposed to be so? Or I miss something obvious?

I mean this snippet

	 (!(__sk)->sk_bound_dev_if	||				\
	   ((__sk)->sk_bound_dev_if == (__dif))) 	&&		\

when someone calls for destory sockets on particular interface and @__dif != 0 the match may return socket where sk_bound_dev_if = 0 instead of completely matching one. Isn't it?

Cyrill