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

Commit ab143302 authored by Miroslav Lichvar's avatar Miroslav Lichvar Committed by Greg Kroah-Hartman
Browse files

ptp: check gettime64 return code in PTP_SYS_OFFSET ioctl



[ Upstream commit 83d0bdc7390b890905634186baaa294475cd6a06 ]

If a gettime64 call fails, return the error and avoid copying data back
to user.

Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: default avatarMiroslav Lichvar <mlichvar@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 49796c35
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -228,7 +228,9 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
			pct->sec = ts.tv_sec;
			pct->nsec = ts.tv_nsec;
			pct++;
			ptp->info->gettime64(ptp->info, &ts);
			err = ptp->info->gettime64(ptp->info, &ts);
			if (err)
				goto out;
			pct->sec = ts.tv_sec;
			pct->nsec = ts.tv_nsec;
			pct++;
@@ -281,6 +283,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
		break;
	}

out:
	kfree(sysoff);
	return err;
}