Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756180AbbEUQ0P (ORCPT ); Thu, 21 May 2015 12:26:15 -0400 Received: from mail-ig0-f174.google.com ([209.85.213.174]:33278 "EHLO mail-ig0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161068AbbEUQ0N (ORCPT ); Thu, 21 May 2015 12:26:13 -0400 From: Mark Salyzyn To: linux-kernel@vger.kernel.org Cc: Mark Salyzyn , "David S. Miller" , Al Viro , David Howells , Ying Xue , Christoph Hellwig , netdev@vger.kernel.org Subject: net/unix: sk_socket can disappear when state is unlocked Date: Thu, 21 May 2015 09:25:32 -0700 Message-Id: <1432225541-28498-1-git-send-email-salyzyn@android.com> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 913 Lines: 31 got a rare NULL pointer dereference in clear_bit Signed-off-by: Mark Salyzyn --- net/unix/af_unix.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 5266ea7..37a8925 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -1880,6 +1880,11 @@ static long unix_stream_data_wait(struct sock *sk, long timeo, unix_state_unlock(sk); timeo = freezable_schedule_timeout(timeo); unix_state_lock(sk); + + /* sk_socket may have been killed while unlocked */ + if (!sk->sk_socket) + break; + clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); } -- 2.2.0.rc0.207.ga3a616c -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/