From: Pavel Emelyanov Date: Fri, 21 Mar 2008 22:58:52 +0000 (-0700) Subject: [DLCI]: Fix tiny race between module unload and sock_ioctl. X-Git-Tag: v2.6.25-rc7~25^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7512cbf6efc97644812f137527a54b8e92b6a90a;p=platform%2Fkernel%2Flinux-exynos.git [DLCI]: Fix tiny race between module unload and sock_ioctl. This is a narrow pedantry :) but the dlci_ioctl_hook check and call should not be parted with the mutex lock. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- diff --git a/net/socket.c b/net/socket.c index b6d35cd..9d3fbfb 100644 --- a/net/socket.c +++ b/net/socket.c @@ -909,11 +909,10 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg) if (!dlci_ioctl_hook) request_module("dlci"); - if (dlci_ioctl_hook) { - mutex_lock(&dlci_ioctl_mutex); + mutex_lock(&dlci_ioctl_mutex); + if (dlci_ioctl_hook) err = dlci_ioctl_hook(cmd, argp); - mutex_unlock(&dlci_ioctl_mutex); - } + mutex_unlock(&dlci_ioctl_mutex); break; default: err = sock->ops->ioctl(sock, cmd, arg);