Eric Dumazet d198b27762 Revert "Revert "ipv4: fix memory leaks in ip_cmsg_send() callers""
This reverts commit d7807a9adf4856171f8441f13078c33941df48ab.

As mentioned in https://lkml.org/lkml/2021/9/13/1819
5 years old commit 919483096bfe ("ipv4: fix memory leaks in ip_cmsg_send() callers")
was a correct fix.

  ip_cmsg_send() can loop over multiple cmsghdr()

  If IP_RETOPTS has been successful, but following cmsghdr generates an error,
  we do not free ipc.ok

  If IP_RETOPTS is not successful, we have freed the allocated temporary space,
  not the one currently in ipc.opt.

Sure, code could be refactored, but let's not bring back old bugs.

Fixes: d7807a9adf48 ("Revert "ipv4: fix memory leaks in ip_cmsg_send() callers"")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Yajun Deng <yajun.deng@linux.dev>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-09-14 14:24:31 +01:00
..
2021-06-30 15:51:09 -07:00
2021-08-04 10:01:26 +01:00
2021-06-07 14:08:30 -07:00
2021-08-31 12:03:33 +01:00
2021-05-17 15:29:35 -07:00
2021-08-05 13:27:50 +01:00
2021-07-27 20:11:44 +01:00
2021-06-30 15:51:09 -07:00
2021-07-27 20:11:44 +01:00
2021-07-07 20:52:25 -07:00
2021-06-23 12:56:08 -07:00
2021-05-17 15:29:35 -07:00
2020-12-16 11:01:04 -08:00
2020-03-16 18:26:54 -07:00
2021-03-28 17:31:13 -07:00
2020-12-14 16:40:27 -08:00
2021-08-26 18:00:40 -07:00
2021-05-17 15:29:35 -07:00
2021-08-31 12:03:33 +01:00
2021-05-17 15:29:35 -07:00