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

Commit e278e9c5 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "scsi: ufs: Fix IOCTL error checking for input buffer"

parents 703f3879 e9d9686e
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
 *
 * This code is based on drivers/scsi/ufs/ufshcd.c
 * Copyright (C) 2011-2013 Samsung India Software Operations
 * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
 *
 * Authors:
 *	Santosh Yaraganavi <santosh.sy@samsung.com>
@@ -9510,13 +9510,14 @@ static int ufshcd_ioctl(struct scsi_device *dev, int cmd, void __user *buffer)
	int err = 0;

	BUG_ON(!hba);
	if (!buffer) {
		dev_err(hba->dev, "%s: User buffer is NULL!\n", __func__);
		return -EINVAL;
	}

	switch (cmd) {
	case UFS_IOCTL_QUERY:
		if (!buffer) {
			dev_err(hba->dev, "%s: User buffer is NULL!\n",
				 __func__);
			return -EINVAL;
		}
		pm_runtime_get_sync(hba->dev);
		err = ufshcd_query_ioctl(hba, ufshcd_scsi_to_upiu_lun(dev->lun),
				buffer);