Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3613122ybl; Sun, 8 Dec 2019 19:21:01 -0800 (PST) X-Google-Smtp-Source: APXvYqzz3xC5lom6aEfykJWfaFwsruLlxG7GuoQqBOekgyy4WycrbPII1PfvzlaHpSOut22UaoiO X-Received: by 2002:a9d:68ca:: with SMTP id i10mr19242913oto.178.1575861661475; Sun, 08 Dec 2019 19:21:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575861661; cv=none; d=google.com; s=arc-20160816; b=RyU8ji27coeS0NVF+BUDqgxtEie/OSr2R5cSZaNZ7GZ37tGrllbkDYShCxREoO0uGU iBllIqf5Nqc8/RcRTQ2KKf1t8IA9pvh+MBPeXE6lSQZqnj55GMZj+OmvuqYQjRxHAI3t y4ToeCu0VbGc+7dO7/nlvKf6+RhsNn32JoxjLV/K1Rb66psNClAT/j0pYkMN1cszachz R+jZTyDuTpldcqtxGWMPIR2thE7HcmbQITemRddeevYp5hfoVGHuSFFlVElIMNBH77iN 2nmXz5QfKiivxSeA1gSrai0yprr2SbUcS1c5KsBwPn3PgY7/atVvZ0KDUMy53X6Ad/5h fAXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ZP/DTKsRxd9x57rsuKi8rjLFwHgduCkLhdBpzRruD/w=; b=mHPZJvVty+yxviZLa2NoZSprDjwNIv+snRp20mn10skqP04cWW2CtywaHqaYYyc0Tu bJ3zQ4ozAL6orCwYqjAoI/M7mQL+2/BL5LOCoL+BwHYsXhZ+6QPlMn2gZd4fFIg9aBsu S1UNjsNhN0au6UlH6rWCEU+miaLvJpLPQswsrGD+K4sGJfEk/+zzKNKGEZIexTWDdhjb IKNmekn+14eh6SRLcvlCFIU7syfgqm2YjkaL3FAgx1glg6Sqqnr5lnpcQru2Zf0tAszY 2TCNcDfT2xWMTgYiCADk9CUD9wTLGrlJaw9SJQq3VeQtZMTCFp5OabiJcQ0A5YWmYDqV aOMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZptXpSDh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t23si12304280otp.234.2019.12.08.19.20.50; Sun, 08 Dec 2019 19:21:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZptXpSDh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727022AbfLIDTD (ORCPT + 99 others); Sun, 8 Dec 2019 22:19:03 -0500 Received: from mail-il1-f194.google.com ([209.85.166.194]:36748 "EHLO mail-il1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726748AbfLIDTD (ORCPT ); Sun, 8 Dec 2019 22:19:03 -0500 Received: by mail-il1-f194.google.com with SMTP id b15so11469808iln.3; Sun, 08 Dec 2019 19:19:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZP/DTKsRxd9x57rsuKi8rjLFwHgduCkLhdBpzRruD/w=; b=ZptXpSDhjq8fSMtsFkMdbzfmlB939M/2rbME2gXYrx419Yu8kgJxcJVzTcYzXavcYm Ed0GRd/uxVxTj5vKNdiUgpwmPDZEHML4kMMtAmlOd05dIBpH1xqwMlD1MdOtDDEua7eQ kyLjuaV7DH6TXgGqS5RlJxQwZmjCkvoisiLGb+ygv1nxeXTabKCji2imYOXkmcEmtvBP B2K0iR7PZ2/4WMIcKVyYgUANVebXvotyUry/5ge/inl6ZdJkNDDPPkLpX1/Vi3l57s8J 1q/PT919jpr9DTfP1vy9GblNmCz87eG+sbb3FBRQtYekYdeTvfeSLgN2bK244NzjRiVl QPaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZP/DTKsRxd9x57rsuKi8rjLFwHgduCkLhdBpzRruD/w=; b=P7vFI33wjkczLSRBfJp0SFgm2gJSKX47XZCTQ5lSwChkHHFyuY459kKM1Ae2nkLJPL 1InGsRJPVydoOAZ1dKIFdW/bmS44i4mK3npFZei809gxUQagn/KMA4g++RsEblNPhlgO Xl6MOS1OakeD+5CnYJkbivgxuvMCf34DQRgjNnTA6GXQkAbiJ+zLfcc+y+Yve/Qf3nJJ wcaVg2Z0msDCUz0XC7EMdzy+aIGBJak+Vm5K665OCTd9xATWQKE9qLRTlkrK6RH/t5hZ RsBj+HtyCcXnJpHADjMLRXTGfXRIiMerXalpUcCE16jG8cl6LlEp/illNKpUHtL3e9cJ gslg== X-Gm-Message-State: APjAAAV1QmaD2Zj661saXA5PQxMBJzyuC12YEjU8EPXiggUigITRmxId CR1pugD9793PSQLHAMfJpBT1NWYJsNfPTPIXKL0= X-Received: by 2002:a92:d642:: with SMTP id x2mr26470036ilp.169.1575861542470; Sun, 08 Dec 2019 19:19:02 -0800 (PST) MIME-Version: 1.0 References: <30808b0b-367a-266a-7ef4-de69c08e1319@internode.on.net> <09396dca-3643-9a4b-070a-e7db2a07235e@internode.on.net> In-Reply-To: From: Steve French Date: Sun, 8 Dec 2019 21:18:51 -0600 Message-ID: Subject: Re: refcount_t: underflow; use-after-free with CIFS umount after scsi-misc commit ef2cc88e2a205b8a11a19e78db63a70d3728cdf5 To: Linus Torvalds Cc: Arthur Marsh , SCSI development list , Linux Kernel Mailing List , CIFS , "James E.J. Bottomley" , ronnie sahlberg Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 8, 2019 at 8:23 PM Linus Torvalds wrote: > > On Sun, Dec 8, 2019 at 5:49 PM Arthur Marsh > wrote: > > > > This still happens with 5.5.0-rc1: > > Does it happen 100% of the time? I can reproduce it (although it was a little more difficult since WiFi doesn't work on RC1 on some of my hardware - due to the 802.11 driver regression oops. I was able to reproduce it to Samba localhost). > Your bisection result looks pretty nonsensical - not that it's > impossible (anything is possible), but it really doesn't look very > likely. Which makes me think maybe it's slightly timing-sensitive or > something? The bisection result is implausible. I just did some experiments and it looks far more likely is that it is related to commit 72e73c78c446e ("cifs: close the shared root handle on tree disconnect") so added Ronnie to the cc. That patch added a call (at unmount time) to close_shroot. The idea of that patch made sense - although tree disconnect (and then logoff of the session) will indirectly free any open handles on the server for that session, it is a little cleaner to close the cached root SMB3 file handle explicitly. void close_shroot(struct cached_fid *cfid) { mutex_lock(&cfid->fid_mutex); kref_put(&cfid->refcount, smb2_close_cached_fid); mutex_unlock(&cfid->fid_mutex); } Taking out the one line change in the patch from last week that calls close_shroot from umount (SMB2_tdis, ie tree_disconnect) I don't see the problem so far more likely that it is related to that commit. The problem seems to be related to servers which don't support directory leases. Will spin up a patch to fix this if Ronnie hasn't already fixed it