Patch "scsi: ufs: ufshcd: fix potential NULL pointer dereference in ufshcd_config_vreg" has been added to the 4.9-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
scsi: ufs: ufshcd: fix potential NULL pointer dereference in ufshcd_config_vreg
to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
scsi-ufs-ufshcd-fix-potential-null-pointer-dereference-in-ufshcd_config_vreg.patch
and it can be found in the queue-4.9 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Thu Feb 1 14:00:34 CET 2018
From: "Gustavo A. R. Silva" <[email protected]>
Date: Mon, 20 Nov 2017 08:12:29 -0600
Subject: scsi: ufs: ufshcd: fix potential NULL pointer dereference in ufshcd_config_vreg
From: "Gustavo A. R. Silva" <[email protected]>
[ Upstream commit 727535903bea924c4f73abb202c4b3e85fff0ca4 ]
_vreg_ is being dereferenced before it is null checked, hence there is a potential null pointer dereference.
Fix this by moving the pointer dereference after _vreg_ has been null checked.
This issue was detected with the help of Coccinelle.
--- drivers/scsi/ufs/ufshcd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +5 -2
@@ -5327,12 +5327,15 @@ static int ufshcd_config_vreg(struct dev struct ufs_vreg *vreg, bool on) { int ret = 0; -struct regulator *reg = vreg->reg; -const char *name = vreg->name; +struct regulator *reg; +const char *name;int min_uV, uA_load;BUG_ON (!vreg); + reg = vreg->reg; + name = vreg->name; +if (regulator_count_voltages (reg) >0 ) { min_uV = on ? vreg->min_uV :0 ; ret =regulator_set_voltage (reg, min_uV, vreg->max_uV);
Patches currently in stable-queue which might be from [email protected] are
queue-4.9/scsi-ufs-ufshcd-fix-potential-null-pointer-dereference-in-ufshcd_config_vreg.patch