linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org, Denis Kirjanov <kda@linux-powerpc.org>,
	"Tyler Hicks" <tyhicks@canonical.com>,
	"Dan Carpenter" <dan.carpenter@oracle.com>
Subject: [PATCH 3.16 01/47] eCryptfs: fix a couple type promotion bugs
Date: Fri, 25 Oct 2019 19:03:02 +0100	[thread overview]
Message-ID: <lsq.1572026582.20915405@decadent.org.uk> (raw)
In-Reply-To: <lsq.1572026581.992411028@decadent.org.uk>

3.16.76-rc1 review patch.  If anyone has any objections, please let me know.

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

From: Dan Carpenter <dan.carpenter@oracle.com>

commit 0bdf8a8245fdea6f075a5fede833a5fcf1b3466c upstream.

ECRYPTFS_SIZE_AND_MARKER_BYTES is type size_t, so if "rc" is negative
that gets type promoted to a high positive value and treated as success.

Fixes: 778aeb42a708 ("eCryptfs: Cleanup and optimize ecryptfs_lookup_interpose()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
[tyhicks: Use "if/else if" rather than "if/if"]
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 fs/ecryptfs/crypto.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1042,8 +1042,10 @@ int ecryptfs_read_and_validate_header_re
 
 	rc = ecryptfs_read_lower(file_size, 0, ECRYPTFS_SIZE_AND_MARKER_BYTES,
 				 inode);
-	if (rc < ECRYPTFS_SIZE_AND_MARKER_BYTES)
-		return rc >= 0 ? -EINVAL : rc;
+	if (rc < 0)
+		return rc;
+	else if (rc < ECRYPTFS_SIZE_AND_MARKER_BYTES)
+		return -EINVAL;
 	rc = ecryptfs_validate_marker(marker);
 	if (!rc)
 		ecryptfs_i_size_init(file_size, inode);
@@ -1401,8 +1403,10 @@ int ecryptfs_read_and_validate_xattr_reg
 	rc = ecryptfs_getxattr_lower(ecryptfs_dentry_to_lower(dentry),
 				     ECRYPTFS_XATTR_NAME, file_size,
 				     ECRYPTFS_SIZE_AND_MARKER_BYTES);
-	if (rc < ECRYPTFS_SIZE_AND_MARKER_BYTES)
-		return rc >= 0 ? -EINVAL : rc;
+	if (rc < 0)
+		return rc;
+	else if (rc < ECRYPTFS_SIZE_AND_MARKER_BYTES)
+		return -EINVAL;
 	rc = ecryptfs_validate_marker(marker);
 	if (!rc)
 		ecryptfs_i_size_init(file_size, inode);


  reply	other threads:[~2019-10-25 18:07 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25 18:03 [PATCH 3.16 00/47] 3.16.76-rc1 review Ben Hutchings
2019-10-25 18:03 ` Ben Hutchings [this message]
2019-10-25 18:03 ` [PATCH 3.16 02/47] ARM: riscpc: fix DMA Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 03/47] 9p/virtio: Add cleanup path in p9_virtio_init Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 04/47] tty: serial: cpm_uart - fix init when SMC is relocated Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 05/47] signal/pid_namespace: Fix reboot_pid_ns to use send_sig not force_sig Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 06/47] xfrm: Fix xfrm sel prefix length validation Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 07/47] af_key: fix leaks in key_pol_get_resp and dump_sp Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 08/47] crypto: talitos - check AES key size Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 09/47] crypto: ghash - fix unaligned memory access in ghash_setkey() Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 10/47] s390/qdio: handle PENDING state for QEBSM devices Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 11/47] memstick: Fix error cleanup path of memstick_init Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 12/47] gpio: omap: fix lack of irqstatus_raw0 for OMAP4 Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 13/47] xfrm: fix sa selector validation Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 14/47] PCI: Do not poll for PME if the device is in D3cold Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 15/47] usb: gadget: ether: Fix race between gether_disconnect and rx_submit Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 16/47] powerpc/32s: fix suspend/resume when IBATs 4-7 are used Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 17/47] powerpc/watchpoint: Restore NV GPRs while returning from exception Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 18/47] USB: serial: option: add GosunCn ZTE WeLink ME3630 Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 19/47] USB: serial: option: add support for GosunCn ME3630 RNDIS mode Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 20/47] s390: fix stfle zero padding Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 21/47] VMCI: Fix integer overflow in VMCI handle arrays Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 22/47] mwifiex: Don't abort on small, spec-compliant vendor IEs Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 23/47] mwifiex: fix 802.11n/WPA detection Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 24/47] media: v4l2: Test type instead of cfg->type in v4l2_ctrl_new_custom() Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 25/47] EDAC: Fix global-out-of-bounds write when setting edac_mc_poll_msec Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 26/47] carl9170: fix misuse of device driver API Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 27/47] x86/ptrace: Fix possible spectre-v1 in ptrace_get_debugreg() Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 28/47] x86/tls: Fix possible spectre-v1 in do_get_thread_area() Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 29/47] USB: serial: ftdi_sio: add ID for isodebug v1 Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 30/47] igmp: fix memory leak in igmpv3_del_delrec() Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 31/47] s390/qdio: (re-)initialize tiqdio list entries Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 32/47] s390/qdio: don't touch the dsci in tiqdio_add_input_queues() Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 33/47] net: bridge: stp: don't cache eth dest pointer before skb pull Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 34/47] lib/scatterlist: Fix mapping iterator when sg->offset is greater than PAGE_SIZE Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 35/47] bonding: validate ip header before check IPPROTO_IGMP Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 36/47] NFSv4: Handle the special Linux file open access mode Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 37/47] ARC: hide unused function unw_hdr_alloc Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 38/47] udf: Fix incorrect final NOT_ALLOCATED (hole) extent length Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 39/47] mm/mmu_notifier: use hlist_add_head_rcu() Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 40/47] net: neigh: fix multiple neigh timer scheduling Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 41/47] ALSA: seq: Break too long mutex context in the write loop Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 42/47] coda: pass the host file in vma->vm_file on mmap Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 43/47] caif-hsi: fix possible deadlock in cfhsi_exit_module() Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 44/47] parisc: Fix kernel panic due invalid values in IAOQ0 or IAOQ1 Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 45/47] padata: use smp_mb in padata_reorder to avoid orphaned padata jobs Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 46/47] Input: psmouse - fix build error of multiple definition Ben Hutchings
2019-10-25 18:03 ` [PATCH 3.16 47/47] KVM: x86/vPMU: refine kvm_pmu err msg when event creation failed Ben Hutchings
2019-10-25 19:05   ` Joe Perches
2019-10-31 22:14     ` Ben Hutchings
2019-10-31 22:53       ` Joe Perches
2019-10-31 22:56         ` Paolo Bonzini
2019-11-01  8:07         ` Sasha Levin
2019-11-01 15:40           ` Joe Perches
2019-11-02  7:39             ` Sasha Levin
2019-10-26  1:35 ` [PATCH 3.16 00/47] 3.16.76-rc1 review Guenter Roeck
2019-10-26 18:00   ` Ben Hutchings

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=lsq.1572026582.20915405@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@oracle.com \
    --cc=kda@linux-powerpc.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tyhicks@canonical.com \
    /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;
as well as URLs for NNTP newsgroup(s).