Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

target/configfs: handle match_int() errors

As a follow up to ce31c1b0dc4038a1dec64585d892adb73d9c45f4 - there are
still a few LIO match_int() calls that don't check the return value.
Propagate errors rather than using the potentially uninitialised result.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>

authored by

David Disseldorp and committed by
Nicholas Bellinger
c2091026 9105bfc0

+24 -8
+24 -8
drivers/target/target_core_configfs.c
··· 1658 1658 * PR APTPL Metadata for Reservation 1659 1659 */ 1660 1660 case Opt_res_holder: 1661 - match_int(args, &arg); 1661 + ret = match_int(args, &arg); 1662 + if (ret) 1663 + goto out; 1662 1664 res_holder = arg; 1663 1665 break; 1664 1666 case Opt_res_type: 1665 - match_int(args, &arg); 1667 + ret = match_int(args, &arg); 1668 + if (ret) 1669 + goto out; 1666 1670 type = (u8)arg; 1667 1671 break; 1668 1672 case Opt_res_scope: 1669 - match_int(args, &arg); 1673 + ret = match_int(args, &arg); 1674 + if (ret) 1675 + goto out; 1670 1676 break; 1671 1677 case Opt_res_all_tg_pt: 1672 - match_int(args, &arg); 1678 + ret = match_int(args, &arg); 1679 + if (ret) 1680 + goto out; 1673 1681 all_tg_pt = (int)arg; 1674 1682 break; 1675 1683 case Opt_mapped_lun: 1676 - match_int(args, &arg); 1684 + ret = match_int(args, &arg); 1685 + if (ret) 1686 + goto out; 1677 1687 mapped_lun = (u64)arg; 1678 1688 break; 1679 1689 /* ··· 1711 1701 } 1712 1702 break; 1713 1703 case Opt_tpgt: 1714 - match_int(args, &arg); 1704 + ret = match_int(args, &arg); 1705 + if (ret) 1706 + goto out; 1715 1707 tpgt = (u16)arg; 1716 1708 break; 1717 1709 case Opt_port_rtpi: 1718 - match_int(args, &arg); 1710 + ret = match_int(args, &arg); 1711 + if (ret) 1712 + goto out; 1719 1713 break; 1720 1714 case Opt_target_lun: 1721 - match_int(args, &arg); 1715 + ret = match_int(args, &arg); 1716 + if (ret) 1717 + goto out; 1722 1718 target_lun = (u64)arg; 1723 1719 break; 1724 1720 default: