Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a580a42 authored by Mohammed Nayeem Ur Rahman's avatar Mohammed Nayeem Ur Rahman
Browse files

msm: adsprpc: Fix error code for invalid ioctl



Change error code returned to ENOTTY for invalid ioctl. Also,
limit the number of debug messages printed for non ion buffers
based on size.

Change-Id: Iabbb7a2482b4b5d00a039e90fe7636eba5ca0447
Acked-by: default avatarDeepika Singh <dsi@qti.qualcomm.com>
Signed-off-by: default avatarMohammed Nayeem Ur Rahman <mohara@codeaurora.org>
parent e1bdeb41
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@
#define ADSP_MMAP_ADD_PAGES_LLC  0x3000
#define FASTRPC_DMAHANDLE_NOMAP (16)

#define FASTRPC_ENOSUCH 39
#define DEBUGFS_SIZE 3072
#define UL_SIZE 25
#define PID_SIZE 10
@@ -2132,12 +2133,12 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
				goto bail;
			}
		}
		if (len > DEBUG_PRINT_SIZE_LIMIT)
			ADSPRPC_DEBUG(
			"copied non ion buffer sc 0x%x pv 0x%llx, mend 0x%llx mstart 0x%llx, len %zu size %zu\n",
				"copied non ion buffer sc 0x%x pv 0x%llx, mend 0x%llx mstart 0x%llx, len %zu\n",
				sc, rpra[i].buf.pv,
				ctx->overps[oix]->mend,
			ctx->overps[oix]->mstart,
			rpra[i].buf.len, map->size);
				ctx->overps[oix]->mstart, len);
		args = args + mlen;
		rlen -= mlen;
	}
@@ -2647,7 +2648,7 @@ static int fastrpc_internal_invoke(struct fastrpc_file *fl, uint32_t mode,
		if (err)
			goto bail;
		if (fl->sctx->smmu.faults)
			err = -EDESTADDRREQ;
			err = -FASTRPC_ENOSUCH;
		if (err)
			goto bail;
		if (ctx) {
@@ -5321,7 +5322,7 @@ static inline int fastrpc_mmap_device_ioctl(struct fastrpc_file *fl,
			goto bail;
		break;
	default:
		err = -EINVAL;
		err = -ENOTTY;
		pr_info("bad ioctl: %d\n", ioctl_num);
		break;
	}
@@ -5453,7 +5454,7 @@ static long fastrpc_device_ioctl(struct file *file, unsigned int ioctl_num,
		err = fastrpc_mmap_device_ioctl(fl, ioctl_num, &p, param);
		break;
	default:
		err = -EINVAL;
		err = -ENOTTY;
		pr_info("bad ioctl: %d\n", ioctl_num);
		break;
	}
+2 −2
Original line number Diff line number Diff line
@@ -384,7 +384,7 @@ static int compat_get_fastrpc_ioctl_invoke2(
		break;
	}
	default:
		err = -EBADRQC;
		err = -ENOTTY;
		break;
	}
	*inva = inv2_user;
@@ -983,6 +983,6 @@ long compat_fastrpc_device_ioctl(struct file *filp, unsigned int cmd,
	case COMPAT_FASTRPC_IOCTL_MUNMAP:
		return compat_fastrpc_mmap_device_ioctl(filp, cmd, arg);
	default:
		return -ENOIOCTLCMD;
		return -ENOTTY;
	}
}
+2 −0
Original line number Diff line number Diff line
@@ -146,6 +146,8 @@ do {\
	pr_debug("Debug: adsprpc (%d): %s: %s: " fmt, __LINE__,\
	current->comm, __func__, ##args)

#define DEBUG_PRINT_SIZE_LIMIT (512*1024)

#define remote_arg64_t    union remote_arg64

struct remote_buf64 {