[CRIU] Re: [PATCH] sockets: Fix potential NULL dereference
Pavel Emelyanov
xemul at parallels.com
Thu Apr 12 16:05:14 EDT 2012
On 04/12/2012 10:44 PM, Cyrill Gorcunov wrote:
> In case if unix socket was not found don't
> call for container_of.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
> sockets.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/sockets.c b/sockets.c
> index 75faa0f..128c721 100644
> --- a/sockets.c
> +++ b/sockets.c
> @@ -806,7 +806,9 @@ static struct unix_sk_info *find_unix_sk(int id)
> struct file_desc *d;
>
> d = find_file_desc_raw(FDINFO_UNIXSK, id);
> - return container_of(d, struct unix_sk_info, d);
> + if (d)
> + return container_of(d, struct unix_sk_info, d);
> + return NULL;
> }
>
> struct sk_packet {
Applied
More information about the CRIU
mailing list