Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: "Aurélien Aptel" <aaptel@suse.com>
To: Dominik Brodowski <linux@dominikbrodowski.net>, sfrench@samba.org
Cc: linux-cifs@vger.kernel.org
Subject: Re: v5.1-rc1 cifs bug: underflow; use-after-free.
Date: Tue, 19 Mar 2019 16:47:17 +0100	[thread overview]
Message-ID: <87k1gu6f3u.fsf@suse.com> (raw)
In-Reply-To: <87mulq6g2e.fsf@suse.com>

Aurélien Aptel <aaptel@suse.com> writes:
> 	if (cfid->refcount-- && cfid->is_valid) {

Actually, let's not decrement in the condition :)

void close_shroot(struct cached_fid *cfid)
{
	mutex_lock(&cfid->fid_mutex);
	if (cfid->refcount > 0 && cfid->is_valid) {
		cifs_dbg(FYI, "clear cached root file handle\n");
		SMB2_close(0, cfid->tcon, cfid->fid->persistent_fid,
			   cfid->fid->volatile_fid);
		cfid->is_valid = false;
		cfid->file_all_info_is_valid = false;
                cfid->refcount--;
	}
	mutex_unlock(&cfid->fid_mutex);
}

-- 
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)

  reply	other threads:[~2019-03-19 15:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19 11:51 v5.1-rc1 cifs bug: underflow; use-after-free Dominik Brodowski
2019-03-19 15:26 ` Aurélien Aptel
2019-03-19 15:47   ` Aurélien Aptel [this message]
2019-03-19 16:26   ` Dominik Brodowski
2019-03-20 11:12     ` Aurélien Aptel
2019-03-26  7:18       ` Dominik Brodowski
2019-03-26 12:39         ` [PATCH v1] CIFS: prevent refcount underflow Aurelien Aptel
2019-03-26 15:46           ` Dominik Brodowski
2019-03-26 16:53             ` Aurélien Aptel
2019-03-26 16:53               ` Dominik Brodowski
2019-03-27 22:36           ` Pavel Shilovsky
2019-03-27 23:44             ` ronnie sahlberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k1gu6f3u.fsf@suse.com \
    --to=aaptel@suse.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=sfrench@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox