public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, NeilBrown <neilb@suse.com>,
	Ian Kent <raven@themaw.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 3.18 02/16] autofs: sanity check status reported with AUTOFS_DEV_IOCTL_FAIL
Date: Tue, 27 Jun 2017 14:49:39 +0200	[thread overview]
Message-ID: <20170627124436.989314278@linuxfoundation.org> (raw)
In-Reply-To: <20170627124436.634493038@linuxfoundation.org>

3.18-stable review patch.  If anyone has any objections, please let me know.

------------------

From: NeilBrown <neilb@suse.com>

commit 9fa4eb8e490a28de40964b1b0e583d8db4c7e57c upstream.

If a positive status is passed with the AUTOFS_DEV_IOCTL_FAIL ioctl,
autofs4_d_automount() will return

   ERR_PTR(status)

with that status to follow_automount(), which will then dereference an
invalid pointer.

So treat a positive status the same as zero, and map to ENOENT.

See comment in systemd src/core/automount.c::automount_send_ready().

Link: http://lkml.kernel.org/r/871sqwczx5.fsf@notabene.neil.brown.name
Signed-off-by: NeilBrown <neilb@suse.com>
Cc: Ian Kent <raven@themaw.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/autofs4/dev-ioctl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/autofs4/dev-ioctl.c
+++ b/fs/autofs4/dev-ioctl.c
@@ -331,7 +331,7 @@ static int autofs_dev_ioctl_fail(struct
 	int status;
 
 	token = (autofs_wqt_t) param->fail.token;
-	status = param->fail.status ? param->fail.status : -ENOENT;
+	status = param->fail.status < 0 ? param->fail.status : -ENOENT;
 	return autofs4_wait_release(sbi, token, status);
 }
 

  parent reply	other threads:[~2017-06-27 12:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-27 12:49 [PATCH 3.18 00/16] 3.18.59-stable review Greg Kroah-Hartman
2017-06-27 12:49 ` [PATCH 3.18 01/16] fs/exec.c: account for argv/envp pointers Greg Kroah-Hartman
2017-06-27 12:49 ` Greg Kroah-Hartman [this message]
2017-06-27 12:49 ` [PATCH 3.18 03/16] lib/cmdline.c: fix get_options() overflow while parsing ranges Greg Kroah-Hartman
2017-06-27 12:49 ` [PATCH 3.18 04/16] KVM: PPC: Book3S HV: Preserve userspace HTM state properly Greg Kroah-Hartman
2017-06-27 12:49 ` [PATCH 3.18 05/16] CIFS: Improve readdir verbosity Greg Kroah-Hartman
2017-06-27 12:49 ` [PATCH 3.18 06/16] signal: Only reschedule timers on signals timers have sent Greg Kroah-Hartman
2017-06-27 12:49 ` [PATCH 3.18 07/16] powerpc/kprobes: Pause function_graph tracing during jprobes handling Greg Kroah-Hartman
2017-06-27 12:49 ` [PATCH 3.18 08/16] Input: i8042 - add Fujitsu Lifebook AH544 to notimeout list Greg Kroah-Hartman
2017-06-27 12:49 ` [PATCH 3.18 09/16] target: Fix kref->refcount underflow in transport_cmd_finish_abort Greg Kroah-Hartman
2017-06-27 12:49 ` [PATCH 3.18 11/16] of: Add check to of_scan_flat_dt() before accessing initial_boot_params Greg Kroah-Hartman
2017-06-27 12:49 ` [PATCH 3.18 13/16] powerpc/slb: Force a full SLB flush when we insert for a bad EA Greg Kroah-Hartman
2017-06-27 12:49 ` [PATCH 3.18 14/16] usb: gadget: f_fs: avoid out of bounds access on comp_desc Greg Kroah-Hartman
2017-06-27 12:49 ` [PATCH 3.18 15/16] net: phy: fix marvell phy status reading Greg Kroah-Hartman
2017-06-27 12:49 ` [PATCH 3.18 16/16] mac80211/wpa: use constant time memory comparison for MACs Greg Kroah-Hartman
2017-06-27 18:58 ` [PATCH 3.18 00/16] 3.18.59-stable review Guenter Roeck
2017-06-28 13:51 ` Shuah Khan

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=20170627124436.989314278@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.com \
    --cc=raven@themaw.net \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.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